]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Arm / SetJumpLongJump.asm
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
9 EXPORT SetJump
10 EXPORT InternalLongJump
11
12 AREA BaseLib, CODE, READONLY
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 SetJump
35 MOV R3, R13
36 STM R0, {R3-R12,R14}
37 EOR 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 InternalLongJump
59 LDM R0, {R3-R12,R14}
60 MOV R13, R3
61 MOV R0, R1
62 BX LR
63
64 END