CVSROOT:        /cvs
Module name:    src
Changes by:     bl...@cvs.openbsd.org   2025/07/14 16:14:20

Modified files:
        sys/arch/amd64/amd64: ghcb.c 

Log message:
SEV-ES guest: Fix GHCB trap frame synchronisation for 32-bit values.

In 64-bit mode, when performing 32-bit operations with a GPR
destination, the 32-bit value gets zero extended to the full 64-bit
destination size.  This means, unlike 8-bit or 16-bit values, the
upper 32 bits of the destination register are not retained for
32-bit values.

Therefore, when syncing values back to the stack frame, use a "all
1" mask to clear 32-bit values.

Thus duplicate mask array into two, one for syncing bits between
trap frame and GHCB and one for clearing bits from GHCB to the trap
frame.  In the latter use mask with 64 bit for 32-bit values.

reported Sebastian Sturm; from hshoexer@; OK mlarkin@ earlier diff

Reply via email to