Implemented selector limits on some instructions - fixes LBA2.
GPFs in real mode now work. Selectors correctly zeroed on far return to lower privilege.
This commit is contained in:
parent
624ef9ba3c
commit
cd2c3b47ed
16 changed files with 404 additions and 462 deletions
|
|
@ -1,6 +1,6 @@
|
|||
static int opMOVSB_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds,SI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, SI); if (abrt) return 0;
|
||||
writememb(es, DI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { DI--; SI--; }
|
||||
else { DI++; SI++; }
|
||||
|
|
@ -9,7 +9,7 @@ static int opMOVSB_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opMOVSB_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds,ESI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, ESI); if (abrt) return 0;
|
||||
writememb(es, EDI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { EDI--; ESI--; }
|
||||
else { EDI++; ESI++; }
|
||||
|
|
@ -19,7 +19,7 @@ static int opMOVSB_a32(uint32_t fetchdat)
|
|||
|
||||
static int opMOVSW_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds,SI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, SI); if (abrt) return 0;
|
||||
writememw(es, DI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { DI -= 2; SI -= 2; }
|
||||
else { DI += 2; SI += 2; }
|
||||
|
|
@ -28,7 +28,7 @@ static int opMOVSW_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opMOVSW_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds,ESI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, ESI); if (abrt) return 0;
|
||||
writememw(es, EDI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { EDI -= 2; ESI -= 2; }
|
||||
else { EDI += 2; ESI += 2; }
|
||||
|
|
@ -38,7 +38,7 @@ static int opMOVSW_a32(uint32_t fetchdat)
|
|||
|
||||
static int opMOVSL_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds,SI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, SI); if (abrt) return 0;
|
||||
writememl(es, DI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { DI -= 4; SI -= 4; }
|
||||
else { DI += 4; SI += 4; }
|
||||
|
|
@ -47,7 +47,7 @@ static int opMOVSL_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opMOVSL_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds,ESI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, ESI); if (abrt) return 0;
|
||||
writememl(es, EDI, temp); if (abrt) return 0;
|
||||
if (flags & D_FLAG) { EDI -= 4; ESI -= 4; }
|
||||
else { EDI += 4; ESI += 4; }
|
||||
|
|
@ -58,7 +58,7 @@ static int opMOVSL_a32(uint32_t fetchdat)
|
|||
|
||||
static int opCMPSB_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t src = readmemb(ds, SI);
|
||||
uint8_t src = readmemb(ea_seg->base, SI);
|
||||
uint8_t dst = readmemb(es, DI); if (abrt) return 0;
|
||||
setsub8(src, dst);
|
||||
if (flags & D_FLAG) { DI--; SI--; }
|
||||
|
|
@ -68,7 +68,7 @@ static int opCMPSB_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opCMPSB_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t src = readmemb(ds, ESI);
|
||||
uint8_t src = readmemb(ea_seg->base, ESI);
|
||||
uint8_t dst = readmemb(es, EDI); if (abrt) return 0;
|
||||
setsub8(src, dst);
|
||||
if (flags & D_FLAG) { EDI--; ESI--; }
|
||||
|
|
@ -79,7 +79,7 @@ static int opCMPSB_a32(uint32_t fetchdat)
|
|||
|
||||
static int opCMPSW_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t src = readmemw(ds, SI);
|
||||
uint16_t src = readmemw(ea_seg->base, SI);
|
||||
uint16_t dst = readmemw(es, DI); if (abrt) return 0;
|
||||
setsub16(src, dst);
|
||||
if (flags & D_FLAG) { DI -= 2; SI -= 2; }
|
||||
|
|
@ -89,7 +89,7 @@ static int opCMPSW_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opCMPSW_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t src = readmemw(ds, ESI);
|
||||
uint16_t src = readmemw(ea_seg->base, ESI);
|
||||
uint16_t dst = readmemw(es, EDI); if (abrt) return 0;
|
||||
setsub16(src, dst);
|
||||
if (flags & D_FLAG) { EDI -= 2; ESI -= 2; }
|
||||
|
|
@ -100,7 +100,7 @@ static int opCMPSW_a32(uint32_t fetchdat)
|
|||
|
||||
static int opCMPSL_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t src = readmeml(ds, SI);
|
||||
uint32_t src = readmeml(ea_seg->base, SI);
|
||||
uint32_t dst = readmeml(es, DI); if (abrt) return 0;
|
||||
setsub32(src, dst);
|
||||
if (flags & D_FLAG) { DI -= 4; SI -= 4; }
|
||||
|
|
@ -110,7 +110,7 @@ static int opCMPSL_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opCMPSL_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t src = readmeml(ds, ESI);
|
||||
uint32_t src = readmeml(ea_seg->base, ESI);
|
||||
uint32_t dst = readmeml(es, EDI); if (abrt) return 0;
|
||||
setsub32(src, dst);
|
||||
if (flags & D_FLAG) { EDI -= 4; ESI -= 4; }
|
||||
|
|
@ -173,7 +173,7 @@ static int opSTOSL_a32(uint32_t fetchdat)
|
|||
|
||||
static int opLODSB_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds, SI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, SI); if (abrt) return 0;
|
||||
AL = temp;
|
||||
if (flags & D_FLAG) SI--;
|
||||
else SI++;
|
||||
|
|
@ -182,7 +182,7 @@ static int opLODSB_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opLODSB_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds, ESI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, ESI); if (abrt) return 0;
|
||||
AL = temp;
|
||||
if (flags & D_FLAG) ESI--;
|
||||
else ESI++;
|
||||
|
|
@ -192,7 +192,7 @@ static int opLODSB_a32(uint32_t fetchdat)
|
|||
|
||||
static int opLODSW_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds, SI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, SI); if (abrt) return 0;
|
||||
AX = temp;
|
||||
if (flags & D_FLAG) SI -= 2;
|
||||
else SI += 2;
|
||||
|
|
@ -201,7 +201,7 @@ static int opLODSW_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opLODSW_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds, ESI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, ESI); if (abrt) return 0;
|
||||
AX = temp;
|
||||
if (flags & D_FLAG) ESI -= 2;
|
||||
else ESI += 2;
|
||||
|
|
@ -211,7 +211,7 @@ static int opLODSW_a32(uint32_t fetchdat)
|
|||
|
||||
static int opLODSL_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds, SI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, SI); if (abrt) return 0;
|
||||
EAX = temp;
|
||||
if (flags & D_FLAG) SI -= 4;
|
||||
else SI += 4;
|
||||
|
|
@ -220,7 +220,7 @@ static int opLODSL_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opLODSL_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds, ESI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, ESI); if (abrt) return 0;
|
||||
EAX = temp;
|
||||
if (flags & D_FLAG) ESI -= 4;
|
||||
else ESI += 4;
|
||||
|
|
@ -365,7 +365,7 @@ static int opINSL_a32(uint32_t fetchdat)
|
|||
|
||||
static int opOUTSB_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds, SI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, SI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
if (flags & D_FLAG) SI--;
|
||||
else SI++;
|
||||
|
|
@ -375,7 +375,7 @@ static int opOUTSB_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opOUTSB_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp = readmemb(ds, ESI); if (abrt) return 0;
|
||||
uint8_t temp = readmemb(ea_seg->base, ESI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
if (flags & D_FLAG) ESI--;
|
||||
else ESI++;
|
||||
|
|
@ -386,7 +386,7 @@ static int opOUTSB_a32(uint32_t fetchdat)
|
|||
|
||||
static int opOUTSW_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds, SI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, SI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
check_io_perm(DX + 1);
|
||||
if (flags & D_FLAG) SI -= 2;
|
||||
|
|
@ -397,7 +397,7 @@ static int opOUTSW_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opOUTSW_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp = readmemw(ds, ESI); if (abrt) return 0;
|
||||
uint16_t temp = readmemw(ea_seg->base, ESI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
check_io_perm(DX + 1);
|
||||
if (flags & D_FLAG) ESI -= 2;
|
||||
|
|
@ -409,7 +409,7 @@ static int opOUTSW_a32(uint32_t fetchdat)
|
|||
|
||||
static int opOUTSL_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds, SI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, SI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
check_io_perm(DX + 1);
|
||||
check_io_perm(DX + 2);
|
||||
|
|
@ -422,7 +422,7 @@ static int opOUTSL_a16(uint32_t fetchdat)
|
|||
}
|
||||
static int opOUTSL_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp = readmeml(ds, ESI); if (abrt) return 0;
|
||||
uint32_t temp = readmeml(ea_seg->base, ESI); if (abrt) return 0;
|
||||
check_io_perm(DX);
|
||||
check_io_perm(DX + 1);
|
||||
check_io_perm(DX + 2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue