yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Clean up armdefs.h

This commit is contained in:
Lioncash 2014-12-13 20:23:32 -05:00
parent 9ce11b2d92
commit f6cb8c1927
1 changed files with 162 additions and 299 deletions

View File

@ -18,38 +18,26 @@
#ifndef _ARMDEFS_H_ #ifndef _ARMDEFS_H_
#define _ARMDEFS_H_ #define _ARMDEFS_H_
#include <stdio.h> #include <cerrno>
#include <stdlib.h> #include <csignal>
#include <errno.h> #include <cstdio>
#include <cstdlib>
#include "common/platform.h" #include <cstring>
#include <fcntl.h>
//teawater add for arm2x86 2005.02.14------------------------------------------- #include <sys/stat.h>
// koodailar remove it for mingw 2005.12.18---------------- #include <sys/types.h>
//anthonylee modify it for portable 2007.01.30
//#include "portable/mman.h"
#include "arm_regformat.h" #include "arm_regformat.h"
#include "common/common_types.h"
#include "common/platform.h" #include "common/platform.h"
#include "core/arm/skyeye_common/armmmu.h"
#include "core/arm/skyeye_common/skyeye_defs.h" #include "core/arm/skyeye_common/skyeye_defs.h"
//AJ2D--------------------------------------------------------------------------
//teawater add for arm2x86 2005.07.03-------------------------------------------
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if EMU_PLATFORM == PLATFORM_LINUX #if EMU_PLATFORM == PLATFORM_LINUX
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
//#include <memory_space.h>
//AJ2D--------------------------------------------------------------------------
#if 0 #if 0
#if 0 #if 0
#define DIFF_STATE 1 #define DIFF_STATE 1
@ -70,25 +58,8 @@
#define LOWHIGH 1 #define LOWHIGH 1
#define HIGHLOW 2 #define HIGHLOW 2
//teawater add DBCT_TEST_SPEED 2005.10.04---------------------------------------
#include <signal.h>
#include "common/platform.h"
#if EMU_PLATFORM == PLATFORM_LINUX
#include <sys/time.h>
#endif
//#define DBCT_TEST_SPEED //#define DBCT_TEST_SPEED
#define DBCT_TEST_SPEED_SEC 10 #define DBCT_TEST_SPEED_SEC 10
//AJ2D--------------------------------------------------------------------------
//teawater add compile switch for DBCT GDB RSP function 2005.10.21--------------
//#define DBCT_GDBRSP
//AJ2D--------------------------------------------------------------------------
//#include <skyeye_defs.h>
//#include <skyeye_types.h>
#define ARM_BYTE_TYPE 0 #define ARM_BYTE_TYPE 0
#define ARM_HALFWORD_TYPE 1 #define ARM_HALFWORD_TYPE 1
@ -103,71 +74,34 @@
typedef char *VoidStar; typedef char *VoidStar;
#endif #endif
typedef unsigned long long ARMdword; /* must be 64 bits wide */ typedef u64 ARMdword; // must be 64 bits wide
typedef unsigned int ARMword; /* must be 32 bits wide */ typedef u32 ARMword; // must be 32 bits wide
typedef unsigned char ARMbyte; /* must be 8 bits wide */ typedef u16 ARMhword; // must be 16 bits wide
typedef unsigned short ARMhword; /* must be 16 bits wide */ typedef u8 ARMbyte; // must be 8 bits wide
typedef struct ARMul_State ARMul_State; typedef struct ARMul_State ARMul_State;
typedef struct ARMul_io ARMul_io; typedef struct ARMul_io ARMul_io;
typedef struct ARMul_Energy ARMul_Energy; typedef struct ARMul_Energy ARMul_Energy;
//teawater add for arm2x86 2005.06.24-------------------------------------------
#include <stdint.h>
//AJ2D--------------------------------------------------------------------------
/*
//chy 2005-05-11
#ifndef __CYGWIN__
//teawater add for arm2x86 2005.02.14-------------------------------------------
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int u32;
#if defined (__x86_64__)
typedef unsigned long uint64_t;
#else
typedef unsigned long long uint64_t;
#endif
////AJ2D--------------------------------------------------------------------------
#endif
*/
#include "core/arm/skyeye_common/armmmu.h" typedef unsigned ARMul_CPInits(ARMul_State* state);
//#include "lcd/skyeye_lcd.h" typedef unsigned ARMul_CPExits(ARMul_State* state);
typedef unsigned ARMul_LDCs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
typedef unsigned ARMul_STCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
//#include "skyeye.h" typedef unsigned ARMul_MRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
//#include "skyeye_device.h" typedef unsigned ARMul_MCRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
//#include "net/skyeye_net.h" typedef unsigned ARMul_MRRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value1, ARMword* value2);
//#include "skyeye_config.h" typedef unsigned ARMul_MCRRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value1, ARMword value2);
typedef unsigned ARMul_CDPs(ARMul_State* state, unsigned type, ARMword instr);
typedef unsigned ARMul_CPReads(ARMul_State* state, unsigned reg, ARMword* value);
typedef unsigned ARMul_CPInits (ARMul_State * state); typedef unsigned ARMul_CPWrites(ARMul_State* state, unsigned reg, ARMword value);
typedef unsigned ARMul_CPExits (ARMul_State * state);
typedef unsigned ARMul_LDCs (ARMul_State * state, unsigned type,
ARMword instr, ARMword value);
typedef unsigned ARMul_STCs (ARMul_State * state, unsigned type,
ARMword instr, ARMword * value);
typedef unsigned ARMul_MRCs (ARMul_State * state, unsigned type,
ARMword instr, ARMword * value);
typedef unsigned ARMul_MCRs (ARMul_State * state, unsigned type,
ARMword instr, ARMword value);
typedef unsigned ARMul_MRRCs (ARMul_State * state, unsigned type,
ARMword instr, ARMword * value1, ARMword * value2);
typedef unsigned ARMul_MCRRs (ARMul_State * state, unsigned type,
ARMword instr, ARMword value1, ARMword value2);
typedef unsigned ARMul_CDPs (ARMul_State * state, unsigned type,
ARMword instr);
typedef unsigned ARMul_CPReads (ARMul_State * state, unsigned reg,
ARMword * value);
typedef unsigned ARMul_CPWrites (ARMul_State * state, unsigned reg,
ARMword value);
//added by ksh,2004-3-5 //added by ksh,2004-3-5
struct ARMul_io struct ARMul_io
{ {
ARMword *instr; //to display the current interrupt state ARMword *instr; // to display the current interrupt state
ARMword *net_flag; //to judge if network is enabled ARMword *net_flag; // to judge if network is enabled
ARMword *net_int; //netcard interrupt ARMword *net_int; // netcard interrupt
//ywc,2004-04-01 //ywc,2004-04-01
ARMword *ts_int; ARMword *ts_int;
@ -180,17 +114,17 @@ struct ARMul_io
/* added by ksh,2004-11-26,some energy profiling */ /* added by ksh,2004-11-26,some energy profiling */
struct ARMul_Energy struct ARMul_Energy
{ {
int energy_prof; /* <tktan> BUG200103282109 : for energy profiling */ int energy_prof; /* <tktan> BUG200103282109 : for energy profiling */
int enable_func_energy; /* <tktan> BUG200105181702 */ int enable_func_energy; /* <tktan> BUG200105181702 */
char *func_energy; char *func_energy;
int func_display; /* <tktan> BUG200103311509 : for function call display */ int func_display; /* <tktan> BUG200103311509 : for function call display */
int func_disp_start; /* <tktan> BUG200104191428 : to start func profiling */ int func_disp_start; /* <tktan> BUG200104191428 : to start func profiling */
char *start_func; /* <tktan> BUG200104191428 */ char *start_func; /* <tktan> BUG200104191428 */
FILE *outfile; /* <tktan> BUG200105201531 : direct console to file */ FILE *outfile; /* <tktan> BUG200105201531 : direct console to file */
long long tcycle, pcycle; long long tcycle, pcycle;
float t_energy; float t_energy;
void *cur_task; /* <tktan> BUG200103291737 */ void *cur_task; /* <tktan> BUG200103291737 */
long long t_mem_cycle, t_idle_cycle, t_uart_cycle; long long t_mem_cycle, t_idle_cycle, t_uart_cycle;
long long p_mem_cycle, p_idle_cycle, p_uart_cycle; long long p_mem_cycle, p_idle_cycle, p_uart_cycle;
long long p_io_update_tcycle; long long p_io_update_tcycle;
@ -203,13 +137,12 @@ struct ARMul_Energy
typedef struct mem_bank typedef struct mem_bank
{ {
ARMword (*read_byte) (ARMul_State * state, ARMword addr); ARMword (*read_byte) (ARMul_State* state, ARMword addr);
void (*write_byte) (ARMul_State * state, ARMword addr, ARMword data); void (*write_byte) (ARMul_State* state, ARMword addr, ARMword data);
ARMword (*read_halfword) (ARMul_State * state, ARMword addr); ARMword (*read_halfword) (ARMul_State* state, ARMword addr);
void (*write_halfword) (ARMul_State * state, ARMword addr, void (*write_halfword) (ARMul_State* state, ARMword addr, ARMword data);
ARMword data); ARMword (*read_word) (ARMul_State* state, ARMword addr);
ARMword (*read_word) (ARMul_State * state, ARMword addr); void (*write_word) (ARMul_State* state, ARMword addr, ARMword data);
void (*write_word) (ARMul_State * state, ARMword addr, ARMword data);
unsigned int addr, len; unsigned int addr, len;
char filename[MAX_STR]; char filename[MAX_STR];
unsigned type; //chy 2003-09-21: maybe io,ram,rom unsigned type; //chy 2003-09-21: maybe io,ram,rom
@ -224,24 +157,24 @@ typedef struct
#define VFP_REG_NUM 64 #define VFP_REG_NUM 64
struct ARMul_State struct ARMul_State
{ {
ARMword Emulate; /* to start and stop emulation */ ARMword Emulate; /* to start and stop emulation */
unsigned EndCondition; /* reason for stopping */ unsigned EndCondition; /* reason for stopping */
unsigned ErrorCode; /* type of illegal instruction */ unsigned ErrorCode; /* type of illegal instruction */
/* Order of the following register should not be modified */ /* Order of the following register should not be modified */
ARMword Reg[16]; /* the current register file */ ARMword Reg[16]; /* the current register file */
ARMword Cpsr; /* the current psr */ ARMword Cpsr; /* the current psr */
ARMword Spsr_copy; ARMword Spsr_copy;
ARMword phys_pc; ARMword phys_pc;
ARMword Reg_usr[2]; ARMword Reg_usr[2];
ARMword Reg_svc[2]; /* R13_SVC R14_SVC */ ARMword Reg_svc[2]; /* R13_SVC R14_SVC */
ARMword Reg_abort[2]; /* R13_ABORT R14_ABORT */ ARMword Reg_abort[2]; /* R13_ABORT R14_ABORT */
ARMword Reg_undef[2]; /* R13 UNDEF R14 UNDEF */ ARMword Reg_undef[2]; /* R13 UNDEF R14 UNDEF */
ARMword Reg_irq[2]; /* R13_IRQ R14_IRQ */ ARMword Reg_irq[2]; /* R13_IRQ R14_IRQ */
ARMword Reg_firq[7]; /* R8---R14 FIRQ */ ARMword Reg_firq[7]; /* R8---R14 FIRQ */
ARMword Spsr[7]; /* the exception psr's */ ARMword Spsr[7]; /* the exception psr's */
ARMword Mode; /* the current mode */ ARMword Mode; /* the current mode */
ARMword Bank; /* the current register bank */ ARMword Bank; /* the current register bank */
ARMword exclusive_tag; ARMword exclusive_tag;
ARMword exclusive_state; ARMword exclusive_state;
ARMword exclusive_result; ARMword exclusive_result;
@ -284,35 +217,35 @@ struct ARMul_State
ARMword servaddr; ARMword servaddr;
unsigned NextInstr; unsigned NextInstr;
unsigned VectorCatch; /* caught exception mask */ unsigned VectorCatch; /* caught exception mask */
unsigned CallDebug; /* set to call the debugger */ unsigned CallDebug; /* set to call the debugger */
unsigned CanWatch; /* set by memory interface if its willing to suffer the unsigned CanWatch; /* set by memory interface if its willing to suffer the
overhead of checking for watchpoints on each memory overhead of checking for watchpoints on each memory
access */ access */
unsigned int StopHandle; unsigned int StopHandle;
char *CommandLine; /* Command Line from ARMsd */ char *CommandLine; /* Command Line from ARMsd */
ARMul_CPInits *CPInit[16]; /* coprocessor initialisers */ ARMul_CPInits *CPInit[16]; /* coprocessor initialisers */
ARMul_CPExits *CPExit[16]; /* coprocessor finalisers */ ARMul_CPExits *CPExit[16]; /* coprocessor finalisers */
ARMul_LDCs *LDC[16]; /* LDC instruction */ ARMul_LDCs *LDC[16]; /* LDC instruction */
ARMul_STCs *STC[16]; /* STC instruction */ ARMul_STCs *STC[16]; /* STC instruction */
ARMul_MRCs *MRC[16]; /* MRC instruction */ ARMul_MRCs *MRC[16]; /* MRC instruction */
ARMul_MCRs *MCR[16]; /* MCR instruction */ ARMul_MCRs *MCR[16]; /* MCR instruction */
ARMul_MRRCs *MRRC[16]; /* MRRC instruction */ ARMul_MRRCs *MRRC[16]; /* MRRC instruction */
ARMul_MCRRs *MCRR[16]; /* MCRR instruction */ ARMul_MCRRs *MCRR[16]; /* MCRR instruction */
ARMul_CDPs *CDP[16]; /* CDP instruction */ ARMul_CDPs *CDP[16]; /* CDP instruction */
ARMul_CPReads *CPRead[16]; /* Read CP register */ ARMul_CPReads *CPRead[16]; /* Read CP register */
ARMul_CPWrites *CPWrite[16]; /* Write CP register */ ARMul_CPWrites *CPWrite[16]; /* Write CP register */
unsigned char *CPData[16]; /* Coprocessor data */ unsigned char *CPData[16]; /* Coprocessor data */
unsigned char const *CPRegWords[16]; /* map of coprocessor register sizes */ unsigned char const *CPRegWords[16]; /* map of coprocessor register sizes */
unsigned EventSet; /* the number of events in the queue */ unsigned EventSet; /* the number of events in the queue */
unsigned int Now; /* time to the nearest cycle */ unsigned int Now; /* time to the nearest cycle */
struct EventNode **EventPtr; /* the event list */ struct EventNode **EventPtr; /* the event list */
unsigned Debug; /* show instructions as they are executed */ unsigned Debug; /* show instructions as they are executed */
unsigned NresetSig; /* reset the processor */ unsigned NresetSig; /* reset the processor */
unsigned NfiqSig; unsigned NfiqSig;
unsigned NirqSig; unsigned NirqSig;
@ -356,12 +289,12 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
*/ */
unsigned lateabtSig; unsigned lateabtSig;
ARMword Vector; /* synthesize aborts in cycle modes */ ARMword Vector; /* synthesize aborts in cycle modes */
ARMword Aborted; /* sticky flag for aborts */ ARMword Aborted; /* sticky flag for aborts */
ARMword Reseted; /* sticky flag for Reset */ ARMword Reseted; /* sticky flag for Reset */
ARMword Inted, LastInted; /* sticky flags for interrupts */ ARMword Inted, LastInted; /* sticky flags for interrupts */
ARMword Base; /* extra hand for base writeback */ ARMword Base; /* extra hand for base writeback */
ARMword AbortAddr; /* to keep track of Prefetch aborts */ ARMword AbortAddr; /* to keep track of Prefetch aborts */
const struct Dbg_HostosInterface *hostif; const struct Dbg_HostosInterface *hostif;
@ -378,7 +311,7 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
//chy: 2003-08-11, for different arm core type //chy: 2003-08-11, for different arm core type
unsigned is_v4; /* Are we emulating a v4 architecture (or higher) ? */ unsigned is_v4; /* Are we emulating a v4 architecture (or higher) ? */
unsigned is_v5; /* Are we emulating a v5 architecture ? */ unsigned is_v5; /* Are we emulating a v5 architecture ? */
unsigned is_v5e; /* Are we emulating a v5e architecture ? */ unsigned is_v5e; /* Are we emulating a v5e architecture ? */
unsigned is_v6; /* Are we emulating a v6 architecture ? */ unsigned is_v6; /* Are we emulating a v6 architecture ? */
unsigned is_v7; /* Are we emulating a v7 architecture ? */ unsigned is_v7; /* Are we emulating a v7 architecture ? */
unsigned is_XScale; /* Are we emulating an XScale architecture ? */ unsigned is_XScale; /* Are we emulating an XScale architecture ? */
@ -387,51 +320,43 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
//chy 2005-09-19 //chy 2005-09-19
unsigned is_pxa27x; /* Are we emulating a Intel PXA27x co-processor ? */ unsigned is_pxa27x; /* Are we emulating a Intel PXA27x co-processor ? */
//chy: seems only used in xscale's CP14 //chy: seems only used in xscale's CP14
unsigned int LastTime; /* Value of last call to ARMul_Time() */ unsigned int LastTime; /* Value of last call to ARMul_Time() */
ARMword CP14R0_CCD; /* used to count 64 clock cycles with CP14 R0 bit 3 set */ ARMword CP14R0_CCD; /* used to count 64 clock cycles with CP14 R0 bit 3 set */
//added by ksh:for handle different machs io 2004-3-5 //added by ksh:for handle different machs io 2004-3-5
ARMul_io mach_io; ARMul_io mach_io;
/*added by ksh,2004-11-26,some energy profiling*/ /*added by ksh,2004-11-26,some energy profiling*/
ARMul_Energy energy; ARMul_Energy energy;
//teawater add for next_dis 2004.10.27----------------------- //teawater add for next_dis 2004.10.27-----------------------
int disassemble; int disassemble;
//AJ2D------------------------------------------
//teawater add for arm2x86 2005.02.15-------------------------------------------
//teawater add for arm2x86 2005.02.15-------------------------------------------
u32 trap; u32 trap;
u32 tea_break_addr; u32 tea_break_addr;
u32 tea_break_ok; u32 tea_break_ok;
int tea_pc; int tea_pc;
//AJ2D--------------------------------------------------------------------------
//teawater add for arm2x86 2005.07.03-------------------------------------------
/* //teawater add for arm2x86 2005.07.05-------------------------------------------
* 2007-01-24 removed the term-io functions by Anthony Lee,
* moved to "device/uart/skyeye_uart_stdio.c".
*/
//AJ2D--------------------------------------------------------------------------
//teawater add for arm2x86 2005.07.05-------------------------------------------
//arm_arm A2-18 //arm_arm A2-18
int abort_model; //0 Base Restored Abort Model, 1 the Early Abort Model, 2 Base Updated Abort Model int abort_model; //0 Base Restored Abort Model, 1 the Early Abort Model, 2 Base Updated Abort Model
//AJ2D--------------------------------------------------------------------------
//teawater change for return if running tb dirty 2005.07.09--------------------- //teawater change for return if running tb dirty 2005.07.09---------------------
void *tb_now; void *tb_now;
//AJ2D--------------------------------------------------------------------------
//teawater add for record reg value to ./reg.txt 2005.07.10---------------------
//teawater add for record reg value to ./reg.txt 2005.07.10---------------------
FILE *tea_reg_fd; FILE *tea_reg_fd;
//AJ2D--------------------------------------------------------------------------
/*added by ksh in 2005-10-1*/
/*added by ksh in 2005-10-1*/
cpu_config_t *cpu; cpu_config_t *cpu;
//mem_config_t *mem_bank; //mem_config_t *mem_bank;
/* added LPC remap function */ /* added LPC remap function */
int vector_remap_flag; int vector_remap_flag;
u32 vector_remap_addr; u32 vector_remap_addr;
u32 vector_remap_size; u32 vector_remap_size;
@ -486,17 +411,14 @@ typedef ARMul_State arm_core_t;
#define ARM_Debug_Prop 0x10 #define ARM_Debug_Prop 0x10
#define ARM_Isync_Prop ARM_Debug_Prop #define ARM_Isync_Prop ARM_Debug_Prop
#define ARM_Lock_Prop 0x20 #define ARM_Lock_Prop 0x20
//chy 2003-08-11
#define ARM_v4_Prop 0x40 #define ARM_v4_Prop 0x40
#define ARM_v5_Prop 0x80 #define ARM_v5_Prop 0x80
/*jeff.du 2010-08-05 */
#define ARM_v6_Prop 0xc0 #define ARM_v6_Prop 0xc0
#define ARM_v5e_Prop 0x100 #define ARM_v5e_Prop 0x100
#define ARM_XScale_Prop 0x200 #define ARM_XScale_Prop 0x200
#define ARM_ep9312_Prop 0x400 #define ARM_ep9312_Prop 0x400
#define ARM_iWMMXt_Prop 0x800 #define ARM_iWMMXt_Prop 0x800
//chy 2005-09-19
#define ARM_PXA27X_Prop 0x1000 #define ARM_PXA27X_Prop 0x1000
#define ARM_v7_Prop 0x2000 #define ARM_v7_Prop 0x2000
@ -591,47 +513,44 @@ typedef ARMul_State arm_core_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern void ARMul_EmulateInit (void); extern void ARMul_EmulateInit();
extern void ARMul_Reset (ARMul_State * state); extern void ARMul_Reset(ARMul_State* state);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
extern ARMul_State *ARMul_NewState (ARMul_State * state); extern ARMul_State *ARMul_NewState(ARMul_State* state);
extern ARMword ARMul_DoProg (ARMul_State * state); extern ARMword ARMul_DoProg(ARMul_State* state);
extern ARMword ARMul_DoInstr (ARMul_State * state); extern ARMword ARMul_DoInstr(ARMul_State* state);
/***************************************************************************\ /***************************************************************************\
* Definitons of things for event handling * * Definitons of things for event handling *
\***************************************************************************/ \***************************************************************************/
extern void ARMul_ScheduleEvent (ARMul_State * state, unsigned int delay, extern void ARMul_ScheduleEvent(ARMul_State* state, unsigned int delay, unsigned(*func) ());
unsigned (*func) ()); extern void ARMul_EnvokeEvent(ARMul_State* state);
extern void ARMul_EnvokeEvent (ARMul_State * state); extern unsigned int ARMul_Time(ARMul_State* state);
extern unsigned int ARMul_Time (ARMul_State * state);
/***************************************************************************\ /***************************************************************************\
* Useful support routines * * Useful support routines *
\***************************************************************************/ \***************************************************************************/
extern ARMword ARMul_GetReg (ARMul_State * state, unsigned mode, extern ARMword ARMul_GetReg (ARMul_State* state, unsigned mode, unsigned reg);
unsigned reg); extern void ARMul_SetReg (ARMul_State* state, unsigned mode, unsigned reg, ARMword value);
extern void ARMul_SetReg (ARMul_State * state, unsigned mode, unsigned reg, extern ARMword ARMul_GetPC(ARMul_State* state);
ARMword value); extern ARMword ARMul_GetNextPC(ARMul_State* state);
extern ARMword ARMul_GetPC (ARMul_State * state); extern void ARMul_SetPC(ARMul_State* state, ARMword value);
extern ARMword ARMul_GetNextPC (ARMul_State * state); extern ARMword ARMul_GetR15(ARMul_State* state);
extern void ARMul_SetPC (ARMul_State * state, ARMword value); extern void ARMul_SetR15(ARMul_State* state, ARMword value);
extern ARMword ARMul_GetR15 (ARMul_State * state);
extern void ARMul_SetR15 (ARMul_State * state, ARMword value);
extern ARMword ARMul_GetCPSR (ARMul_State * state); extern ARMword ARMul_GetCPSR(ARMul_State* state);
extern void ARMul_SetCPSR (ARMul_State * state, ARMword value); extern void ARMul_SetCPSR(ARMul_State* state, ARMword value);
extern ARMword ARMul_GetSPSR (ARMul_State * state, ARMword mode); extern ARMword ARMul_GetSPSR(ARMul_State* state, ARMword mode);
extern void ARMul_SetSPSR (ARMul_State * state, ARMword mode, ARMword value); extern void ARMul_SetSPSR(ARMul_State* state, ARMword mode, ARMword value);
/***************************************************************************\ /***************************************************************************\
* Definitons of things to handle aborts * * Definitons of things to handle aborts *
\***************************************************************************/ \***************************************************************************/
extern void ARMul_Abort (ARMul_State * state, ARMword address); extern void ARMul_Abort(ARMul_State* state, ARMword address);
#ifdef MODET #ifdef MODET
#define ARMul_ABORTWORD (state->TFlag ? 0xefffdfff : 0xefffffff) /* SWI -1 */ #define ARMul_ABORTWORD (state->TFlag ? 0xefffdfff : 0xefffffff) /* SWI -1 */
#define ARMul_PREFETCHABORT(address) if (state->AbortAddr == 1) \ #define ARMul_PREFETCHABORT(address) if (state->AbortAddr == 1) \
@ -649,54 +568,40 @@ extern void ARMul_Abort (ARMul_State * state, ARMword address);
* Definitons of things in the memory interface * * Definitons of things in the memory interface *
\***************************************************************************/ \***************************************************************************/
extern unsigned ARMul_MemoryInit (ARMul_State * state, extern unsigned ARMul_MemoryInit(ARMul_State* state, unsigned int initmemsize);
unsigned int initmemsize); extern void ARMul_MemoryExit(ARMul_State* state);
extern void ARMul_MemoryExit (ARMul_State * state);
extern ARMword ARMul_LoadInstrS (ARMul_State * state, ARMword address, extern ARMword ARMul_LoadInstrS(ARMul_State* state, ARMword address, ARMword isize);
ARMword isize); extern ARMword ARMul_LoadInstrN(ARMul_State* state, ARMword address, ARMword isize);
extern ARMword ARMul_LoadInstrN (ARMul_State * state, ARMword address,
ARMword isize);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern ARMword ARMul_ReLoadInstr (ARMul_State * state, ARMword address, extern ARMword ARMul_ReLoadInstr(ARMul_State* state, ARMword address, ARMword isize);
ARMword isize);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
extern ARMword ARMul_LoadWordS (ARMul_State * state, ARMword address); extern ARMword ARMul_LoadWordS(ARMul_State* state, ARMword address);
extern ARMword ARMul_LoadWordN (ARMul_State * state, ARMword address); extern ARMword ARMul_LoadWordN(ARMul_State* state, ARMword address);
extern ARMword ARMul_LoadHalfWord (ARMul_State * state, ARMword address); extern ARMword ARMul_LoadHalfWord(ARMul_State* state, ARMword address);
extern ARMword ARMul_LoadByte (ARMul_State * state, ARMword address); extern ARMword ARMul_LoadByte(ARMul_State* state, ARMword address);
extern void ARMul_StoreWordS (ARMul_State * state, ARMword address, extern void ARMul_StoreWordS(ARMul_State* state, ARMword address, ARMword data);
ARMword data); extern void ARMul_StoreWordN(ARMul_State* state, ARMword address, ARMword data);
extern void ARMul_StoreWordN (ARMul_State * state, ARMword address, extern void ARMul_StoreHalfWord(ARMul_State* state, ARMword address, ARMword data);
ARMword data); extern void ARMul_StoreByte(ARMul_State* state, ARMword address, ARMword data);
extern void ARMul_StoreHalfWord (ARMul_State * state, ARMword address,
ARMword data);
extern void ARMul_StoreByte (ARMul_State * state, ARMword address,
ARMword data);
extern ARMword ARMul_SwapWord (ARMul_State * state, ARMword address, extern ARMword ARMul_SwapWord(ARMul_State* state, ARMword address, ARMword data);
ARMword data); extern ARMword ARMul_SwapByte(ARMul_State* state, ARMword address, ARMword data);
extern ARMword ARMul_SwapByte (ARMul_State * state, ARMword address,
ARMword data);
extern void ARMul_Icycles (ARMul_State * state, unsigned number, extern void ARMul_Icycles(ARMul_State* state, unsigned number, ARMword address);
ARMword address); extern void ARMul_Ccycles(ARMul_State* state, unsigned number, ARMword address);
extern void ARMul_Ccycles (ARMul_State * state, unsigned number,
ARMword address);
extern ARMword ARMul_ReadWord (ARMul_State * state, ARMword address); extern ARMword ARMul_ReadWord(ARMul_State* state, ARMword address);
extern ARMword ARMul_ReadByte (ARMul_State * state, ARMword address); extern ARMword ARMul_ReadByte(ARMul_State* state, ARMword address);
extern void ARMul_WriteWord (ARMul_State * state, ARMword address, extern void ARMul_WriteWord(ARMul_State* state, ARMword address, ARMword data);
ARMword data); extern void ARMul_WriteByte(ARMul_State* state, ARMword address, ARMword data);
extern void ARMul_WriteByte (ARMul_State * state, ARMword address,
ARMword data);
extern ARMword ARMul_MemAccess (ARMul_State * state, ARMword, ARMword, extern ARMword ARMul_MemAccess(ARMul_State* state, ARMword, ARMword,
ARMword, ARMword, ARMword, ARMword, ARMword, ARMword, ARMword, ARMword, ARMword, ARMword,
ARMword, ARMword, ARMword); ARMword, ARMword, ARMword);
@ -739,66 +644,40 @@ extern ARMword ARMul_MemAccess (ARMul_State * state, ARMword, ARMword,
#define ARMul_CP15_DBCON_E1 0x000c #define ARMul_CP15_DBCON_E1 0x000c
#define ARMul_CP15_DBCON_E0 0x0003 #define ARMul_CP15_DBCON_E0 0x0003
extern unsigned ARMul_CoProInit (ARMul_State * state); extern unsigned ARMul_CoProInit(ARMul_State* state);
extern void ARMul_CoProExit (ARMul_State * state); extern void ARMul_CoProExit(ARMul_State* state);
extern void ARMul_CoProAttach (ARMul_State * state, unsigned number, extern void ARMul_CoProAttach (ARMul_State* state, unsigned number,
ARMul_CPInits * init, ARMul_CPExits * exit, ARMul_CPInits* init, ARMul_CPExits* exit,
ARMul_LDCs * ldc, ARMul_STCs * stc, ARMul_LDCs* ldc, ARMul_STCs* stc,
ARMul_MRCs * mrc, ARMul_MCRs * mcr, ARMul_MRCs* mrc, ARMul_MCRs* mcr,
ARMul_MRRCs * mrrc, ARMul_MCRRs * mcrr, ARMul_MRRCs* mrrc, ARMul_MCRRs* mcrr,
ARMul_CDPs * cdp, ARMul_CDPs* cdp,
ARMul_CPReads * read, ARMul_CPWrites * write); ARMul_CPReads* read, ARMul_CPWrites* write);
extern void ARMul_CoProDetach (ARMul_State * state, unsigned number); extern void ARMul_CoProDetach(ARMul_State* state, unsigned number);
/***************************************************************************\ /***************************************************************************\
* Definitons of things in the host environment * * Definitons of things in the host environment *
\***************************************************************************/ \***************************************************************************/
extern unsigned ARMul_OSInit (ARMul_State * state); extern unsigned ARMul_OSInit(ARMul_State* state);
extern void ARMul_OSExit (ARMul_State * state); extern void ARMul_OSExit(ARMul_State* state);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number); extern unsigned ARMul_OSHandleSWI(ARMul_State* state, ARMword number);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
extern ARMword ARMul_OSLastErrorP (ARMul_State * state); extern ARMword ARMul_OSLastErrorP(ARMul_State* state);
extern ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr); extern ARMword ARMul_Debug(ARMul_State* state, ARMword pc, ARMword instr);
extern unsigned ARMul_OSException (ARMul_State * state, ARMword vector, extern unsigned ARMul_OSException(ARMul_State* state, ARMword vector, ARMword pc);
ARMword pc);
extern int rdi_log; extern int rdi_log;
/***************************************************************************\
* Host-dependent stuff *
\***************************************************************************/
#ifdef macintosh
pascal void SpinCursor (short increment); /* copied from CursorCtl.h */
# define HOURGLASS SpinCursor( 1 )
# define HOURGLASS_RATE 1023 /* 2^n - 1 */
#endif
//teawater add for arm2x86 2005.02.14-------------------------------------------
/*ywc 2005-03-31*/
/*
#include "arm2x86.h"
#include "arm2x86_dp.h"
#include "arm2x86_movl.h"
#include "arm2x86_psr.h"
#include "arm2x86_shift.h"
#include "arm2x86_mem.h"
#include "arm2x86_mul.h"
#include "arm2x86_test.h"
#include "arm2x86_other.h"
#include "list.h"
#include "tb.h"
*/
enum ConditionCode { enum ConditionCode {
EQ = 0, EQ = 0,
NE = 1, NE = 1,
@ -851,32 +730,16 @@ enum ConditionCode {
#define ZBIT_SHIFT 30 #define ZBIT_SHIFT 30
#define CBIT_SHIFT 29 #define CBIT_SHIFT 29
#define VBIT_SHIFT 28 #define VBIT_SHIFT 28
#ifdef DBCT
//teawater change for local tb branch directly jump 2005.10.18------------------
#include "dbct/list.h"
#include "dbct/arm2x86.h"
#include "dbct/arm2x86_dp.h"
#include "dbct/arm2x86_movl.h"
#include "dbct/arm2x86_psr.h"
#include "dbct/arm2x86_shift.h"
#include "dbct/arm2x86_mem.h"
#include "dbct/arm2x86_mul.h"
#include "dbct/arm2x86_test.h"
#include "dbct/arm2x86_other.h"
#include "dbct/arm2x86_coproc.h"
#include "dbct/tb.h"
#endif
//AJ2D--------------------------------------------------------------------------
//AJ2D--------------------------------------------------------------------------
#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,",\ #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,",\
state->Reg[0],state->Reg[1],state->Reg[2],state->Reg[3], \ state->Reg[0],state->Reg[1],state->Reg[2],state->Reg[3], \
state->Reg[4],state->Reg[5],state->Reg[6],state->Reg[7], \ state->Reg[4],state->Reg[5],state->Reg[6],state->Reg[7], \
state->Reg[8],state->Reg[9],state->Reg[10],state->Reg[11], \ state->Reg[8],state->Reg[9],state->Reg[10],state->Reg[11], \
state->Reg[12],state->Reg[13],state->Reg[14],state->Reg[15], \ state->Reg[12],state->Reg[13],state->Reg[14],state->Reg[15], \
state->Cpsr, state->Spsr[0], state->Spsr[1], state->Spsr[2],\ state->Cpsr, state->Spsr[0], state->Spsr[1], state->Spsr[2],\
state->Spsr[3],state->Spsr[4], state->Spsr[5], state->Spsr[6],\ state->Spsr[3],state->Spsr[4], state->Spsr[5], state->Spsr[6],\
state->Mode,state->Bank,state->ErrorCode,state->instr,state->pc,\ state->Mode,state->Bank,state->ErrorCode,state->instr,state->pc,\
state->temp,state->loaded,state->decoded);} state->temp,state->loaded,state->decoded);}
#define SKYEYE_OUTMOREREGS(fd) { fprintf ((fd),"\ #define SKYEYE_OUTMOREREGS(fd) { fprintf ((fd),"\
RUs %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\ RUs %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\
@ -914,17 +777,17 @@ RUn %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",\
#define SA1110 0x6901b110 #define SA1110 0x6901b110
#define SA1100 0x4401a100 #define SA1100 0x4401a100
#define PXA250 0x69052100 #define PXA250 0x69052100
#define PXA270 0x69054110 #define PXA270 0x69054110
//#define PXA250 0x69052903 //#define PXA250 0x69052903
// 0x69052903; //PXA250 B1 from intel 278522-001.pdf // 0x69052903; //PXA250 B1 from intel 278522-001.pdf
extern void ARMul_UndefInstr (ARMul_State *, ARMword); extern void ARMul_UndefInstr(ARMul_State*, ARMword);
extern void ARMul_FixCPSR (ARMul_State *, ARMword, ARMword); extern void ARMul_FixCPSR(ARMul_State*, ARMword, ARMword);
extern void ARMul_FixSPSR (ARMul_State *, ARMword, ARMword); extern void ARMul_FixSPSR(ARMul_State*, ARMword, ARMword);
extern void ARMul_ConsolePrint (ARMul_State *, const char *, ...); extern void ARMul_ConsolePrint(ARMul_State*, const char*, ...);
extern void ARMul_SelectProcessor (ARMul_State *, unsigned); extern void ARMul_SelectProcessor(ARMul_State*, unsigned);
#define DIFF_LOG 0 #define DIFF_LOG 0
#define SAVE_LOG 0 #define SAVE_LOG 0