286/386 interpreter fixes - the correct opcode arrays are now used and fixed the debug registers.
This commit is contained in:
@@ -82,18 +82,41 @@ opMOV_r_CRx_a32(uint32_t fetchdat)
|
||||
static int
|
||||
opMOV_r_DRx_a16(uint32_t fetchdat)
|
||||
{
|
||||
if ((CPL || (cpu_state.eflags & VM_FLAG)) && (cr0 & 1)) {
|
||||
if ((CPL > 0) && (cr0 & 1)) {
|
||||
x86gpf(NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_reg == 4 || cpu_reg == 5) {
|
||||
if (cr4 & 0x8)
|
||||
x86illegal();
|
||||
else
|
||||
cpu_reg += 2;
|
||||
if ((dr[7] & 0x2000) && !(cpu_state.eflags & RF_FLAG)) {
|
||||
trap |= 1;
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_16(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0 ... 3:
|
||||
cpu_state.regs[cpu_rm].l = dr[cpu_reg];
|
||||
break;
|
||||
case 4:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 6:
|
||||
cpu_state.regs[cpu_rm].l = dr[6];
|
||||
break;
|
||||
case 5:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 7:
|
||||
cpu_state.regs[cpu_rm].l = dr[7];
|
||||
break;
|
||||
default:
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
cpu_state.regs[cpu_rm].l = dr[cpu_reg] | (cpu_reg == 6 ? 0xffff0ff0u : 0);
|
||||
CLOCK_CYCLES(6);
|
||||
PREFETCH_RUN(6, 2, rmdat, 0, 0, 0, 0, 0);
|
||||
return 0;
|
||||
@@ -101,18 +124,41 @@ opMOV_r_DRx_a16(uint32_t fetchdat)
|
||||
static int
|
||||
opMOV_r_DRx_a32(uint32_t fetchdat)
|
||||
{
|
||||
if ((CPL || (cpu_state.eflags & VM_FLAG)) && (cr0 & 1)) {
|
||||
if ((CPL > 0) && (cr0 & 1)) {
|
||||
x86gpf(NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_reg == 4 || cpu_reg == 5) {
|
||||
if (cr4 & 0x8)
|
||||
x86illegal();
|
||||
else
|
||||
cpu_reg += 2;
|
||||
if ((dr[7] & 0x2000) && !(cpu_state.eflags & RF_FLAG)) {
|
||||
trap |= 1;
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_32(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0 ... 3:
|
||||
cpu_state.regs[cpu_rm].l = dr[cpu_reg];
|
||||
break;
|
||||
case 4:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 6:
|
||||
cpu_state.regs[cpu_rm].l = dr[6];
|
||||
break;
|
||||
case 5:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 7:
|
||||
cpu_state.regs[cpu_rm].l = dr[7];
|
||||
break;
|
||||
default:
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
cpu_state.regs[cpu_rm].l = dr[cpu_reg] | (cpu_reg == 6 ? 0xffff0ff0u : 0);
|
||||
CLOCK_CYCLES(6);
|
||||
PREFETCH_RUN(6, 2, rmdat, 0, 0, 0, 0, 1);
|
||||
return 0;
|
||||
@@ -236,24 +282,41 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
|
||||
static int
|
||||
opMOV_DRx_r_a16(uint32_t fetchdat)
|
||||
{
|
||||
if ((CPL || (cpu_state.eflags & VM_FLAG)) && (cr0 & 1)) {
|
||||
if ((CPL > 0) && (cr0 & 1)) {
|
||||
x86gpf(NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
if ((dr[6] & 0x2000) && !(cpu_state.eflags & RF_FLAG)) {
|
||||
dr[7] |= 0x2000;
|
||||
dr[6] &= ~0x2000;
|
||||
x86gen();
|
||||
if ((dr[7] & 0x2000) && !(cpu_state.eflags & RF_FLAG)) {
|
||||
trap |= 1;
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_reg == 4 || cpu_reg == 5) {
|
||||
if (cr4 & 0x8)
|
||||
switch (cpu_reg) {
|
||||
case 0 ... 3:
|
||||
dr[cpu_reg] = cpu_state.regs[cpu_rm].l;
|
||||
break;
|
||||
case 4:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 6:
|
||||
dr[6] = (dr[6] & 0xffff0ff0) | (cpu_state.regs[cpu_rm].l & 0x0000f00f);
|
||||
break;
|
||||
case 5:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 7:
|
||||
dr[7] = cpu_state.regs[cpu_rm].l | 0x00000400;
|
||||
break;
|
||||
default:
|
||||
x86illegal();
|
||||
else
|
||||
cpu_reg += 2;
|
||||
return 1;
|
||||
}
|
||||
dr[cpu_reg] = cpu_state.regs[cpu_rm].l;
|
||||
CLOCK_CYCLES(6);
|
||||
PREFETCH_RUN(6, 2, rmdat, 0, 0, 0, 0, 0);
|
||||
CPU_BLOCK_END();
|
||||
@@ -262,18 +325,41 @@ opMOV_DRx_r_a16(uint32_t fetchdat)
|
||||
static int
|
||||
opMOV_DRx_r_a32(uint32_t fetchdat)
|
||||
{
|
||||
if ((CPL || (cpu_state.eflags & VM_FLAG)) && (cr0 & 1)) {
|
||||
if ((CPL > 0) && (cr0 & 1)) {
|
||||
x86gpf(NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_reg == 4 || cpu_reg == 5) {
|
||||
if (cr4 & 0x8)
|
||||
x86illegal();
|
||||
else
|
||||
cpu_reg += 2;
|
||||
if ((dr[7] & 0x2000) && !(cpu_state.eflags & RF_FLAG)) {
|
||||
trap |= 1;
|
||||
return 1;
|
||||
}
|
||||
fetch_ea_32(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0 ... 3:
|
||||
dr[cpu_reg] = cpu_state.regs[cpu_rm].l;
|
||||
break;
|
||||
case 4:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 6:
|
||||
dr[6] = (dr[6] & 0xffff0ff0) | (cpu_state.regs[cpu_rm].l & 0x0000f00f);
|
||||
break;
|
||||
case 5:
|
||||
if (cr4 & 0x8) {
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
fallthrough;
|
||||
case 7:
|
||||
dr[7] = cpu_state.regs[cpu_rm].l | 0x00000400;
|
||||
break;
|
||||
default:
|
||||
x86illegal();
|
||||
return 1;
|
||||
}
|
||||
dr[cpu_reg] = cpu_state.regs[cpu_rm].l;
|
||||
CLOCK_CYCLES(6);
|
||||
PREFETCH_RUN(6, 2, rmdat, 0, 0, 0, 0, 1);
|
||||
CPU_BLOCK_END();
|
||||
|
||||
Reference in New Issue
Block a user