summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/arm/skyeye_common/armdefs.h475
1 files changed, 169 insertions, 306 deletions
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h
index 9e62255aa..28a4a0db4 100644
--- a/src/core/arm/skyeye_common/armdefs.h
+++ b/src/core/arm/skyeye_common/armdefs.h
@@ -18,38 +18,26 @@
18#ifndef _ARMDEFS_H_ 18#ifndef _ARMDEFS_H_
19#define _ARMDEFS_H_ 19#define _ARMDEFS_H_
20 20
21#include <stdio.h> 21#include <cerrno>
22#include <stdlib.h> 22#include <csignal>
23#include <errno.h> 23#include <cstdio>
24 24#include <cstdlib>
25#include "common/platform.h" 25#include <cstring>
26 26#include <fcntl.h>
27//teawater add for arm2x86 2005.02.14------------------------------------------- 27#include <sys/stat.h>
28// koodailar remove it for mingw 2005.12.18---------------- 28#include <sys/types.h>
29//anthonylee modify it for portable 2007.01.30
30//#include "portable/mman.h"
31 29
32#include "arm_regformat.h" 30#include "arm_regformat.h"
31#include "common/common_types.h"
33#include "common/platform.h" 32#include "common/platform.h"
33#include "core/arm/skyeye_common/armmmu.h"
34#include "core/arm/skyeye_common/skyeye_defs.h" 34#include "core/arm/skyeye_common/skyeye_defs.h"
35 35
36//AJ2D--------------------------------------------------------------------------
37
38//teawater add for arm2x86 2005.07.03-------------------------------------------
39
40#include <sys/types.h>
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
44#if EMU_PLATFORM == PLATFORM_LINUX 36#if EMU_PLATFORM == PLATFORM_LINUX
37#include <sys/time.h>
45#include <unistd.h> 38#include <unistd.h>
46#endif 39#endif
47#include <errno.h>
48#include <sys/stat.h>
49#include <fcntl.h>
50 40
51//#include <memory_space.h>
52//AJ2D--------------------------------------------------------------------------
53#if 0 41#if 0
54#if 0 42#if 0
55#define DIFF_STATE 1 43#define DIFF_STATE 1
@@ -70,25 +58,8 @@
70#define LOWHIGH 1 58#define LOWHIGH 1
71#define HIGHLOW 2 59#define HIGHLOW 2
72 60
73//teawater add DBCT_TEST_SPEED 2005.10.04---------------------------------------
74#include <signal.h>
75
76#include "common/platform.h"
77
78#if EMU_PLATFORM == PLATFORM_LINUX
79#include <sys/time.h>
80#endif
81
82//#define DBCT_TEST_SPEED 61//#define DBCT_TEST_SPEED
83#define DBCT_TEST_SPEED_SEC 10 62#define DBCT_TEST_SPEED_SEC 10
84//AJ2D--------------------------------------------------------------------------
85
86//teawater add compile switch for DBCT GDB RSP function 2005.10.21--------------
87//#define DBCT_GDBRSP
88//AJ2D--------------------------------------------------------------------------
89
90//#include <skyeye_defs.h>
91//#include <skyeye_types.h>
92 63
93#define ARM_BYTE_TYPE 0 64#define ARM_BYTE_TYPE 0
94#define ARM_HALFWORD_TYPE 1 65#define ARM_HALFWORD_TYPE 1
@@ -103,71 +74,34 @@
103typedef char *VoidStar; 74typedef char *VoidStar;
104#endif 75#endif
105 76
106typedef unsigned long long ARMdword; /* must be 64 bits wide */ 77typedef u64 ARMdword; // must be 64 bits wide
107typedef unsigned int ARMword; /* must be 32 bits wide */ 78typedef u32 ARMword; // must be 32 bits wide
108typedef unsigned char ARMbyte; /* must be 8 bits wide */ 79typedef u16 ARMhword; // must be 16 bits wide
109typedef unsigned short ARMhword; /* must be 16 bits wide */ 80typedef u8 ARMbyte; // must be 8 bits wide
110typedef struct ARMul_State ARMul_State; 81typedef struct ARMul_State ARMul_State;
111typedef struct ARMul_io ARMul_io; 82typedef struct ARMul_io ARMul_io;
112typedef struct ARMul_Energy ARMul_Energy; 83typedef struct ARMul_Energy ARMul_Energy;
113 84
114//teawater add for arm2x86 2005.06.24-------------------------------------------
115#include <stdint.h>
116//AJ2D--------------------------------------------------------------------------
117/*
118//chy 2005-05-11
119#ifndef __CYGWIN__
120//teawater add for arm2x86 2005.02.14-------------------------------------------
121typedef unsigned char uint8_t;
122typedef unsigned short uint16_t;
123typedef unsigned int u32;
124#if defined (__x86_64__)
125typedef unsigned long uint64_t;
126#else
127typedef unsigned long long uint64_t;
128#endif
129////AJ2D--------------------------------------------------------------------------
130#endif
131*/
132 85
133#include "core/arm/skyeye_common/armmmu.h" 86typedef unsigned ARMul_CPInits(ARMul_State* state);
134//#include "lcd/skyeye_lcd.h" 87typedef unsigned ARMul_CPExits(ARMul_State* state);
135 88typedef unsigned ARMul_LDCs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
136 89typedef unsigned ARMul_STCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
137//#include "skyeye.h" 90typedef unsigned ARMul_MRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
138//#include "skyeye_device.h" 91typedef unsigned ARMul_MCRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
139//#include "net/skyeye_net.h" 92typedef unsigned ARMul_MRRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value1, ARMword* value2);
140//#include "skyeye_config.h" 93typedef unsigned ARMul_MCRRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value1, ARMword value2);
141 94typedef unsigned ARMul_CDPs(ARMul_State* state, unsigned type, ARMword instr);
142 95typedef unsigned ARMul_CPReads(ARMul_State* state, unsigned reg, ARMword* value);
143typedef unsigned ARMul_CPInits (ARMul_State * state); 96typedef unsigned ARMul_CPWrites(ARMul_State* state, unsigned reg, ARMword value);
144typedef unsigned ARMul_CPExits (ARMul_State * state);
145typedef unsigned ARMul_LDCs (ARMul_State * state, unsigned type,
146 ARMword instr, ARMword value);
147typedef unsigned ARMul_STCs (ARMul_State * state, unsigned type,
148 ARMword instr, ARMword * value);
149typedef unsigned ARMul_MRCs (ARMul_State * state, unsigned type,
150 ARMword instr, ARMword * value);
151typedef unsigned ARMul_MCRs (ARMul_State * state, unsigned type,
152 ARMword instr, ARMword value);
153typedef unsigned ARMul_MRRCs (ARMul_State * state, unsigned type,
154 ARMword instr, ARMword * value1, ARMword * value2);
155typedef unsigned ARMul_MCRRs (ARMul_State * state, unsigned type,
156 ARMword instr, ARMword value1, ARMword value2);
157typedef unsigned ARMul_CDPs (ARMul_State * state, unsigned type,
158 ARMword instr);
159typedef unsigned ARMul_CPReads (ARMul_State * state, unsigned reg,
160 ARMword * value);
161typedef unsigned ARMul_CPWrites (ARMul_State * state, unsigned reg,
162 ARMword value);
163 97
164 98
165//added by ksh,2004-3-5 99//added by ksh,2004-3-5
166struct ARMul_io 100struct ARMul_io
167{ 101{
168 ARMword *instr; //to display the current interrupt state 102 ARMword *instr; // to display the current interrupt state
169 ARMword *net_flag; //to judge if network is enabled 103 ARMword *net_flag; // to judge if network is enabled
170 ARMword *net_int; //netcard interrupt 104 ARMword *net_int; // netcard interrupt
171 105
172 //ywc,2004-04-01 106 //ywc,2004-04-01
173 ARMword *ts_int; 107 ARMword *ts_int;
@@ -180,17 +114,17 @@ struct ARMul_io
180/* added by ksh,2004-11-26,some energy profiling */ 114/* added by ksh,2004-11-26,some energy profiling */
181struct ARMul_Energy 115struct ARMul_Energy
182{ 116{
183 int energy_prof; /* <tktan> BUG200103282109 : for energy profiling */ 117 int energy_prof; /* <tktan> BUG200103282109 : for energy profiling */
184 int enable_func_energy; /* <tktan> BUG200105181702 */ 118 int enable_func_energy; /* <tktan> BUG200105181702 */
185 char *func_energy; 119 char *func_energy;
186 int func_display; /* <tktan> BUG200103311509 : for function call display */ 120 int func_display; /* <tktan> BUG200103311509 : for function call display */
187 int func_disp_start; /* <tktan> BUG200104191428 : to start func profiling */ 121 int func_disp_start; /* <tktan> BUG200104191428 : to start func profiling */
188 char *start_func; /* <tktan> BUG200104191428 */ 122 char *start_func; /* <tktan> BUG200104191428 */
189 123
190 FILE *outfile; /* <tktan> BUG200105201531 : direct console to file */ 124 FILE *outfile; /* <tktan> BUG200105201531 : direct console to file */
191 long long tcycle, pcycle; 125 long long tcycle, pcycle;
192 float t_energy; 126 float t_energy;
193 void *cur_task; /* <tktan> BUG200103291737 */ 127 void *cur_task; /* <tktan> BUG200103291737 */
194 long long t_mem_cycle, t_idle_cycle, t_uart_cycle; 128 long long t_mem_cycle, t_idle_cycle, t_uart_cycle;
195 long long p_mem_cycle, p_idle_cycle, p_uart_cycle; 129 long long p_mem_cycle, p_idle_cycle, p_uart_cycle;
196 long long p_io_update_tcycle; 130 long long p_io_update_tcycle;
@@ -203,13 +137,12 @@ struct ARMul_Energy
203 137
204typedef struct mem_bank 138typedef struct mem_bank
205{ 139{
206 ARMword (*read_byte) (ARMul_State * state, ARMword addr); 140 ARMword (*read_byte) (ARMul_State* state, ARMword addr);
207 void (*write_byte) (ARMul_State * state, ARMword addr, ARMword data); 141 void (*write_byte) (ARMul_State* state, ARMword addr, ARMword data);
208 ARMword (*read_halfword) (ARMul_State * state, ARMword addr); 142 ARMword (*read_halfword) (ARMul_State* state, ARMword addr);
209 void (*write_halfword) (ARMul_State * state, ARMword addr, 143 void (*write_halfword) (ARMul_State* state, ARMword addr, ARMword data);
210 ARMword data); 144 ARMword (*read_word) (ARMul_State* state, ARMword addr);
211 ARMword (*read_word) (ARMul_State * state, ARMword addr); 145 void (*write_word) (ARMul_State* state, ARMword addr, ARMword data);
212 void (*write_word) (ARMul_State * state, ARMword addr, ARMword data);
213 unsigned int addr, len; 146 unsigned int addr, len;
214 char filename[MAX_STR]; 147 char filename[MAX_STR];
215 unsigned type; //chy 2003-09-21: maybe io,ram,rom 148 unsigned type; //chy 2003-09-21: maybe io,ram,rom
@@ -224,24 +157,24 @@ typedef struct
224#define VFP_REG_NUM 64 157#define VFP_REG_NUM 64
225struct ARMul_State 158struct ARMul_State
226{ 159{
227 ARMword Emulate; /* to start and stop emulation */ 160 ARMword Emulate; /* to start and stop emulation */
228 unsigned EndCondition; /* reason for stopping */ 161 unsigned EndCondition; /* reason for stopping */
229 unsigned ErrorCode; /* type of illegal instruction */ 162 unsigned ErrorCode; /* type of illegal instruction */
230 163
231 /* Order of the following register should not be modified */ 164 /* Order of the following register should not be modified */
232 ARMword Reg[16]; /* the current register file */ 165 ARMword Reg[16]; /* the current register file */
233 ARMword Cpsr; /* the current psr */ 166 ARMword Cpsr; /* the current psr */
234 ARMword Spsr_copy; 167 ARMword Spsr_copy;
235 ARMword phys_pc; 168 ARMword phys_pc;
236 ARMword Reg_usr[2]; 169 ARMword Reg_usr[2];
237 ARMword Reg_svc[2]; /* R13_SVC R14_SVC */ 170 ARMword Reg_svc[2]; /* R13_SVC R14_SVC */
238 ARMword Reg_abort[2]; /* R13_ABORT R14_ABORT */ 171 ARMword Reg_abort[2]; /* R13_ABORT R14_ABORT */
239 ARMword Reg_undef[2]; /* R13 UNDEF R14 UNDEF */ 172 ARMword Reg_undef[2]; /* R13 UNDEF R14 UNDEF */
240 ARMword Reg_irq[2]; /* R13_IRQ R14_IRQ */ 173 ARMword Reg_irq[2]; /* R13_IRQ R14_IRQ */
241 ARMword Reg_firq[7]; /* R8---R14 FIRQ */ 174 ARMword Reg_firq[7]; /* R8---R14 FIRQ */
242 ARMword Spsr[7]; /* the exception psr's */ 175 ARMword Spsr[7]; /* the exception psr's */
243 ARMword Mode; /* the current mode */ 176 ARMword Mode; /* the current mode */
244 ARMword Bank; /* the current register bank */ 177 ARMword Bank; /* the current register bank */
245 ARMword exclusive_tag; 178 ARMword exclusive_tag;
246 ARMword exclusive_state; 179 ARMword exclusive_state;
247 ARMword exclusive_result; 180 ARMword exclusive_result;
@@ -285,35 +218,35 @@ struct ARMul_State
285 ARMword servaddr; 218 ARMword servaddr;
286 219
287 unsigned NextInstr; 220 unsigned NextInstr;
288 unsigned VectorCatch; /* caught exception mask */ 221 unsigned VectorCatch; /* caught exception mask */
289 unsigned CallDebug; /* set to call the debugger */ 222 unsigned CallDebug; /* set to call the debugger */
290 unsigned CanWatch; /* set by memory interface if its willing to suffer the 223 unsigned CanWatch; /* set by memory interface if its willing to suffer the
291 overhead of checking for watchpoints on each memory 224 overhead of checking for watchpoints on each memory
292 access */ 225 access */
293 unsigned int StopHandle; 226 unsigned int StopHandle;
294 227
295 char *CommandLine; /* Command Line from ARMsd */ 228 char *CommandLine; /* Command Line from ARMsd */
296 229
297 ARMul_CPInits *CPInit[16]; /* coprocessor initialisers */ 230 ARMul_CPInits *CPInit[16]; /* coprocessor initialisers */
298 ARMul_CPExits *CPExit[16]; /* coprocessor finalisers */ 231 ARMul_CPExits *CPExit[16]; /* coprocessor finalisers */
299 ARMul_LDCs *LDC[16]; /* LDC instruction */ 232 ARMul_LDCs *LDC[16]; /* LDC instruction */
300 ARMul_STCs *STC[16]; /* STC instruction */ 233 ARMul_STCs *STC[16]; /* STC instruction */
301 ARMul_MRCs *MRC[16]; /* MRC instruction */ 234 ARMul_MRCs *MRC[16]; /* MRC instruction */
302 ARMul_MCRs *MCR[16]; /* MCR instruction */ 235 ARMul_MCRs *MCR[16]; /* MCR instruction */
303 ARMul_MRRCs *MRRC[16]; /* MRRC instruction */ 236 ARMul_MRRCs *MRRC[16]; /* MRRC instruction */
304 ARMul_MCRRs *MCRR[16]; /* MCRR instruction */ 237 ARMul_MCRRs *MCRR[16]; /* MCRR instruction */
305 ARMul_CDPs *CDP[16]; /* CDP instruction */ 238 ARMul_CDPs *CDP[16]; /* CDP instruction */
306 ARMul_CPReads *CPRead[16]; /* Read CP register */ 239 ARMul_CPReads *CPRead[16]; /* Read CP register */
307 ARMul_CPWrites *CPWrite[16]; /* Write CP register */ 240 ARMul_CPWrites *CPWrite[16]; /* Write CP register */
308 unsigned char *CPData[16]; /* Coprocessor data */ 241 unsigned char *CPData[16]; /* Coprocessor data */
309 unsigned char const *CPRegWords[16]; /* map of coprocessor register sizes */ 242 unsigned char const *CPRegWords[16]; /* map of coprocessor register sizes */
310 243
311 unsigned EventSet; /* the number of events in the queue */ 244 unsigned EventSet; /* the number of events in the queue */
312 unsigned int Now; /* time to the nearest cycle */ 245 unsigned int Now; /* time to the nearest cycle */
313 struct EventNode **EventPtr; /* the event list */ 246 struct EventNode **EventPtr; /* the event list */
314 247
315 unsigned Debug; /* show instructions as they are executed */ 248 unsigned Debug; /* show instructions as they are executed */
316 unsigned NresetSig; /* reset the processor */ 249 unsigned NresetSig; /* reset the processor */
317 unsigned NfiqSig; 250 unsigned NfiqSig;
318 unsigned NirqSig; 251 unsigned NirqSig;
319 252
@@ -357,12 +290,12 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
357*/ 290*/
358 unsigned lateabtSig; 291 unsigned lateabtSig;
359 292
360 ARMword Vector; /* synthesize aborts in cycle modes */ 293 ARMword Vector; /* synthesize aborts in cycle modes */
361 ARMword Aborted; /* sticky flag for aborts */ 294 ARMword Aborted; /* sticky flag for aborts */
362 ARMword Reseted; /* sticky flag for Reset */ 295 ARMword Reseted; /* sticky flag for Reset */
363 ARMword Inted, LastInted; /* sticky flags for interrupts */ 296 ARMword Inted, LastInted; /* sticky flags for interrupts */
364 ARMword Base; /* extra hand for base writeback */ 297 ARMword Base; /* extra hand for base writeback */
365 ARMword AbortAddr; /* to keep track of Prefetch aborts */ 298 ARMword AbortAddr; /* to keep track of Prefetch aborts */
366 299
367 const struct Dbg_HostosInterface *hostif; 300 const struct Dbg_HostosInterface *hostif;
368 301
@@ -379,7 +312,7 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
379 //chy: 2003-08-11, for different arm core type 312 //chy: 2003-08-11, for different arm core type
380 unsigned is_v4; /* Are we emulating a v4 architecture (or higher) ? */ 313 unsigned is_v4; /* Are we emulating a v4 architecture (or higher) ? */
381 unsigned is_v5; /* Are we emulating a v5 architecture ? */ 314 unsigned is_v5; /* Are we emulating a v5 architecture ? */
382 unsigned is_v5e; /* Are we emulating a v5e architecture ? */ 315 unsigned is_v5e; /* Are we emulating a v5e architecture ? */
383 unsigned is_v6; /* Are we emulating a v6 architecture ? */ 316 unsigned is_v6; /* Are we emulating a v6 architecture ? */
384 unsigned is_v7; /* Are we emulating a v7 architecture ? */ 317 unsigned is_v7; /* Are we emulating a v7 architecture ? */
385 unsigned is_XScale; /* Are we emulating an XScale architecture ? */ 318 unsigned is_XScale; /* Are we emulating an XScale architecture ? */
@@ -388,51 +321,43 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
388 //chy 2005-09-19 321 //chy 2005-09-19
389 unsigned is_pxa27x; /* Are we emulating a Intel PXA27x co-processor ? */ 322 unsigned is_pxa27x; /* Are we emulating a Intel PXA27x co-processor ? */
390 //chy: seems only used in xscale's CP14 323 //chy: seems only used in xscale's CP14
391 unsigned int LastTime; /* Value of last call to ARMul_Time() */ 324 unsigned int LastTime; /* Value of last call to ARMul_Time() */
392 ARMword CP14R0_CCD; /* used to count 64 clock cycles with CP14 R0 bit 3 set */ 325 ARMword CP14R0_CCD; /* used to count 64 clock cycles with CP14 R0 bit 3 set */
393 326
394 327
395//added by ksh:for handle different machs io 2004-3-5 328 //added by ksh:for handle different machs io 2004-3-5
396 ARMul_io mach_io; 329 ARMul_io mach_io;
397 330
398/*added by ksh,2004-11-26,some energy profiling*/ 331 /*added by ksh,2004-11-26,some energy profiling*/
399 ARMul_Energy energy; 332 ARMul_Energy energy;
400 333
401//teawater add for next_dis 2004.10.27----------------------- 334 //teawater add for next_dis 2004.10.27-----------------------
402 int disassemble; 335 int disassemble;
403//AJ2D------------------------------------------
404 336
405//teawater add for arm2x86 2005.02.15------------------------------------------- 337
338 //teawater add for arm2x86 2005.02.15-------------------------------------------
406 u32 trap; 339 u32 trap;
407 u32 tea_break_addr; 340 u32 tea_break_addr;
408 u32 tea_break_ok; 341 u32 tea_break_ok;
409 int tea_pc; 342 int tea_pc;
410//AJ2D--------------------------------------------------------------------------
411//teawater add for arm2x86 2005.07.03-------------------------------------------
412
413 /*
414 * 2007-01-24 removed the term-io functions by Anthony Lee,
415 * moved to "device/uart/skyeye_uart_stdio.c".
416 */
417 343
418//AJ2D-------------------------------------------------------------------------- 344 //teawater add for arm2x86 2005.07.05-------------------------------------------
419//teawater add for arm2x86 2005.07.05-------------------------------------------
420 //arm_arm A2-18 345 //arm_arm A2-18
421 int abort_model; //0 Base Restored Abort Model, 1 the Early Abort Model, 2 Base Updated Abort Model 346 int abort_model; //0 Base Restored Abort Model, 1 the Early Abort Model, 2 Base Updated Abort Model
422//AJ2D-------------------------------------------------------------------------- 347
423//teawater change for return if running tb dirty 2005.07.09--------------------- 348 //teawater change for return if running tb dirty 2005.07.09---------------------
424 void *tb_now; 349 void *tb_now;
425//AJ2D--------------------------------------------------------------------------
426 350
427//teawater add for record reg value to ./reg.txt 2005.07.10--------------------- 351
352 //teawater add for record reg value to ./reg.txt 2005.07.10---------------------
428 FILE *tea_reg_fd; 353 FILE *tea_reg_fd;
429//AJ2D--------------------------------------------------------------------------
430 354
431/*added by ksh in 2005-10-1*/ 355
356 /*added by ksh in 2005-10-1*/
432 cpu_config_t *cpu; 357 cpu_config_t *cpu;
433 //mem_config_t *mem_bank; 358 //mem_config_t *mem_bank;
434 359
435/* added LPC remap function */ 360 /* added LPC remap function */
436 int vector_remap_flag; 361 int vector_remap_flag;
437 u32 vector_remap_addr; 362 u32 vector_remap_addr;
438 u32 vector_remap_size; 363 u32 vector_remap_size;
@@ -487,17 +412,14 @@ typedef ARMul_State arm_core_t;
487#define ARM_Debug_Prop 0x10 412#define ARM_Debug_Prop 0x10
488#define ARM_Isync_Prop ARM_Debug_Prop 413#define ARM_Isync_Prop ARM_Debug_Prop
489#define ARM_Lock_Prop 0x20 414#define ARM_Lock_Prop 0x20
490//chy 2003-08-11
491#define ARM_v4_Prop 0x40 415#define ARM_v4_Prop 0x40
492#define ARM_v5_Prop 0x80 416#define ARM_v5_Prop 0x80
493/*jeff.du 2010-08-05 */
494#define ARM_v6_Prop 0xc0 417#define ARM_v6_Prop 0xc0
495 418
496#define ARM_v5e_Prop 0x100 419#define ARM_v5e_Prop 0x100
497#define ARM_XScale_Prop 0x200 420#define ARM_XScale_Prop 0x200
498#define ARM_ep9312_Prop 0x400 421#define ARM_ep9312_Prop 0x400
499#define ARM_iWMMXt_Prop 0x800 422#define ARM_iWMMXt_Prop 0x800
500//chy 2005-09-19
501#define ARM_PXA27X_Prop 0x1000 423#define ARM_PXA27X_Prop 0x1000
502#define ARM_v7_Prop 0x2000 424#define ARM_v7_Prop 0x2000
503 425
@@ -592,47 +514,44 @@ typedef ARMul_State arm_core_t;
592#ifdef __cplusplus 514#ifdef __cplusplus
593extern "C" { 515extern "C" {
594#endif 516#endif
595extern void ARMul_EmulateInit (void); 517extern void ARMul_EmulateInit();
596extern void ARMul_Reset (ARMul_State * state); 518extern void ARMul_Reset(ARMul_State* state);
597#ifdef __cplusplus 519#ifdef __cplusplus
598 } 520 }
599#endif 521#endif
600extern ARMul_State *ARMul_NewState (ARMul_State * state); 522extern ARMul_State *ARMul_NewState(ARMul_State* state);
601extern ARMword ARMul_DoProg (ARMul_State * state); 523extern ARMword ARMul_DoProg(ARMul_State* state);
602extern ARMword ARMul_DoInstr (ARMul_State * state); 524extern ARMword ARMul_DoInstr(ARMul_State* state);
603/***************************************************************************\ 525/***************************************************************************\
604* Definitons of things for event handling * 526* Definitons of things for event handling *
605\***************************************************************************/ 527\***************************************************************************/
606 528
607extern void ARMul_ScheduleEvent (ARMul_State * state, unsigned int delay, 529extern void ARMul_ScheduleEvent(ARMul_State* state, unsigned int delay, unsigned(*func) ());
608 unsigned (*func) ()); 530extern void ARMul_EnvokeEvent(ARMul_State* state);
609extern void ARMul_EnvokeEvent (ARMul_State * state); 531extern unsigned int ARMul_Time(ARMul_State* state);
610extern unsigned int ARMul_Time (ARMul_State * state);
611 532
612/***************************************************************************\ 533/***************************************************************************\
613* Useful support routines * 534* Useful support routines *
614\***************************************************************************/ 535\***************************************************************************/
615 536
616extern ARMword ARMul_GetReg (ARMul_State * state, unsigned mode, 537extern ARMword ARMul_GetReg (ARMul_State* state, unsigned mode, unsigned reg);
617 unsigned reg); 538extern void ARMul_SetReg (ARMul_State* state, unsigned mode, unsigned reg, ARMword value);
618extern void ARMul_SetReg (ARMul_State * state, unsigned mode, unsigned reg, 539extern ARMword ARMul_GetPC(ARMul_State* state);
619 ARMword value); 540extern ARMword ARMul_GetNextPC(ARMul_State* state);
620extern ARMword ARMul_GetPC (ARMul_State * state); 541extern void ARMul_SetPC(ARMul_State* state, ARMword value);
621extern ARMword ARMul_GetNextPC (ARMul_State * state); 542extern ARMword ARMul_GetR15(ARMul_State* state);
622extern void ARMul_SetPC (ARMul_State * state, ARMword value); 543extern void ARMul_SetR15(ARMul_State* state, ARMword value);
623extern ARMword ARMul_GetR15 (ARMul_State * state); 544
624extern void ARMul_SetR15 (ARMul_State * state, ARMword value); 545extern ARMword ARMul_GetCPSR(ARMul_State* state);
625 546extern void ARMul_SetCPSR(ARMul_State* state, ARMword value);
626extern ARMword ARMul_GetCPSR (ARMul_State * state); 547extern ARMword ARMul_GetSPSR(ARMul_State* state, ARMword mode);
627extern void ARMul_SetCPSR (ARMul_State * state, ARMword value); 548extern void ARMul_SetSPSR(ARMul_State* state, ARMword mode, ARMword value);
628extern ARMword ARMul_GetSPSR (ARMul_State * state, ARMword mode);
629extern void ARMul_SetSPSR (ARMul_State * state, ARMword mode, ARMword value);
630 549
631/***************************************************************************\ 550/***************************************************************************\
632* Definitons of things to handle aborts * 551* Definitons of things to handle aborts *
633\***************************************************************************/ 552\***************************************************************************/
634 553
635extern void ARMul_Abort (ARMul_State * state, ARMword address); 554extern void ARMul_Abort(ARMul_State* state, ARMword address);
636#ifdef MODET 555#ifdef MODET
637#define ARMul_ABORTWORD (state->TFlag ? 0xefffdfff : 0xefffffff) /* SWI -1 */ 556#define ARMul_ABORTWORD (state->TFlag ? 0xefffdfff : 0xefffffff) /* SWI -1 */
638#define ARMul_PREFETCHABORT(address) if (state->AbortAddr == 1) \ 557#define ARMul_PREFETCHABORT(address) if (state->AbortAddr == 1) \
@@ -650,54 +569,40 @@ extern void ARMul_Abort (ARMul_State * state, ARMword address);
650* Definitons of things in the memory interface * 569* Definitons of things in the memory interface *
651\***************************************************************************/ 570\***************************************************************************/
652 571
653extern unsigned ARMul_MemoryInit (ARMul_State * state, 572extern unsigned ARMul_MemoryInit(ARMul_State* state, unsigned int initmemsize);
654 unsigned int initmemsize); 573extern void ARMul_MemoryExit(ARMul_State* state);
655extern void ARMul_MemoryExit (ARMul_State * state);
656 574
657extern ARMword ARMul_LoadInstrS (ARMul_State * state, ARMword address, 575extern ARMword ARMul_LoadInstrS(ARMul_State* state, ARMword address, ARMword isize);
658 ARMword isize); 576extern ARMword ARMul_LoadInstrN(ARMul_State* state, ARMword address, ARMword isize);
659extern ARMword ARMul_LoadInstrN (ARMul_State * state, ARMword address,
660 ARMword isize);
661#ifdef __cplusplus 577#ifdef __cplusplus
662extern "C" { 578extern "C" {
663#endif 579#endif
664extern ARMword ARMul_ReLoadInstr (ARMul_State * state, ARMword address, 580extern ARMword ARMul_ReLoadInstr(ARMul_State* state, ARMword address, ARMword isize);
665 ARMword isize);
666#ifdef __cplusplus 581#ifdef __cplusplus
667 } 582 }
668#endif 583#endif
669extern ARMword ARMul_LoadWordS (ARMul_State * state, ARMword address); 584extern ARMword ARMul_LoadWordS(ARMul_State* state, ARMword address);
670extern ARMword ARMul_LoadWordN (ARMul_State * state, ARMword address); 585extern ARMword ARMul_LoadWordN(ARMul_State* state, ARMword address);
671extern ARMword ARMul_LoadHalfWord (ARMul_State * state, ARMword address); 586extern ARMword ARMul_LoadHalfWord(ARMul_State* state, ARMword address);
672extern ARMword ARMul_LoadByte (ARMul_State * state, ARMword address); 587extern ARMword ARMul_LoadByte(ARMul_State* state, ARMword address);
673 588
674extern void ARMul_StoreWordS (ARMul_State * state, ARMword address, 589extern void ARMul_StoreWordS(ARMul_State* state, ARMword address, ARMword data);
675 ARMword data); 590extern void ARMul_StoreWordN(ARMul_State* state, ARMword address, ARMword data);
676extern void ARMul_StoreWordN (ARMul_State * state, ARMword address, 591extern void ARMul_StoreHalfWord(ARMul_State* state, ARMword address, ARMword data);
677 ARMword data); 592extern void ARMul_StoreByte(ARMul_State* state, ARMword address, ARMword data);
678extern void ARMul_StoreHalfWord (ARMul_State * state, ARMword address, 593
679 ARMword data); 594extern ARMword ARMul_SwapWord(ARMul_State* state, ARMword address, ARMword data);
680extern void ARMul_StoreByte (ARMul_State * state, ARMword address, 595extern ARMword ARMul_SwapByte(ARMul_State* state, ARMword address, ARMword data);
681 ARMword data); 596
682 597extern void ARMul_Icycles(ARMul_State* state, unsigned number, ARMword address);
683extern ARMword ARMul_SwapWord (ARMul_State * state, ARMword address, 598extern void ARMul_Ccycles(ARMul_State* state, unsigned number, ARMword address);
684 ARMword data); 599
685extern ARMword ARMul_SwapByte (ARMul_State * state, ARMword address, 600extern ARMword ARMul_ReadWord(ARMul_State* state, ARMword address);
686 ARMword data); 601extern ARMword ARMul_ReadByte(ARMul_State* state, ARMword address);
687 602extern void ARMul_WriteWord(ARMul_State* state, ARMword address, ARMword data);
688extern void ARMul_Icycles (ARMul_State * state, unsigned number, 603extern void ARMul_WriteByte(ARMul_State* state, ARMword address, ARMword data);
689 ARMword address); 604
690extern void ARMul_Ccycles (ARMul_State * state, unsigned number, 605extern ARMword ARMul_MemAccess(ARMul_State* state, ARMword, ARMword,
691 ARMword address);
692
693extern ARMword ARMul_ReadWord (ARMul_State * state, ARMword address);
694extern ARMword ARMul_ReadByte (ARMul_State * state, ARMword address);
695extern void ARMul_WriteWord (ARMul_State * state, ARMword address,
696 ARMword data);
697extern void ARMul_WriteByte (ARMul_State * state, ARMword address,
698 ARMword data);
699
700extern ARMword ARMul_MemAccess (ARMul_State * state, ARMword, ARMword,
701 ARMword, ARMword, ARMword, ARMword, ARMword, 606 ARMword, ARMword, ARMword, ARMword, ARMword,
702 ARMword, ARMword, ARMword); 607 ARMword, ARMword, ARMword);
703 608
@@ -740,66 +645,40 @@ extern ARMword ARMul_MemAccess (ARMul_State * state, ARMword, ARMword,
740#define ARMul_CP15_DBCON_E1 0x000c 645#define ARMul_CP15_DBCON_E1 0x000c
741#define ARMul_CP15_DBCON_E0 0x0003 646#define ARMul_CP15_DBCON_E0 0x0003
742 647
743extern unsigned ARMul_CoProInit (ARMul_State * state); 648extern unsigned ARMul_CoProInit(ARMul_State* state);
744extern void ARMul_CoProExit (ARMul_State * state); 649extern void ARMul_CoProExit(ARMul_State* state);
745extern void ARMul_CoProAttach (ARMul_State * state, unsigned number, 650extern void ARMul_CoProAttach (ARMul_State* state, unsigned number,
746 ARMul_CPInits * init, ARMul_CPExits * exit, 651 ARMul_CPInits* init, ARMul_CPExits* exit,
747 ARMul_LDCs * ldc, ARMul_STCs * stc, 652 ARMul_LDCs* ldc, ARMul_STCs* stc,
748 ARMul_MRCs * mrc, ARMul_MCRs * mcr, 653 ARMul_MRCs* mrc, ARMul_MCRs* mcr,
749 ARMul_MRRCs * mrrc, ARMul_MCRRs * mcrr, 654 ARMul_MRRCs* mrrc, ARMul_MCRRs* mcrr,
750 ARMul_CDPs * cdp, 655 ARMul_CDPs* cdp,
751 ARMul_CPReads * read, ARMul_CPWrites * write); 656 ARMul_CPReads* read, ARMul_CPWrites* write);
752extern void ARMul_CoProDetach (ARMul_State * state, unsigned number); 657extern void ARMul_CoProDetach(ARMul_State* state, unsigned number);
753 658
754/***************************************************************************\ 659/***************************************************************************\
755* Definitons of things in the host environment * 660* Definitons of things in the host environment *
756\***************************************************************************/ 661\***************************************************************************/
757 662
758extern unsigned ARMul_OSInit (ARMul_State * state); 663extern unsigned ARMul_OSInit(ARMul_State* state);
759extern void ARMul_OSExit (ARMul_State * state); 664extern void ARMul_OSExit(ARMul_State* state);
760 665
761#ifdef __cplusplus 666#ifdef __cplusplus
762 extern "C" { 667 extern "C" {
763#endif 668#endif
764 669
765extern unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number); 670extern unsigned ARMul_OSHandleSWI(ARMul_State* state, ARMword number);
766#ifdef __cplusplus 671#ifdef __cplusplus
767} 672}
768#endif 673#endif
769 674
770 675
771extern ARMword ARMul_OSLastErrorP (ARMul_State * state); 676extern ARMword ARMul_OSLastErrorP(ARMul_State* state);
772 677
773extern ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr); 678extern ARMword ARMul_Debug(ARMul_State* state, ARMword pc, ARMword instr);
774extern unsigned ARMul_OSException (ARMul_State * state, ARMword vector, 679extern unsigned ARMul_OSException(ARMul_State* state, ARMword vector, ARMword pc);
775 ARMword pc);
776extern int rdi_log; 680extern int rdi_log;
777 681
778/***************************************************************************\
779* Host-dependent stuff *
780\***************************************************************************/
781
782#ifdef macintosh
783pascal void SpinCursor (short increment); /* copied from CursorCtl.h */
784# define HOURGLASS SpinCursor( 1 )
785# define HOURGLASS_RATE 1023 /* 2^n - 1 */
786#endif
787
788//teawater add for arm2x86 2005.02.14-------------------------------------------
789/*ywc 2005-03-31*/
790/*
791#include "arm2x86.h"
792#include "arm2x86_dp.h"
793#include "arm2x86_movl.h"
794#include "arm2x86_psr.h"
795#include "arm2x86_shift.h"
796#include "arm2x86_mem.h"
797#include "arm2x86_mul.h"
798#include "arm2x86_test.h"
799#include "arm2x86_other.h"
800#include "list.h"
801#include "tb.h"
802*/
803enum ConditionCode { 682enum ConditionCode {
804 EQ = 0, 683 EQ = 0,
805 NE = 1, 684 NE = 1,
@@ -852,32 +731,16 @@ enum ConditionCode {
852#define ZBIT_SHIFT 30 731#define ZBIT_SHIFT 30
853#define CBIT_SHIFT 29 732#define CBIT_SHIFT 29
854#define VBIT_SHIFT 28 733#define VBIT_SHIFT 28
855#ifdef DBCT 734
856//teawater change for local tb branch directly jump 2005.10.18------------------
857#include "dbct/list.h"
858#include "dbct/arm2x86.h"
859#include "dbct/arm2x86_dp.h"
860#include "dbct/arm2x86_movl.h"
861#include "dbct/arm2x86_psr.h"
862#include "dbct/arm2x86_shift.h"
863#include "dbct/arm2x86_mem.h"
864#include "dbct/arm2x86_mul.h"
865#include "dbct/arm2x86_test.h"
866#include "dbct/arm2x86_other.h"
867#include "dbct/arm2x86_coproc.h"
868#include "dbct/tb.h"
869#endif
870//AJ2D--------------------------------------------------------------------------
871//AJ2D--------------------------------------------------------------------------
872#define SKYEYE_OUTREGS(fd) { fprintf ((fd), "R %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,C %x,S %x,%x,%x,%x,%x,%x,%x,M %x,B %x,E %x,I %x,P %x,T %x,L %x,D %x,",\ 735#define SKYEYE_OUTREGS(fd) { fprintf ((fd), "R %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,C %x,S %x,%x,%x,%x,%x,%x,%x,M %x,B %x,E %x,I %x,P %x,T %x,L %x,D %x,",\
873 state->Reg[0],state->Reg[1],state->Reg[2],state->Reg[3], \ 736 state->Reg[0],state->Reg[1],state->Reg[2],state->Reg[3], \
874 state->Reg[4],state->Reg[5],state->Reg[6],state->Reg[7], \ 737 state->Reg[4],state->Reg[5],state->Reg[6],state->Reg[7], \
875 state->Reg[8],state->Reg[9],state->Reg[10],state->Reg[11], \ 738 state->Reg[8],state->Reg[9],state->Reg[10],state->Reg[11], \
876 state->Reg[12],state->Reg[13],state->Reg[14],state->Reg[15], \ 739 state->Reg[12],state->Reg[13],state->Reg[14],state->Reg[15], \
877 state->Cpsr, state->Spsr[0], state->Spsr[1], state->Spsr[2],\ 740 state->Cpsr, state->Spsr[0], state->Spsr[1], state->Spsr[2],\
878 state->Spsr[3],state->Spsr[4], state->Spsr[5], state->Spsr[6],\ 741 state->Spsr[3],state->Spsr[4], state->Spsr[5], state->Spsr[6],\
879 state->Mode,state->Bank,state->ErrorCode,state->instr,state->pc,\ 742 state->Mode,state->Bank,state->ErrorCode,state->instr,state->pc,\
880 state->temp,state->loaded,state->decoded);} 743 state->temp,state->loaded,state->decoded);}
881 744
882#define SKYEYE_OUTMOREREGS(fd) { fprintf ((fd),"\ 745#define SKYEYE_OUTMOREREGS(fd) { fprintf ((fd),"\
883RUs %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\ 746RUs %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\
@@ -915,17 +778,17 @@ RUn %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",\
915 778
916#define SA1110 0x6901b110 779#define SA1110 0x6901b110
917#define SA1100 0x4401a100 780#define SA1100 0x4401a100
918#define PXA250 0x69052100 781#define PXA250 0x69052100
919#define PXA270 0x69054110 782#define PXA270 0x69054110
920//#define PXA250 0x69052903 783//#define PXA250 0x69052903
921// 0x69052903; //PXA250 B1 from intel 278522-001.pdf 784// 0x69052903; //PXA250 B1 from intel 278522-001.pdf
922 785
923 786
924extern void ARMul_UndefInstr (ARMul_State *, ARMword); 787extern void ARMul_UndefInstr(ARMul_State*, ARMword);
925extern void ARMul_FixCPSR (ARMul_State *, ARMword, ARMword); 788extern void ARMul_FixCPSR(ARMul_State*, ARMword, ARMword);
926extern void ARMul_FixSPSR (ARMul_State *, ARMword, ARMword); 789extern void ARMul_FixSPSR(ARMul_State*, ARMword, ARMword);
927extern void ARMul_ConsolePrint (ARMul_State *, const char *, ...); 790extern void ARMul_ConsolePrint(ARMul_State*, const char*, ...);
928extern void ARMul_SelectProcessor (ARMul_State *, unsigned); 791extern void ARMul_SelectProcessor(ARMul_State*, unsigned);
929 792
930#define DIFF_LOG 0 793#define DIFF_LOG 0
931#define SAVE_LOG 0 794#define SAVE_LOG 0