]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S
Fix issue with CodeSourcery gcc requiring assembly functions to have a .type define...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Arm / SetJumpLongJump.S
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 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php.
9 #
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 #
13 #------------------------------------------------------------------------------
14 .text
15 .p2align 2
16
17 .globl ASM_PFX(SetJump)
18 INTERWORK_FUNC(SetJump)
19
20 .globl ASM_PFX(InternalLongJump)
21 INTERWORK_FUNC(InternalLongJump)
22
23 #/**
24 # Saves the current CPU context that can be restored with a call to LongJump() and returns 0.#
25 #
26 # Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
27 # call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
28 # value to be returned by SetJump().
29 #
30 # If JumpBuffer is NULL, then ASSERT().
31 # For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
32 #
33 # @param JumpBuffer A pointer to CPU context buffer.
34 #
35 #**/
36 #
37 #UINTN
38 #EFIAPI
39 #SetJump (
40 # IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
41 # );
42 #
43 ASM_PFX(SetJump):
44 mov r3, r13
45 stmia r0, {r3-r12,r14}
46 eor r0, r0, r0
47 bx lr
48
49 #/**
50 # Restores the CPU context that was saved with SetJump().#
51 #
52 # Restores the CPU context from the buffer specified by JumpBuffer.
53 # This function never returns to the caller.
54 # Instead is resumes execution based on the state of JumpBuffer.
55 #
56 # @param JumpBuffer A pointer to CPU context buffer.
57 # @param Value The value to return when the SetJump() context is restored.
58 #
59 #**/
60 #VOID
61 #EFIAPI
62 #InternalLongJump (
63 # IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
64 # IN UINTN Value // R1
65 # );
66 #
67 ASM_PFX(InternalLongJump):
68 ldmia r0, {r3-r12,r14}
69 mov r13, r3
70 mov r0, r1
71 bx lr
72
73 ASM_FUNCTION_REMOVE_IF_UNREFERENCED