VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/misc/setjmp.asm@ 5799

Last change on this file since 5799 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1; $Id: setjmp.asm 4071 2007-08-07 17:07:59Z vboxsync $
2;; @file
3; innotek Portable Runtime - No-CRT setjmp & longjmp - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2007 innotek GmbH
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License as published by the Free Software Foundation,
13; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14; distribution. VirtualBox OSE is distributed in the hope that it will
15; be useful, but WITHOUT ANY WARRANTY of any kind.
16
17%include "iprt/asmdefs.mac"
18
19
20BEGINCODE
21
22
23BEGINPROC RT_NOCRT(setjmp)
24%ifdef RT_ARCH_AMD64
25 mov rax, [rsp]
26 mov [rdi + 00h], rax ; rip
27 lea rcx, [rsp + 8]
28 mov [rdi + 08h], rcx ; rsp
29 mov [rdi + 10h], rbp
30 mov [rdi + 18h], r15
31 mov [rdi + 20h], r14
32 mov [rdi + 28h], r13
33 mov [rdi + 30h], r12
34 mov [rdi + 38h], rbx
35%else
36 mov edx, [esp + 4h]
37 mov eax, [esp]
38 mov [edx + 00h], eax ; eip
39 lea ecx, [esp + 4h]
40 mov [edx + 04h], ecx ; esp
41 mov [edx + 08h], ebp
42 mov [edx + 0ch], ebx
43 mov [edx + 10h], edi
44 mov [edx + 14h], esi
45%endif
46 xor eax, eax
47 ret
48ENDPROC RT_NOCRT(setjmp)
49
50
51BEGINPROC RT_NOCRT(longjmp)
52%ifdef RT_ARCH_AMD64
53 mov rbx, [rdi + 38h]
54 mov r12, [rdi + 30h]
55 mov r13, [rdi + 28h]
56 mov r14, [rdi + 20h]
57 mov r15, [rdi + 18h]
58 mov rbp, [rdi + 10h]
59 mov eax, esi
60 test eax, eax
61 jnz .fine
62 inc al
63.fine:
64 mov rsp, [rdi + 08h]
65 jmp qword [rdi + 00h]
66%else
67 mov edx, [esp + 4h]
68 mov eax, [esp + 8h]
69 mov esi, [edx + 14h]
70 mov edi, [edx + 10h]
71 mov ebx, [edx + 0ch]
72 mov ebp, [edx + 08h]
73 test eax, eax
74 jnz .fine
75 inc al
76.fine:
77 mov esp, [edx + 04h]
78 jmp dword [edx + 00h]
79%endif
80ENDPROC RT_NOCRT(longjmp)
81
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette