Prevent writes to R15 via LDR or LDM from changing the ARM/Thumb state in pre-v5 architectures.
PR sim/8388 * armemu.c (WriteR15Load): New function. Determines if the state can be changed upon a write to R15. (LoadMult): Use WriteR15Load. * armemu.h (WRITEDESTB): Use WriteR15Load.
This commit is contained in:
parent
e5b98723a5
commit
b9366cf395
@ -1,3 +1,11 @@
|
|||||||
|
2014-03-14 David McQuillan <dmcq@tao-group.com>
|
||||||
|
|
||||||
|
PR sim/8388
|
||||||
|
* armemu.c (WriteR15Load): New function. Determines if the state
|
||||||
|
can be changed upon a write to R15.
|
||||||
|
(LoadMult): Use WriteR15Load.
|
||||||
|
* armemu.h (WRITEDESTB): Use WriteR15Load.
|
||||||
|
|
||||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* wrapper.c (sim_do_command): Add const to cmd.
|
* wrapper.c (sim_do_command): Add const to cmd.
|
||||||
|
@ -25,6 +25,7 @@ static ARMword GetDPSRegRHS (ARMul_State *, ARMword);
|
|||||||
static void WriteR15 (ARMul_State *, ARMword);
|
static void WriteR15 (ARMul_State *, ARMword);
|
||||||
static void WriteSR15 (ARMul_State *, ARMword);
|
static void WriteSR15 (ARMul_State *, ARMword);
|
||||||
static void WriteR15Branch (ARMul_State *, ARMword);
|
static void WriteR15Branch (ARMul_State *, ARMword);
|
||||||
|
static void WriteR15Load (ARMul_State *, ARMword);
|
||||||
static ARMword GetLSRegRHS (ARMul_State *, ARMword);
|
static ARMword GetLSRegRHS (ARMul_State *, ARMword);
|
||||||
static ARMword GetLS7RHS (ARMul_State *, ARMword);
|
static ARMword GetLS7RHS (ARMul_State *, ARMword);
|
||||||
static unsigned LoadWord (ARMul_State *, ARMword, ARMword);
|
static unsigned LoadWord (ARMul_State *, ARMword, ARMword);
|
||||||
@ -4212,6 +4213,17 @@ WriteR15Branch (ARMul_State * state, ARMword src)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Before ARM_v5 LDR and LDM of pc did not change mode. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
WriteR15Load (ARMul_State * state, ARMword src)
|
||||||
|
{
|
||||||
|
if (state->is_v5)
|
||||||
|
WriteR15Branch (state, src);
|
||||||
|
else
|
||||||
|
WriteR15 (state, src);
|
||||||
|
}
|
||||||
|
|
||||||
/* This routine evaluates most Load and Store register RHS's. It is
|
/* This routine evaluates most Load and Store register RHS's. It is
|
||||||
intended to be called from the macro LSRegRHS, which filters the
|
intended to be called from the macro LSRegRHS, which filters the
|
||||||
common case of an unshifted register with in line code. */
|
common case of an unshifted register with in line code. */
|
||||||
@ -4724,7 +4736,7 @@ LoadMult (ARMul_State * state, ARMword instr, ARMword address, ARMword WBBase)
|
|||||||
|
|
||||||
if (BIT (15) && !state->Aborted)
|
if (BIT (15) && !state->Aborted)
|
||||||
/* PC is in the reg list. */
|
/* PC is in the reg list. */
|
||||||
WriteR15Branch (state, PC);
|
WriteR15Load (state, PC);
|
||||||
|
|
||||||
/* To write back the final register. */
|
/* To write back the final register. */
|
||||||
ARMul_Icycles (state, 1, 0L);
|
ARMul_Icycles (state, 1, 0L);
|
||||||
|
@ -402,7 +402,7 @@ extern ARMword isize;
|
|||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (DESTReg == 15) \
|
if (DESTReg == 15) \
|
||||||
WriteR15Branch (state, d); \
|
WriteR15Load (state, d); \
|
||||||
else \
|
else \
|
||||||
DEST = d; \
|
DEST = d; \
|
||||||
} \
|
} \
|
||||||
|
Loading…
Reference in New Issue
Block a user