From 7a292a7adf506b866905b06b3024c0fd411c4583 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Mon, 26 Apr 1999 18:34:20 +0000 Subject: import gdb-19990422 snapshot --- sim/arm/ChangeLog | 22 ++++++++++++++++++++++ sim/arm/Makefile.in | 2 +- sim/arm/armemu.c | 42 +++++++++++++++++++++++++++++++++++++----- sim/arm/thumbemu.c | 4 ++++ sim/arm/wrapper.c | 14 ++++++++++++-- 5 files changed, 76 insertions(+), 8 deletions(-) (limited to 'sim/arm') diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 4149366..9f6adf4 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,25 @@ +1999-04-06 Keith Seitz + + * wrapper.c (stop_simulator): New global. + (sim_stop): Set sim state to STOP and set + stop_simulator. + (sim_resume): Reset stop_simulator. + (sim_stop_reason): If stop_simulator is set, tell gdb + that the we took SIGINT. + * armemu.c (ARMul_Emulate26): Don't loop forever. Stop if + stop_simulator is set. + +1999-04-02 Keith Seitz + + * armemu.c (ARMul_Emulate26): If NEED_UI_LOOP_HOOK, call ui_loop_hook + whenever the counter expires. + * Makefile.in (SIM_EXTRA_CFLAGS): Include define NEED_UI_LOOP_HOOK. + +1999-03-24 Nick Clifton + + * armemu.c (ARMul_Emulate26): Handle new breakpoint value. + * thumbemu.c (ARMul_ThumbDecode): Handle new breakpoint value. + Mon Sep 14 09:00:05 1998 Nick Clifton * wrapper.c (sim_open): Set endianness according to BFD or command diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in index b6ae2af..e2f2b3c 100644 --- a/sim/arm/Makefile.in +++ b/sim/arm/Makefile.in @@ -18,7 +18,7 @@ ## COMMON_PRE_CONFIG_FRAG -SIM_EXTRA_CFLAGS = -DMODET +SIM_EXTRA_CFLAGS = -DMODET -DNEED_UI_LOOP_HOOK SIM_OBJS = armcopro.o armemu26.o armemu32.o arminit.o armos.o armsupp.o \ armvirt.o bag.o thumbemu.o wrapper.o sim-load.o diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 171f1c8..36b7bba 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -18,6 +18,7 @@ #include "armdefs.h" #include "armemu.h" +#include "armos.h" static ARMword GetDPRegRHS(ARMul_State *state, ARMword instr) ; static ARMword GetDPSRegRHS(ARMul_State *state, ARMword instr) ; @@ -43,6 +44,19 @@ static unsigned MultiplyAdd64(ARMul_State *state, ARMword instr,int signextend,i #define LDEFAULT (0) /* default : do nothing */ #define LSCC (1) /* set condition codes on result */ +#ifdef NEED_UI_LOOP_HOOK +/* How often to run the ui_loop update, when in use */ +#define UI_LOOP_POLL_INTERVAL 0x32000 + +/* Counter for the ui_loop_hook update */ +static long ui_loop_hook_counter = UI_LOOP_POLL_INTERVAL; + +/* Actual hook to call to run through gdb's gui event loop */ +extern int (*ui_loop_hook) (int); +#endif /* NEED_UI_LOOP_HOOK */ + +extern int stop_simulator; + /***************************************************************************\ * short-hand macros for LDR/STR * \***************************************************************************/ @@ -2166,10 +2180,20 @@ mainswitch: break ; case 0x7f : /* Load Byte, WriteBack, Pre Inc, Reg */ - if (BIT(4)) { - ARMul_UndefInstr(state,instr) ; - break ; - } + if (BIT(4)) + { + /* Check for the special breakpoint opcode. + This value should correspond to the value defined + as ARM_BE_BREAKPOINT in gdb/arm-tdep.c. */ + if (BITS (0,19) == 0xfdefe) + { + if (! ARMul_OSHandleSWI (state, SWI_Breakpoint)) + ARMul_Abort (state, ARMul_SWIV); + } + else + ARMul_UndefInstr(state,instr) ; + break ; + } UNDEF_LSRBaseEQOffWb ; UNDEF_LSRBaseEQDestWb ; UNDEF_LSRPCBaseWb ; @@ -2549,11 +2573,19 @@ mainswitch: donext: #endif +#ifdef NEED_UI_LOOP_HOOK + if (ui_loop_hook != NULL && ui_loop_hook_counter-- < 0) + { + ui_loop_hook_counter = UI_LOOP_POLL_INTERVAL; + ui_loop_hook (0); + } +#endif /* NEED_UI_LOOP_HOOK */ + if (state->Emulate == ONCE) state->Emulate = STOP; else if (state->Emulate != RUN) break; - } while (1) ; /* do loop */ + } while (!stop_simulator) ; /* do loop */ state->decoded = decoded ; state->loaded = loaded ; diff --git a/sim/arm/thumbemu.c b/sim/arm/thumbemu.c index eaf6e0c..c610b97 100644 --- a/sim/arm/thumbemu.c +++ b/sim/arm/thumbemu.c @@ -29,6 +29,7 @@ existing ARM simulator. */ #include "armdefs.h" #include "armemu.h" +#include "armos.h" /* Decode a 16bit Thumb instruction. The instruction is in the low 16-bits of the tinstr field, with the following Thumb instruction @@ -356,6 +357,9 @@ ARMul_ThumbDecode (state,pc,tinstr,ainstr) /* Breakpoint must be handled specially. */ if ((tinstr & 0x00FF) == 0x18) *ainstr |= ((tinstr & 0x00FF) << 16); + /* New breakpoint value. See gdb/arm-tdep.c */ + else if ((tinstr & 0x00FF) == 0xFE) + * ainstr |= SWI_Breakpoint; else *ainstr |= (tinstr & 0x00FF); } diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 4038004..7d725b8 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -50,6 +50,8 @@ static int verbosity; /* Non-zero to set big endian mode. */ static int big_endian; +int stop_simulator; + static void init () { @@ -154,7 +156,9 @@ int sim_stop (sd) SIM_DESC sd; { - return 0; + state->Emulate = STOP; + stop_simulator = 1; + return 1; } void @@ -163,6 +167,7 @@ sim_resume (sd, step, siggnal) int step, siggnal; { state->EndCondition = 0; + stop_simulator = 0; if (step) { @@ -435,7 +440,12 @@ sim_stop_reason (sd, reason, sigrc) enum sim_stop *reason; int *sigrc; { - if (state->EndCondition == 0) + if (stop_simulator) + { + *reason = sim_stopped; + *sigrc = SIGINT; + } + else if (state->EndCondition == 0) { *reason = sim_exited; *sigrc = state->Reg[0] & 255; -- cgit v1.1