summaryrefslogtreecommitdiffstats
path: root/MdePkg/Include
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2020-08-12 15:21:35 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-08-16 16:45:42 +0000
commit9b3ca509abd4e45439bbdfe2c2fa8780c950320a (patch)
tree87c6b6e7e4f3b47624a2ff87a5e3990e6de5a46e /MdePkg/Include
parentb098f5e9e90537524929f7917f28bb9472b5eb59 (diff)
downloadedk2-9b3ca509abd4e45439bbdfe2c2fa8780c950320a.tar.gz
edk2-9b3ca509abd4e45439bbdfe2c2fa8780c950320a.tar.bz2
edk2-9b3ca509abd4e45439bbdfe2c2fa8780c950320a.zip
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>
Diffstat (limited to 'MdePkg/Include')
-rw-r--r--MdePkg/Include/Library/BaseLib.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 8e7b87cbda..7edf0051a0 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -7832,6 +7832,23 @@ AsmLfence (
);
/**
+ Executes a XGETBV instruction
+
+ Executes a XGETBV instruction. This function is only available on IA-32 and
+ x64.
+
+ @param[in] Index Extended control register index
+
+ @return The current value of the extended control register
+**/
+UINT64
+EFIAPI
+AsmXGetBv (
+ IN UINT32 Index
+ );
+
+
+/**
Patch the immediate operand of an IA32 or X64 instruction such that the byte,
word, dword or qword operand is encoded at the end of the instruction's
binary representation.