https://git.reactos.org/?p=reactos.git;a=commitdiff;h=656a5dcc1fd6fac455a469a39383ceeb4533f1f7
commit 656a5dcc1fd6fac455a469a39383ceeb4533f1f7 Author: Justin Miller <justin.mil...@reactos.org> AuthorDate: Wed Mar 12 05:24:36 2025 -0700 Commit: GitHub <nore...@github.com> CommitDate: Wed Mar 12 05:24:36 2025 -0700 [NTOS:KE] Implement KeI386VirtualIntExtensions code paths for INT and IRET. CORE-19049 (#7742) Co-authored-by: Thomas Faber <thomas.fa...@reactos.org> Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-ma...@reactos.org> Continued from PR #6070 JIRA issue: CORE-19049 --- ntoskrnl/ke/i386/v86vdm.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/ntoskrnl/ke/i386/v86vdm.c b/ntoskrnl/ke/i386/v86vdm.c index a50f3aba188..b4790d146f6 100644 --- a/ntoskrnl/ke/i386/v86vdm.c +++ b/ntoskrnl/ke/i386/v86vdm.c @@ -191,13 +191,21 @@ KiVdmOpcodeINTnn(IN PKTRAP_FRAME TrapFrame, V86EFlags &= (EFLAGS_ALIGN_CHECK | EFLAGS_INTERRUPT_MASK); /* Check for VME support */ - ASSERT(KeI386VirtualIntExtensions == FALSE); + if (KeI386VirtualIntExtensions) + { + /* Set IF based on VIF */ + V86EFlags &= ~EFLAGS_INTERRUPT_MASK; + if (TrapEFlags & EFLAGS_VIF) + { + V86EFlags |= EFLAGS_INTERRUPT_MASK; + } + } /* Mask in the relevant V86 EFlags into the trap flags */ V86EFlags |= (TrapEFlags & ~EFLAGS_INTERRUPT_MASK); /* And mask out the VIF, nested task and TF flag from the trap flags */ - TrapFrame->EFlags = TrapEFlags &~ (EFLAGS_VIF | EFLAGS_NESTED_TASK | EFLAGS_TF); + TrapFrame->EFlags = TrapEFlags & ~(EFLAGS_VIF | EFLAGS_NESTED_TASK | EFLAGS_TF); /* Add the IOPL flag to the local trap flags */ V86EFlags |= EFLAGS_IOPL; @@ -299,11 +307,17 @@ KiVdmOpcodeIRET(IN PKTRAP_FRAME TrapFrame, } /* Mask out EFlags */ - EFlags &= ~(EFLAGS_IOPL + EFLAGS_VIF + EFLAGS_NESTED_TASK + EFLAGS_VIP); + EFlags &= ~(EFLAGS_VIP | EFLAGS_VIF | EFLAGS_NESTED_TASK | EFLAGS_IOPL); V86EFlags = EFlags; /* Check for VME support */ - ASSERT(KeI386VirtualIntExtensions == FALSE); + if (KeI386VirtualIntExtensions) + { + if (EFlags & EFLAGS_INTERRUPT_MASK) + { + EFlags |= EFLAGS_VIF; + } + } /* Add V86 and Interrupt flag */ EFlags |= EFLAGS_V86_MASK | EFLAGS_INTERRUPT_MASK;