mirror of https://github.com/acidanthera/audk.git
Deleted x64\SwitchStack.c Ipf/SwitchStack.c.
Added SwitchStack.c in Baselib\ Rename Ia32/SwitchStack.c to Ia32/InternalSwitchStack.c Changed _SwitchStack() into InternalSwitchStack() in SwitchStack.asm and SwitchStack.s Fixed one bug in LinkedList.c, that List length couldn't up to PcdMaximumLinkedListLength. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@394 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6fc80a45b5
commit
7d7c2b4640
|
@ -73,6 +73,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename>x86Thunk.c</Filename>
|
||||
<Filename>Unaligned.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>Ia32/Non-existing.c</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/LShiftU64.s</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/RShiftU64.s</Filename>
|
||||
|
@ -89,7 +90,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename FileType="GCC_Assembly_Code">Ia32/SwapBytes64.s</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/SetJump.s</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/LongJump.s</Filename>
|
||||
<Filename>Ia32/SwitchStack.c</Filename>
|
||||
<Filename>Ia32/InternalSwitchStack.c</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/CpuId.s</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/ReadEflags.s</Filename>
|
||||
<Filename FileType="GCC_Assembly_Code">Ia32/ReadMsr64.s</Filename>
|
||||
|
@ -179,8 +180,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename>Unaligned.c</Filename>
|
||||
<Filename>Math64.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>x64/Non-existing.c</Filename>
|
||||
<Filename>x64/SwitchStack.c</Filename>
|
||||
<Filename>x64/SwitchStack.asm</Filename>
|
||||
<Filename>x64/SetJump.asm</Filename>
|
||||
<Filename>x64/LongJump.asm</Filename>
|
||||
|
@ -269,9 +270,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Arch ArchType="IPF">
|
||||
<Filename>Math64.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>Ipf/setjmp.s</Filename>
|
||||
<Filename>Ipf/SwitchStack.s</Filename>
|
||||
<Filename>x64/SwitchStack.c</Filename>
|
||||
<Filename>Ipf/Unaligned.c</Filename>
|
||||
<Filename>Ipf/CpuBreakpoint.c</Filename>
|
||||
<Filename>Ipf/InterlockedCompareExchange32.s</Filename>
|
||||
|
|
|
@ -73,7 +73,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename>x86Thunk.c</Filename>
|
||||
<Filename>Unaligned.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>Ia32/Non-existing.c</Filename>
|
||||
<Filename>Ia32/InternalSwitchStack.c</Filename>
|
||||
<Filename>Ia32/LShiftU64.asm</Filename>
|
||||
<Filename>Ia32/RShiftU64.asm</Filename>
|
||||
<Filename>Ia32/ARShiftU64.asm</Filename>
|
||||
|
@ -89,7 +91,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename>Ia32/SwapBytes64.asm</Filename>
|
||||
<Filename>Ia32/SetJump.asm</Filename>
|
||||
<Filename>Ia32/LongJump.asm</Filename>
|
||||
<Filename>Ia32/SwitchStack.c</Filename>
|
||||
<Filename>Ia32/CpuId.asm</Filename>
|
||||
<Filename>Ia32/ReadEflags.asm</Filename>
|
||||
<Filename>Ia32/ReadMsr64.asm</Filename>
|
||||
|
@ -179,8 +180,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Filename>Unaligned.c</Filename>
|
||||
<Filename>Math64.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>x64/Non-existing.c</Filename>
|
||||
<Filename>x64/SwitchStack.c</Filename>
|
||||
<Filename>x64/SwitchStack.asm</Filename>
|
||||
<Filename>x64/SetJump.asm</Filename>
|
||||
<Filename>x64/LongJump.asm</Filename>
|
||||
|
@ -269,9 +270,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<Arch ArchType="IPF">
|
||||
<Filename>Math64.c</Filename>
|
||||
<Filename>LongJump.c</Filename>
|
||||
<Filename>SwitchStack.c</Filename>
|
||||
<Filename>Ipf/PalCallStatic.s</Filename>
|
||||
<Filename>Ipf/setjmp.s</Filename>
|
||||
<Filename>x64/SwitchStack.c</Filename>
|
||||
<Filename>Ipf/SwitchStack.s</Filename>
|
||||
<Filename>Ipf/Unaligned.c</Filename>
|
||||
<Filename>Ipf/CpuBreakpoint.c</Filename>
|
||||
|
|
|
@ -114,6 +114,15 @@ InternalMathDivRemS64x64 (
|
|||
OUT INT64 *Remainder
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
InternalSwitchStack (
|
||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
IN VOID *Context1,
|
||||
IN VOID *Context2,
|
||||
IN VOID *NewStack
|
||||
);
|
||||
|
||||
//
|
||||
// Ia32 and x64 specific functions
|
||||
//
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/** @file
|
||||
SwitchStack() function for IA-32.
|
||||
|
||||
Copyright (c) 2006, 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
|
||||
|
||||
**/
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@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,
|
||||
IN VOID *Context2,
|
||||
IN VOID *NewStack
|
||||
)
|
||||
{
|
||||
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||
|
||||
JumpBuffer.Eip = (UINTN)EntryPoint;
|
||||
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
|
||||
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
|
||||
((VOID**)JumpBuffer.Esp)[1] = Context1;
|
||||
((VOID**)JumpBuffer.Esp)[2] = Context2;
|
||||
|
||||
LongJump (&JumpBuffer, (UINTN)-1);
|
||||
}
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
|
||||
//VOID
|
||||
//_SwitchStack (
|
||||
//InternalSwitchStack (
|
||||
// VOID *ContinuationFunction,
|
||||
// UINTN Parameter,
|
||||
// UINTN NewTopOfStack,
|
||||
|
@ -85,7 +85,7 @@
|
|||
//
|
||||
//--*/
|
||||
|
||||
PROCEDURE_ENTRY(_SwitchStack)
|
||||
PROCEDURE_ENTRY(InternalSwitchStack)
|
||||
|
||||
mov r16 = -0x10;;
|
||||
and r16 = r34, r16;; // get new stack value in R16, 0 the last nibble.
|
||||
|
@ -117,6 +117,6 @@ PROCEDURE_ENTRY(_SwitchStack)
|
|||
;;
|
||||
br.call.sptk.few b0=b6;; // Call the continuation function
|
||||
;;
|
||||
PROCEDURE_EXIT(_SwitchStack)
|
||||
PROCEDURE_EXIT(InternalSwitchStack)
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ IsNodeInList (
|
|||
ASSERT (Node != NULL);
|
||||
|
||||
Count = FixedPcdGet32 (PcdMaximumLinkedListLength);
|
||||
if (Count != 0) {
|
||||
Count++;
|
||||
}
|
||||
|
||||
Ptr = List;
|
||||
do {
|
||||
Ptr = Ptr->ForwardLink;
|
||||
|
@ -44,6 +48,7 @@ IsNodeInList (
|
|||
if (FixedPcdGet32 (PcdMaximumLinkedListLength) > 0) {
|
||||
while ((Count > 0) && (Ptr != List)) {
|
||||
Ptr = Ptr->ForwardLink;
|
||||
Count--;
|
||||
}
|
||||
ASSERT (Count > 0);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/** @file
|
||||
Switch Stack functions.
|
||||
|
||||
Copyright (c) 2006, 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: SwitchStack.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
|
||||
SwitchStack (
|
||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
IN VOID *Context1,
|
||||
IN VOID *Context2,
|
||||
IN VOID *NewStack
|
||||
)
|
||||
{
|
||||
ASSERT (EntryPoint != NULL && NewStack != NULL);
|
||||
|
||||
InternalSwitchStack (EntryPoint, Context1, Context2, NewStack);
|
||||
}
|
|
@ -36,12 +36,12 @@
|
|||
; None
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
_SwitchStack PROC
|
||||
InternalSwitchStack PROC
|
||||
mov rax, rcx
|
||||
mov rcx, rdx
|
||||
mov rdx, r8
|
||||
lea rsp, [r9 - 20h]
|
||||
call rax
|
||||
_SwitchStack ENDP
|
||||
InternalSwitchStack ENDP
|
||||
|
||||
END
|
||||
|
|
Loading…
Reference in New Issue