On 8/6/25 09:58, Zero Tang wrote:
  Replaces "long" with "int64_t" during canonicalization.

  ---
  In Linux GCC, "long" has 8 bytes. However, in msys2 GCC, "long" has 4
  bytes. In this case, canonicalization would set all high bits to 1 when
  the segment base is bigger than 0x7FFF (assuming 48-bit linear address).

  This is why QEMU-TCG in Windows cannot boot a bluepill-like hypervisor
  in UEFI, in that the guest IDT and GDT bases are above 0x7FFF, thereby
  resulting in incorrect bases. When an interrupt arrives, it would
  trigger a #PF exception; the #PF would trigger again, resulting in a #DF
  exception; the #PF would trigger for the third time, resulting in
  triple-fault, and eventually causes the shutdown VM-Exit to the
  bluepill hypervisor right after it boots.

  In summary, this patch replaces "long" with "int64_t" in order to enforce
  the canonicalization with 64-bit signed integers.

  Signed-off-by: Zero Tang <zero.tang...@gmail.com>
Queued, thanks. However, please note that the patch is not formatted correctly; do not send patches as HTML mail. In this case it was one line of code only so I fixed it up.

Paolo


Reply via email to