summaryrefslogtreecommitdiff
path: root/src/core/arm/interpreter/armsupp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/arm/interpreter/armsupp.cpp')
-rw-r--r--src/core/arm/interpreter/armsupp.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index e2626eefb..5a8f09b22 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -22,13 +22,6 @@
22 22
23 23
24static ARMword ModeToBank (ARMword); 24static ARMword ModeToBank (ARMword);
25static void EnvokeList (ARMul_State *, unsigned int, unsigned int);
26
27struct EventNode {
28 /* An event list node. */
29 unsigned (*func) (ARMul_State *); /* The function to call. */
30 struct EventNode *next;
31};
32 25
33/* This routine returns the value of a register from a mode. */ 26/* This routine returns the value of a register from a mode. */
34 27
@@ -1068,76 +1061,3 @@ ARMul_Align (ARMul_State* state, ARMword address, ARMword data)
1068 address = (address & 3) << 3; /* Get the word address. */ 1061 address = (address & 3) << 3; /* Get the word address. */
1069 return ((data >> address) | (data << (32 - address))); /* rot right */ 1062 return ((data >> address) | (data << (32 - address))); /* rot right */
1070} 1063}
1071
1072/* This routine is used to call another routine after a certain number of
1073 cycles have been executed. The first parameter is the number of cycles
1074 delay before the function is called, the second argument is a pointer
1075 to the function. A delay of zero doesn't work, just call the function. */
1076
1077void
1078ARMul_ScheduleEvent (ARMul_State * state, unsigned int delay,
1079 unsigned (*what) (ARMul_State *))
1080{
1081 unsigned int when;
1082 struct EventNode *event;
1083
1084 if (state->EventSet++ == 0)
1085 state->Now = ARMul_Time (state);
1086 when = (state->Now + delay) % EVENTLISTSIZE;
1087 event = (struct EventNode *) malloc (sizeof (struct EventNode));
1088 if (!event) {
1089 printf ("SKYEYE:ARMul_ScheduleEvent: malloc event error\n");
1090 exit(-1);
1091 //skyeye_exit (-1);
1092 }
1093 event->func = what;
1094 event->next = *(state->EventPtr + when);
1095 *(state->EventPtr + when) = event;
1096}
1097
1098/* This routine is called at the beginning of
1099 every cycle, to envoke scheduled events. */
1100
1101void
1102ARMul_EnvokeEvent (ARMul_State * state)
1103{
1104 static unsigned int then;
1105
1106 then = state->Now;
1107 state->Now = ARMul_Time (state) % EVENTLISTSIZE;
1108 if (then < state->Now)
1109 /* Schedule events. */
1110 EnvokeList (state, then, state->Now);
1111 else if (then > state->Now) {
1112 /* Need to wrap around the list. */
1113 EnvokeList (state, then, EVENTLISTSIZE - 1L);
1114 EnvokeList (state, 0L, state->Now);
1115 }
1116}
1117
1118/* Envokes all the entries in a range. */
1119
1120static void
1121EnvokeList (ARMul_State * state, unsigned int from, unsigned int to)
1122{
1123 for (; from <= to; from++) {
1124 struct EventNode *anevent;
1125
1126 anevent = *(state->EventPtr + from);
1127 while (anevent) {
1128 (anevent->func) (state);
1129 state->EventSet--;
1130 anevent = anevent->next;
1131 }
1132 *(state->EventPtr + from) = NULL;
1133 }
1134}
1135
1136/* This routine is returns the number of clock ticks since the last reset. */
1137
1138unsigned int
1139ARMul_Time (ARMul_State * state)
1140{
1141 return (state->NumScycles + state->NumNcycles +
1142 state->NumIcycles + state->NumCcycles + state->NumFcycles);
1143}