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 17GCC_ASM_EXPORT(SetJump) 18GCC_ASM_EXPORT(InternalLongJump) 19 20#/** 21# Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# 22# 23# Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial 24# call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero 25# value to be returned by SetJump(). 26# 27# If JumpBuffer is NULL, then ASSERT(). 28# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). 29# 30# @param JumpBuffer A pointer to CPU context buffer. 31# 32#**/ 33# 34#UINTN 35#EFIAPI 36#SetJump ( 37# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0 38# ); 39# 40ASM_PFX(SetJump): 41 mov r3, r13 42 stmia r0, {r3-r12,r14} 43 eor r0, r0, r0 44 bx lr 45 46#/** 47# Restores the CPU context that was saved with SetJump().# 48# 49# Restores the CPU context from the buffer specified by JumpBuffer. 50# This function never returns to the caller. 51# Instead is resumes execution based on the state of JumpBuffer. 52# 53# @param JumpBuffer A pointer to CPU context buffer. 54# @param Value The value to return when the SetJump() context is restored. 55# 56#**/ 57#VOID 58#EFIAPI 59#InternalLongJump ( 60# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0 61# IN UINTN Value // R1 62# ); 63# 64ASM_PFX(InternalLongJump): 65 ldmia r0, {r3-r12,r14} 66 mov r13, r3 67 mov r0, r1 68 bx lr 69 70ASM_FUNCTION_REMOVE_IF_UNREFERENCED 71