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