]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuDxe.h
BaseTools: Library hashing fix and optimization for --hash feature
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuDxe.h
index 9baccb25657092ad1babef104be876cdbef6c5a8..b029be430b4c5ea1497dcf8a3b1ec9cd152d3856 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
-  CPU DXE Module.\r
+  CPU DXE Module to produce CPU ARCH Protocol and CPU MP Protocol.\r
 \r
-  Copyright (c) 2008 - 2012, 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
+  Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include <PiDxe.h>\r
 \r
 #include <Protocol/Cpu.h>\r
+#include <Protocol/MpService.h>\r
+#include <Register/Msr.h>\r
+\r
+#include <Ppi/SecPlatformInformation.h>\r
+#include <Ppi/SecPlatformInformation2.h>\r
 \r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/MtrrLib.h>\r
 #include <Library/LocalApicLib.h>\r
-#include <Guid/IdleLoopEvent.h>\r
+#include <Library/UefiCpuLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/CpuExceptionHandlerLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/MpInitLib.h>\r
+#include <Library/TimerLib.h>\r
 \r
-//\r
-//\r
-//\r
-#define INTERRUPT_VECTOR_NUMBER   256\r
+#include <Guid/IdleLoopEvent.h>\r
+#include <Guid/VectorHandoffTable.h>\r
 \r
 #define EFI_MEMORY_CACHETYPE_MASK     (EFI_MEMORY_UC  | \\r
                                        EFI_MEMORY_WC  | \\r
                                        EFI_MEMORY_UCE   \\r
                                        )\r
 \r
+#define EFI_MEMORY_PAGETYPE_MASK      (EFI_MEMORY_RP  | \\r
+                                       EFI_MEMORY_XP  | \\r
+                                       EFI_MEMORY_RO    \\r
+                                       )\r
+\r
+#define HEAP_GUARD_NONSTOP_MODE       \\r
+        ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT4|BIT1|BIT0)) > BIT6)\r
+\r
+#define NULL_DETECTION_NONSTOP_MODE   \\r
+        ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT6|BIT0)) > BIT6)\r
 \r
 /**\r
   Flush CPU data cache. If the instruction cache is fully coherent\r
@@ -220,72 +233,80 @@ CpuSetMemoryAttributes (
   );\r
 \r
 /**\r
-  Label of base address of IDT vector 0.\r
-\r
-  This is just a label of base address of IDT vector 0.\r
+  Initialize Global Descriptor Table.\r
 \r
 **/\r
 VOID\r
-EFIAPI\r
-AsmIdtVector00 (\r
+InitGlobalDescriptorTable (\r
   VOID\r
   );\r
 \r
 /**\r
-  Initializes the pointer to the external interrupt vector table.\r
+  Sets the code selector (CS).\r
 \r
-  @param  VectorTable  Address of the external interrupt vector table.\r
+  @param  Selector  Value of code selector.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-InitializeExternalVectorTablePtr (\r
-  EFI_CPU_INTERRUPT_HANDLER  *VectorTable\r
+SetCodeSelector (\r
+  UINT16 Selector\r
   );\r
 \r
 /**\r
-  Initialize Global Descriptor Table.\r
+  Sets the data selector (DS).\r
+\r
+  @param  Selector  Value of data selector.\r
 \r
 **/\r
 VOID\r
-InitGlobalDescriptorTable (\r
-  VOID\r
+EFIAPI\r
+SetDataSelectors (\r
+  UINT16 Selector\r
   );\r
 \r
 /**\r
-  Sets the code selector (CS).\r
-\r
-  @param  Selector  Value of code selector.\r
-\r
+  Update GCD memory space attributes according to current page table setup.\r
 **/\r
 VOID\r
-EFIAPI\r
-SetCodeSelector (\r
-  UINT16 Selector\r
+RefreshGcdMemoryAttributesFromPaging (\r
+  VOID\r
   );\r
 \r
 /**\r
-  Sets the data selector (DS).\r
+  Special handler for #DB exception, which will restore the page attributes\r
+  (not-present). It should work with #PF handler which will set pages to\r
+  'present'.\r
 \r
-  @param  Selector  Value of data selector.\r
+  @param ExceptionType  Exception type.\r
+  @param SystemContext  Pointer to EFI_SYSTEM_CONTEXT.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-SetDataSelectors (\r
-  UINT16 Selector\r
+DebugExceptionHandler (\r
+  IN EFI_EXCEPTION_TYPE   ExceptionType,\r
+  IN EFI_SYSTEM_CONTEXT   SystemContext\r
   );\r
 \r
 /**\r
-  Restore original Interrupt Descriptor Table Handler Address.\r
+  Special handler for #PF exception, which will set the pages which caused\r
+  #PF to be 'present'. The attribute of those pages should be restored in\r
+  the subsequent #DB handler.\r
 \r
-  @param Index        The Index of the interrupt descriptor table handle.\r
+  @param ExceptionType  Exception type.\r
+  @param SystemContext  Pointer to EFI_SYSTEM_CONTEXT.\r
 \r
 **/\r
 VOID\r
-RestoreInterruptDescriptorTableHandlerAddress (\r
-  IN UINTN       Index\r
+EFIAPI\r
+PageFaultExceptionHandler (\r
+  IN EFI_EXCEPTION_TYPE   ExceptionType,\r
+  IN EFI_SYSTEM_CONTEXT   SystemContext\r
   );\r
 \r
+extern BOOLEAN mIsAllocatingPageTable;\r
+extern UINTN   mNumberOfProcessors;\r
+\r
 #endif\r
 \r