1
0
Fork 0

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:
ripsaw8080 2019-04-01 22:06:11 +00:00
parent 687e3cf058
commit 3978e05909
6 changed files with 20 additions and 14 deletions

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;