]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
UefiCpuPkg/PiSmmCpu: Check EFI_RUNTIME_RO in UEFI mem attrib table.
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / PiSmmCpuDxeSmm.h
index cbaa513244d5a78d7a3b6b87c7115ab691001c4d..e3c7cff81cc232053a537493e29d466f3ffa390d 100644 (file)
@@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SmmMemoryAttribute.h>\r
 \r
 #include <Guid/AcpiS3Context.h>\r
+#include <Guid/MemoryAttributesTable.h>\r
 #include <Guid/PiSmmMemoryAttributesTable.h>\r
 \r
 #include <Library/BaseLib.h>\r
@@ -45,6 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/DebugAgentLib.h>\r
+#include <Library/UefiLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/LocalApicLib.h>\r
 #include <Library/UefiCpuLib.h>\r
@@ -295,23 +297,14 @@ WriteSaveStateRegister (
   IN CONST VOID                   *Buffer\r
   );\r
 \r
-//\r
-//\r
-//\r
-typedef struct {\r
-  UINT32                            Offset;\r
-  UINT16                            Segment;\r
-  UINT16                            Reserved;\r
-} IA32_FAR_ADDRESS;\r
-\r
-extern IA32_FAR_ADDRESS             gSmmJmpAddr;\r
-\r
 extern CONST UINT8                  gcSmmInitTemplate[];\r
 extern CONST UINT16                 gcSmmInitSize;\r
-extern UINT32                       gSmmCr0;\r
-extern UINT32                       gSmmCr3;\r
-extern UINT32                       gSmmCr4;\r
-extern UINTN                        gSmmInitStack;\r
+X86_ASSEMBLY_PATCH_LABEL            gPatchSmmCr0;\r
+extern UINT32                       mSmmCr0;\r
+X86_ASSEMBLY_PATCH_LABEL            gPatchSmmCr3;\r
+extern UINT32                       mSmmCr4;\r
+X86_ASSEMBLY_PATCH_LABEL            gPatchSmmCr4;\r
+X86_ASSEMBLY_PATCH_LABEL            gPatchSmmInitStack;\r
 \r
 /**\r
   Semaphore operation for all processor relocate SMMBase.\r
@@ -1079,7 +1072,7 @@ TransferApToSafeState (
   @retval EFI_UNSUPPORTED       The processor does not support one or more\r
                                 bytes of the memory resource range specified\r
                                 by BaseAddress and Length.\r
-                                The bit mask of attributes is not support for\r
+                                The bit mask of attributes is not supported for\r
                                 the memory resource range specified by\r
                                 BaseAddress and Length.\r
 \r
@@ -1101,17 +1094,17 @@ EdkiiSmmSetMemoryAttributes (
   @param  BaseAddress       The physical address that is the start address of\r
                             a memory region.\r
   @param  Length            The size in bytes of the memory region.\r
-  @param  Attributes        The bit mask of attributes to set for the memory\r
+  @param  Attributes        The bit mask of attributes to clear for the memory\r
                             region.\r
 \r
-  @retval EFI_SUCCESS           The attributes were set for the memory region.\r
+  @retval EFI_SUCCESS           The attributes were cleared for the memory region.\r
   @retval EFI_INVALID_PARAMETER Length is zero.\r
                                 Attributes specified an illegal combination of\r
-                                attributes that cannot be set together.\r
+                                attributes that cannot be cleared together.\r
   @retval EFI_UNSUPPORTED       The processor does not support one or more\r
                                 bytes of the memory resource range specified\r
                                 by BaseAddress and Length.\r
-                                The bit mask of attributes is not support for\r
+                                The bit mask of attributes is not supported for\r
                                 the memory resource range specified by\r
                                 BaseAddress and Length.\r
 \r
@@ -1126,7 +1119,7 @@ EdkiiSmmClearMemoryAttributes (
   );\r
 \r
 /**\r
-  This function retrieve the attributes of the memory region specified by\r
+  This function retrieves the attributes of the memory region specified by\r
   BaseAddress and Length. If different attributes are got from different part\r
   of the memory region, EFI_NO_MAPPING will be returned.\r
 \r
@@ -1144,9 +1137,6 @@ EdkiiSmmClearMemoryAttributes (
   @retval EFI_UNSUPPORTED       The processor does not support one or more\r
                                 bytes of the memory resource range specified\r
                                 by BaseAddress and Length.\r
-                                The bit mask of attributes is not support for\r
-                                the memory resource range specified by\r
-                                BaseAddress and Length.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1158,4 +1148,22 @@ EdkiiSmmGetMemoryAttributes (
   IN  UINT64                                *Attributes\r
   );\r
 \r
+/**\r
+  This function fixes up the address of the global variable or function\r
+  referred in SmmInit assembly files to be the absoute address.\r
+**/\r
+VOID\r
+EFIAPI\r
+PiSmmCpuSmmInitFixupAddress (\r
+ );\r
+\r
+/**\r
+  This function fixes up the address of the global variable or function\r
+  referred in SmiEntry assembly files to be the absoute address.\r
+**/\r
+VOID\r
+EFIAPI\r
+PiSmmCpuSmiEntryFixupAddress (\r
+ );\r
+\r
 #endif\r