]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
• Set the default value of PcdDxeIplSwitchToLongMode to TRUE.
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / Ipf / DxeLoadFunc.c
index 079ae924da9a181f7e800b28016c37a22483010e..e53f708fd419c56ede18bb09031b0c7ce4c9034c 100644 (file)
@@ -21,91 +21,44 @@ Abstract:
 \r
 #include "DxeIpl.h"\r
 \r
-EFI_STATUS\r
-CreateArchSpecificHobs (\r
-  OUT EFI_PHYSICAL_ADDRESS      *BspStore\r
+VOID\r
+HandOffToDxeCore (\r
+  IN EFI_PHYSICAL_ADDRESS   DxeCoreEntryPoint,\r
+  IN EFI_PEI_HOB_POINTERS   HobList\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Creates architecture-specific HOBs.\r
-\r
-  Note: New parameters should NOT be added for any HOBs that are added to this\r
-        function.  BspStore is a special case because it is required for the\r
-        call to SwitchStacks() in DxeLoad().\r
-\r
-Arguments:\r
-\r
-  BspStore    - The address of the BSP Store for those architectures that need\r
-                it.  Otherwise 0.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS   - The HOBs were created successfully.\r
-\r
---*/\r
 {\r
-  EFI_STATUS  Status;\r
+  VOID                *BaseOfStack;\r
+  VOID                *TopOfStack;\r
+  VOID                *BspStore;\r
 \r
-  Status = EFI_SUCCESS;\r
-\r
-  ASSERT (NULL != BspStore);\r
+  //\r
+  // Allocate 128KB for the Stack\r
+  //\r
+  BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));\r
+  ASSERT (BaseOfStack != NULL);\r
 \r
   //\r
   // Allocate 16KB for the BspStore\r
   //\r
-  Status = PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (BSP_STORE_SIZE), BspStore);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  BuildBspStoreHob (\r
-    *BspStore,\r
-    BSP_STORE_SIZE,\r
-    EfiBootServicesData\r
-    );\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Transfers control to a function starting with a new stack.\r
-\r
-  Transfers control to the function specified by EntryPoint using the new stack\r
-  specified by NewStack and passing in the parameters specified by Context1 and\r
-  Context2. Context1 and Context2 are optional and may be NULL. The function\r
-  EntryPoint must never return.\r
-\r
-  If EntryPoint is NULL, then ASSERT().\r
-  If NewStack is NULL, then ASSERT().\r
+  BspStore    = AllocatePages (EFI_SIZE_TO_PAGES (BSP_STORE_SIZE));\r
+  ASSERT (BspStore != NULL);\r
+  //\r
+  // Build BspStoreHob\r
+  //\r
+  BuildBspStoreHob ((EFI_PHYSICAL_ADDRESS) (UINTN) BspStore, BSP_STORE_SIZE, EfiBootServicesData);\r
 \r
-  @param  EntryPoint  A pointer to function to call with the new stack.\r
-  @param  Context1    A pointer to the context to pass into the EntryPoint\r
-                      function.\r
-  @param  Context2    A pointer to the context to pass into the EntryPoint\r
-                      function.\r
-  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
-                      function.\r
-  @param  NewBsp      A pointer to the new BSP for the EntryPoint on IPF. It's\r
-                      Reserved on other architectures.\r
+  //\r
+  // Compute the top of the stack we were allocated. Pre-allocate a UINTN\r
+  // for safety.\r
+  //\r
+  TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);\r
+  TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r
 \r
-**/\r
-VOID\r
-EFIAPI\r
-SwitchIplStacks (\r
-  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
-  IN      VOID                      *Context1,  OPTIONAL\r
-  IN      VOID                      *Context2,  OPTIONAL\r
-  IN      VOID                      *NewStack,\r
-  IN      VOID                      *NewBsp\r
-  )\r
-{\r
   AsmSwitchStackAndBackingStore (\r
-    EntryPoint,\r
-    Context1,\r
-    Context2,\r
-    NewStack,\r
-    NewBsp\r
+    (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
+    HobList.Raw,\r
+    NULL,\r
+    TopOfStack,\r
+    BspStore\r
     );\r
 }\r