UINT8 *GdtBuffer;\r
UINT8 *StackTop;\r
\r
- if (!PcdGetBool (PcdCpuStackGuard)) {\r
- return;\r
- }\r
-\r
ExceptionNumber = FixedPcdGetSize (PcdCpuStackSwitchExceptionList);\r
NewStackSize = FixedPcdGet32 (PcdCpuKnownGoodStackSize) * ExceptionNumber;\r
\r
}\r
}\r
\r
+/**\r
+ Initializes MP exceptions handlers for special features, such as Heap Guard\r
+ and Stack Guard.\r
+**/\r
+VOID\r
+InitializeMpExceptionHandlers (\r
+ VOID\r
+ )\r
+{\r
+ //\r
+ // Enable non-stop mode for #PF triggered by Heap Guard or NULL Pointer\r
+ // Detection.\r
+ //\r
+ if (HEAP_GUARD_NONSTOP_MODE || NULL_DETECTION_NONSTOP_MODE) {\r
+ RegisterCpuInterruptHandler (EXCEPT_IA32_DEBUG, DebugExceptionHandler);\r
+ RegisterCpuInterruptHandler (EXCEPT_IA32_PAGE_FAULT, PageFaultExceptionHandler);\r
+ }\r
+\r
+ //\r
+ // Setup stack switch for Stack Guard feature.\r
+ //\r
+ if (PcdGetBool (PcdCpuStackGuard)) {\r
+ InitializeMpExceptionStackSwitchHandlers ();\r
+ }\r
+}\r
+\r
/**\r
Initialize Multi-processor support.\r
\r
DEBUG ((DEBUG_INFO, "Detect CPU count: %d\n", mNumberOfProcessors));\r
\r
//\r
- // Initialize exception stack switch handlers for each logic processor.\r
+ // Initialize special exception handlers for each logic processor.\r
//\r
- InitializeMpExceptionStackSwitchHandlers ();\r
+ InitializeMpExceptionHandlers ();\r
\r
//\r
// Update CPU healthy information from Guided HOB\r