mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86emul: correct PUSHF/POPF
Both need to raise #GP(0) when in VM86 mode with IOPL < 3.
Additionally PUSHF is documented to clear VM and RF from the value
placed onto the stack.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: e5c1b8145b
master date: 2016-12-07 13:55:42 +0100
This commit is contained in:
1 parent
fd869a6ec7
commit
ff555d59e8
1 file changed
+8
-1
@@ -2563,13 +2563,20 @@ x86_emulate(
|
||||
}
|
||||
|
||||
case 0x9c: /* pushf */
|
||||
src.val = _regs.eflags;
|
||||
generate_exception_if((_regs.eflags & EFLG_VM) &&
|
||||
MASK_EXTR(_regs.eflags, EFLG_IOPL) != 3,
|
||||
EXC_GP, 0);
|
||||
src.val = _regs.eflags & ~(EFLG_VM | EFLG_RF);
|
||||
goto push;
|
||||
|
||||
case 0x9d: /* popf */ {
|
||||
uint32_t mask = EFLG_VIP | EFLG_VIF | EFLG_VM;
|
||||
|
||||
if ( !mode_ring0() )
|
||||
{
|
||||
generate_exception_if((_regs.eflags & EFLG_VM) &&
|
||||
MASK_EXTR(_regs.eflags, EFLG_IOPL) != 3,
|
||||
EXC_GP, 0);
|
||||
mask |= EFLG_IOPL;
|
||||
if ( !mode_iopl() )
|
||||
mask |= EFLG_IF;
|
||||
|
||||