X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=UefiCpuPkg%2FCpuDxe%2FCpuMp.c;fp=UefiCpuPkg%2FCpuDxe%2FCpuMp.c;h=5b3c87d24414a041649d4e45d113b3130080bda4;hp=82145e762443ebdf9791d1e1757b2d87d02a53cc;hb=dcc026217fdc363f55c217039fc43d344f69fed6;hpb=16b918bbaf51211a32ae04d9d8a5ba6ccca25a6a diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index 82145e7624..5b3c87d244 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -673,10 +673,6 @@ InitializeMpExceptionStackSwitchHandlers ( UINT8 *GdtBuffer; UINT8 *StackTop; - if (!PcdGetBool (PcdCpuStackGuard)) { - return; - } - ExceptionNumber = FixedPcdGetSize (PcdCpuStackSwitchExceptionList); NewStackSize = FixedPcdGet32 (PcdCpuKnownGoodStackSize) * ExceptionNumber; @@ -790,6 +786,32 @@ InitializeMpExceptionStackSwitchHandlers ( } } +/** + Initializes MP exceptions handlers for special features, such as Heap Guard + and Stack Guard. +**/ +VOID +InitializeMpExceptionHandlers ( + VOID + ) +{ + // + // Enable non-stop mode for #PF triggered by Heap Guard or NULL Pointer + // Detection. + // + if (HEAP_GUARD_NONSTOP_MODE || NULL_DETECTION_NONSTOP_MODE) { + RegisterCpuInterruptHandler (EXCEPT_IA32_DEBUG, DebugExceptionHandler); + RegisterCpuInterruptHandler (EXCEPT_IA32_PAGE_FAULT, PageFaultExceptionHandler); + } + + // + // Setup stack switch for Stack Guard feature. + // + if (PcdGetBool (PcdCpuStackGuard)) { + InitializeMpExceptionStackSwitchHandlers (); + } +} + /** Initialize Multi-processor support. @@ -814,9 +836,9 @@ InitializeMpSupport ( DEBUG ((DEBUG_INFO, "Detect CPU count: %d\n", mNumberOfProcessors)); // - // Initialize exception stack switch handlers for each logic processor. + // Initialize special exception handlers for each logic processor. // - InitializeMpExceptionStackSwitchHandlers (); + InitializeMpExceptionHandlers (); // // Update CPU healthy information from Guided HOB