diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-12 09:52:37 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-09-12 09:52:37 +0000 |
commit | 5aae0aa7d8347ce30d856aa5f39c53d181654e8b (patch) | |
tree | 0ce6daf4bfc9aef126485c27558a68522adebcbb /Nt32Pkg/Sec | |
parent | 2303536ca102b051b6f134a84ea33a626b023573 (diff) | |
download | edk2-platforms-5aae0aa7d8347ce30d856aa5f39c53d181654e8b.tar.xz |
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
Diffstat (limited to 'Nt32Pkg/Sec')
-rw-r--r-- | Nt32Pkg/Sec/SecMain.c | 81 | ||||
-rw-r--r-- | Nt32Pkg/Sec/SecMain.inf | 3 |
2 files changed, 76 insertions, 8 deletions
diff --git a/Nt32Pkg/Sec/SecMain.c b/Nt32Pkg/Sec/SecMain.c index ab66dfc52c..a1ab3f20ef 100644 --- a/Nt32Pkg/Sec/SecMain.c +++ b/Nt32Pkg/Sec/SecMain.c @@ -484,6 +484,63 @@ Returns: 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
SecLoadFromCore (
@@ -514,7 +571,7 @@ Returns: UINT64 PeiCoreSize;
EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;
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
@@ -524,7 +581,7 @@ Returns: //
// 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);
TopOfMemory = TopOfMemory - STACK_SIZE;
@@ -536,10 +593,16 @@ Returns: //
// Bind this information into the SEC hand-off state
//
- PeiStartup = (EFI_PEI_STARTUP_DESCRIPTOR *) (UINTN) TopOfStack;
- PeiStartup->DispatchTable = (EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable;
- PeiStartup->SizeOfCacheAsRam = STACK_SIZE;
- PeiStartup->BootFirmwareVolume = BootFirmwareVolumeBase;
+ SecCoreData = (EFI_SEC_PEI_HAND_OFF*)(UINTN) TopOfStack;
+ SecCoreData->DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
+ SecCoreData->BootFirmwareVolumeBase = (VOID*)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
@@ -553,12 +616,14 @@ Returns: if (EFI_ERROR (Status)) {
return ;
}
+
//
// Transfer control to the PEI Core
//
- SwitchStack (
+ PeiSwitchStacks (
(SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
- PeiStartup,
+ SecCoreData,
+ (VOID *) (UINTN) ((EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable),
NULL,
TopOfStack
);
diff --git a/Nt32Pkg/Sec/SecMain.inf b/Nt32Pkg/Sec/SecMain.inf index db891436e2..170e87188d 100644 --- a/Nt32Pkg/Sec/SecMain.inf +++ b/Nt32Pkg/Sec/SecMain.inf @@ -68,6 +68,9 @@ #gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySizeForSecMain
#gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume
+[FixedPcd.common]
+ gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize
+
[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_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
|