From 46ba0f63e9adaa2147366fcbd68c1c6f672b647b Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Wed, 15 Jul 2015 03:36:51 +0000 Subject: UefiCpuPkg/CpuMpPei: Initialize FPU per UEFI specification Invoke InitializeFloatingPointUnits() to initialize FPU per UEFI specification before call C function in assembly code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17993 6f19259b-4bc3-4df7-8a09-765794883524 --- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 1 + UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 1 + UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm | 3 +++ UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm | 3 +++ UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm | 6 ++++++ UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm | 5 +++++ 6 files changed, 19 insertions(+) (limited to 'UefiCpuPkg/CpuMpPei') diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index 3f4fa92fc1..146422c2b5 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h @@ -21,6 +21,7 @@ #include #include #include +#include #pragma pack(1) diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf index 7cf33d3249..9fb9e945a8 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf @@ -51,6 +51,7 @@ BaseLib HobLib PeimEntryPoint + UefiCpuLib diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm index c8bdc52e95..4dc7191b80 100644 --- a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm +++ b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm @@ -22,6 +22,7 @@ .model flat include MpEqu.inc +InitializeFloatingPointUnits PROTO C .code @@ -124,6 +125,8 @@ CProcedureInvoke: push ebp mov ebp, esp + mov eax, InitializeFloatingPointUnits + call eax ; Call assembly function to initialize FPU per UEFI spec push ebx ; Push NumApsExecuting mov eax, esi diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm index 379f13e6db..4a1aa71b8d 100644 --- a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm @@ -19,6 +19,7 @@ ;------------------------------------------------------------------------------- %include "MpEqu.inc" +extern ASM_PFX(InitializeFloatingPointUnits) SECTION .text @@ -114,6 +115,8 @@ CProcedureInvoke: push ebp mov ebp, esp + mov eax, ASM_PFX(InitializeFloatingPointUnits) + call eax ; Call assembly function to initialize FPU per UEFI spec push ebx ; Push NumApsExecuting mov eax, esi diff --git a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm index 5425547634..425bc202fd 100644 --- a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm +++ b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm @@ -19,6 +19,8 @@ ;------------------------------------------------------------------------------- include MpEqu.inc +extern InitializeFloatingPointUnits:PROC + .code ;------------------------------------------------------------------------------------- ;RendezvousFunnelProc procedure follows. All APs execute their procedure. This @@ -158,6 +160,10 @@ CProcedureInvoke: push rbp mov rbp, rsp + mov rax, InitializeFloatingPointUnits + sub rsp, 20h + call rax ; Call assembly function to initialize FPU per UEFI spec + add rsp, 20h mov edx, ebx ; edx is NumApsExecuting mov ecx, esi diff --git a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm index 99669ce95e..3ddf26c29d 100644 --- a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm +++ b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm @@ -19,6 +19,7 @@ ;------------------------------------------------------------------------------- %include "MpEqu.inc" +extern ASM_PFX(InitializeFloatingPointUnits) DEFAULT REL @@ -155,6 +156,10 @@ CProcedureInvoke: push rbp mov rbp, rsp + mov rax, ASM_PFX(InitializeFloatingPointUnits) + sub rsp, 20h + call rax ; Call assembly function to initialize FPU per UEFI spec + add rsp, 20h mov edx, ebx ; edx is NumApsExecuting mov ecx, esi -- cgit v1.2.3