| 34 | } |
| 35 | |
| 36 | static void initDynamicOps() { |
| 37 | if (dynamicOpsInitialized) |
| 38 | return; |
| 39 | static_assert(offsetof(CPU, eip.u32) <= 127, "Jit needs eip to be in the first 127 bytes of the CPU"); |
| 40 | static_assert(offsetof(CPU, reg[8].u32) <= 127, "Jit needs reg to be in the first 127 bytes of the CPU"); |
| 41 | static_assert(offsetof(CPU, seg[6].address) <= 127, "Jit needs seg to be in the first 127 bytes of the CPU"); |
| 42 | |
| 43 | dynamicOpsInitialized = 1; |
| 44 | for (int i = 0; i < InstructionCount; i++) { |
| 45 | dynamicOps[i] = &Jit::dynamic_invalid_op; |
| 46 | } |
| 47 | #define INIT_CPU(e, f) dynamicOps[e] = &Jit::dynamic_##f; |
| 48 | #include "../common/cpu_init.h" |
| 49 | #include "../common/cpu_init_mmx.h" |
| 50 | #include "../common/cpu_init_sse.h" |
| 51 | #include "../common/cpu_init_sse2.h" |
| 52 | #include "../common/cpu_init_fpu.h" |
| 53 | #ifdef BOXEDWINE_MULTI_THREADED |
| 54 | #define INIT_CPU_LOCK(e, f) dynamicOps[e##_Lock] = &Jit::dynamic_##f##_lock; |
| 55 | #include "../common/cpu_init_lock.h" |
| 56 | #endif |
| 57 | |
| 58 | #undef INIT_CPU |
| 59 | |
| 60 | dynamicOps[SLDTReg] = 0; |
| 61 | dynamicOps[SLDTE16] = 0; |
| 62 | dynamicOps[STRReg] = 0; |
| 63 | dynamicOps[STRE16] = 0; |
| 64 | dynamicOps[LLDTR16] = 0; |
| 65 | dynamicOps[LLDTE16] = 0; |
| 66 | dynamicOps[LTRR16] = 0; |
| 67 | dynamicOps[LTRE16] = 0; |
| 68 | dynamicOps[VERRR16] = 0; |
| 69 | dynamicOps[VERWR16] = 0; |
| 70 | dynamicOps[SGDT] = 0; |
| 71 | dynamicOps[SIDT] = &Jit::dynamic_sidt; |
| 72 | dynamicOps[LGDT] = 0; |
| 73 | dynamicOps[LIDT] = 0; |
| 74 | dynamicOps[SMSWRreg] = 0; |
| 75 | dynamicOps[SMSW] = 0; |
| 76 | dynamicOps[LMSWRreg] = 0; |
| 77 | dynamicOps[LMSW] = 0; |
| 78 | dynamicOps[INVLPG] = 0; |
| 79 | dynamicOps[Callback] = &Jit::dynamic_callback; |
| 80 | dynamicOps[TestEnd] = &JitCodeGen::dynamic_onTestEnd; |
| 81 | } |
| 82 | |
| 83 | #ifdef _DEBUG |
| 84 | static void logBlock(CPU* cpu, U32 address, DecodedOp* op, U32 len) { |