]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/WriteCr4.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / WriteCr4.c
1 /** @file
2 AsmWriteCr4 function
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 /**
10 Writes a value to Control Register 4 (CR4).
11
12 Writes and returns a new value to CR4. This function is only available on
13 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
14
15 @param Value The value to write to CR4.
16
17 @return The value written to CR4.
18
19 **/
20 UINTN
21 EFIAPI
22 AsmWriteCr4 (
23 UINTN Value
24 )
25 {
26 _asm {
27 mov eax, Value
28 _emit 0x0f // mov cr4, eax
29 _emit 0x22
30 _emit 0xE0
31 }
32 }