aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-07-19 17:35:51 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-07-19 17:35:51 -0700
commit7272e3f9bc7ce1b397db74bd120e0aeb56a6e872 (patch)
tree60836cf0c5e5beb93f2c1864cd384d0da8435092
parentdc939be3b31a8d78690583ecccad286b8a2a8f76 (diff)
downloadriscv-pk-7272e3f9bc7ce1b397db74bd120e0aeb56a6e872.zip
riscv-pk-7272e3f9bc7ce1b397db74bd120e0aeb56a6e872.tar.gz
riscv-pk-7272e3f9bc7ce1b397db74bd120e0aeb56a6e872.tar.bz2
Handle misaligned loads in ascending order of byte address
-rw-r--r--machine/misaligned_ldst.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/machine/misaligned_ldst.c b/machine/misaligned_ldst.c
index 2225ea1..dd56f7f 100644
--- a/machine/misaligned_ldst.c
+++ b/machine/misaligned_ldst.c
@@ -39,7 +39,7 @@ void misaligned_load_trap(uintptr_t* regs, uintptr_t mcause, uintptr_t mepc)
return truly_illegal_insn(regs, mcause, mepc, mstatus, insn);
val.int64 = 0;
- for (intptr_t i = len-1; i >= 0; i--)
+ for (intptr_t i = 0; i < len; i++)
val.bytes[i] = load_uint8_t((void *)(addr + i), mepc);
if (!fp)