]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | Implementation of SetJump() on IA-32.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2007, Intel Corporation<BR>\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 | **/\r | |
14 | \r | |
15 | //\r | |
16 | // Include common header file for this module.\r | |
17 | //\r | |
f734a10a A |
18 | #include <BaseLibInternals.h>\r |
19 | \r | |
42eedea9 | 20 | /**\r |
21 | Worker function that checks ASSERT condition for JumpBuffer\r | |
e1f414b6 | 22 | \r |
42eedea9 | 23 | Checks ASSERT condition for JumpBuffer.\r |
24 | \r | |
25 | If JumpBuffer is NULL, then ASSERT().\r | |
26 | For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
27 | \r | |
28 | @param JumpBuffer A pointer to CPU context buffer.\r | |
29 | \r | |
30 | **/\r | |
e1f414b6 | 31 | VOID\r |
32 | EFIAPI\r | |
33 | InternalAssertJumpBuffer (\r | |
34 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
35 | );\r | |
36 | \r | |
42eedea9 | 37 | /**\r |
38 | Saves the current CPU context that can be restored with a call to LongJump()\r | |
39 | and returns 0.\r | |
40 | \r | |
41 | Saves the current CPU context in the buffer specified by JumpBuffer and\r | |
42 | returns 0. The initial call to SetJump() must always return 0. Subsequent\r | |
43 | calls to LongJump() cause a non-zero value to be returned by SetJump().\r | |
44 | \r | |
45 | If JumpBuffer is NULL, then ASSERT().\r | |
46 | For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
47 | \r | |
48 | @param JumpBuffer A pointer to CPU context buffer.\r | |
49 | \r | |
50 | @retval 0 Indicates a return from SetJump().\r | |
51 | \r | |
52 | **/\r | |
e1f414b6 | 53 | _declspec (naked)\r |
54 | UINTN\r | |
55 | EFIAPI\r | |
56 | SetJump (\r | |
57 | OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
58 | )\r | |
59 | {\r | |
60 | _asm {\r | |
61 | push [esp + 4]\r | |
62 | call InternalAssertJumpBuffer\r | |
63 | pop ecx\r | |
64 | pop ecx\r | |
65 | mov edx, [esp]\r | |
66 | mov [edx], ebx\r | |
67 | mov [edx + 4], esi\r | |
68 | mov [edx + 8], edi\r | |
69 | mov [edx + 12], ebp\r | |
70 | mov [edx + 16], esp\r | |
71 | mov [edx + 20], ecx\r | |
72 | xor eax, eax\r | |
73 | jmp ecx\r | |
74 | }\r | |
75 | }\r | |
76 | \r |