diff options
Diffstat (limited to 'UefiCpuPkg/Library/MpInitLib/DxeMpLib.c')
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c index 762d76dd7a..785653be8f 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -389,7 +389,31 @@ MpInitLibSwitchBSP ( IN BOOLEAN EnableOldBSP
)
{
- return EFI_UNSUPPORTED;
+ EFI_STATUS Status;
+ BOOLEAN OldInterruptState;
+
+ //
+ // Before send both BSP and AP to a procedure to exchange their roles,
+ // interrupt must be disabled. This is because during the exchange role
+ // process, 2 CPU may use 1 stack. If interrupt happens, the stack will
+ // be corrupted, since interrupt return address will be pushed to stack
+ // by hardware.
+ //
+ OldInterruptState = SaveAndDisableInterrupts ();
+
+ //
+ // Mask LINT0 & LINT1 for the old BSP
+ //
+ DisableLvtInterrupts ();
+
+ Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
+
+ //
+ // Restore interrupt state.
+ //
+ SetInterruptState (OldInterruptState);
+
+ return Status;
}
/**
|