]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/SwitchStack.c
1. added functions header for BaseUefiDecompressLi
[mirror_edk2.git] / MdePkg / Library / BaseLib / SwitchStack.c
CommitLineData
7d7c2b46 1/** @file\r
2 Switch Stack functions.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: SwitchStack.c\r
14\r
15**/\r
16\r
17#include <BaseLibInternals.h>\r
18\r
19/**\r
20 Transfers control to a function starting with a new stack.\r
21\r
22 Transfers control to the function specified by EntryPoint using the new stack\r
23 specified by NewStack and passing in the parameters specified by Context1 and\r
24 Context2. Context1 and Context2 are optional and may be NULL. The function\r
25 EntryPoint must never return.\r
26\r
27 If EntryPoint is NULL, then ASSERT().\r
28 If NewStack is NULL, then ASSERT().\r
1ea5ca46 29 For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT().\r
7d7c2b46 30\r
31 @param EntryPoint A pointer to function to call with the new stack.\r
32 @param Context1 A pointer to the context to pass into the EntryPoint\r
33 function.\r
34 @param Context2 A pointer to the context to pass into the EntryPoint\r
35 function.\r
36 @param NewStack A pointer to the new stack to use for the EntryPoint\r
37 function.\r
38\r
39**/\r
40VOID\r
41EFIAPI\r
42SwitchStack (\r
43 IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
44 IN VOID *Context1,\r
45 IN VOID *Context2,\r
46 IN VOID *NewStack\r
47 )\r
48{\r
49 ASSERT (EntryPoint != NULL && NewStack != NULL);\r
50\r
4cbd2175 51#ifdef MDE_CPU_IPF\r
52 ASSERT (((UINTN)NewStack & 0xf) == 0);\r
53#endif\r
54\r
7d7c2b46 55 InternalSwitchStack (EntryPoint, Context1, Context2, NewStack);\r
56}\r