⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 armemu.h

📁 skyeye的开源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  armemu.h -- ARMulator emulation macros:  ARM6 Instruction Emulator.    Copyright (C) 1994 Advanced RISC Machines Ltd.     This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.     This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.     You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */extern ARMword isize;/* Condition code values.  */#define EQ 0#define NE 1#define CS 2#define CC 3#define MI 4#define PL 5#define VS 6#define VC 7#define HI 8#define LS 9#define GE 10#define LT 11#define GT 12#define LE 13#define AL 14#define NV 15/* Shift Opcodes.  */#define LSL 0#define LSR 1#define ASR 2#define ROR 3/* Macros to twiddle the status flags and mode.  */#define NBIT ((unsigned)1L << 31)#define ZBIT (1L << 30)#define CBIT (1L << 29)#define VBIT (1L << 28)#define SBIT (1L << 27)#define IBIT (1L << 7)#define FBIT (1L << 6)#define IFBITS (3L << 6)#define R15IBIT (1L << 27)#define R15FBIT (1L << 26)#define R15IFBITS (3L << 26)#define POS(i) ( (~(i)) >> 31 )#define NEG(i) ( (i) >> 31 )#ifdef MODET			/* Thumb support.  *//* ??? This bit is actually in the low order bit of the PC in the hardware.   It isn't clear if the simulator needs to model that or not.  */#define TBIT (1L << 5)#define TFLAG state->TFlag#define SETT state->TFlag = 1#define CLEART state->TFlag = 0#define ASSIGNT(res) state->TFlag = res#define INSN_SIZE (TFLAG ? 2 : 4)#else#define INSN_SIZE 4#endif#define NFLAG state->NFlag#define SETN state->NFlag = 1#define CLEARN state->NFlag = 0#define ASSIGNN(res) state->NFlag = res#define ZFLAG state->ZFlag#define SETZ state->ZFlag = 1#define CLEARZ state->ZFlag = 0#define ASSIGNZ(res) state->ZFlag = res#define CFLAG state->CFlag#define SETC state->CFlag = 1#define CLEARC state->CFlag = 0#define ASSIGNC(res) state->CFlag = res#define VFLAG state->VFlag#define SETV state->VFlag = 1#define CLEARV state->VFlag = 0#define ASSIGNV(res) state->VFlag = res#define SFLAG state->SFlag#define SETS state->SFlag = 1#define CLEARS state->SFlag = 0#define ASSIGNS(res) state->SFlag = res#define IFLAG (state->IFFlags >> 1)#define FFLAG (state->IFFlags & 1)#define IFFLAGS state->IFFlags#define ASSIGNINT(res) state->IFFlags = (((res) >> 6) & 3)#define ASSIGNR15INT(res) state->IFFlags = (((res) >> 26) & 3) ;#define PSR_FBITS (0xff000000L)#define PSR_SBITS (0x00ff0000L)#define PSR_XBITS (0x0000ff00L)#define PSR_CBITS (0x000000ffL)#if defined MODE32 || defined MODET#define CCBITS (0xf8000000L)#else#define CCBITS (0xf0000000L)#endif#define INTBITS (0xc0L)#if defined MODET && defined MODE32#define PCBITS (0xffffffffL)#else#define PCBITS (0xfffffffcL)#endif#define MODEBITS (0x1fL)#define R15INTBITS (3L << 26)#if defined MODET && defined MODE32#define R15PCBITS (0x03ffffffL)#else#define R15PCBITS (0x03fffffcL)#endif#define R15PCMODEBITS (0x03ffffffL)#define R15MODEBITS (0x3L)#ifdef MODE32#define PCMASK PCBITS#define PCWRAP(pc) (pc)#else#define PCMASK R15PCBITS#define PCWRAP(pc) ((pc) & R15PCBITS)#endif#define PC (state->Reg[15] & PCMASK)#define R15CCINTMODE (state->Reg[15] & (CCBITS | R15INTBITS | R15MODEBITS))#define R15INT (state->Reg[15] & R15INTBITS)#define R15INTPC (state->Reg[15] & (R15INTBITS | R15PCBITS))#define R15INTPCMODE (state->Reg[15] & (R15INTBITS | R15PCBITS | R15MODEBITS))#define R15INTMODE (state->Reg[15] & (R15INTBITS | R15MODEBITS))#define R15PC (state->Reg[15] & R15PCBITS)#define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS))#define R15MODE (state->Reg[15] & R15MODEBITS)#define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28) | (SFLAG << 27))#define EINT (IFFLAGS << 6)#define ER15INT (IFFLAGS << 26)#define EMODE (state->Mode)#ifdef MODET#define CPSR (ECC | EINT | EMODE | (TFLAG << 5))#else#define CPSR (ECC | EINT | EMODE)#endif#ifdef MODE32#define PATCHR15#else#define PATCHR15 state->Reg[15] = ECC | ER15INT | EMODE | R15PC#endif#define GETSPSR(bank) (ARMul_GetSPSR (state, EMODE))#define SETPSR_F(d,s) d = ((d) & ~PSR_FBITS) | ((s) & PSR_FBITS)#define SETPSR_S(d,s) d = ((d) & ~PSR_SBITS) | ((s) & PSR_SBITS)#define SETPSR_X(d,s) d = ((d) & ~PSR_XBITS) | ((s) & PSR_XBITS)#define SETPSR_C(d,s) d = ((d) & ~PSR_CBITS) | ((s) & PSR_CBITS)#define SETR15PSR(s) 								\  do										\    {										\      if (state->Mode == USER26MODE)						\        {									\          state->Reg[15] = ((s) & CCBITS) | R15PC | ER15INT | EMODE;		\          ASSIGNN ((state->Reg[15] & NBIT) != 0);				\          ASSIGNZ ((state->Reg[15] & ZBIT) != 0);				\          ASSIGNC ((state->Reg[15] & CBIT) != 0);				\          ASSIGNV ((state->Reg[15] & VBIT) != 0);				\        }									\      else									\        {									\          state->Reg[15] = R15PC | ((s) & (CCBITS | R15INTBITS | R15MODEBITS));	\          ARMul_R15Altered (state);						\       }									\    }										\  while (0)#define SETABORT(i, m, d)						\  do									\    { 									\      int SETABORT_mode = (m);						\									\      ARMul_SetSPSR (state, SETABORT_mode, ARMul_GetCPSR (state));	\      ARMul_SetCPSR (state, ((ARMul_GetCPSR (state) & ~(EMODE | TBIT))	\			     | (i) | SETABORT_mode));			\      state->Reg[14] = temp - (d);					\    }									\  while (0)#ifndef MODE32#define VECTORS 0x20#define LEGALADDR 0x03ffffff#define VECTORACCESS(address) (address < VECTORS && ARMul_MODE26BIT && state->prog32Sig)#define ADDREXCEPT(address)   (address > LEGALADDR && !state->data32Sig)#endif#define INTERNALABORT(address)			\  do						\    {						\      if (address < VECTORS)			\	state->Aborted = ARMul_DataAbortV;	\      else					\	state->Aborted = ARMul_AddrExceptnV;	\    }						\  while (0)#ifdef MODE32#define TAKEABORT ARMul_Abort (state, ARMul_DataAbortV)#else#define TAKEABORT 					\  do							\    {							\      if (state->Aborted == ARMul_AddrExceptnV) 	\	ARMul_Abort (state, ARMul_AddrExceptnV); 	\      else 						\	ARMul_Abort (state, ARMul_DataAbortV);		\    }							\  while (0)#endif#define CPTAKEABORT					\  do							\    {							\      if (!state->Aborted)				\	ARMul_Abort (state, ARMul_UndefinedInstrV); 	\      else if (state->Aborted == ARMul_AddrExceptnV) 	\	ARMul_Abort (state, ARMul_AddrExceptnV); 	\      else 						\	ARMul_Abort (state, ARMul_DataAbortV);		\    }							\  while (0);/* Different ways to start the next instruction.  */#define SEQ           0#define NONSEQ        1#define PCINCEDSEQ    2#define PCINCEDNONSEQ 3#define PRIMEPIPE     4#define RESUME        8#define NORMALCYCLE state->NextInstr = 0#define BUSUSEDN    state->NextInstr |= 1	/* The next fetch will be an N cycle.  */#define BUSUSEDINCPCS						\  do								\    {								\      if (! state->is_v4)					\        {							\	  /* A standard PC inc and an S cycle.  */		\	  state->Reg[15] += isize;				\	  state->NextInstr = (state->NextInstr & 0xff) | 2;	\	}							\    }								\  while (0)#define BUSUSEDINCPCN					\  do							\    {							\      if (state->is_v4)					\	BUSUSEDN;					\      else						\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -