]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X86FxRestore.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / X86FxRestore.c
1 /** @file
2 IA-32/x64 AsmFxRestore()
3
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "BaseLibInternals.h"
10
11 /**
12 Restores the current floating point/SSE/SSE2 context from a buffer.
13
14 Restores the current floating point/SSE/SSE2 state from the buffer specified
15 by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
16 only available on IA-32 and x64.
17
18 If Buffer is NULL, then ASSERT().
19 If Buffer is not aligned on a 16-byte boundary, then ASSERT().
20 If Buffer was not saved with AsmFxSave(), then ASSERT().
21
22 @param Buffer A pointer to a buffer to save the floating point/SSE/SSE2 context.
23
24 **/
25 VOID
26 EFIAPI
27 AsmFxRestore (
28 IN CONST IA32_FX_BUFFER *Buffer
29 )
30 {
31 ASSERT (Buffer != NULL);
32 ASSERT (0 == ((UINTN)Buffer & 0xf));
33
34 //
35 // Check the flag recorded by AsmFxSave()
36 //
37 ASSERT (0xAA5555AA == *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
38
39 InternalX86FxRestore (Buffer);
40 }