From 823c9062ed0c071c0100c141fede0d1bd8b801c6 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Thu, 22 Oct 2015 18:00:16 -0700 Subject: [PATCH] Fix restartability of POP [mem] when a page fault occurs --- modules/pcjs/lib/x86ops.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/pcjs/lib/x86ops.js b/modules/pcjs/lib/x86ops.js index 92bc32bb1..ae0657991 100644 --- a/modules/pcjs/lib/x86ops.js +++ b/modules/pcjs/lib/x86ops.js @@ -2361,6 +2361,13 @@ X86.opPOPmw = function POPmw() * Like other MOV operations, the destination does not need to be read, just written. */ this.opFlags |= X86.OPFLAG.NOREAD; + + /* + * If the word we're about to pop FROM the stack gets popped INTO a not-present page, this + * instruction will not be restartable unless we snapshot regLSP first. + */ + this.opLSP = this.regLSP; + /* * A "clever" instruction like this: * @@ -2376,7 +2383,9 @@ X86.opPOPmw = function POPmw() * BEFORE the push, which occurs through our normal ModRM processing. */ this.regXX = this.popWord(); + this.aOpModGrpWord[this.getIPByte()].call(this, X86.aOpGrpPOPw, X86.fnSRCxx); + this.opLSP = X86.ADDR_INVALID; }; /**