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