SetJumpLongJump.c revision 38bbd3d91c38481d18c1a7e2049473c951ee98ed
1/** @file 2 Switch Stack functions. 3 4 Copyright (c) 2006, Intel Corporation 5 All rights reserved. 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// 15// Include common header file for this module. 16// 17#include <BaseLibInternals.h> 18 19/** 20 Worker function that checks ASSERT condition for JumpBuffer 21 22 Checks ASSERT condition for JumpBuffer. 23 24 If JumpBuffer is NULL, then ASSERT(). 25 For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). 26 27 @param JumpBuffer A pointer to CPU context buffer. 28 29**/ 30VOID 31EFIAPI 32InternalAssertJumpBuffer ( 33 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer 34 ); 35 36/** 37 Saves the current CPU context that can be restored with a call to LongJump() and returns 0. 38 39 Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial 40 call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero 41 value to be returned by SetJump(). 42 43 If JumpBuffer is NULL, then ASSERT(). 44 For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). 45 46 @param JumpBuffer A pointer to CPU context buffer. 47 48**/ 49UINTN 50EFIAPI 51SetJump ( 52 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer 53 ) 54{ 55 InternalAssertJumpBuffer (JumpBuffer); 56 return 0; 57} 58 59/** 60 Restores the CPU context that was saved with SetJump(). 61 62 Restores the CPU context from the buffer specified by JumpBuffer. 63 This function never returns to the caller. 64 Instead is resumes execution based on the state of JumpBuffer. 65 66 @param JumpBuffer A pointer to CPU context buffer. 67 @param Value The value to return when the SetJump() context is restored. 68 69**/ 70VOID 71EFIAPI 72InternalLongJump ( 73 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, 74 IN UINTN Value 75 ) 76{ 77 // 78 // This function cannot work on EBC 79 // 80 ASSERT (FALSE); 81} 82