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