]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmProfileArch.c
UefiCpuPkg: Add PiSmmCpuDxeSmm module IA32 files
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / SmmProfileArch.c
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmProfileArch.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmProfileArch.c
new file mode 100644 (file)
index 0000000..85756d0
--- /dev/null
@@ -0,0 +1,80 @@
+/** @file\r
+IA-32 processor specific functions to enable SMM profile.\r
+\r
+Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "PiSmmCpuDxeSmm.h"\r
+#include "SmmProfileInternal.h"\r
+\r
+/**\r
+  Create SMM page table for S3 path.\r
+\r
+**/\r
+VOID\r
+InitSmmS3Cr3 (\r
+  VOID\r
+  )\r
+{\r
+  mSmmS3ResumeState->SmmS3Cr3 = Gen4GPageTable (0);\r
+\r
+  return ;\r
+}\r
+\r
+/**\r
+  Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.\r
+  32-bit firmware does not need it.\r
+\r
+**/\r
+VOID\r
+InitPagesForPFHandler (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
+/**\r
+  Update page table to map the memory correctly in order to make the instruction\r
+  which caused page fault execute successfully. And it also save the original page\r
+  table to be restored in single-step exception. 32-bit firmware does not need it.\r
+\r
+  @param  PageTable           PageTable Address.\r
+  @param  PFAddress           The memory address which caused page fault exception.\r
+  @param  CpuIndex            The index of the processor.\r
+  @param  ErrorCode           The Error code of exception.\r
+  @param  IsValidPFAddress    The flag indicates if SMM profile data need be added.\r
+\r
+**/\r
+VOID\r
+RestorePageTableAbove4G (\r
+  UINT64        *PageTable,\r
+  UINT64        PFAddress,\r
+  UINTN         CpuIndex,\r
+  UINTN         ErrorCode,\r
+  BOOLEAN       *IsValidPFAddress\r
+  )\r
+{\r
+}\r
+\r
+/**\r
+  Clear TF in FLAGS.\r
+\r
+  @param  SystemContext    A pointer to the processor context when\r
+                           the interrupt occurred on the processor.\r
+\r
+**/\r
+VOID\r
+ClearTrapFlag (\r
+  IN OUT EFI_SYSTEM_CONTEXT   SystemContext\r
+  )\r
+{\r
+  SystemContext.SystemContextIa32->Eflags &= (UINTN) ~BIT8;\r
+}\r