Skip to content

Commit

Permalink
Merge part of PR by rei141
Browse files Browse the repository at this point in the history
Fixes in VM Entry Checks for Guest Segment Registers #51

Correction in Type range checks for DS, ES, FS, GS:
The original code erroneously applied the check for types less than 11, excluding types equal to 11.
This is not in accordance with Intel SDM, Vol. 3C, Chapter 27.3.1.2, which states that the check should include types equal to or less than 11.
This fix corrects this by including types equal to or less than 11 in the check.
  • Loading branch information
Stanislav Shwartsman committed Aug 20, 2023
1 parent 4b7e61d commit 58c047c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bochs/cpu/vmx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
}

if (! (vm->vmexec_ctrls3 & VMX_VM_EXEC_CTRL3_UNRESTRICTED_GUEST)) {
if (guest.sregs[n].cache.type < 11) {
if (guest.sregs[n].cache.type <= 11) {
// data segment or non-conforming code segment
if (guest.sregs[n].selector.rpl > guest.sregs[n].cache.dpl) {
BX_ERROR(("VMENTER FAIL: VMCS guest non-conforming %s.RPL < %s.DPL", segname[n], segname[n]));
Expand Down

0 comments on commit 58c047c

Please sign in to comment.