]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/SetJump.c
Optimize the size of the Base Library for the MSFT 32-bit tool chains by taking advan...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / SetJump.c
1 /** @file
2 Implementation of SetJump() on IA-32.
3
4 Copyright (c) 2006, Intel Corporation<BR>
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 #if _MSC_EXTENSIONS
16
17 VOID
18 EFIAPI
19 InternalAssertJumpBuffer (
20 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
21 );
22
23 _declspec (naked)
24 UINTN
25 EFIAPI
26 SetJump (
27 OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
28 )
29 {
30 _asm {
31 push [esp + 4]
32 call InternalAssertJumpBuffer
33 pop ecx
34 pop ecx
35 mov edx, [esp]
36 mov [edx], ebx
37 mov [edx + 4], esi
38 mov [edx + 8], edi
39 mov [edx + 12], ebp
40 mov [edx + 16], esp
41 mov [edx + 20], ecx
42 xor eax, eax
43 jmp ecx
44 }
45 }
46
47 #endif