X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FSwitchStack.c;h=954e863fc1ebd4e4bec0e72967ffb0dbba3df61b;hb=d3febfd9ade35dc552df6b3607c2b15d26b82867;hp=acc0e715ca7c13888881ee0e9348c97d383fc968;hpb=d5b86e43cf23787da85fcf862807c1f6714bfac2;p=mirror_edk2.git
diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c
index acc0e715ca..954e863fc1 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -1,23 +1,12 @@
/** @file
Switch Stack functions.
- Copyright (c) 2006 - 2007, 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.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-//
-// Include common header file for this module.
-//
-
-
-#include
+#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
@@ -41,27 +30,39 @@
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
+ @param ... This variable argument list is ignored for IA32, x64, and EBC.
+ For IPF, this variable argument list is expected to contain
+ a single parameter of type VOID * that specifies the new backing
+ store pointer.
+
**/
VOID
EFIAPI
SwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
+ IN VOID *Context1 OPTIONAL,
+ IN VOID *Context2 OPTIONAL,
IN VOID *NewStack,
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
+ //
+ // New stack must be aligned with CPU_STACK_ALIGNMENT
+ //
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
+
VA_START (Marker, NewStack);
InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
+ VA_END (Marker);
+
//
// InternalSwitchStack () will never return
//