aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-05-12 04:57:49 +0000
committerAndrew Cagney <cagney@redhat.com>1997-05-12 04:57:49 +0000
commitc445af5a2b1fd76533a6ce709677e779f215721f (patch)
tree119a7b8e222693254bb42285d2f51025760c1d68 /sim/common
parente05e76e8a470200543c927636f8ceae638236c5f (diff)
downloadbinutils-c445af5a2b1fd76533a6ce709677e779f215721f.zip
binutils-c445af5a2b1fd76533a6ce709677e779f215721f.tar.gz
binutils-c445af5a2b1fd76533a6ce709677e779f215721f.tar.bz2
c80 simulator fixes.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog13
-rw-r--r--sim/common/sim-basics.h19
-rw-r--r--sim/common/sim-core.c2
-rw-r--r--sim/common/sim-events.h160
4 files changed, 150 insertions, 44 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 54a4c6b..e859b9a 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,16 @@
+Mon May 12 14:49:05 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-core.c (sim_core_find_mapping): Call engine_error not
+ sim_io_error when possible.
+
+Mon May 12 08:55:07 1997 Andrew Cagney <cagney@b2.cygnus.com>
+
+ * sim-endian.h (V1_H2): Add macro's to insert a word into a
+ high/low double word.
+
+ * sim-trace.h: Remove definition of attribute - defined in
+ sim_basics.h.
+
Mon May 12 08:55:07 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-options.h (struct OPTION): Add doc_opt as the documenting
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index d33a0d5..149e6a0 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -42,14 +42,11 @@
#endif
-
/* Some versions of GCC include an attribute operator, define it */
#if !defined (__attribute__)
-#if (!defined(__GNUC__) \
- || (__GNUC__ < 2) \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
+#if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
#define __attribute__(arg)
#endif
#endif
@@ -64,15 +61,19 @@ void *zalloc (unsigned long size);
void zfree(void*);
+
/* Turn VALUE into a string with commas. */
char *sim_add_commas (char *, int, unsigned long);
/* Utilities for elapsed time reporting. */
+
/* Opaque type, known only inside sim_elapsed_time_foo fns. */
typedef unsigned long SIM_ELAPSED_TIME;
+
/* Get reference point for future call to sim_time_elapsed. */
SIM_ELAPSED_TIME sim_elapsed_time_get (void);
+
/* Elapsed time in milliseconds since START. */
unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start);
@@ -117,16 +118,14 @@ typedef enum _attach_type {
#include "sim-config.h"
-#include "sim-module.h"
-#include "sim-trace.h"
-#include "sim-profile.h"
-#include "sim-model.h"
-#include "sim-base.h"
-
#include "sim-inline.h"
#include "sim-types.h"
#include "sim-bits.h"
#include "sim-endian.h"
+/* Note: Only the simpler interfaces are defined here. More heavy
+ weight objects, such as core and events, are defined in the more
+ serious sim-base.h header. */
+
#endif /* _SIM_BASICS_H_ */
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index 01ff5d7..e9102cf 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -312,7 +312,7 @@ sim_core_find_mapping(sim_core *core,
if (cpu == NULL)
sim_io_error (NULL, "sim_core_find_map - internal error - can not abort without a processor");
else
- sim_io_error (CPU_STATE (cpu),
+ engine_error (CPU_STATE (cpu), cpu, cia,
"access to unmaped address 0x%lx (%d bytes)\n",
(unsigned long) addr, nr_bytes);
}
diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h
index eb52690..05b28b5 100644
--- a/sim/common/sim-events.h
+++ b/sim/common/sim-events.h
@@ -23,84 +23,178 @@
#define _SIM_EVENTS_H_
-typedef void event_handler(void *data);
+/* Notes:
-typedef struct _event_entry event_entry;
-struct _event_entry {
+ When scheduling an event, the a delta of zero/one refers to the
+ timeline as follows:
+
+ epoch 0|1 1|2 2|3 3|
+ **queue**|--insn--|*queue*|--insn--|*queue*|--insn--|*queue*|
+ | ^ ^ | ^ ^
+ `- +0 ------------ +1 --.. `----- +0 ------------- +1 --..
+
+ When the queue is initialized, the time is set to zero with a
+ number of initialization events scheduled. Consequently, as also
+ illustrated above, the event queue should be processed before the
+ first instruction. That instruction being executed during tick 1.
+
+ The event queue is processed using:
+
+ if (sim_events_tick (sd)) {
+ sim_events_process (sd);
+ }
+
+ */
+
+
+typedef void sim_event_handler(void *data);
+
+typedef struct _sim_event sim_event;
+struct _sim_event {
void *data;
- event_handler *handler;
+ sim_event_handler *handler;
signed64 time_of_event;
- event_entry *next;
+ sim_event *next;
};
-typedef struct _event_queue event_queue;
-struct _event_queue {
+typedef struct _sim_events sim_events;
+struct _sim_events {
int processing;
- event_entry *queue;
- event_entry *volatile held;
- event_entry *volatile *volatile held_end;
+ sim_event *queue;
+ sim_event *volatile held;
+ sim_event *volatile *volatile held_end;
signed64 time_of_event;
- signed64 time_from_event;
+ int time_from_event;
+ void *path_to_halt_or_restart;
int trace;
};
-typedef struct event_entry *event_entry_tag;
/* Initialization */
INLINE_SIM_EVENTS\
-(void) event_queue_init
-(engine *system);
+(void) sim_events_init
+(SIM_DESC sd);
-/* Tracing level */
+/* Set Tracing Level */
INLINE_SIM_EVENTS\
-(void) event_queue_trace
-(engine *system,
+(void) sim_events_set_trace
+(SIM_DESC sd,
int level);
-/* (de)Schedule things to happen in the future. */
+/* Schedule an event DELTA_TIME ticks into the future */
INLINE_SIM_EVENTS\
-(event_entry_tag) event_queue_schedule
-(engine *system,
+(sim_event *) sim_events_schedule
+(SIM_DESC sd,
signed64 delta_time,
- event_handler *handler,
+ sim_event_handler *handler,
void *data);
INLINE_SIM_EVENTS\
-(event_entry_tag) event_queue_schedule_after_signal
-(engine *system,
+(sim_event *) sim_events_schedule_after_signal
+(SIM_DESC sd,
signed64 delta_time,
- event_handler *handler,
+ sim_event_handler *handler,
void *data);
+
+/* Schedule an event WALLCLOCK milli-seconds from the start of the
+ simulation. The exact interpretation of wallclock is host
+ dependant. */
+
+INLINE_SIM_EVENTS\
+(void) sim_events_wallclock_schedule
+(SIM_DESC sd,
+ signed64 wallclock_ms_time,
+ sim_event_handler *handler,
+ void *data);
+
+
+#if 0
+/* Schedule an event when the value at ADDR lies between LB..UB */
+
+typedef enum {
+ /* value host byte ordered */
+ watch_host_1,
+ watch_host_2,
+ watch_host_4,
+ watch_host_8,
+ /* value target byte ordered */
+ watch_targ_1,
+ watch_targ_2,
+ watch_targ_4,
+ watch_targ_8,
+ /* value big-endian */
+ watch_bend_1,
+ watch_bend_2,
+ watch_bend_4,
+ watch_bend_8,
+ /* value little-endian */
+ watch_lend_1,
+ watch_lend_2,
+ watch_lend_4,
+ watch_lend_8,
+} sim_watchpoint;
+
INLINE_SIM_EVENTS\
-(void) event_queue_deschedule
-(engine *system,
- event_entry_tag event_to_remove);
+(void) sim_events_watchpoint_schedule
+(SIM_DESC sd,
+ sim_watchpoint type,
+ void *addr,
+ unsigned64 lb,
+ unsigned64 ub,
+ sim_event_handler *handler,
+ void *data);
+#endif
+
+
+#if 0
+/* Schedule an event when the value in CORE lies between LB..UB */
+
+INLINE_SIM_EVENTS\
+(void) sim_events_watchcore_schedule
+(SIM_DESC sd,
+ sim_watchpoint type,
+ address_word addr,
+ sim_core_maps map,
+ unsigned64 lb,
+ unsigned64 ub,
+ sim_event_handler *handler,
+ void *data);
+#endif
+
+
+/* Deschedule the specified event */
+
+INLINE_SIM_EVENTS\
+(void) sim_events_deschedule
+(SIM_DESC sd,
+ sim_event *event_to_remove);
+
/* progress time. Broken into two parts so that if something is
pending, the caller has a chance to save any cached state */
INLINE_SIM_EVENTS\
-(int) event_queue_tick
-(engine *system);
+(int) sim_events_tick
+(SIM_DESC sd);
INLINE_SIM_EVENTS\
-(void) event_queue_process
-(engine *system);
+(void) sim_events_process
+(SIM_DESC sd);
/* local concept of time */
INLINE_SIM_EVENTS\
-(signed64) event_queue_time
-(engine *system);
+(signed64) sim_events_time
+(SIM_DESC sd);
#endif