Rolling out v1.19.8 (and cleaning up how gate frame size is tracked)

This commit is contained in:
Jeff Parsons 2015-10-21 10:47:37 -07:00
commit caccae5cc8
24 changed files with 6915 additions and 26 deletions

View file

@ -547,9 +547,9 @@ X86.fnCALLw = function(dst, src)
* 16-bit code segment, we must push 32-bit segment and offset values.
*
* TODO: Since setCSIP() already informs the segCS load() function when it's making a call, the load() function
* could automatically push the old CS and IP values *before* segCS is updated (which would be a better time to do
* this); unfortunately, load() is also used by loadIDT(), and loadIDT() has different requirements (eg, pushing
* flags first), so it's not a trivial change.
* could automatically push the old CS and IP values *before* segCS is updated -- which would be a better time to do
* those pushes AND eliminate the need for pushData(). Unfortunately, load() is also used by loadIDT(), and loadIDT()
* has different requirements (eg, pushing flags first), so it's not a trivial change.
*
* @this {X86CPU}
* @param {number} off
@ -560,7 +560,7 @@ X86.fnCALLF = function(off, sel)
/*
* Since we always push the return address AFTER calling setCSIP(), and since either push could trigger
* fault (eg, segment fault, page fault, etc), we must not only snapshot regLSP into opLSP, but also the
* current CS into opCS, so that fnFault() can make this CALL restartable.
* current CS into opCS, so that fnFault() can always make CALLF restartable.
*/
this.opCS = this.getCS();
this.opLSP = this.regLSP;
@ -1444,15 +1444,10 @@ X86.fnINT = function(nIDT, nError, nCycles)
var oldIP = this.getIP();
var addr = this.segCS.loadIDT(nIDT);
if (addr !== X86.ADDR_INVALID) {
/*
* TODO: Harmonize this with the code in fnCALLF(), which relies on the OPERAND size in
* effect at the time of the call, NOT the size of the new segCS.
*/
var size = this.segCS.sizeFrame;
this.pushData(oldPS, size);
this.pushData(oldCS, size);
this.pushData(oldIP, size);
if (nError != null) this.pushData(nError, size);
this.pushWord(oldPS);
this.pushWord(oldCS);
this.pushWord(oldIP);
if (nError != null) this.pushWord(nError);
this.nFault = -1;
/*
* TODO: Should this code be factored into a setLIP() function? The other primary client would be setCSIP().

View file

@ -128,7 +128,6 @@ function X86Seg(cpu, id, sName, fProt)
this.offIP = 0;
this.fCall = null;
this.fStackSwitch = false;
this.sizeFrame = 2; // must be set by all loadIDT() calls so that callers know the proper frame size
this.awParms = new Array(32);
this.aCallBreaks = [];
}
@ -301,7 +300,6 @@ X86Seg.prototype.loadIDTReal = function loadIDTReal(nIDT)
*/
var addrIDT = cpu.addrIDT + (nIDT << 2);
var off = cpu.getShort(addrIDT);
this.sizeFrame = 2;
cpu.regPS &= ~(X86.PS.TF | X86.PS.IF);
return (this.load(cpu.getShort(addrIDT + 2)) + off)|0;
};
@ -667,10 +665,8 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe)
case X86Seg.ID.CODE:
this.fStackSwitch = false;
this.sizeFrame = this.sizeData;
var fCall = this.fCall;
this.fStackSwitch = false;
/*
* This special bit of code is currently used only by the Debugger, when it needs to inject
@ -856,7 +852,7 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe)
return X86.ADDR_INVALID;
}
this.sizeFrame = sizeGate;
cpu.setDataSize(sizeGate);
this.offIP = limit;
cpu.assert(this.cpl == cplNew);
@ -880,12 +876,6 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe)
cpu.setSS(selStack, true);
cpu.setSP(offStack);
/*
* This call to resetSizes() used to appear before the parameter copying above, but
* anything that was pushed on the old stack would have been pushed with the old sizes.
*/
cpu.resetSizes();
if (regPS & X86.PS.VM) {
/*
* Frames coming from V86-mode ALWAYS contain 32-bit values, and look like this:
@ -902,7 +892,7 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe)
*
* Our caller (eg, fnINT()) will take care of pushing the final bits (EFLAGS, CS, and EIP).
*/
cpu.setDataSize(this.sizeFrame = 4);
cpu.setDataSize(4);
cpu.assert(I386 && cpu.model >= X86.MODEL_80386);
cpu.pushWord(cpu.segGS.sel);
cpu.setGS(0);