mirror of https://github.com/acidanthera/audk.git
MpInitLib: Allocate code buffer for PEI phase
Today's implementation assumes PEI phase runs at 32bit so the execution-disable feature is not applicable. It's not always TRUE. The patch allocates 32bit&64bit code buffer for PEI phase as well. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
e7abb94d1f
commit
54aeed7e00
|
@ -162,7 +162,7 @@ GetWakeupBuffer (
|
||||||
@retval 0 Cannot find free memory below 4GB.
|
@retval 0 Cannot find free memory below 4GB.
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
GetModeTransitionBuffer (
|
AllocateCodeBuffer (
|
||||||
IN UINTN BufferSize
|
IN UINTN BufferSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1056,7 +1056,7 @@ AllocateResetVector (
|
||||||
(CpuMpData->WakeupBuffer +
|
(CpuMpData->WakeupBuffer +
|
||||||
CpuMpData->AddressMap.RendezvousFunnelSize +
|
CpuMpData->AddressMap.RendezvousFunnelSize +
|
||||||
CpuMpData->AddressMap.SwitchToRealSize);
|
CpuMpData->AddressMap.SwitchToRealSize);
|
||||||
CpuMpData->WakeupBufferHigh = GetModeTransitionBuffer (
|
CpuMpData->WakeupBufferHigh = AllocateCodeBuffer (
|
||||||
CpuMpData->AddressMap.RendezvousFunnelSize +
|
CpuMpData->AddressMap.RendezvousFunnelSize +
|
||||||
CpuMpData->AddressMap.SwitchToRealSize -
|
CpuMpData->AddressMap.SwitchToRealSize -
|
||||||
CpuMpData->AddressMap.ModeTransitionOffset
|
CpuMpData->AddressMap.ModeTransitionOffset
|
||||||
|
|
|
@ -442,7 +442,7 @@ GetWakeupBuffer (
|
||||||
@retval 0 Cannot find free memory below 4GB.
|
@retval 0 Cannot find free memory below 4GB.
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
GetModeTransitionBuffer (
|
AllocateCodeBuffer (
|
||||||
IN UINTN BufferSize
|
IN UINTN BufferSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -299,14 +299,19 @@ GetWakeupBuffer (
|
||||||
@retval 0 Cannot find free memory below 4GB.
|
@retval 0 Cannot find free memory below 4GB.
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
GetModeTransitionBuffer (
|
AllocateCodeBuffer (
|
||||||
IN UINTN BufferSize
|
IN UINTN BufferSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
EFI_STATUS Status;
|
||||||
// PEI phase doesn't need to do such transition. So simply return 0.
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
//
|
|
||||||
return 0;
|
Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES (BufferSize), &Address);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
Address = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (UINTN)Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue