diff options
author | Jeff Fan <jeff.fan@intel.com> | 2015-07-15 03:37:25 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-07-15 03:37:25 +0000 |
commit | 8018cb158ccd3b466692533532edcd534d4704ff (patch) | |
tree | f478ff6d205efc5a0d49b4ffe477dd1a7d2fb118 | |
parent | 46ba0f63e9adaa2147366fcbd68c1c6f672b647b (diff) | |
download | edk2-platforms-8018cb158ccd3b466692533532edcd534d4704ff.tar.xz |
UefiCpuPkg/CpuMpPei: Get AP reset code size and far jump information
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17994 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | UefiCpuPkg/CpuMpPei/CpuMpPei.h | 23 | ||||
-rw-r--r-- | UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm | 16 | ||||
-rw-r--r-- | UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm | 16 | ||||
-rw-r--r-- | UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm | 11 | ||||
-rw-r--r-- | UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm | 11 |
5 files changed, 77 insertions, 0 deletions
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index 146422c2b5..7c96084ca2 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h @@ -23,6 +23,16 @@ #include <Library/PeimEntryPoint.h> #include <Library/UefiCpuLib.h> +// +// AP reset code information +// +typedef struct { + UINT8 *RendezvousFunnelAddress; + UINTN PModeEntryOffset; + UINTN LModeEntryOffset; + UINTN RendezvousFunnelSize; +} MP_ASSEMBLY_ADDRESS_MAP; + #pragma pack(1) typedef union { @@ -62,6 +72,19 @@ typedef struct { } MP_CPU_EXCHANGE_INFO; #pragma pack() + +/** + Assembly code to get starting address and size of the rendezvous entry for APs. + Information for fixing a jump instruction in the code is also returned. + + @param AddressMap Output buffer for address map information. +**/ +VOID +EFIAPI +AsmGetAddressMap ( + OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap + ); + /** Assembly code to load GDT table and update segment accordingly. diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm index 4dc7191b80..9861472509 100644 --- a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm +++ b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm @@ -144,6 +144,22 @@ CProcedureInvoke: RendezvousFunnelProc ENDP RendezvousFunnelProcEnd:: +;------------------------------------------------------------------------------------- +; AsmGetAddressMap (&AddressMap); +;------------------------------------------------------------------------------------- +AsmGetAddressMap PROC near C PUBLIC + pushad + mov ebp,esp + + mov ebx, dword ptr [ebp+24h] + mov dword ptr [ebx], RendezvousFunnelProcStart + mov dword ptr [ebx + 4h], Flat32Start - RendezvousFunnelProcStart + mov dword ptr [ebx + 8h], 0 + mov dword ptr [ebx + 0ch], RendezvousFunnelProcEnd - RendezvousFunnelProcStart + + popad + ret +AsmGetAddressMap ENDP AsmInitializeGdt PROC near C PUBLIC push ebp diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm index 4a1aa71b8d..a3c4ae9e58 100644 --- a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm @@ -132,6 +132,22 @@ CProcedureInvoke: jmp $ ; never reach here RendezvousFunnelProcEnd: +;------------------------------------------------------------------------------------- +; AsmGetAddressMap (&AddressMap); +;------------------------------------------------------------------------------------- +global ASM_PFX(AsmGetAddressMap) +ASM_PFX(AsmGetAddressMap): + pushad + mov ebp,esp + + mov ebx, [ebp + 24h] + mov dword [ebx], RendezvousFunnelProcStart + mov dword [ebx + 4h], Flat32Start - RendezvousFunnelProcStart + mov dword [ebx + 8h], 0 + mov dword [ebx + 0ch], RendezvousFunnelProcEnd - RendezvousFunnelProcStart + + popad + ret global ASM_PFX(AsmInitializeGdt) ASM_PFX(AsmInitializeGdt): diff --git a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm index 425bc202fd..9e85fac435 100644 --- a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm +++ b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm @@ -181,6 +181,17 @@ CProcedureInvoke: RendezvousFunnelProc ENDP RendezvousFunnelProcEnd:: +;------------------------------------------------------------------------------------- +; AsmGetAddressMap (&AddressMap); +;------------------------------------------------------------------------------------- +AsmGetAddressMap PROC + mov rax, offset RendezvousFunnelProcStart + mov qword ptr [rcx], rax + mov qword ptr [rcx + 8h], Flat32Start - RendezvousFunnelProcStart + mov qword ptr [rcx + 10h], LongModeStart - RendezvousFunnelProcStart + mov qword ptr [rcx + 18h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart + ret +AsmGetAddressMap ENDP AsmInitializeGdt PROC push rbp diff --git a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm index 3ddf26c29d..09c2fbc15e 100644 --- a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm +++ b/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm @@ -175,6 +175,17 @@ CProcedureInvoke: RendezvousFunnelProcEnd: +;------------------------------------------------------------------------------------- +; AsmGetAddressMap (&AddressMap); +;------------------------------------------------------------------------------------- +global ASM_PFX(AsmGetAddressMap) +ASM_PFX(AsmGetAddressMap): + mov rax, ASM_PFX(RendezvousFunnelProc) + mov qword [rcx], rax + mov qword [rcx + 8h], Flat32Start - RendezvousFunnelProcStart + mov qword [rcx + 10h], LongModeStart - RendezvousFunnelProcStart + mov qword [rcx + 18h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart + ret global ASM_PFX(AsmInitializeGdt) ASM_PFX(AsmInitializeGdt): |