1. Removed AsmSwitchStackAndBackingStore from BaseLib.h

2. Modified SwitchStack definition update to MWG 0.60e.
3. Added BaseLib/Ipf/InternalSwitchStack.c and removed BaseLib/Ipf/Non-existing.c
4. Updated any references of AsmSwitchStackAndBackingStore to SwichStack on IPF.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2499 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2007-03-22 03:03:32 +00:00
parent ebc5b9557e
commit cb41bea732
10 changed files with 420 additions and 355 deletions

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -62,7 +62,7 @@ HandOffToDxeCore (
Status = PeiServicesInstallPpi (EndOfPeiSignal); Status = PeiServicesInstallPpi (EndOfPeiSignal);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
AsmSwitchStackAndBackingStore ( SwitchStack (
(SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint, (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
HobList.Raw, HobList.Raw,
NULL, NULL,

View File

@ -1,7 +1,7 @@
/** @file /** @file
PeiSwitchStacks() function for PEI dispatcher. PeiSwitchStacks() function for PEI dispatcher.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -48,7 +48,7 @@ PeiSwitchStacks (
IN VOID *NewBsp IN VOID *NewBsp
) )
{ {
AsmSwitchStackAndBackingStore ( SwitchStack (
EntryPoint, EntryPoint,
Context1, Context1,
Context2, Context2,

View File

@ -3429,10 +3429,14 @@ CpuFlushTlb (
/** /**
Transfers control to a function starting with a new stack. Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack Transfers control to the function specified by EntryPoint using the
specified by NewStack and passing in the parameters specified by Context1 and new stack specified by NewStack and passing in the parameters specified
Context2. Context1 and Context2 are optional and may be NULL. The function by Context1 and Context2. Context1 and Context2 are optional and may
EntryPoint must never return. be NULL. The function EntryPoint must never return. This function
supports a variable number of arguments following the NewStack parameter.
These additional arguments are 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 EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT(). If NewStack is NULL, then ASSERT().
@ -3452,7 +3456,8 @@ SwitchStack (
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 *NewStack IN VOID *NewStack,
...
); );
/** /**
@ -5666,38 +5671,6 @@ AsmPrepareAndThunk16 (
IN OUT THUNK_CONTEXT *ThunkContext IN OUT THUNK_CONTEXT *ThunkContext
); );
/**
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 memory location for RSE backing
store.
**/
VOID
EFIAPI
AsmSwitchStackAndBackingStore (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VOID *NewBsp
);
typedef struct { typedef struct {
UINT64 Status; UINT64 Status;
UINT64 r9; UINT64 r9;

View File

@ -499,7 +499,7 @@
<Filename SupArchList="IPF">Ipf/CpuPause.s</Filename> <Filename SupArchList="IPF">Ipf/CpuPause.s</Filename>
<Filename SupArchList="IPF">Ipf/CpuFlushTlb.s</Filename> <Filename SupArchList="IPF">Ipf/CpuFlushTlb.s</Filename>
<Filename SupArchList="IPF">Ipf/GetInterruptState.s</Filename> <Filename SupArchList="IPF">Ipf/GetInterruptState.s</Filename>
<Filename SupArchList="IPF">Ipf/Non-existing.c</Filename> <Filename SupArchList="IPF">Ipf/InternalSwitchStack.c</Filename>
<Filename SupArchList="IPF">Ipf/FlushCacheRange.s</Filename> <Filename SupArchList="IPF">Ipf/FlushCacheRange.s</Filename>
<Filename SupArchList="IPF">Ipf/ReadItc.s</Filename> <Filename SupArchList="IPF">Ipf/ReadItc.s</Filename>

View File

@ -314,10 +314,16 @@ InternalMathDivRemS64x64 (
/** /**
Transfers control to a function starting with a new stack. Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack Transfers control to the function specified by EntryPoint using the
specified by NewStack and passing in the parameters specified by Context1 and new stack specified by NewStack and passing in the parameters specified
Context2. Context1 and Context2 are optional and may be NULL. The function by Context1 and Context2. Context1 and Context2 are optional and may
EntryPoint must never return. 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 EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint @param Context1 A pointer to the context to pass into the EntryPoint
@ -326,15 +332,17 @@ InternalMathDivRemS64x64 (
function. function.
@param NewStack A pointer to the new stack to use for the EntryPoint @param NewStack A pointer to the new stack to use for the EntryPoint
function. function.
@param Marker VA_LIST marker for the variable argument list.
**/ **/
VOID VOID
EFIAPI EFIAPI
InternalSwitchStack ( InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, IN VOID *Context1, OPTIONAL
IN VOID *Context2, IN VOID *Context2, OPTIONAL
IN VOID *NewStack IN VOID *NewStack,
IN VA_LIST Marker
); );
// //
@ -784,6 +792,7 @@ InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
); );
/** /**
Restores the CPU context that was saved with SetJump(). Restores the CPU context that was saved with SetJump().
@ -802,4 +811,41 @@ InternalLongJump (
IN UINTN Value IN UINTN Value
); );
//
// IPF specific functions
//
/**
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 memory location for RSE backing
store.
**/
VOID
EFIAPI
AsmSwitchStackAndBackingStore (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VOID *NewBsp
);
#endif #endif

View File

@ -1,7 +1,7 @@
/** @file /** @file
Switch Stack functions. Switch Stack functions.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -17,10 +17,13 @@
/** /**
Transfers control to a function starting with a new stack. Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack Transfers control to the function specified by EntryPoint using the
specified by NewStack and passing in the parameters specified by Context1 and new stack specified by NewStack and passing in the parameters specified
Context2. Context1 and Context2 are optional and may be NULL. The function by Context1 and Context2. Context1 and Context2 are optional and may
EntryPoint must never return. 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 EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT(). If NewStack is NULL, then ASSERT().
@ -32,6 +35,7 @@
function. function.
@param NewStack A pointer to the new stack to use for the EntryPoint @param NewStack A pointer to the new stack to use for the EntryPoint
function. function.
@param Marker VA_LIST marker for the variable argument list.
**/ **/
VOID VOID
@ -40,13 +44,21 @@ InternalSwitchStack (
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 *NewStack IN VOID *NewStack,
IN VA_LIST Marker
) )
{ {
// //
// This version of this function does not actually change the stack pointer // This version of this function does not actually change the stack pointer
// This is to support compilation of CPU types that do not support assemblers // This is to support compilation of CPU types that do not support assemblers
// such as EBC // such as EBC
// //
//
// Stack should be aligned with CPU_STACK_ALIGNMENT
//
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
EntryPoint (Context1, Context2); EntryPoint (Context1, Context2);
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
SwitchStack() function for IA-32. SwitchStack() function for IA-32.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -17,10 +17,16 @@
/** /**
Transfers control to a function starting with a new stack. Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack Transfers control to the function specified by EntryPoint using the
specified by NewStack and passing in the parameters specified by Context1 and new stack specified by NewStack and passing in the parameters specified
Context2. Context1 and Context2 are optional and may be NULL. The function by Context1 and Context2. Context1 and Context2 are optional and may
EntryPoint must never return. 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 EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint @param Context1 A pointer to the context to pass into the EntryPoint
@ -29,19 +35,26 @@
function. function.
@param NewStack A pointer to the new stack to use for the EntryPoint @param NewStack A pointer to the new stack to use for the EntryPoint
function. function.
@param Marker VA_LIST marker for the variable argument list.
**/ **/
VOID VOID
EFIAPI EFIAPI
InternalSwitchStack ( InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, IN VOID *Context1, OPTIONAL
IN VOID *Context2, IN VOID *Context2, OPTIONAL
IN VOID *NewStack IN VOID *NewStack,
IN VA_LIST Marker
) )
{ {
BASE_LIBRARY_JUMP_BUFFER JumpBuffer; BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
//
// Stack should be aligned with CPU_STACK_ALIGNMENT
//
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
JumpBuffer.Eip = (UINTN)EntryPoint; JumpBuffer.Eip = (UINTN)EntryPoint;
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*); JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2); JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);

View File

@ -0,0 +1,68 @@
/** @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.
Module Name: InternalSwitchStack.c
**/
#include <BaseLibInternals.h>
/**
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 *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);
AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp);
}

View File

@ -1,53 +0,0 @@
/** @file
Non-existing BaseLib functions on Ipf
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: Non-existing.c
**/
#include "../BaseLibInternals.h"
/**
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.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
//
// This version of this function does not actually change the stack pointer
// This is to support compilation of CPU types that do not support assemblers
// such as EBC
//
ASSERT (FALSE);
}

View File

@ -1,7 +1,7 @@
/** @file /** @file
Switch Stack functions. Switch Stack functions.
Copyright (c) 2006, Intel Corporation<BR> Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -19,14 +19,17 @@
/** /**
Transfers control to a function starting with a new stack. Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack Transfers control to the function specified by EntryPoint using the
specified by NewStack and passing in the parameters specified by Context1 and new stack specified by NewStack and passing in the parameters specified
Context2. Context1 and Context2 are optional and may be NULL. The function by Context1 and Context2. Context1 and Context2 are optional and may
EntryPoint must never return. be NULL. The function EntryPoint must never return. This function
supports a variable number of arguments following the NewStack parameter.
These additional arguments are 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 EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT(). If NewStack is NULL, then ASSERT().
For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack. @param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint @param Context1 A pointer to the context to pass into the EntryPoint
@ -41,16 +44,19 @@ VOID
EFIAPI EFIAPI
SwitchStack ( SwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, IN VOID *Context1, OPTIONAL
IN VOID *Context2, IN VOID *Context2, OPTIONAL
IN VOID *NewStack IN VOID *NewStack,
...
) )
{ {
VA_LIST Marker;
ASSERT (EntryPoint != NULL && NewStack != NULL); ASSERT (EntryPoint != NULL && NewStack != NULL);
#ifdef MDE_CPU_IPF VA_START (Marker, NewStack);
ASSERT (((UINTN)NewStack & 0xf) == 0);
#endif
InternalSwitchStack (EntryPoint, Context1, Context2, NewStack); InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
VA_END (Marker);
} }