Fixed WDEB386 fielding of V86-mode exceptions

This commit is contained in:
Jeff Parsons 2015-10-20 19:23:45 -07:00
commit 7babb15868
3 changed files with 34 additions and 10 deletions

View file

@ -4572,10 +4572,14 @@ if (DEBUGGER) {
var sOpcode = Debugger.INS_NAMES[aOpDesc[0]]; var sOpcode = Debugger.INS_NAMES[aOpDesc[0]];
var cOperands = aOpDesc.length - 1; var cOperands = aOpDesc.length - 1;
var sOperands = ""; var sOperands = "";
if (this.isStringIns(bOpcode)) { if (this.isStringIns(bOpcode)) {
cOperands = 0; // suppress display of operands for string instructions cOperands = 0; // suppress display of operands for string instructions
if (dbgAddr.fData32 && sOpcode.slice(-1) == 'W') sOpcode = sOpcode.slice(0, -1) + 'D'; if (dbgAddr.fData32 && sOpcode.slice(-1) == 'W') sOpcode = sOpcode.slice(0, -1) + 'D';
} }
/*
* TODO: We need a similar fixup for POPF and POPA when OPERAND size is 4 (to make them POPFD and POPAD)
*/
var typeCPU = null; var typeCPU = null;
var fComplete = true; var fComplete = true;

View file

@ -1506,19 +1506,23 @@ X86.fnIRET = function()
} }
else { else {
if (newPS & X86.PS.VM) { if (newPS & X86.PS.VM) {
this.assert(!!(this.regCR0 & X86.CR0.MSW.PE)); /*
* As noted in loadDesc8(), where the V86-mode frame we're about to pop was originally pushed,
* these frames ALWAYS contain 32-bit values, so make sure that sizeData reflects that.
*/
this.assert(!!(this.regCR0 & X86.CR0.MSW.PE) && this.sizeData == 4);
/* /*
* We have to assume that a full V86-mode interrupt frame was on the protected-mode stack; namely: * We have to assume that a full V86-mode interrupt frame was on the protected-mode stack; namely:
* *
* GS * low: EIP
* FS * CS (padded to 32 bits)
* DS * EFLAGS
* ES * ESP
* SS * SS (padded to 32 bits)
* ESP * ES (padded to 32 bits)
* EFLAGS * DS (padded to 32 bits)
* CS * FS (padded to 32 bits)
* EIP * high: GS (padded to 32 bits)
* *
* We've already popped EIP, CS, and EFLAGS into newIP, newCS and newPS, respectively, so we must now * We've already popped EIP, CS, and EFLAGS into newIP, newCS and newPS, respectively, so we must now
* pop the rest, while we're still in protected-mode, before the switch to V86-mode alters the current * pop the rest, while we're still in protected-mode, before the switch to V86-mode alters the current

View file

@ -887,6 +887,22 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe)
cpu.resetSizes(); cpu.resetSizes();
if (regPS & X86.PS.VM) { if (regPS & X86.PS.VM) {
/*
* Frames coming from V86-mode ALWAYS contain 32-bit values, and look like this:
*
* low: EIP
* CS (padded to 32 bits)
* EFLAGS
* ESP
* SS (padded to 32 bits)
* ES (padded to 32 bits)
* DS (padded to 32 bits)
* FS (padded to 32 bits)
* high: GS (padded to 32 bits)
*
* Our caller (eg, fnINT()) will take care of pushing the final bits (EFLAGS, CS, and EIP).
*/
cpu.setDataSize(this.sizeFrame = 4);
cpu.assert(I386 && cpu.model >= X86.MODEL_80386); cpu.assert(I386 && cpu.model >= X86.MODEL_80386);
cpu.pushWord(cpu.segGS.sel); cpu.pushWord(cpu.segGS.sel);
cpu.setGS(0); cpu.setGS(0);