|
|
@ -18,38 +18,26 @@ |
|
|
#ifndef _ARMDEFS_H_ |
|
|
#ifndef _ARMDEFS_H_ |
|
|
#define _ARMDEFS_H_ |
|
|
#define _ARMDEFS_H_ |
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
#include <errno.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "common/platform.h" |
|
|
|
|
|
|
|
|
|
|
|
//teawater add for arm2x86 2005.02.14------------------------------------------- |
|
|
|
|
|
// koodailar remove it for mingw 2005.12.18---------------- |
|
|
|
|
|
//anthonylee modify it for portable 2007.01.30 |
|
|
|
|
|
//#include "portable/mman.h" |
|
|
|
|
|
|
|
|
#include <cerrno> |
|
|
|
|
|
#include <csignal> |
|
|
|
|
|
#include <cstdio> |
|
|
|
|
|
#include <cstdlib> |
|
|
|
|
|
#include <cstring> |
|
|
|
|
|
#include <fcntl.h> |
|
|
|
|
|
#include <sys/stat.h> |
|
|
|
|
|
#include <sys/types.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 unsigned int ARMword; /* must be 32 bits wide */ |
|
|
|
|
|
typedef unsigned char ARMbyte; /* must be 8 bits wide */ |
|
|
|
|
|
typedef unsigned short ARMhword; /* must be 16 bits wide */ |
|
|
|
|
|
|
|
|
typedef u64 ARMdword; // must be 64 bits wide |
|
|
|
|
|
typedef u32 ARMword; // must be 32 bits wide |
|
|
|
|
|
typedef u16 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" |
|
|
|
|
|
//#include "lcd/skyeye_lcd.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#include "skyeye.h" |
|
|
|
|
|
//#include "skyeye_device.h" |
|
|
|
|
|
//#include "net/skyeye_net.h" |
|
|
|
|
|
//#include "skyeye_config.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef unsigned ARMul_CPInits (ARMul_State * state); |
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
typedef unsigned ARMul_CPInits(ARMul_State* state); |
|
|
|
|
|
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 *net_flag; //to judge if network is enabled |
|
|
|
|
|
ARMword *net_int; //netcard interrupt |
|
|
|
|
|
|
|
|
ARMword *instr; // to display the current interrupt state |
|
|
|
|
|
ARMword *net_flag; // to judge if network is enabled |
|
|
|
|
|
ARMword *net_int; // netcard interrupt |
|
|
|
|
|
|
|
|
//ywc,2004-04-01 |
|
|
//ywc,2004-04-01 |
|
|
ARMword *ts_int; |
|
|
ARMword *ts_int; |
|
|
@ -203,13 +137,12 @@ struct ARMul_Energy |
|
|
|
|
|
|
|
|
typedef struct mem_bank |
|
|
typedef struct mem_bank |
|
|
{ |
|
|
{ |
|
|
ARMword (*read_byte) (ARMul_State * state, ARMword addr); |
|
|
|
|
|
void (*write_byte) (ARMul_State * state, ARMword addr, ARMword data); |
|
|
|
|
|
ARMword (*read_halfword) (ARMul_State * state, ARMword addr); |
|
|
|
|
|
void (*write_halfword) (ARMul_State * state, ARMword addr, |
|
|
|
|
|
ARMword data); |
|
|
|
|
|
ARMword (*read_word) (ARMul_State * state, ARMword addr); |
|
|
|
|
|
void (*write_word) (ARMul_State * state, ARMword addr, ARMword data); |
|
|
|
|
|
|
|
|
ARMword (*read_byte) (ARMul_State* state, ARMword addr); |
|
|
|
|
|
void (*write_byte) (ARMul_State* state, ARMword addr, ARMword data); |
|
|
|
|
|
ARMword (*read_halfword) (ARMul_State* state, ARMword addr); |
|
|
|
|
|
void (*write_halfword) (ARMul_State* state, ARMword addr, ARMword data); |
|
|
|
|
|
ARMword (*read_word) (ARMul_State* state, ARMword addr); |
|
|
|
|
|
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 |
|
|
@ -391,47 +324,39 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) |
|
|
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------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* 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------------------------------------------- |
|
|
|
|
|
|
|
|
//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_Reset (ARMul_State * state); |
|
|
|
|
|
|
|
|
extern void ARMul_EmulateInit(); |
|
|
|
|
|
extern void ARMul_Reset(ARMul_State* state); |
|
|
#ifdef __cplusplus |
|
|
#ifdef __cplusplus |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
extern ARMul_State *ARMul_NewState (ARMul_State * state); |
|
|
|
|
|
extern ARMword ARMul_DoProg (ARMul_State * state); |
|
|
|
|
|
extern ARMword ARMul_DoInstr (ARMul_State * state); |
|
|
|
|
|
|
|
|
extern ARMul_State *ARMul_NewState(ARMul_State* state); |
|
|
|
|
|
extern ARMword ARMul_DoProg(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, |
|
|
|
|
|
unsigned (*func) ()); |
|
|
|
|
|
extern void ARMul_EnvokeEvent (ARMul_State * state); |
|
|
|
|
|
extern unsigned int ARMul_Time (ARMul_State * state); |
|
|
|
|
|
|
|
|
extern void ARMul_ScheduleEvent(ARMul_State* state, unsigned int delay, unsigned(*func) ()); |
|
|
|
|
|
extern void ARMul_EnvokeEvent(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, |
|
|
|
|
|
unsigned reg); |
|
|
|
|
|
extern void ARMul_SetReg (ARMul_State * state, unsigned mode, unsigned reg, |
|
|
|
|
|
ARMword value); |
|
|
|
|
|
extern ARMword ARMul_GetPC (ARMul_State * state); |
|
|
|
|
|
extern ARMword ARMul_GetNextPC (ARMul_State * state); |
|
|
|
|
|
extern void ARMul_SetPC (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 void ARMul_SetCPSR (ARMul_State * state, ARMword value); |
|
|
|
|
|
extern ARMword ARMul_GetSPSR (ARMul_State * state, ARMword mode); |
|
|
|
|
|
extern void ARMul_SetSPSR (ARMul_State * state, ARMword mode, ARMword value); |
|
|
|
|
|
|
|
|
extern ARMword ARMul_GetReg (ARMul_State* state, unsigned mode, unsigned reg); |
|
|
|
|
|
extern void ARMul_SetReg (ARMul_State* state, unsigned mode, unsigned reg, ARMword value); |
|
|
|
|
|
extern ARMword ARMul_GetPC(ARMul_State* state); |
|
|
|
|
|
extern ARMword ARMul_GetNextPC(ARMul_State* state); |
|
|
|
|
|
extern void ARMul_SetPC(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 void ARMul_SetCPSR(ARMul_State* state, ARMword value); |
|
|
|
|
|
extern ARMword ARMul_GetSPSR(ARMul_State* state, ARMword mode); |
|
|
|
|
|
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, |
|
|
|
|
|
unsigned int initmemsize); |
|
|
|
|
|
extern void ARMul_MemoryExit (ARMul_State * state); |
|
|
|
|
|
|
|
|
extern unsigned ARMul_MemoryInit(ARMul_State* state, unsigned int initmemsize); |
|
|
|
|
|
extern void ARMul_MemoryExit(ARMul_State* state); |
|
|
|
|
|
|
|
|
extern ARMword ARMul_LoadInstrS (ARMul_State * state, ARMword address, |
|
|
|
|
|
ARMword isize); |
|
|
|
|
|
extern ARMword ARMul_LoadInstrN (ARMul_State * state, ARMword address, |
|
|
|
|
|
ARMword isize); |
|
|
|
|
|
|
|
|
extern ARMword ARMul_LoadInstrS(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, |
|
|
|
|
|
ARMword isize); |
|
|
|
|
|
|
|
|
extern ARMword ARMul_ReLoadInstr(ARMul_State* state, ARMword address, ARMword isize); |
|
|
#ifdef __cplusplus |
|
|
#ifdef __cplusplus |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
extern ARMword ARMul_LoadWordS (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_LoadByte (ARMul_State * state, ARMword address); |
|
|
|
|
|
|
|
|
|
|
|
extern void ARMul_StoreWordS (ARMul_State * state, ARMword address, |
|
|
|
|
|
ARMword data); |
|
|
|
|
|
extern void ARMul_StoreWordN (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, |
|
|
|
|
|
ARMword data); |
|
|
|
|
|
extern ARMword ARMul_SwapByte (ARMul_State * state, ARMword address, |
|
|
|
|
|
ARMword data); |
|
|
|
|
|
|
|
|
|
|
|
extern void ARMul_Icycles (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_ReadByte (ARMul_State * state, ARMword address); |
|
|
|
|
|
extern void ARMul_WriteWord (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_LoadWordS(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_LoadByte(ARMul_State* state, ARMword address); |
|
|
|
|
|
|
|
|
|
|
|
extern void ARMul_StoreWordS(ARMul_State* state, ARMword address, ARMword data); |
|
|
|
|
|
extern void ARMul_StoreWordN(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, ARMword data); |
|
|
|
|
|
extern ARMword ARMul_SwapByte(ARMul_State* state, ARMword address, ARMword data); |
|
|
|
|
|
|
|
|
|
|
|
extern void ARMul_Icycles(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_ReadByte(ARMul_State* state, ARMword address); |
|
|
|
|
|
extern void ARMul_WriteWord(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, |
|
|
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 void ARMul_CoProExit (ARMul_State * state); |
|
|
|
|
|
extern void ARMul_CoProAttach (ARMul_State * state, unsigned number, |
|
|
|
|
|
ARMul_CPInits * init, ARMul_CPExits * exit, |
|
|
|
|
|
ARMul_LDCs * ldc, ARMul_STCs * stc, |
|
|
|
|
|
ARMul_MRCs * mrc, ARMul_MCRs * mcr, |
|
|
|
|
|
ARMul_MRRCs * mrrc, ARMul_MCRRs * mcrr, |
|
|
|
|
|
ARMul_CDPs * cdp, |
|
|
|
|
|
ARMul_CPReads * read, ARMul_CPWrites * write); |
|
|
|
|
|
extern void ARMul_CoProDetach (ARMul_State * state, unsigned number); |
|
|
|
|
|
|
|
|
extern unsigned ARMul_CoProInit(ARMul_State* state); |
|
|
|
|
|
extern void ARMul_CoProExit(ARMul_State* state); |
|
|
|
|
|
extern void ARMul_CoProAttach (ARMul_State* state, unsigned number, |
|
|
|
|
|
ARMul_CPInits* init, ARMul_CPExits* exit, |
|
|
|
|
|
ARMul_LDCs* ldc, ARMul_STCs* stc, |
|
|
|
|
|
ARMul_MRCs* mrc, ARMul_MCRs* mcr, |
|
|
|
|
|
ARMul_MRRCs* mrrc, ARMul_MCRRs* mcrr, |
|
|
|
|
|
ARMul_CDPs* cdp, |
|
|
|
|
|
ARMul_CPReads* read, ARMul_CPWrites* write); |
|
|
|
|
|
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 void ARMul_OSExit (ARMul_State * state); |
|
|
|
|
|
|
|
|
extern unsigned ARMul_OSInit(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 unsigned ARMul_OSException (ARMul_State * state, ARMword vector, |
|
|
|
|
|
ARMword pc); |
|
|
|
|
|
|
|
|
extern ARMword ARMul_Debug(ARMul_State* state, ARMword pc, ARMword instr); |
|
|
|
|
|
extern unsigned ARMul_OSException(ARMul_State* state, ARMword vector, 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,23 +730,7 @@ 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], \ |
|
|
@ -920,11 +783,11 @@ RUn %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",\ |
|
|
// 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_FixCPSR (ARMul_State *, ARMword, ARMword); |
|
|
|
|
|
extern void ARMul_FixSPSR (ARMul_State *, ARMword, ARMword); |
|
|
|
|
|
extern void ARMul_ConsolePrint (ARMul_State *, const char *, ...); |
|
|
|
|
|
extern void ARMul_SelectProcessor (ARMul_State *, unsigned); |
|
|
|
|
|
|
|
|
extern void ARMul_UndefInstr(ARMul_State*, ARMword); |
|
|
|
|
|
extern void ARMul_FixCPSR(ARMul_State*, ARMword, ARMword); |
|
|
|
|
|
extern void ARMul_FixSPSR(ARMul_State*, ARMword, ARMword); |
|
|
|
|
|
extern void ARMul_ConsolePrint(ARMul_State*, const char*, ...); |
|
|
|
|
|
extern void ARMul_SelectProcessor(ARMul_State*, unsigned); |
|
|
|
|
|
|
|
|
#define DIFF_LOG 0 |
|
|
#define DIFF_LOG 0 |
|
|
#define SAVE_LOG 0 |
|
|
#define SAVE_LOG 0 |
|
|
|