Reviewed-by: Jordan Justen <[email protected]> On 2014-11-16 18:18:39, Chen Fan wrote: > when gBS->ExitBootServices() is called, the APs should avoid > to access the unsafed buff datas which were allocated by boot services. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Chen Fan <[email protected]> > Tested-by: Gabriel Somlo <[email protected]> > --- > UefiCpuPkg/CpuDxe/CpuDxe.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c > index c9df4e1..7303e85 100644 > --- a/UefiCpuPkg/CpuDxe/CpuDxe.c > +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c > @@ -24,6 +24,8 @@ BOOLEAN mIsFlushingGCD; > UINT64 mValidMtrrAddressMask = > MTRR_LIB_CACHE_VALID_ADDRESS; > UINT64 mValidMtrrBitsMask = MTRR_LIB_MSR_VALID_MASK; > > +EFI_EVENT mExitBootServicesEvent = (EFI_EVENT)NULL; > + > FIXED_MTRR mFixedMtrrTable[] = { > { > MTRR_LIB_IA32_MTRR_FIX64K_00000, > @@ -826,6 +828,28 @@ IdleLoopEventCallback ( > CpuSleep (); > } > > +/** > + Callback function for ExitBootServices. > + > + @param Event Event whose notification function is being > invoked. > + @param Context The pointer to the notification function's > context, > + which is implementation-dependent. > + > +**/ > +VOID > +EFIAPI > +ExitBootServicesCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + // > + // Avoid APs access invalid buff datas which allocated by Boot Services, > + // so we send INIT IPI to APs to let them wait for SIPI state. > + // > + SendInitIpiAllExcludingSelf (); > +} > + > > /** > Initialize the state information for the CPU Architectural Protocol. > @@ -900,6 +924,15 @@ InitializeCpu ( > > InitializeMpSupport (); > > + Status = gBS->CreateEvent ( > + EVT_SIGNAL_EXIT_BOOT_SERVICES, > + TPL_CALLBACK, > + ExitBootServicesCallback, > + NULL, > + &mExitBootServicesEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > return Status; > } > > -- > 1.9.3 >
------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
