]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Arm / SetJumpLongJump.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
4 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
6 #
7 #------------------------------------------------------------------------------
8 .text
9 .p2align 2
10
11 GCC_ASM_EXPORT(SetJump)
12 GCC_ASM_EXPORT(InternalLongJump)
13
14 #/**
15 # Saves the current CPU context that can be restored with a call to LongJump() and returns 0.#
16 #
17 # Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
18 # call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
19 # value to be returned by SetJump().
20 #
21 # If JumpBuffer is NULL, then ASSERT().
22 # For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
23 #
24 # @param JumpBuffer A pointer to CPU context buffer.
25 #
26 #**/
27 #
28 #UINTN
29 #EFIAPI
30 #SetJump (
31 # IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
32 # );
33 #
34 ASM_PFX(SetJump):
35 mov r3, r13
36 stmia r0, {r3-r12,r14}
37 eor r0, r0, r0
38 bx lr
39
40 #/**
41 # Restores the CPU context that was saved with SetJump().#
42 #
43 # Restores the CPU context from the buffer specified by JumpBuffer.
44 # This function never returns to the caller.
45 # Instead is resumes execution based on the state of JumpBuffer.
46 #
47 # @param JumpBuffer A pointer to CPU context buffer.
48 # @param Value The value to return when the SetJump() context is restored.
49 #
50 #**/
51 #VOID
52 #EFIAPI
53 #InternalLongJump (
54 # IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
55 # IN UINTN Value // R1
56 # );
57 #
58 ASM_PFX(InternalLongJump):
59 ldmia r0, {r3-r12,r14}
60 mov r13, r3
61 mov r0, r1
62 bx lr
63
64 ASM_FUNCTION_REMOVE_IF_UNREFERENCED