Protected mode improvements :

- LTR now sets TSS state to busy
- LMSW preserves ET bit in CR0
- Fixed PC size in 16-bit system segment on CALL/JMP
Patch from Greatpsycho
This commit is contained in:
OBattler
2017-07-16 21:36:49 +02:00
parent a7eb3c1608
commit c1495ed91d
2 changed files with 15 additions and 6 deletions

View File

@@ -212,6 +212,9 @@ static int op0F00_common(uint32_t fetchdat, int ea32)
access = readmemb(0, addr + 5);
granularity = readmemb(0, addr + 6) & 0x80;
if (cpu_state.abrt) return 1;
access |= 2;
writememb(0, addr + 5, access);
if (cpu_state.abrt) return 1;
tr.seg = sel;
tr.limit = limit;
tr.access = access;
@@ -365,7 +368,12 @@ static int op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32)
}
tempw = geteaw(); if (cpu_state.abrt) return 1;
if (msw & 1) tempw |= 1;
if (!is386) tempw &= 0xF;
if (is386)
{
tempw &= ~0x10;
tempw |= (msw & 0x10);
}
else tempw &= 0xF;
msw = tempw;
PREFETCH_RUN(2, 2, rmdat, 0,0,(cpu_mod == 3) ? 0:1,0, ea32);
break;

View File

@@ -628,8 +628,8 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc)
return;
}
type=segdat[2]&0xF00;
if (type==0x400) newpc=segdat[0];
else newpc=segdat[0]|(segdat[3]<<16);
newpc=segdat[0];
if (type&0x800) newpc|=segdat[3]<<16;
switch (type)
{
case 0x400: /*Call gate*/
@@ -737,6 +737,7 @@ void loadcsjmp(uint16_t seg, uint32_t oxpc)
case 0x100: /*286 Task gate*/
case 0x900: /*386 Task gate*/
cpu_state.pc=oxpc;
optype=JMP;
cpl_override=1;
taskswitch286(seg,segdat,segdat[2]&0x800);
flags &= ~NT_FLAG;
@@ -874,8 +875,8 @@ void loadcscall(uint16_t seg)
segdat[2]=readmemw(0,addr+4);
segdat[3]=readmemw(0,addr+6); cpl_override=0; if (cpu_state.abrt) return;
type=segdat[2]&0xF00;
if (type==0x400) newpc=segdat[0];
else newpc=segdat[0]|(segdat[3]<<16);
newpc=segdat[0];
if (type&0x800) newpc|=segdat[3]<<16;
if (csout) pclog("Code seg call - %04X - %04X %04X %04X\n",seg,segdat[0],segdat[1],segdat[2]);
if (segdat[2]&0x1000)
@@ -900,7 +901,7 @@ void loadcscall(uint16_t seg)
}
if (!(segdat[2]&0x8000))
{
x86np("Load CS call not present", seg & 0xfffc);
x86ss("Load CS call not present", seg & 0xfffc);
return;
}
set_use32(segdat[3]&0x40);