From fe4118a6918b7829f96f42944522da79564a1393 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 29 Mar 2021 16:49:29 -0700 Subject: pk: remove vestigial trapframe_t::insn field This assumes that stval is populated with the opcode on illegal instruction exceptions. But since we're only using the opcode for error reporting, it's OK if this assumption is violated. --- pk/console.c | 3 +-- pk/entry.S | 4 ---- pk/handlers.c | 7 ------- pk/pk.h | 1 - 4 files changed, 1 insertion(+), 14 deletions(-) (limited to 'pk') diff --git a/pk/console.c b/pk/console.c index 90742d1..475a93b 100644 --- a/pk/console.c +++ b/pk/console.c @@ -48,8 +48,7 @@ void dump_tf(trapframe_t* tf) for(int j = 0; j < 4; j++) printk("%s %lx%c", get_regname(i+j), tf->gpr[i+j], j < 3 ? ' ' : '\n'); } - printk("pc %lx va %lx insn %x sr %lx\n", tf->epc, tf->badvaddr, - (uint32_t)tf->insn, tf->status); + printk("pc %lx va/inst %lx sr %lx\n", tf->epc, tf->badvaddr, tf->status); } void do_panic(const char* s, ...) diff --git a/pk/entry.S b/pk/entry.S index 39be286..5bbf697 100644 --- a/pk/entry.S +++ b/pk/entry.S @@ -47,10 +47,6 @@ STORE t1,33*REGBYTES(x2) STORE t2,34*REGBYTES(x2) STORE t3,35*REGBYTES(x2) - - # get faulting insn, if it wasn't a fetch-related trap - li x5,-1 - STORE x5,36*REGBYTES(x2) 1: .endm diff --git a/pk/handlers.c b/pk/handlers.c index efd14f1..7216713 100644 --- a/pk/handlers.c +++ b/pk/handlers.c @@ -25,13 +25,6 @@ static void handle_store_access_fault(trapframe_t *tf) static void handle_illegal_instruction(trapframe_t* tf) { - tf->insn = *(uint16_t*)tf->epc; - int len = insn_len(tf->insn); - if (len == 4) - tf->insn |= ((uint32_t)*(uint16_t*)(tf->epc + 2) << 16); - else - kassert(len == 2); - dump_tf(tf); panic("An illegal instruction was executed!"); } diff --git a/pk/pk.h b/pk/pk.h index 0ac2cdc..56cdafe 100644 --- a/pk/pk.h +++ b/pk/pk.h @@ -17,7 +17,6 @@ typedef struct long epc; long badvaddr; long cause; - long insn; } trapframe_t; #define panic(s,...) do { do_panic(s"\n", ##__VA_ARGS__); } while(0) -- cgit v1.1