]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuMpPei: Get AP reset code size and far jump information
authorJeff Fan <jeff.fan@intel.com>
Wed, 15 Jul 2015 03:37:25 +0000 (03:37 +0000)
committervanjeff <vanjeff@Edk2>
Wed, 15 Jul 2015 03:37:25 +0000 (03:37 +0000)
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

UefiCpuPkg/CpuMpPei/CpuMpPei.h
UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm
UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm
UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm
UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm

index 146422c2b5b60dcf8532970444bb89062852f66f..7c96084ca2a1216b1209b243633686b2e87fc8bd 100644 (file)
 #include <Library/PeimEntryPoint.h>
 #include <Library/UefiCpuLib.h>
 
 #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 {
 #pragma pack(1)
 
 typedef union {
@@ -62,6 +72,19 @@ typedef struct {
 } MP_CPU_EXCHANGE_INFO;
 
 #pragma pack()
 } 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.
 
 /**
   Assembly code to load GDT table and update segment accordingly.
 
index 4dc7191b801bf644223dd9e69510e7a67c587917..9861472509358f978cc9867f141a0773023d7c41 100644 (file)
@@ -144,6 +144,22 @@ CProcedureInvoke:
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
 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
 
 AsmInitializeGdt   PROC  near C  PUBLIC
   push         ebp
index 4a1aa71b8d3852da3e7d9a32f3e6b01d116ab3fd..a3c4ae9e58d91f3ea0982a2e368f4c6170ba5e00 100644 (file)
@@ -132,6 +132,22 @@ CProcedureInvoke:
     jmp        $                 ; never reach here
 RendezvousFunnelProcEnd:
 
     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):
 
 global ASM_PFX(AsmInitializeGdt)
 ASM_PFX(AsmInitializeGdt):
index 425bc202fdea4401d3bd26e6ceb684b7461f3a3d..9e85fac435fdacd19932e286afceb89a484eb999 100644 (file)
@@ -181,6 +181,17 @@ CProcedureInvoke:
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
 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
 
 AsmInitializeGdt   PROC
     push       rbp
index 3ddf26c29dc7eb6e92c1faf9d738b9f49cc8c071..09c2fbc15ec4bfb77daae244d7e0bf042d4fdd78 100644 (file)
@@ -175,6 +175,17 @@ CProcedureInvoke:
 
 RendezvousFunnelProcEnd:
 
 
 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):
 
 global ASM_PFX(AsmInitializeGdt)
 ASM_PFX(AsmInitializeGdt):