mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Add Pentium II SYSENTER/SYSEXIT stub, add to debugger decompiler, add option to enable the instruction
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
|
||||
bool CPU_RDMSR();
|
||||
bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
#define PRE_EXCEPTION { }
|
||||
|
||||
|
@@ -257,6 +257,18 @@
|
||||
reg_eax=(uint32_t)(tsc&0xffffffff);
|
||||
}
|
||||
break;
|
||||
CASE_0F_B(0x34) /* SYSENTER */
|
||||
{
|
||||
if (CPU_ArchitectureType<CPU_ARCHTYPE_PENTIUMII) goto illegal_opcode;
|
||||
if (!CPU_SYSENTER()) goto illegal_opcode;
|
||||
}
|
||||
break;
|
||||
CASE_0F_B(0x35) /* SYSEXIT */
|
||||
{
|
||||
if (CPU_ArchitectureType<CPU_ARCHTYPE_PENTIUMII) goto illegal_opcode;
|
||||
if (!CPU_SYSEXIT()) goto illegal_opcode;
|
||||
}
|
||||
break;
|
||||
|
||||
// Pentium Pro Conditional Moves
|
||||
CASE_0F_W(0x40) /* CMOVO */
|
||||
|
@@ -26,6 +26,8 @@
|
||||
|
||||
bool CPU_RDMSR();
|
||||
bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
#define PRE_EXCEPTION { }
|
||||
|
||||
|
@@ -161,6 +161,8 @@ static uint32_t Fetchd() {
|
||||
|
||||
bool CPU_RDMSR();
|
||||
bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
#define Push_16 CPU_Push16
|
||||
#define Push_32 CPU_Push32
|
||||
|
@@ -31,6 +31,8 @@ using namespace std;
|
||||
|
||||
bool CPU_RDMSR();
|
||||
bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
#define PRE_EXCEPTION { }
|
||||
|
||||
|
@@ -144,6 +144,8 @@ static INLINE uint32_t Fetchd() {
|
||||
|
||||
bool CPU_RDMSR();
|
||||
bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
#include "instructions.h"
|
||||
#include "core_normal/support.h"
|
||||
|
@@ -69,6 +69,7 @@ bool do_seg_limits = false;
|
||||
|
||||
bool enable_fpu = true;
|
||||
bool enable_msr = true;
|
||||
bool enable_syscall = true;
|
||||
bool enable_cmpxchg8b = true;
|
||||
bool ignore_undefined_msr = true;
|
||||
bool report_fdiv_bug = false;
|
||||
@@ -2956,6 +2957,7 @@ bool CPU_CPUID(void) {
|
||||
reg_edx=0x00008011; /* FPU+TimeStamp/RDTSC */
|
||||
if (enable_msr) reg_edx |= 0x20; /* ModelSpecific/MSR */
|
||||
if (enable_cmpxchg8b) reg_edx |= 0x100; /* CMPXCHG8B */
|
||||
if (enable_syscall) reg_edx |= 0x800; /* SEP Fast System Call aka SYSENTER/SYSEXIT */
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -3516,7 +3518,8 @@ public:
|
||||
cpu_rep_max=section->Get_int("interruptible rep string op");
|
||||
ignore_undefined_msr=section->Get_bool("ignore undefined msr");
|
||||
enable_msr=section->Get_bool("enable msr");
|
||||
enable_cmpxchg8b=section->Get_bool("enable cmpxchg8b");
|
||||
enable_syscall=section->Get_bool("enable syscall");
|
||||
enable_cmpxchg8b=section->Get_bool("enable cmpxchg8b");
|
||||
CPU_CycleUp=section->Get_int("cycleup");
|
||||
CPU_CycleDown=section->Get_int("cycledown");
|
||||
std::string core(section->Get_string("core"));
|
||||
@@ -4096,6 +4099,19 @@ void CPU_ForceV86FakeIO_Out(Bitu port,Bitu val,Bitu len) {
|
||||
reg_edx = old_edx;
|
||||
}
|
||||
|
||||
/* pentium II fast system call */
|
||||
bool CPU_SYSENTER() {
|
||||
if (!enable_syscall) return false;
|
||||
LOG(LOG_CPU,LOG_NORMAL)("SYSENTER: UNIMPLEMENTED");
|
||||
return false; /* TODO */
|
||||
}
|
||||
|
||||
bool CPU_SYSEXIT() {
|
||||
if (!enable_syscall) return false;
|
||||
LOG(LOG_CPU,LOG_NORMAL)("SYSEXIT: UNIMPLEMENTED");
|
||||
return false; /* TODO */
|
||||
}
|
||||
|
||||
/* pentium machine-specific registers */
|
||||
bool CPU_RDMSR() {
|
||||
if (!enable_msr) return false;
|
||||
|
@@ -284,7 +284,7 @@ static char const *second[] = {
|
||||
0, 0, 0, 0,
|
||||
/* 3 */
|
||||
0, "rdtsc", 0, 0,
|
||||
0, 0, 0, 0,
|
||||
"sysenter", "sysexit", 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
/* 4 */
|
||||
|
@@ -2531,6 +2531,9 @@ void DOSBOX_SetupConfigSections(void) {
|
||||
Pbool->Set_help("Enable Pentium CMPXCHG8B instruction. Enable this explicitly if using software that uses this instruction.\n"
|
||||
"You must enable this option to run Windows ME because portions of the kernel rely on this instruction.");
|
||||
|
||||
Pbool = secprop->Add_bool("enable syscall",Property::Changeable::Always,true);
|
||||
Pbool->Set_help("Allow SYSENTER/SYSEXIT instructions. This option is only meaningful when cputype=pentium_ii.\n");
|
||||
|
||||
Pbool = secprop->Add_bool("ignore undefined msr",Property::Changeable::Always,false);
|
||||
Pbool->Set_help("Ignore RDMSR/WRMSR on undefined registers. Normally the CPU will fire an Invalid Opcode exception in that case.\n"
|
||||
"This option is off by default, enable if using software or drivers that assumes the presence of\n"
|
||||
|
Reference in New Issue
Block a user