aboutsummaryrefslogtreecommitdiff
path: root/sim/arm/wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/arm/wrapper.c')
-rw-r--r--sim/arm/wrapper.c57
1 files changed, 37 insertions, 20 deletions
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index b5ecd31..f6c4b05 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -114,6 +114,8 @@ ARMul_Debug (ARMul_State * state ATTRIBUTE_UNUSED, ARMword pc ATTRIBUTE_UNUSED,
return 0;
}
+int SWI_vector_installed = FALSE;
+
int
sim_write (sd, addr, buffer, size)
SIM_DESC sd ATTRIBUTE_UNUSED;
@@ -125,6 +127,9 @@ sim_write (sd, addr, buffer, size)
init ();
+ if ((addr <= 0x8) && ((addr + size) >= 0x8))
+ SWI_vector_installed = TRUE;
+
for (i = 0; i < size; i++)
ARMul_WriteByte (state, addr + i, buffer[i]);
@@ -216,37 +221,47 @@ sim_create_inferior (sd, abfd, argv, env)
"Unknown machine type; please update sim_create_inferior.\n");
/* fall through */
- case 0: /* arm */
+ case 0:
/* We wouldn't set the machine type with earlier toolchains, so we
- explicitly select a processor capable of supporting all ARM
- 32bit mode. */
- /* fall through */
+ explicitly select a processor capable of supporting all ARMs in
+ 32bit mode. */
+ case bfd_mach_arm_5:
+ case bfd_mach_arm_5T:
+ ARMul_SelectProcessor (state, ARM_v5_Prop);
+ break;
- case 5: /* armv4 */
- case 6: /* armv4t */
- case 7: /* armv5 */
- case 8: /* armv5t */
- if (mach == 7 || mach == 8)
- ARMul_SelectProcessor (state, ARM_v5_Prop);
- else
- ARMul_SelectProcessor (state, ARM_v4_Prop);
- /* Reset mode to ARM. A gdb user may rerun a program that had entered
- THUMB mode from the start and cause the ARM-mode startup code to be
- executed in THUMB mode. */
- ARMul_SetCPSR (state, USER32MODE);
+ case bfd_mach_arm_5TE:
+ ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop);
+ break;
+
+ case bfd_mach_arm_XScale:
+ ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop);
break;
- case 3: /* armv3 */
- case 4: /* armv3m */
+ case bfd_mach_arm_4:
+ case bfd_mach_arm_4T:
+ ARMul_SelectProcessor (state, ARM_v4_Prop);
+ break;
+
+ case bfd_mach_arm_3:
+ case bfd_mach_arm_3M:
ARMul_SelectProcessor (state, ARM_Lock_Prop);
break;
- case 1: /* armv2 */
- case 2: /* armv2a */
+ case bfd_mach_arm_2:
+ case bfd_mach_arm_2a:
ARMul_SelectProcessor (state, ARM_Fix26_Prop);
break;
}
+ if (mach > 3)
+ {
+ /* Reset mode to ARM. A gdb user may rerun a program that had entered
+ THUMB mode from the start and cause the ARM-mode startup code to be
+ executed in THUMB mode. */
+ ARMul_SetCPSR (state, USER32MODE);
+ }
+
if (argv != NULL)
{
/*
@@ -354,6 +369,7 @@ sim_store_register (sd, rn, memory, length)
int length ATTRIBUTE_UNUSED;
{
init ();
+
if (rn == 25)
{
state->Cpsr = frommem (state, memory);
@@ -374,6 +390,7 @@ sim_fetch_register (sd, rn, memory, length)
ARMword regval;
init ();
+
if (rn < 16)
regval = ARMul_GetReg (state, state->Mode, rn);
else if (rn == 25) /* FIXME: use PS_REGNUM from gdb/config/arm/tm-arm.h */