mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
Remember last prefix, for future SSE instruction decoding
This commit is contained in:
parent
f27b1cb89b
commit
09f7244e22
@ -358,6 +358,15 @@ struct TSS_32 {
|
||||
uint32_t ldt; /* The local descriptor table */
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
|
||||
/* Last prefix encountered, needed for Pentium III "mandatory opcode prefixes" needed to differentiate SSE instructions given the opcode.
|
||||
* Keeping it small and sequential should help your C++ compiler optimize the switch statement you're probably going to use in the normal core code. */
|
||||
enum {
|
||||
MP_NONE=0,
|
||||
MP_66,
|
||||
MP_F2,
|
||||
MP_F3
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
@ -100,6 +100,10 @@ Bitu cycle_count;
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x) last_prefix = (_x)
|
||||
|
||||
static uint8_t last_prefix;
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0xffffffffu};
|
||||
@ -167,6 +171,7 @@ Bits CPU_Core_Normal_Run(void) {
|
||||
|
||||
while (CPU_Cycles-->0) {
|
||||
LOADIP;
|
||||
last_prefix=MP_NONE;
|
||||
core.opcode_index=cpu.code.big*(Bitu)0x200u;
|
||||
core.prefixes=cpu.code.big;
|
||||
core.ea_table=&EATable[cpu.code.big*256u];
|
||||
|
@ -337,6 +337,7 @@
|
||||
goto illegal_opcode;
|
||||
#endif
|
||||
#if CPU_CORE >= CPU_ARCHTYPE_386
|
||||
REMEMBER_PREFIX(MP_66);
|
||||
core.opcode_index=(cpu.code.big^0x1u)*0x200u;
|
||||
goto restart_opcode;
|
||||
#endif
|
||||
@ -1282,9 +1283,11 @@
|
||||
goto opcode_f0;
|
||||
#endif
|
||||
CASE_B(0xf2) /* REPNZ */
|
||||
REMEMBER_PREFIX(MP_F2);
|
||||
DO_PREFIX_REP(false);
|
||||
break;
|
||||
CASE_B(0xf3) /* REPZ */
|
||||
REMEMBER_PREFIX(MP_F3);
|
||||
DO_PREFIX_REP(true);
|
||||
break;
|
||||
CASE_B(0xf4) /* HLT */
|
||||
|
@ -119,6 +119,8 @@ extern Bitu cycle_count;
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x)
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0x0000ffffu};
|
||||
|
@ -149,6 +149,8 @@ extern Bitu cycle_count;
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x)
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0x0000ffffu};
|
||||
|
@ -98,6 +98,10 @@ extern Bitu cycle_count;
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x) last_prefix = (_x)
|
||||
|
||||
static uint8_t last_prefix;
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0xffffffffu};
|
||||
@ -203,6 +207,7 @@ Bits CPU_Core_Prefetch_Run(void) {
|
||||
invalidate_pq=false;
|
||||
}
|
||||
LOADIP;
|
||||
last_prefix=MP_NONE;
|
||||
core.opcode_index=cpu.code.big*(Bitu)0x200u;
|
||||
core.prefixes=cpu.code.big;
|
||||
core.ea_table=&EATable[cpu.code.big*256u];
|
||||
|
@ -122,6 +122,8 @@ Bits CPU_Core_Prefetch_Trap_Run(void);
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x)
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0x0000ffffu};
|
||||
|
@ -178,6 +178,8 @@ static struct {
|
||||
#define BaseDS core.base_ds
|
||||
#define BaseSS core.base_ss
|
||||
|
||||
#define REMEMBER_PREFIX(_x)
|
||||
|
||||
//#define PREFETCH_DEBUG
|
||||
|
||||
#define MAX_PQ_SIZE 32
|
||||
|
@ -85,6 +85,10 @@ extern Bitu cycle_count;
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_opcode;
|
||||
|
||||
#define REMEMBER_PREFIX(_x) last_prefix = (_x)
|
||||
|
||||
static uint8_t last_prefix;
|
||||
|
||||
typedef PhysPt (*GetEAHandler)(void);
|
||||
|
||||
static const uint32_t AddrMaskTable[2]={0x0000ffffu,0xffffffffu};
|
||||
@ -176,6 +180,7 @@ Bits CPU_Core_Simple_Run(void) {
|
||||
/* Simple core optimizes for non-paged linear memory access and can break (segfault) if beyond end of memory */
|
||||
if (core.cseip >= safety_limit) break;
|
||||
|
||||
last_prefix=MP_NONE;
|
||||
core.opcode_index=cpu.code.big*0x200u;
|
||||
core.prefixes=cpu.code.big;
|
||||
core.ea_table=&EATable[cpu.code.big*256u];
|
||||
|
Loading…
x
Reference in New Issue
Block a user