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