[PATCH, FT32] sim: correct simulation of MEMCPY and MEMSET
James Bowman
james.bowman@ftdichip.com
Tue Sep 29 23:48:00 GMT 2015
The MEMCPY and MEMSET instructions should only examine the low 15 bits of
their length arguments.
OK to apply?
[sim/ft32]
2015-09-28 James Bowman <james.bowman@ftdichip.com>
* interp.c (step_once): correct length for MEMSET and MEMCPY
instructions.
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index a20907c..ed50b0e 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -598,7 +598,7 @@ step_once (SIM_DESC sd)
uint32_t src = r_1v;
uint32_t dst = cpu->state.regs[r_d];
uint32_t i;
- for (i = 0; i < rimmv; i++)
+ for (i = 0; i < (rimmv & 0x7fff); i++)
PUT_BYTE (dst + i, GET_BYTE (src + i));
}
break;
@@ -617,7 +617,7 @@ step_once (SIM_DESC sd)
/* memset instruction. */
uint32_t dst = cpu->state.regs[r_d];
uint32_t i;
- for (i = 0; i < rimmv; i++)
+ for (i = 0; i < (rimmv & 0x7fff); i++)
PUT_BYTE (dst + i, r_1v);
}
break;
More information about the Gdb-patches
mailing list