diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom.cpp | 6 | ||||
| -rw-r--r-- | src/core/arm/interpreter/arminit.cpp | 22 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/armdefs.h | 53 | ||||
| -rw-r--r-- | src/core/arm/skyeye_common/armemu.h | 12 | ||||
| -rw-r--r-- | src/core/core.h | 3 |
5 files changed, 1 insertions, 95 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index 1b1d01420..bc1e969e4 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp | |||
| @@ -31,7 +31,6 @@ ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { | |||
| 31 | 31 | ||
| 32 | // Reset the core to initial state | 32 | // Reset the core to initial state |
| 33 | ARMul_Reset(state.get()); | 33 | ARMul_Reset(state.get()); |
| 34 | state->NextInstr = RESUME; // NOTE: This will be overwritten by LoadContext | ||
| 35 | state->Emulate = RUN; | 34 | state->Emulate = RUN; |
| 36 | 35 | ||
| 37 | // Switch to the desired privilege mode. | 36 | // Switch to the desired privilege mode. |
| @@ -99,7 +98,6 @@ void ARM_DynCom::ResetContext(Core::ThreadContext& context, u32 stack_top, u32 e | |||
| 99 | context.pc = entry_point; | 98 | context.pc = entry_point; |
| 100 | context.sp = stack_top; | 99 | context.sp = stack_top; |
| 101 | context.cpsr = 0x1F; // Usermode | 100 | context.cpsr = 0x1F; // Usermode |
| 102 | context.mode = 8; // Instructs dyncom CPU core to start execution as if it's "resuming" a thread. | ||
| 103 | } | 101 | } |
| 104 | 102 | ||
| 105 | void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) { | 103 | void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) { |
| @@ -113,8 +111,6 @@ void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) { | |||
| 113 | 111 | ||
| 114 | ctx.fpscr = state->VFP[1]; | 112 | ctx.fpscr = state->VFP[1]; |
| 115 | ctx.fpexc = state->VFP[2]; | 113 | ctx.fpexc = state->VFP[2]; |
| 116 | |||
| 117 | ctx.mode = state->NextInstr; | ||
| 118 | } | 114 | } |
| 119 | 115 | ||
| 120 | void ARM_DynCom::LoadContext(const Core::ThreadContext& ctx) { | 116 | void ARM_DynCom::LoadContext(const Core::ThreadContext& ctx) { |
| @@ -128,8 +124,6 @@ void ARM_DynCom::LoadContext(const Core::ThreadContext& ctx) { | |||
| 128 | 124 | ||
| 129 | state->VFP[1] = ctx.fpscr; | 125 | state->VFP[1] = ctx.fpscr; |
| 130 | state->VFP[2] = ctx.fpexc; | 126 | state->VFP[2] = ctx.fpexc; |
| 131 | |||
| 132 | state->NextInstr = ctx.mode; | ||
| 133 | } | 127 | } |
| 134 | 128 | ||
| 135 | void ARM_DynCom::PrepareReschedule() { | 129 | void ARM_DynCom::PrepareReschedule() { |
diff --git a/src/core/arm/interpreter/arminit.cpp b/src/core/arm/interpreter/arminit.cpp index 6fa028f49..6ac45c396 100644 --- a/src/core/arm/interpreter/arminit.cpp +++ b/src/core/arm/interpreter/arminit.cpp | |||
| @@ -29,22 +29,8 @@ ARMul_State* ARMul_NewState(ARMul_State* state) | |||
| 29 | memset(state, 0, sizeof(ARMul_State)); | 29 | memset(state, 0, sizeof(ARMul_State)); |
| 30 | 30 | ||
| 31 | state->Emulate = RUN; | 31 | state->Emulate = RUN; |
| 32 | for (unsigned int i = 0; i < 16; i++) { | ||
| 33 | state->Reg[i] = 0; | ||
| 34 | for (unsigned int j = 0; j < 7; j++) | ||
| 35 | state->RegBank[j][i] = 0; | ||
| 36 | } | ||
| 37 | for (unsigned int i = 0; i < 7; i++) | ||
| 38 | state->Spsr[i] = 0; | ||
| 39 | |||
| 40 | state->Mode = USER32MODE; | 32 | state->Mode = USER32MODE; |
| 41 | 33 | ||
| 42 | state->VectorCatch = 0; | ||
| 43 | state->Aborted = false; | ||
| 44 | state->Reseted = false; | ||
| 45 | state->Inted = 3; | ||
| 46 | state->LastInted = 3; | ||
| 47 | |||
| 48 | state->lateabtSig = HIGH; | 34 | state->lateabtSig = HIGH; |
| 49 | state->bigendSig = LOW; | 35 | state->bigendSig = LOW; |
| 50 | 36 | ||
| @@ -129,26 +115,18 @@ void ARMul_Reset(ARMul_State* state) | |||
| 129 | { | 115 | { |
| 130 | VFPInit(state); | 116 | VFPInit(state); |
| 131 | 117 | ||
| 132 | state->NextInstr = 0; | ||
| 133 | |||
| 134 | state->Reg[15] = 0; | 118 | state->Reg[15] = 0; |
| 135 | state->Cpsr = INTBITS | SVC32MODE; | 119 | state->Cpsr = INTBITS | SVC32MODE; |
| 136 | state->Mode = SVC32MODE; | 120 | state->Mode = SVC32MODE; |
| 137 | |||
| 138 | state->Bank = SVCBANK; | 121 | state->Bank = SVCBANK; |
| 139 | FLUSHPIPE; | ||
| 140 | 122 | ||
| 141 | ResetMPCoreCP15Registers(state); | 123 | ResetMPCoreCP15Registers(state); |
| 142 | 124 | ||
| 143 | state->EndCondition = 0; | ||
| 144 | state->ErrorCode = 0; | ||
| 145 | |||
| 146 | state->NresetSig = HIGH; | 125 | state->NresetSig = HIGH; |
| 147 | state->NfiqSig = HIGH; | 126 | state->NfiqSig = HIGH; |
| 148 | state->NirqSig = HIGH; | 127 | state->NirqSig = HIGH; |
| 149 | state->NtransSig = (state->Mode & 3) ? HIGH : LOW; | 128 | state->NtransSig = (state->Mode & 3) ? HIGH : LOW; |
| 150 | state->abortSig = LOW; | 129 | state->abortSig = LOW; |
| 151 | state->AbortAddr = 1; | ||
| 152 | 130 | ||
| 153 | state->NumInstrs = 0; | 131 | state->NumInstrs = 0; |
| 154 | } | 132 | } |
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h index 64ca523e8..08da6d9eb 100644 --- a/src/core/arm/skyeye_common/armdefs.h +++ b/src/core/arm/skyeye_common/armdefs.h | |||
| @@ -53,14 +53,11 @@ typedef u64 ARMdword; // must be 64 bits wide | |||
| 53 | typedef u32 ARMword; // must be 32 bits wide | 53 | typedef u32 ARMword; // must be 32 bits wide |
| 54 | typedef u16 ARMhword; // must be 16 bits wide | 54 | typedef u16 ARMhword; // must be 16 bits wide |
| 55 | typedef u8 ARMbyte; // must be 8 bits wide | 55 | typedef u8 ARMbyte; // must be 8 bits wide |
| 56 | typedef struct ARMul_State ARMul_State; | ||
| 57 | 56 | ||
| 58 | #define VFP_REG_NUM 64 | 57 | #define VFP_REG_NUM 64 |
| 59 | struct ARMul_State | 58 | struct ARMul_State |
| 60 | { | 59 | { |
| 61 | ARMword Emulate; // To start and stop emulation | 60 | ARMword Emulate; // To start and stop emulation |
| 62 | unsigned EndCondition; // Reason for stopping | ||
| 63 | unsigned ErrorCode; // Type of illegal instruction | ||
| 64 | 61 | ||
| 65 | // Order of the following register should not be modified | 62 | // Order of the following register should not be modified |
| 66 | ARMword Reg[16]; // The current register file | 63 | ARMword Reg[16]; // The current register file |
| @@ -89,8 +86,6 @@ struct ARMul_State | |||
| 89 | ARMword ExtReg[VFP_REG_NUM]; | 86 | ARMword ExtReg[VFP_REG_NUM]; |
| 90 | /* ---- End of the ordered registers ---- */ | 87 | /* ---- End of the ordered registers ---- */ |
| 91 | 88 | ||
| 92 | ARMword RegBank[7][16]; // all the registers | ||
| 93 | |||
| 94 | ARMword NFlag, ZFlag, CFlag, VFlag, IFFlags; // Dummy flags for speed | 89 | ARMword NFlag, ZFlag, CFlag, VFlag, IFFlags; // Dummy flags for speed |
| 95 | unsigned int shifter_carry_out; | 90 | unsigned int shifter_carry_out; |
| 96 | 91 | ||
| @@ -102,10 +97,7 @@ struct ARMul_State | |||
| 102 | unsigned long long NumInstrs; // The number of instructions executed | 97 | unsigned long long NumInstrs; // The number of instructions executed |
| 103 | unsigned NumInstrsToExecute; | 98 | unsigned NumInstrsToExecute; |
| 104 | 99 | ||
| 105 | unsigned NextInstr; | 100 | unsigned NresetSig; // Reset the processor |
| 106 | unsigned VectorCatch; // Caught exception mask | ||
| 107 | |||
| 108 | unsigned NresetSig; // Reset the processor | ||
| 109 | unsigned NfiqSig; | 101 | unsigned NfiqSig; |
| 110 | unsigned NirqSig; | 102 | unsigned NirqSig; |
| 111 | 103 | ||
| @@ -147,13 +139,6 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) | |||
| 147 | */ | 139 | */ |
| 148 | unsigned lateabtSig; | 140 | unsigned lateabtSig; |
| 149 | 141 | ||
| 150 | bool Aborted; // Sticky flag for aborts | ||
| 151 | bool Reseted; // Sticky flag for Reset | ||
| 152 | ARMword Inted, LastInted; // Sticky flags for interrupts | ||
| 153 | ARMword Base; // Extra hand for base writeback | ||
| 154 | ARMword AbortAddr; // To keep track of Prefetch aborts | ||
| 155 | ARMword Vector; // Synthesize aborts in cycle modes | ||
| 156 | |||
| 157 | // For differentiating ARM core emulaiton. | 142 | // For differentiating ARM core emulaiton. |
| 158 | bool is_v4; // Are we emulating a v4 architecture (or higher)? | 143 | bool is_v4; // Are we emulating a v4 architecture (or higher)? |
| 159 | bool is_v5; // Are we emulating a v5 architecture? | 144 | bool is_v5; // Are we emulating a v5 architecture? |
| @@ -167,14 +152,6 @@ So, if lateabtSig=1, then it means Late Abort Model(Base Updated Abort Model) | |||
| 167 | 152 | ||
| 168 | // Added by ksh in 2005-10-1 | 153 | // Added by ksh in 2005-10-1 |
| 169 | cpu_config_t* cpu; | 154 | cpu_config_t* cpu; |
| 170 | |||
| 171 | u32 CurrInstr; | ||
| 172 | u32 last_pc; // The last PC executed | ||
| 173 | u32 last_instr; // The last instruction executed | ||
| 174 | u32 WriteAddr[17]; | ||
| 175 | u32 WriteData[17]; | ||
| 176 | u32 WritePc[17]; | ||
| 177 | u32 CurrWrite; | ||
| 178 | }; | 155 | }; |
| 179 | 156 | ||
| 180 | /***************************************************************************\ | 157 | /***************************************************************************\ |
| @@ -260,34 +237,6 @@ enum { | |||
| 260 | ARMul_INC = 3 | 237 | ARMul_INC = 3 |
| 261 | }; | 238 | }; |
| 262 | 239 | ||
| 263 | enum { | ||
| 264 | ARMul_CP13_R0_FIQ = 0x1, | ||
| 265 | ARMul_CP13_R0_IRQ = 0x2, | ||
| 266 | ARMul_CP13_R8_PMUS = 0x1, | ||
| 267 | |||
| 268 | ARMul_CP14_R0_ENABLE = 0x0001, | ||
| 269 | ARMul_CP14_R0_CLKRST = 0x0004, | ||
| 270 | ARMul_CP14_R0_CCD = 0x0008, | ||
| 271 | ARMul_CP14_R0_INTEN0 = 0x0010, | ||
| 272 | ARMul_CP14_R0_INTEN1 = 0x0020, | ||
| 273 | ARMul_CP14_R0_INTEN2 = 0x0040, | ||
| 274 | ARMul_CP14_R0_FLAG0 = 0x0100, | ||
| 275 | ARMul_CP14_R0_FLAG1 = 0x0200, | ||
| 276 | ARMul_CP14_R0_FLAG2 = 0x0400, | ||
| 277 | ARMul_CP14_R10_MOE_IB = 0x0004, | ||
| 278 | ARMul_CP14_R10_MOE_DB = 0x0008, | ||
| 279 | ARMul_CP14_R10_MOE_BT = 0x000c, | ||
| 280 | ARMul_CP15_R1_ENDIAN = 0x0080, | ||
| 281 | ARMul_CP15_R1_ALIGN = 0x0002, | ||
| 282 | ARMul_CP15_R5_X = 0x0400, | ||
| 283 | ARMul_CP15_R5_ST_ALIGN = 0x0001, | ||
| 284 | ARMul_CP15_R5_IMPRE = 0x0406, | ||
| 285 | ARMul_CP15_R5_MMU_EXCPT = 0x0400, | ||
| 286 | ARMul_CP15_DBCON_M = 0x0100, | ||
| 287 | ARMul_CP15_DBCON_E1 = 0x000c, | ||
| 288 | ARMul_CP15_DBCON_E0 = 0x0003 | ||
| 289 | }; | ||
| 290 | |||
| 291 | /***************************************************************************\ | 240 | /***************************************************************************\ |
| 292 | * Definitons of things in the host environment * | 241 | * Definitons of things in the host environment * |
| 293 | \***************************************************************************/ | 242 | \***************************************************************************/ |
diff --git a/src/core/arm/skyeye_common/armemu.h b/src/core/arm/skyeye_common/armemu.h index b8113dfc1..7e0965052 100644 --- a/src/core/arm/skyeye_common/armemu.h +++ b/src/core/arm/skyeye_common/armemu.h | |||
| @@ -38,16 +38,6 @@ enum : u32 { | |||
| 38 | INTBITS = 0x1C0, | 38 | INTBITS = 0x1C0, |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | // Different ways to start the next instruction. | ||
| 42 | enum { | ||
| 43 | SEQ = 0, | ||
| 44 | NONSEQ = 1, | ||
| 45 | PCINCEDSEQ = 2, | ||
| 46 | PCINCEDNONSEQ = 3, | ||
| 47 | PRIMEPIPE = 4, | ||
| 48 | RESUME = 8 | ||
| 49 | }; | ||
| 50 | |||
| 51 | // Values for Emulate. | 41 | // Values for Emulate. |
| 52 | enum { | 42 | enum { |
| 53 | STOP = 0, // Stop | 43 | STOP = 0, // Stop |
| @@ -55,5 +45,3 @@ enum { | |||
| 55 | ONCE = 2, // Execute just one interation | 45 | ONCE = 2, // Execute just one interation |
| 56 | RUN = 3 // Continuous execution | 46 | RUN = 3 // Continuous execution |
| 57 | }; | 47 | }; |
| 58 | |||
| 59 | #define FLUSHPIPE state->NextInstr |= PRIMEPIPE | ||
diff --git a/src/core/core.h b/src/core/core.h index 5e132cb5a..278f0f1cc 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -21,9 +21,6 @@ struct ThreadContext { | |||
| 21 | u32 fpu_registers[32]; | 21 | u32 fpu_registers[32]; |
| 22 | u32 fpscr; | 22 | u32 fpscr; |
| 23 | u32 fpexc; | 23 | u32 fpexc; |
| 24 | |||
| 25 | // These are not part of native ThreadContext, but needed by emu | ||
| 26 | u32 mode; | ||
| 27 | }; | 24 | }; |
| 28 | 25 | ||
| 29 | extern ARM_Interface* g_app_core; ///< ARM11 application core | 26 | extern ARM_Interface* g_app_core; ///< ARM11 application core |