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