CPL is now forced to 0 when switching from real to protected mode.

This commit is contained in:
OBattler 2021-08-20 17:25:27 +02:00
parent 3d004b56e7
commit 52a1ab757a

@ -125,6 +125,9 @@ static int opMOV_CRx_r_a16(uint32_t fetchdat)
case 0:
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000001)
flushmmucache();
/* Make sure CPL = 0 when switching from real mode to protected mode. */
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
cpu_state.seg_cs.access &= 0x9f;
cr0 = cpu_state.regs[cpu_rm].l;
if (cpu_16bitbus)
cr0 |= 0x10;
@ -181,6 +184,9 @@ static int opMOV_CRx_r_a32(uint32_t fetchdat)
case 0:
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000001)
flushmmucache();
/* Make sure CPL = 0 when switching from real mode to protected mode. */
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
cpu_state.seg_cs.access &= 0x9f;
cr0 = cpu_state.regs[cpu_rm].l;
if (cpu_16bitbus)
cr0 |= 0x10;