c1b2de07e205b634f95b29eb814bff0d7e96f299
[mirror_edk2.git] / MdePkg / Library / BaseLib / AArch64 / SwitchStack.asm
1 //------------------------------------------------------------------------------
2 //
3 // Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
4 // Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 // Portions copyright (c) 2011 - 2013, ARM Limited. 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 EXPORT InternalSwitchStackAsm
17 EXPORT CpuPause
18 AREA BaseLib_LowLevel, CODE, READONLY
19
20 /**
21 //
22 // This allows the caller to switch the stack and goes to the new entry point
23 //
24 // @param EntryPoint The pointer to the location to enter
25 // @param Context Parameter to pass in
26 // @param Context2 Parameter2 to pass in
27 // @param NewStack New Location of the stack
28 //
29 // @return Nothing. Goes to the Entry Point passing in the new parameters
30 //
31 VOID
32 EFIAPI
33 InternalSwitchStackAsm (
34 SWITCH_STACK_ENTRY_POINT EntryPoint,
35 VOID *Context,
36 VOID *Context2,
37 VOID *NewStack
38 );
39 **/
40 InternalSwitchStackAsm
41 mov x29, #0
42 mov x30, x0
43 mov sp, x3
44 mov x0, x1
45 mov x1, x2
46 ret
47
48 /**
49 //
50 // Requests CPU to pause for a short period of time.
51 //
52 // Requests CPU to pause for a short period of time. Typically used in MP
53 // systems to prevent memory starvation while waiting for a spin lock.
54 //
55 VOID
56 EFIAPI
57 CpuPause (
58 VOID
59 )
60 **/
61 CpuPause
62 nop
63 nop
64 nop
65 nop
66 nop
67 ret
68
69 END