]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64
authorKun Qin <kun.q@outlook.com>
Fri, 18 Dec 2020 01:23:35 +0000 (17:23 -0800)
committerKun Qin <kun.q@outlook.com>
Mon, 1 Feb 2021 18:01:02 +0000 (10:01 -0800)
This change extends StandaloneMmCoreEntryPoint library to support X64
architecture.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c [new file with mode: 0644]

index 75a654b06d51246a444aaff62df31ec1ca3f8290..313bc6f7bdad357326ac8edc5b2f04aace5ad2eb 100644 (file)
@@ -26,6 +26,9 @@
   AArch64/SetPermissions.c\r
   AArch64/CreateHobList.c\r
 \r
+[Sources.X64]\r
+  X64/StandaloneMmCoreEntryPoint.c\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c
new file mode 100644 (file)
index 0000000..dffa965
--- /dev/null
@@ -0,0 +1,71 @@
+/** @file\r
+  Entry point to the Standalone Mm Core.\r
+\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+\r
+#include <PiMm.h>\r
+\r
+#include <Library/StandaloneMmCoreEntryPoint.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseLib.h>\r
+\r
+//\r
+// Cache copy of HobList pointer.\r
+//\r
+VOID *gHobList = NULL;\r
+\r
+/**\r
+  The entry point of PE/COFF Image for the STANDALONE MM Core.\r
+\r
+  This function is the entry point for the STANDALONE MM Core. This function is required to call\r
+  ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return.\r
+  The STANDALONE MM Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI\r
+  System Table and the image handle for the STANDALONE MM Core itself have been established.\r
+  If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system.\r
+\r
+  @param  HobStart  Pointer to the beginning of the HOB List passed in from the PEI Phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN VOID  *HobStart\r
+  )\r
+{\r
+  //\r
+  // Cache a pointer to the HobList\r
+  //\r
+  gHobList = HobStart;\r
+\r
+  //\r
+  // Call the Standalone MM Core entry point\r
+  //\r
+  ProcessModuleEntryPointList (HobStart);\r
+\r
+  //\r
+  // TODO: Set page table here?? AARCH64 has this step for some reason\r
+  //\r
+}\r
+\r
+\r
+/**\r
+  Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().\r
+\r
+  This function is required to call _ModuleEntryPoint() passing in HobStart.\r
+\r
+  @param  HobStart  Pointer to the beginning of the HOB List passed in from the PEI Phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EfiMain (\r
+  IN VOID  *HobStart\r
+  )\r
+{\r
+  _ModuleEntryPoint (HobStart);\r
+}\r