1 /** @file
2   SwitchStack() function for ARM.
3 
4   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php.
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #include "BaseLibInternals.h"
17 
18 /**
19   Transfers control to a function starting with a new stack.
20 
21   This internal worker function transfers control to the function
22   specified by EntryPoint using the new stack specified by NewStack,
23   and passes in the parameters specified by Context1 and Context2.
24   Context1 and Context2 are optional and may be NULL.
25   The function EntryPoint must never return.
26 
27   @param EntryPoint   The pointer to the function to enter.
28   @param Context1     The first parameter to pass in.
29   @param Context2     The second Parameter to pass in
30   @param NewStack     The new Location of the stack
31 
32 **/
33 VOID
34 EFIAPI
35 InternalSwitchStackAsm (
36   IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,
37   IN      VOID                      *Context1,   OPTIONAL
38   IN      VOID                      *Context2,   OPTIONAL
39   IN      VOID                      *NewStack
40   );
41 
42 
43 /**
44   Transfers control to a function starting with a new stack.
45 
46   Transfers control to the function specified by EntryPoint using the
47   new stack specified by NewStack, and passes in the parameters specified
48   by Context1 and Context2.  Context1 and Context2 are optional and may
49   be NULL.  The function EntryPoint must never return.
50   Marker will be ignored on IA-32, x64, and EBC.
51   IPF CPUs expect one additional parameter of type VOID * that specifies
52   the new backing store pointer.
53 
54   If EntryPoint is NULL, then ASSERT().
55   If NewStack is NULL, then ASSERT().
56 
57   @param  EntryPoint  A pointer to function to call with the new stack.
58   @param  Context1    A pointer to the context to pass into the EntryPoint
59                       function.
60   @param  Context2    A pointer to the context to pass into the EntryPoint
61                       function.
62   @param  NewStack    A pointer to the new stack to use for the EntryPoint
63                       function.
64   @param  Marker      A VA_LIST marker for the variable argument list.
65 
66 **/
67 VOID
68 EFIAPI
InternalSwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint,IN VOID * Context1,OPTIONAL IN VOID * Context2,OPTIONAL IN VOID * NewStack,IN VA_LIST Marker)69 InternalSwitchStack (
70   IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,
71   IN      VOID                      *Context1,   OPTIONAL
72   IN      VOID                      *Context2,   OPTIONAL
73   IN      VOID                      *NewStack,
74   IN      VA_LIST                   Marker
75   )
76 
77 {
78   InternalSwitchStackAsm (EntryPoint, Context1, Context2, NewStack);
79 }
80