This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, FT32] sim: correct simulation of MEMCPY and MEMSET


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]