audk/MdePkg/Library/BaseLib/X64/XSetBv.nasm
Jiaxin Wu 4ac0296201 MdePkg/BaseLib: Add support for the XSETBV instruction
*v2: refine the coding format.

https://bugzilla.tianocore.org/show_bug.cgi?id=3284

This patch is to support XSETBV instruction so as to support
Extended Control Register(XCR) write.

Extended Control Register(XCR) read has already been supported
by below commit to support XGETBV instruction:
9b3ca509abd4e45439bbdfe2c2fa8780c950320a

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ni Ray <ray.ni@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Signed-off-by: Jiaxin Wu <Jiaxin.wu@intel.com>
Signed-off-by: Zhang Hongbin1 <hongbin1.zhang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-04-06 00:43:49 +00:00

35 lines
891 B
NASM

;------------------------------------------------------------------------------
;
; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; XSetBv.nasm
;
; Abstract:
;
; AsmXSetBv function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmXSetBv (
; IN UINT32 Index,
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmXSetBv)
ASM_PFX(AsmXSetBv):
mov rax, rdx ; meanwhile, rax <- return value
shr rdx, 0x20 ; edx:eax contains the value to write
xsetbv
ret