]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/Ia32/SetJump.asm
Import some basic libraries instances for Mde Packages.
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / SetJump.asm
diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.asm b/MdePkg/Library/BaseLib/Ia32/SetJump.asm
new file mode 100644 (file)
index 0000000..4b7b40c
--- /dev/null
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   SetJump.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   Implementation of SetJump() on IA-32.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .386\r
+    .model  flat,C\r
+    .code\r
+\r
+InternalAssertJumpBuffer    PROTO   C\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; SetJump (\r
+;   OUT     BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
+;   );\r
+;------------------------------------------------------------------------------\r
+SetJump     PROC\r
+    push    [esp + 4]\r
+    call    InternalAssertJumpBuffer    ; To validate JumpBuffer\r
+    pop     ecx\r
+    pop     ecx                         ; ecx <- return address\r
+    mov     edx, [esp]\r
+    mov     [edx], ebx\r
+    mov     [edx + 4], esi\r
+    mov     [edx + 8], edi\r
+    mov     [edx + 12], ebp\r
+    mov     [edx + 16], esp\r
+    mov     [edx + 20], ecx             ; eip value to restore in LongJump\r
+    xor     eax, eax\r
+    jmp     ecx\r
+SetJump     ENDP\r
+\r
+    END\r