From ac2f8380359bbbd7852b58a60d6bff5debc7359a Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 18 Nov 2010 19:08:21 +0100 Subject: Fix R-type decoding, seems to work now with images/zImage --- instruction.c | 7 +++---- instruction.h | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/instruction.c b/instruction.c index 4e288db..f41ad63 100644 --- a/instruction.c +++ b/instruction.c @@ -814,11 +814,10 @@ static int handle_r_type_instr(struct nios2 *cpu, uint32_t code) return INSTR_ERR; } + dbg(" R: %s (%08x)\n", r_type_instructions[opx].name, code); handle_instr = r_type_instructions[opx].handler; - if (unlikely(handle_instr == NULL)) { - err("Invalid instruction %08x\n", code); + if (unlikely(handle_instr == NULL)) return INSTR_ERR; - } return handle_instr(cpu, code); } @@ -829,7 +828,7 @@ instruction_handler instruction_get_handler(uint32_t code) if (unlikely(op >= I_TYPE_COUNT)) return NULL; - dbg("%s (%08x)\n", i_type_instructions[op].name, code); + dbg("I: %s (%08x)\n", i_type_instructions[op].name, code); return i_type_instructions[op].handler; } diff --git a/instruction.h b/instruction.h index 8d9c366..cf709dc 100644 --- a/instruction.h +++ b/instruction.h @@ -34,10 +34,8 @@ struct r_type { * Some R-Type instructions embed a small immediate value in the * low-order bits of OPX. */ - struct { - uint8_t imm5:5; - uint8_t opx6:6; - } __packed; + uint8_t imm5:5; + uint8_t opx6:6; uint8_t c:5; uint8_t b:5; uint8_t a:5; -- cgit v1.2.3-54-g00ecf