Improve prefetch and simple cores to not switch to normal core on trap execution. Fixes the demo version of Prehistorik 2 and similar cases that use the trap flag and prefetch tricks. Thanks NewRisingSun.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4201
This commit is contained in:
parent
687e3cf058
commit
3978e05909
6 changed files with 20 additions and 14 deletions
|
@ -71,6 +71,7 @@ extern CPU_Decoder * cpudecoder;
|
|||
Bits CPU_Core_Normal_Run(void);
|
||||
Bits CPU_Core_Normal_Trap_Run(void);
|
||||
Bits CPU_Core_Simple_Run(void);
|
||||
Bits CPU_Core_Simple_Trap_Run(void);
|
||||
Bits CPU_Core_Full_Run(void);
|
||||
Bits CPU_Core_Dyn_X86_Run(void);
|
||||
Bits CPU_Core_Dyn_X86_Trap_Run(void);
|
||||
|
|
|
@ -58,6 +58,8 @@ extern Bitu cycle_count;
|
|||
#define CPU_PIC_CHECK 1
|
||||
#define CPU_TRAP_CHECK 1
|
||||
|
||||
#define CPU_TRAP_DECODER CPU_Core_Normal_Trap_Run
|
||||
|
||||
#define OPCODE_NONE 0x000
|
||||
#define OPCODE_0F 0x100
|
||||
#define OPCODE_SIZE 0x200
|
||||
|
|
|
@ -390,7 +390,7 @@
|
|||
CPU_CALL(true,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -403,7 +403,7 @@
|
|||
if (CPU_POPF(true)) RUNEXCEPTION();
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
goto decode_end;
|
||||
}
|
||||
#endif
|
||||
|
@ -515,7 +515,7 @@
|
|||
CPU_IRET(true,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -589,7 +589,7 @@
|
|||
CPU_JMP(true,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -677,7 +677,7 @@
|
|||
CPU_CALL(true,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -697,7 +697,7 @@
|
|||
CPU_JMP(true,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -564,7 +564,7 @@
|
|||
CPU_CALL(false,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -579,7 +579,7 @@
|
|||
if (CPU_POPF(false)) RUNEXCEPTION();
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
goto decode_end;
|
||||
}
|
||||
#endif
|
||||
|
@ -780,7 +780,7 @@
|
|||
CPU_IRET(false,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -919,7 +919,7 @@
|
|||
CPU_JMP(false,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -1132,7 +1132,7 @@
|
|||
CPU_CALL(false,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -1153,7 +1153,7 @@
|
|||
CPU_JMP(false,newcs,newip,GETIP);
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Trap_Run;
|
||||
cpudecoder=CPU_TRAP_DECODER;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,8 @@ extern Bitu cycle_count;
|
|||
#define CPU_PIC_CHECK 1
|
||||
#define CPU_TRAP_CHECK 1
|
||||
|
||||
#define CPU_TRAP_DECODER CPU_Core_Prefetch_Trap_Run
|
||||
|
||||
#define OPCODE_NONE 0x000
|
||||
#define OPCODE_0F 0x100
|
||||
#define OPCODE_SIZE 0x200
|
||||
|
|
|
@ -50,6 +50,8 @@ extern Bitu cycle_count;
|
|||
#define CPU_PIC_CHECK 1
|
||||
#define CPU_TRAP_CHECK 1
|
||||
|
||||
#define CPU_TRAP_DECODER CPU_Core_Simple_Trap_Run
|
||||
|
||||
#define OPCODE_NONE 0x000
|
||||
#define OPCODE_0F 0x100
|
||||
#define OPCODE_SIZE 0x200
|
||||
|
@ -185,13 +187,12 @@ decode_end:
|
|||
return CBRET_NONE;
|
||||
}
|
||||
|
||||
// not really used
|
||||
Bits CPU_Core_Simple_Trap_Run(void) {
|
||||
Bits oldCycles = CPU_Cycles;
|
||||
CPU_Cycles = 1;
|
||||
cpu.trap_skip = false;
|
||||
|
||||
Bits ret=CPU_Core_Normal_Run();
|
||||
Bits ret=CPU_Core_Simple_Run();
|
||||
if (!cpu.trap_skip) CPU_HW_Interrupt(1);
|
||||
CPU_Cycles = oldCycles-1;
|
||||
cpudecoder = &CPU_Core_Simple_Run;
|
||||
|
|
Loading…
Add table
Reference in a new issue