aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-12 21:19:43 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-12 21:19:43 +0000
commit26216b98222fd93bf11128859575552d180d0576 (patch)
treef3d46998c54fe5e44afa3f6e225222b1ccdadf36 /sim
parent9b17aab6276db153d0fb91e347ed74cc2586b06c (diff)
downloadfsf-binutils-gdb-26216b98222fd93bf11128859575552d180d0576.zip
fsf-binutils-gdb-26216b98222fd93bf11128859575552d180d0576.tar.gz
fsf-binutils-gdb-26216b98222fd93bf11128859575552d180d0576.tar.bz2
Add the file include/gdb/sim-arm.h defining an enum that specifies the
register numbering used by the GDB<->SIM interface.
Diffstat (limited to 'sim')
-rw-r--r--sim/arm/ChangeLog8
-rw-r--r--sim/arm/Makefile.in8
-rw-r--r--sim/arm/wrapper.c87
3 files changed, 91 insertions, 12 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index f7dfd13..f9f7160 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-12 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in: Update copyright.
+ (wrapper.o): Specify dependencies.
+ * wrapper.c: Include "gdb/sim-arm.h".
+ (sim_store_register, sim_fetch_register): Rewrite using `enum
+ arm_sim_regs' and a switch.
+
2002-06-09 Andrew Cagney <cagney@redhat.com>
* wrapper.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in
index 79bbc88..0da765f 100644
--- a/sim/arm/Makefile.in
+++ b/sim/arm/Makefile.in
@@ -1,5 +1,5 @@
# Makefile template for Configure for the arm sim library.
-# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+# Copyright 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# This program is free software; you can redistribute it and/or modify
@@ -48,3 +48,9 @@ armsupp.o: armsupp.c armdefs.h armemu.h
thumbemu.o: thumbemu.c armdefs.h armemu.h
bag.o: bag.c bag.h
+
+wrapper.o: armdefs.h armemu.h dbg_rdi.h \
+ $(srcdir)/../common/run-sim.h \
+ $(srcdir)/../common/sim-utils.h \
+ $(srcdir)/../../include/gdb/sim-arm.h \
+ $(srcdir)/../../include/gdb/remote-sim.h
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 9aa462e..c8361ba 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -36,6 +36,7 @@
#include "ansidecl.h"
#include "sim-utils.h"
#include "run-sim.h"
+#include "gdb/sim-arm.h"
host_callback *sim_callback;
@@ -386,13 +387,45 @@ sim_store_register (sd, rn, memory, length)
{
init ();
- if (rn == 25)
+ switch ((enum sim_arm_regs) rn)
{
+ case SIM_ARM_R0_REGNUM:
+ case SIM_ARM_R1_REGNUM:
+ case SIM_ARM_R2_REGNUM:
+ case SIM_ARM_R3_REGNUM:
+ case SIM_ARM_R4_REGNUM:
+ case SIM_ARM_R5_REGNUM:
+ case SIM_ARM_R6_REGNUM:
+ case SIM_ARM_R7_REGNUM:
+ case SIM_ARM_R8_REGNUM:
+ case SIM_ARM_R9_REGNUM:
+ case SIM_ARM_R10_REGNUM:
+ case SIM_ARM_R11_REGNUM:
+ case SIM_ARM_R12_REGNUM:
+ case SIM_ARM_R13_REGNUM:
+ case SIM_ARM_R14_REGNUM:
+ case SIM_ARM_R15_REGNUM: /* PC */
+ case SIM_ARM_FP0_REGNUM:
+ case SIM_ARM_FP1_REGNUM:
+ case SIM_ARM_FP2_REGNUM:
+ case SIM_ARM_FP3_REGNUM:
+ case SIM_ARM_FP4_REGNUM:
+ case SIM_ARM_FP5_REGNUM:
+ case SIM_ARM_FP6_REGNUM:
+ case SIM_ARM_FP7_REGNUM:
+ case SIM_ARM_FPS_REGNUM:
+ ARMul_SetReg (state, state->Mode, rn, frommem (state, memory));
+ break;
+
+ case SIM_ARM_PS_REGNUM:
state->Cpsr = frommem (state, memory);
ARMul_CPSRAltered (state);
+ break;
+
+ default:
+ return 0;
}
- else
- ARMul_SetReg (state, state->Mode, rn, frommem (state, memory));
+
return -1;
}
@@ -407,14 +440,46 @@ sim_fetch_register (sd, rn, memory, length)
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. */
- regval = ARMul_GetCPSR (state);
- else
- /* FIXME: should report an error. */
- regval = 0;
+ switch ((enum sim_arm_regs) rn)
+ {
+ case SIM_ARM_R0_REGNUM:
+ case SIM_ARM_R1_REGNUM:
+ case SIM_ARM_R2_REGNUM:
+ case SIM_ARM_R3_REGNUM:
+ case SIM_ARM_R4_REGNUM:
+ case SIM_ARM_R5_REGNUM:
+ case SIM_ARM_R6_REGNUM:
+ case SIM_ARM_R7_REGNUM:
+ case SIM_ARM_R8_REGNUM:
+ case SIM_ARM_R9_REGNUM:
+ case SIM_ARM_R10_REGNUM:
+ case SIM_ARM_R11_REGNUM:
+ case SIM_ARM_R12_REGNUM:
+ case SIM_ARM_R13_REGNUM:
+ case SIM_ARM_R14_REGNUM:
+ case SIM_ARM_R15_REGNUM: /* PC */
+ regval = ARMul_GetReg (state, state->Mode, rn);
+ break;
+
+ case SIM_ARM_FP0_REGNUM:
+ case SIM_ARM_FP1_REGNUM:
+ case SIM_ARM_FP2_REGNUM:
+ case SIM_ARM_FP3_REGNUM:
+ case SIM_ARM_FP4_REGNUM:
+ case SIM_ARM_FP5_REGNUM:
+ case SIM_ARM_FP6_REGNUM:
+ case SIM_ARM_FP7_REGNUM:
+ case SIM_ARM_FPS_REGNUM:
+ memset (memory, 0, length);
+ return 0;
+
+ case SIM_ARM_PS_REGNUM:
+ regval = ARMul_GetCPSR (state);
+ break;
+
+ default:
+ return 0;
+ }
while (length)
{