diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-14 07:01:26 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-14 07:01:26 +0000 |
commit | b98c2ab738c71c344c7f03ecf885fdd0a4545cdb (patch) | |
tree | ee09d37111e65ee7a44a0b0c556c6dfaeaca1735 /MdeModulePkg/Core/Pei/Dispatcher | |
parent | a81a35fe2a2e51069036b958380ab91575bd8410 (diff) | |
download | edk2-platforms-b98c2ab738c71c344c7f03ecf885fdd0a4545cdb.tar.xz |
Add InvokePeiCore function to invoke the PeiCore in new stack.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3844 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei/Dispatcher')
-rw-r--r-- | MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 66 | ||||
-rw-r--r-- | MdeModulePkg/Core/Pei/Dispatcher/Stack.c | 26 |
2 files changed, 59 insertions, 33 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c index 335fe9fc5d..900e1d2d50 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -29,6 +29,13 @@ TransferOldDataToNewDataRange ( IN PEI_CORE_INSTANCE *PrivateData
);
+STATIC
+VOID
+InvokePeiCore (
+ VOID *Context1,
+ VOID *Context2
+ );
+
EFI_STATUS
PeiDispatcher (
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
@@ -59,11 +66,12 @@ Returns: {
EFI_STATUS Status;
PEI_CORE_TEMP_POINTERS TempPtr;
- UINTN PrivateDataInMem;
BOOLEAN NextFvFound;
EFI_FIRMWARE_VOLUME_HEADER *NextFvAddress;
EFI_FIRMWARE_VOLUME_HEADER *DefaultFvAddress;
VOID *TopOfStack;
+ PEI_CORE_PARAMETERS PeiCoreParameters;
+
//
// Debug data for uninstalled Peim list
//
@@ -205,20 +213,21 @@ Returns: // nobody else should have any data on the stack.
//
if (PrivateData->SwitchStackSignal) {
- TempPtr.PeiCore = (PEI_CORE_ENTRY_POINT)PeiCore;
- PrivateDataInMem = (UINTN) TransferOldDataToNewDataRange (PrivateData);
- ASSERT (PrivateDataInMem != 0);
//
// Adjust the top of stack to be aligned at CPU_STACK_ALIGNMENT
//
TopOfStack = (VOID *)((UINTN)PrivateData->StackBase + (UINTN)PrivateData->StackSize - CPU_STACK_ALIGNMENT);
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
+
+ PeiCoreParameters.SecCoreData = SecCoreData;
+ PeiCoreParameters.PpiList = NULL;
+ PeiCoreParameters.Data = TransferOldDataToNewDataRange (PrivateData);
+ ASSERT (PeiCoreParameters.Data != 0);
PeiSwitchStacks (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)TempPtr.Raw,
- (VOID*) SecCoreData,
- NULL,
- (VOID*)PrivateDataInMem,
+ InvokePeiCore,
+ (VOID*) (UINTN) PeiCore,
+ (VOID*) &PeiCoreParameters,
TopOfStack,
(VOID*)(UINTN)PrivateData->StackBase
);
@@ -580,4 +589,45 @@ PeiRegisterForShadow ( return EFI_SUCCESS;
}
+/**
+ This routine invoke the PeiCore's entry in new stack environment.
+
+ @param Context1 The first context parameter is entry of PeiCore
+ @param Context2 The second context parameter is parameter structure point for PeiCore
+
+**/
+STATIC
+VOID
+InvokePeiCore (
+ VOID *Context1,
+ VOID *Context2
+ )
+{
+ PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;
+ PEI_CORE_PARAMETERS *PeiCoreParameters;
+
+ //
+ // Running on new stack in SEC Core
+ //
+
+ PeiCoreEntryPoint = (PEI_CORE_ENTRY_POINT) (UINTN) Context1;
+ PeiCoreParameters = (PEI_CORE_PARAMETERS *)Context2;
+
+ //
+ // Call PEI Core using new stack
+ //
+ PeiCoreEntryPoint (
+ PeiCoreParameters->SecCoreData,
+ PeiCoreParameters->PpiList,
+ PeiCoreParameters->Data
+ );
+
+ //
+ // Never returns
+ //
+ ASSERT_EFI_ERROR (FALSE);
+}
+
+
+
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Stack.c b/MdeModulePkg/Core/Pei/Dispatcher/Stack.c index 551e23826c..9e74eee587 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Stack.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Stack.c @@ -47,33 +47,9 @@ PeiSwitchStacks ( IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
- IN VOID *Context3, OPTIONAL
IN VOID *NewStack,
IN VOID *NewBsp
)
{
- 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);
+ SwitchStack (EntryPoint, Context1, Context2, NewStack);
}
|