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,63 +74,26 @@
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"
//#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_CPInits(ARMul_State* state);
typedef unsigned ARMul_CPExits(ARMul_State* state); typedef unsigned ARMul_CPExits(ARMul_State* state);
typedef unsigned ARMul_LDCs (ARMul_State * state, unsigned type, typedef unsigned ARMul_LDCs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
ARMword instr, ARMword value); typedef unsigned ARMul_STCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
typedef unsigned ARMul_STCs (ARMul_State * state, unsigned type, typedef unsigned ARMul_MRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value);
ARMword instr, ARMword * value); typedef unsigned ARMul_MCRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value);
typedef unsigned ARMul_MRCs (ARMul_State * state, unsigned type, typedef unsigned ARMul_MRRCs(ARMul_State* state, unsigned type, ARMword instr, ARMword* value1, ARMword* value2);
ARMword instr, ARMword * value); typedef unsigned ARMul_MCRRs(ARMul_State* state, unsigned type, ARMword instr, ARMword value1, ARMword value2);
typedef unsigned ARMul_MCRs (ARMul_State * state, unsigned type, typedef unsigned ARMul_CDPs(ARMul_State* state, unsigned type, ARMword instr);
ARMword instr, ARMword value); typedef unsigned ARMul_CPReads(ARMul_State* state, unsigned reg, ARMword* value);
typedef unsigned ARMul_MRRCs (ARMul_State * state, unsigned type, typedef unsigned ARMul_CPWrites(ARMul_State* state, unsigned reg, ARMword value);
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
@ -206,8 +140,7 @@ 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;
@ -399,33 +332,25 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model)
//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;
@ -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,7 +513,7 @@ 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
} }
@ -603,8 +525,7 @@ 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);
@ -612,10 +533,8 @@ 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,
ARMword value);
extern ARMword ARMul_GetPC(ARMul_State* state); extern ARMword ARMul_GetPC(ARMul_State* state);
extern ARMword ARMul_GetNextPC(ARMul_State* state); extern ARMword ARMul_GetNextPC(ARMul_State* state);
extern void ARMul_SetPC(ARMul_State* state, ARMword value); extern void ARMul_SetPC(ARMul_State* state, ARMword value);
@ -649,19 +568,15 @@ 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
@ -670,31 +585,21 @@ 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,
@ -770,35 +675,9 @@ extern unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number);
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,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], \