MdePkg/BaseLib: Add support for the XGETBV instruction
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Under SEV-ES, a CPUID instruction requires the current value of the XCR0 register. In order to retrieve that value, the XGETBV instruction needs to be executed. Provide the necessary support to execute the XGETBV instruction. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
b098f5e9e9
commit
9b3ca509ab
34
MdePkg/Library/BaseLib/X64/XGetBv.nasm
Normal file
34
MdePkg/Library/BaseLib/X64/XGetBv.nasm
Normal file
@@ -0,0 +1,34 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; XGetBv.Asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; AsmXgetBv function
|
||||
;
|
||||
; Notes:
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
DEFAULT REL
|
||||
SECTION .text
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; UINT64
|
||||
; EFIAPI
|
||||
; AsmXGetBv (
|
||||
; IN UINT32 Index
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
global ASM_PFX(AsmXGetBv)
|
||||
ASM_PFX(AsmXGetBv):
|
||||
xgetbv
|
||||
shl rdx, 32
|
||||
or rax, rdx
|
||||
ret
|
||||
|
Reference in New Issue
Block a user