mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
PI Enable:
1) The entry point of PeiCore has been changed to EFI_PEI_CORE_ENTRY_POINT defined in PI. 2) Nt32, Tiger and lakeport platform's SecCore has been updated. 3) Autogen tools also has been updated. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3804 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2303536ca1
commit
5aae0aa7d8
Binary file not shown.
@ -31,7 +31,7 @@ TransferOldDataToNewDataRange (
|
|||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiDispatcher (
|
PeiDispatcher (
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN PEI_CORE_DISPATCH_DATA *DispatchData
|
IN PEI_CORE_DISPATCH_DATA *DispatchData
|
||||||
)
|
)
|
||||||
@ -44,7 +44,9 @@ Routine Description:
|
|||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
|
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
PrivateData - Pointer to the private data passed in from caller
|
PrivateData - Pointer to the private data passed in from caller
|
||||||
DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
|
DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
|
||||||
|
|
||||||
@ -214,7 +216,8 @@ Returns:
|
|||||||
|
|
||||||
PeiSwitchStacks (
|
PeiSwitchStacks (
|
||||||
(SWITCH_STACK_ENTRY_POINT)(UINTN)TempPtr.Raw,
|
(SWITCH_STACK_ENTRY_POINT)(UINTN)TempPtr.Raw,
|
||||||
PeiStartupDescriptor,
|
(VOID*) SecCoreData,
|
||||||
|
NULL,
|
||||||
(VOID*)PrivateDataInMem,
|
(VOID*)PrivateDataInMem,
|
||||||
TopOfStack,
|
TopOfStack,
|
||||||
(VOID*)(UINTN)PrivateData->StackBase
|
(VOID*)(UINTN)PrivateData->StackBase
|
||||||
@ -360,7 +363,7 @@ VOID
|
|||||||
InitializeDispatcherData (
|
InitializeDispatcherData (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData,
|
IN PEI_CORE_INSTANCE *OldCoreData,
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
@ -373,7 +376,9 @@ Arguments:
|
|||||||
PeiServices - The PEI core services table.
|
PeiServices - The PEI core services table.
|
||||||
OldCoreData - Pointer to old core data (before switching stack).
|
OldCoreData - Pointer to old core data (before switching stack).
|
||||||
NULL if being run in non-permament memory mode.
|
NULL if being run in non-permament memory mode.
|
||||||
PeiStartupDescriptor - Information and services provided by SEC phase.
|
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
@ -386,8 +391,8 @@ Returns:
|
|||||||
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
|
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
|
||||||
|
|
||||||
if (OldCoreData == NULL) {
|
if (OldCoreData == NULL) {
|
||||||
PrivateData->DispatchData.CurrentFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) PeiStartupDescriptor->BootFirmwareVolume;
|
PrivateData->DispatchData.CurrentFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase;
|
||||||
PrivateData->DispatchData.BootFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) PeiStartupDescriptor->BootFirmwareVolume;
|
PrivateData->DispatchData.BootFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -47,9 +47,33 @@ PeiSwitchStacks (
|
|||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1, OPTIONAL
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2, OPTIONAL
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
IN VOID *NewStack,
|
IN VOID *NewStack,
|
||||||
IN VOID *NewBsp
|
IN VOID *NewBsp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SwitchStack (EntryPoint, Context1, Context2, NewStack);
|
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||||
|
|
||||||
|
ASSERT (EntryPoint != NULL);
|
||||||
|
ASSERT (NewStack != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||||
|
//
|
||||||
|
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
|
||||||
|
JumpBuffer.Eip = (UINTN)EntryPoint;
|
||||||
|
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
|
||||||
|
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2) + sizeof(Context3);
|
||||||
|
((VOID**)JumpBuffer.Esp)[1] = Context1;
|
||||||
|
((VOID**)JumpBuffer.Esp)[2] = Context2;
|
||||||
|
((VOID**)JumpBuffer.Esp)[3] = Context3;
|
||||||
|
|
||||||
|
LongJump (&JumpBuffer, (UINTN)-1);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// InternalSwitchStack () will never return
|
||||||
|
//
|
||||||
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
78
MdeModulePkg/Core/Pei/Ipf/InternalSwitchStack.c
Normal file
78
MdeModulePkg/Core/Pei/Ipf/InternalSwitchStack.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/** @file
|
||||||
|
SwitchStack() function for IPF.
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation<BR>
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IpfAsmSwitchStack (
|
||||||
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
|
IN VOID *ConText1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
|
IN VOID *NewStack,
|
||||||
|
IN VOID *NewBsp
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
|
Transfers control to the function specified by EntryPoint using the
|
||||||
|
new stack specified by NewStack and passing in the parameters specified
|
||||||
|
by Context1 and Context2. Context1 and Context2 are optional and may
|
||||||
|
be NULL. The function EntryPoint must never return.
|
||||||
|
Marker will be ignored on IA-32, x64, and EBC.
|
||||||
|
IPF CPUs expect one additional parameter of type VOID * that specifies
|
||||||
|
the new backing store pointer.
|
||||||
|
|
||||||
|
If EntryPoint is NULL, then ASSERT().
|
||||||
|
If NewStack is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param EntryPoint A pointer to function to call with the new stack.
|
||||||
|
@param Context1 A pointer to the context to pass into the EntryPoint
|
||||||
|
function.
|
||||||
|
@param Context2 A pointer to the context to pass into the EntryPoint
|
||||||
|
function.
|
||||||
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
|
function.
|
||||||
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
InternalSwitchStack (
|
||||||
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
|
IN VOID *Context1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
|
IN VOID *NewStack,
|
||||||
|
IN VA_LIST Marker
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
VOID *NewBsp;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get new backing store pointer from variable list
|
||||||
|
//
|
||||||
|
NewBsp = VA_ARG (Marker, VOID *);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||||
|
//
|
||||||
|
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
|
||||||
|
IpfAsmSwitchStack (EntryPoint, Context1, Context2, Context3, NewStack, NewBsp);
|
||||||
|
}
|
@ -16,6 +16,17 @@
|
|||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
InternalSwitchStack (
|
||||||
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
|
IN VOID *Context1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
|
IN VOID *NewStack,
|
||||||
|
IN VA_LIST Marker
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transfers control to a function starting with a new stack.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
@ -44,15 +55,18 @@ PeiSwitchStacks (
|
|||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1, OPTIONAL
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2, OPTIONAL
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
IN VOID *NewStack,
|
IN VOID *NewStack,
|
||||||
IN VOID *NewBsp
|
IN VOID *NewBsp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SwitchStack (
|
InternalSwitchStack(
|
||||||
EntryPoint,
|
EntryPoint,
|
||||||
Context1,
|
Context1,
|
||||||
Context2,
|
Context2,
|
||||||
|
Context3,
|
||||||
NewStack,
|
NewStack,
|
||||||
NewBsp
|
NewBsp
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
52
MdeModulePkg/Core/Pei/Ipf/SwitchStack.s
Normal file
52
MdeModulePkg/Core/Pei/Ipf/SwitchStack.s
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/// @file
|
||||||
|
/// IPF specific SwitchStack() function
|
||||||
|
///
|
||||||
|
/// Copyright (c) 2006, Intel Corporation
|
||||||
|
/// All rights reserved. This program and the accompanying materials
|
||||||
|
/// are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
/// which accompanies this distribution. The full text of the license may be found at
|
||||||
|
/// http://opensource.org/licenses/bsd-license.php
|
||||||
|
///
|
||||||
|
/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
///
|
||||||
|
/// Module Name: SwitchStack.s
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
.auto
|
||||||
|
.text
|
||||||
|
|
||||||
|
.proc IpfAsmSwitchStack
|
||||||
|
.type IpfAsmSwitchStack, @function
|
||||||
|
.regstk 6, 0, 0, 0
|
||||||
|
IpfAsmSwitchStack::
|
||||||
|
mov r14 = ar.rsc
|
||||||
|
movl r2 = ~((((1 << 14) - 1) << 16) | 3)
|
||||||
|
|
||||||
|
mov r17 = in1
|
||||||
|
mov r18 = in2
|
||||||
|
mov r19 = in3
|
||||||
|
and r2 = r14, r2
|
||||||
|
|
||||||
|
mov ar.rsc = r2
|
||||||
|
mov sp = in4
|
||||||
|
mov r20 = in5
|
||||||
|
|
||||||
|
ld8.nt1 r16 = [in0], 8
|
||||||
|
ld8.nta gp = [in0]
|
||||||
|
mov r3 = -1
|
||||||
|
|
||||||
|
loadrs
|
||||||
|
mov ar.bspstore = r20
|
||||||
|
mov b7 = r16
|
||||||
|
|
||||||
|
alloc r2 = ar.pfs, 0, 0, 3, 0
|
||||||
|
mov out0 = r17
|
||||||
|
mov out1 = r18
|
||||||
|
mov out2 = r19
|
||||||
|
|
||||||
|
mov ar.rnat = r3
|
||||||
|
mov ar.rsc = r14
|
||||||
|
br.call.sptk.many b0 = b7
|
||||||
|
.endp IpfAsmSwitchStack
|
@ -24,7 +24,7 @@ Abstract:
|
|||||||
VOID
|
VOID
|
||||||
InitializeMemoryServices (
|
InitializeMemoryServices (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
@ -36,7 +36,10 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
PeiServices - The PEI core services table.
|
||||||
PeiStartupDescriptor - Information and services provided by SEC phase.
|
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
|
||||||
OldCoreData - Pointer to the PEI Core data.
|
OldCoreData - Pointer to the PEI Core data.
|
||||||
NULL if being run in non-permament memory mode.
|
NULL if being run in non-permament memory mode.
|
||||||
|
|
||||||
@ -47,7 +50,6 @@ Returns:
|
|||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
UINT64 SizeOfCarHeap;
|
|
||||||
|
|
||||||
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
|
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
|
||||||
PrivateData->SwitchStackSignal = FALSE;
|
PrivateData->SwitchStackSignal = FALSE;
|
||||||
@ -56,18 +58,12 @@ Returns:
|
|||||||
|
|
||||||
PrivateData->PeiMemoryInstalled = FALSE;
|
PrivateData->PeiMemoryInstalled = FALSE;
|
||||||
|
|
||||||
PrivateData->BottomOfCarHeap = (VOID *) (((UINTN)(VOID *)(&PrivateData))
|
PrivateData->BottomOfCarHeap = SecCoreData->PeiTemporaryRamBase;
|
||||||
& (~((PeiStartupDescriptor->SizeOfCacheAsRam) - 1)));
|
PrivateData->TopOfCarHeap = (VOID *)((UINTN)(PrivateData->BottomOfCarHeap) + SecCoreData->PeiTemporaryRamSize);
|
||||||
PrivateData->TopOfCarHeap = (VOID *)((UINTN)(PrivateData->BottomOfCarHeap) + PeiStartupDescriptor->SizeOfCacheAsRam);
|
|
||||||
//
|
|
||||||
// SizeOfCarHeap is 1/2 (arbitrary) of CacheAsRam Size.
|
|
||||||
//
|
|
||||||
SizeOfCarHeap = (UINT64) PeiStartupDescriptor->SizeOfCacheAsRam;
|
|
||||||
SizeOfCarHeap = RShiftU64 (SizeOfCarHeap, 1);
|
|
||||||
|
|
||||||
DEBUG_CODE_BEGIN ();
|
DEBUG_CODE_BEGIN ();
|
||||||
PrivateData->SizeOfCacheAsRam = PeiStartupDescriptor->SizeOfCacheAsRam;
|
PrivateData->SizeOfCacheAsRam = SecCoreData->PeiTemporaryRamSize + SecCoreData->StackSize;
|
||||||
PrivateData->MaxTopOfCarHeap = (VOID *) ((UINTN) PrivateData->BottomOfCarHeap + (UINTN) SizeOfCarHeap);
|
PrivateData->MaxTopOfCarHeap = (VOID *) ((UINTN) PrivateData->BottomOfCarHeap + (UINTN) PrivateData->SizeOfCacheAsRam);
|
||||||
DEBUG_CODE_END ();
|
DEBUG_CODE_END ();
|
||||||
|
|
||||||
PrivateData->HobList.Raw = PrivateData->BottomOfCarHeap;
|
PrivateData->HobList.Raw = PrivateData->BottomOfCarHeap;
|
||||||
@ -75,7 +71,7 @@ Returns:
|
|||||||
PeiCoreBuildHobHandoffInfoTable (
|
PeiCoreBuildHobHandoffInfoTable (
|
||||||
BOOT_WITH_FULL_CONFIGURATION,
|
BOOT_WITH_FULL_CONFIGURATION,
|
||||||
(EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->BottomOfCarHeap,
|
(EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->BottomOfCarHeap,
|
||||||
(UINTN) SizeOfCarHeap
|
(UINTN) SecCoreData->PeiTemporaryRamSize
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Copy PeiServices from ROM to Cache in PrivateData
|
// Copy PeiServices from ROM to Cache in PrivateData
|
||||||
|
@ -177,8 +177,9 @@ typedef union {
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiCore (
|
PeiCore (
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN VOID *Data
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList,
|
||||||
|
IN VOID *Data
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
@ -248,7 +249,7 @@ Returns:
|
|||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiDispatcher (
|
PeiDispatcher (
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN PEI_CORE_DISPATCH_DATA *DispatchData
|
IN PEI_CORE_DISPATCH_DATA *DispatchData
|
||||||
)
|
)
|
||||||
@ -278,7 +279,7 @@ VOID
|
|||||||
InitializeDispatcherData (
|
InitializeDispatcherData (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData,
|
IN PEI_CORE_INSTANCE *OldCoreData,
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
@ -956,7 +957,7 @@ Returns:
|
|||||||
VOID
|
VOID
|
||||||
InitializeMemoryServices (
|
InitializeMemoryServices (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
@ -1208,6 +1209,7 @@ PeiSwitchStacks (
|
|||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1, OPTIONAL
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2, OPTIONAL
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
IN VOID *NewStack,
|
IN VOID *NewStack,
|
||||||
IN VOID *NewBsp
|
IN VOID *NewBsp
|
||||||
);
|
);
|
||||||
|
@ -59,6 +59,8 @@
|
|||||||
Ipf/IpfCpuCore.s
|
Ipf/IpfCpuCore.s
|
||||||
Ipf/IpfCpuCore.i
|
Ipf/IpfCpuCore.i
|
||||||
Ipf/SwitchToCacheMode.c
|
Ipf/SwitchToCacheMode.c
|
||||||
|
Ipf/InternalSwitchStack.c
|
||||||
|
Ipf/SwitchStack.s
|
||||||
|
|
||||||
[Sources.EBC]
|
[Sources.EBC]
|
||||||
Dispatcher/Stack.c
|
Dispatcher/Stack.c
|
||||||
@ -77,7 +79,7 @@
|
|||||||
PerformanceLib
|
PerformanceLib
|
||||||
HobLib
|
HobLib
|
||||||
BaseLib
|
BaseLib
|
||||||
OldPeiCoreEntryPoint
|
PeiCoreEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
|
@ -81,8 +81,9 @@ static EFI_PEI_SERVICES mPS = {
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiCore (
|
PeiCore (
|
||||||
IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN VOID *Data
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList,
|
||||||
|
IN VOID *Data
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
@ -94,8 +95,16 @@ Routine Description:
|
|||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
PeiStartupDescriptor - Information and services provided by SEC phase.
|
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
||||||
OldCoreData - Pointer to old core data that is used to initialize the
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
PpiList - Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
|
||||||
|
An empty PPI list consists of a single descriptor with the end-tag
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
|
||||||
|
phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
|
||||||
|
that both the PEI Foundation and any modules can leverage the associated service
|
||||||
|
calls and/or code in these early PPIs
|
||||||
|
Data - Pointer to old core data that is used to initialize the
|
||||||
core's data areas.
|
core's data areas.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -142,13 +151,13 @@ Returns:
|
|||||||
//
|
//
|
||||||
ProcessLibraryConstructorList (NULL, &PrivateData.PS);
|
ProcessLibraryConstructorList (NULL, &PrivateData.PS);
|
||||||
|
|
||||||
InitializeMemoryServices (&PrivateData.PS, PeiStartupDescriptor, OldCoreData);
|
InitializeMemoryServices (&PrivateData.PS, SecCoreData, OldCoreData);
|
||||||
|
|
||||||
InitializePpiServices (&PrivateData.PS, OldCoreData);
|
InitializePpiServices (&PrivateData.PS, OldCoreData);
|
||||||
|
|
||||||
InitializeSecurityServices (&PrivateData.PS, OldCoreData);
|
InitializeSecurityServices (&PrivateData.PS, OldCoreData);
|
||||||
|
|
||||||
InitializeDispatcherData (&PrivateData.PS, OldCoreData, PeiStartupDescriptor);
|
InitializeDispatcherData (&PrivateData.PS, OldCoreData, SecCoreData);
|
||||||
|
|
||||||
if (OldCoreData != NULL) {
|
if (OldCoreData != NULL) {
|
||||||
|
|
||||||
@ -210,8 +219,8 @@ Returns:
|
|||||||
//
|
//
|
||||||
// If SEC provided any PPI services to PEI, install them.
|
// If SEC provided any PPI services to PEI, install them.
|
||||||
//
|
//
|
||||||
if (PeiStartupDescriptor->DispatchTable != NULL) {
|
if (PpList != NULL) {
|
||||||
Status = PeiServicesInstallPpi (PeiStartupDescriptor->DispatchTable);
|
Status = PeiServicesInstallPpi (PpList);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +230,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Call PEIM dispatcher
|
// Call PEIM dispatcher
|
||||||
//
|
//
|
||||||
PeiDispatcher (PeiStartupDescriptor, &PrivateData, DispatchData);
|
PeiDispatcher (SecCoreData, &PrivateData, DispatchData);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if InstallPeiMemory service was called.
|
// Check if InstallPeiMemory service was called.
|
||||||
|
@ -484,6 +484,63 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
|
Transfers control to the function specified by EntryPoint using the new stack
|
||||||
|
specified by NewStack and passing in the parameters specified by Context1 and
|
||||||
|
Context2. Context1 and Context2 are optional and may be NULL. The function
|
||||||
|
EntryPoint must never return.
|
||||||
|
|
||||||
|
If EntryPoint is NULL, then ASSERT().
|
||||||
|
If NewStack is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param EntryPoint A pointer to function to call with the new stack.
|
||||||
|
@param Context1 A pointer to the context to pass into the EntryPoint
|
||||||
|
function.
|
||||||
|
@param Context2 A pointer to the context to pass into the EntryPoint
|
||||||
|
function.
|
||||||
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
|
function.
|
||||||
|
@param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
|
||||||
|
Reserved on other architectures.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PeiSwitchStacks (
|
||||||
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
|
IN VOID *Context1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *Context3, OPTIONAL
|
||||||
|
IN VOID *NewStack
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||||
|
|
||||||
|
ASSERT (EntryPoint != NULL);
|
||||||
|
ASSERT (NewStack != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||||
|
//
|
||||||
|
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
|
||||||
|
JumpBuffer.Eip = (UINTN)EntryPoint;
|
||||||
|
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
|
||||||
|
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2) + sizeof(Context3);
|
||||||
|
((VOID**)JumpBuffer.Esp)[1] = Context1;
|
||||||
|
((VOID**)JumpBuffer.Esp)[2] = Context2;
|
||||||
|
((VOID**)JumpBuffer.Esp)[3] = Context3;
|
||||||
|
|
||||||
|
LongJump (&JumpBuffer, (UINTN)-1);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// InternalSwitchStack () will never return
|
||||||
|
//
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecLoadFromCore (
|
SecLoadFromCore (
|
||||||
@ -514,7 +571,7 @@ Returns:
|
|||||||
UINT64 PeiCoreSize;
|
UINT64 PeiCoreSize;
|
||||||
EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;
|
EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;
|
||||||
EFI_PHYSICAL_ADDRESS PeiImageAddress;
|
EFI_PHYSICAL_ADDRESS PeiImageAddress;
|
||||||
EFI_PEI_STARTUP_DESCRIPTOR *PeiStartup;
|
EFI_SEC_PEI_HAND_OFF *SecCoreData;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compute Top Of Memory for Stack and PEI Core Allocations
|
// Compute Top Of Memory for Stack and PEI Core Allocations
|
||||||
@ -524,7 +581,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Allocate 128KB for the Stack
|
// Allocate 128KB for the Stack
|
||||||
//
|
//
|
||||||
TopOfStack = (VOID *)((UINTN)TopOfMemory - sizeof (EFI_PEI_STARTUP_DESCRIPTOR) - CPU_STACK_ALIGNMENT);
|
TopOfStack = (VOID *)((UINTN)TopOfMemory - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
|
||||||
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
||||||
TopOfMemory = TopOfMemory - STACK_SIZE;
|
TopOfMemory = TopOfMemory - STACK_SIZE;
|
||||||
|
|
||||||
@ -536,10 +593,16 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Bind this information into the SEC hand-off state
|
// Bind this information into the SEC hand-off state
|
||||||
//
|
//
|
||||||
PeiStartup = (EFI_PEI_STARTUP_DESCRIPTOR *) (UINTN) TopOfStack;
|
SecCoreData = (EFI_SEC_PEI_HAND_OFF*)(UINTN) TopOfStack;
|
||||||
PeiStartup->DispatchTable = (EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable;
|
SecCoreData->DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
|
||||||
PeiStartup->SizeOfCacheAsRam = STACK_SIZE;
|
SecCoreData->BootFirmwareVolumeBase = (VOID*)BootFirmwareVolumeBase;
|
||||||
PeiStartup->BootFirmwareVolume = BootFirmwareVolumeBase;
|
SecCoreData->BootFirmwareVolumeSize = FixedPcdGet32(PcdWinNtFirmwareFdSize);
|
||||||
|
SecCoreData->TemporaryRamBase = (VOID*)(UINTN)TopOfMemory;
|
||||||
|
SecCoreData->TemporaryRamSize = STACK_SIZE;
|
||||||
|
SecCoreData->PeiTemporaryRamBase = SecCoreData->TemporaryRamBase;
|
||||||
|
SecCoreData->PeiTemporaryRamSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);
|
||||||
|
SecCoreData->StackBase = (VOID*)((UINTN)SecCoreData->TemporaryRamBase + (UINTN)SecCoreData->TemporaryRamSize);
|
||||||
|
SecCoreData->StackSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load the PEI Core from a Firmware Volume
|
// Load the PEI Core from a Firmware Volume
|
||||||
@ -553,12 +616,14 @@ Returns:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Transfer control to the PEI Core
|
// Transfer control to the PEI Core
|
||||||
//
|
//
|
||||||
SwitchStack (
|
PeiSwitchStacks (
|
||||||
(SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
|
(SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
|
||||||
PeiStartup,
|
SecCoreData,
|
||||||
|
(VOID *) (UINTN) ((EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable),
|
||||||
NULL,
|
NULL,
|
||||||
TopOfStack
|
TopOfStack
|
||||||
);
|
);
|
||||||
|
@ -68,6 +68,9 @@
|
|||||||
#gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySizeForSecMain
|
#gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySizeForSecMain
|
||||||
#gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume
|
#gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume
|
||||||
|
|
||||||
|
[FixedPcd.common]
|
||||||
|
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize
|
||||||
|
|
||||||
[BuildOptions.common]
|
[BuildOptions.common]
|
||||||
MSFT:DEBUG_*_IA32_DLINK_FLAGS = /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib
|
MSFT:DEBUG_*_IA32_DLINK_FLAGS = /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib
|
||||||
MSFT:DEBUG_*_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /Od /DSTRING_ARRAY_NAME=SecMainStrings /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm
|
MSFT:DEBUG_*_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /Od /DSTRING_ARRAY_NAME=SecMainStrings /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user