VirtualBox

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

Last change on this file since 25565 was 25565, checked in by vboxsync, 15 years ago

iprt/setjmp.asm: todos

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1; $Id: setjmp.asm 25565 2009-12-22 13:21:59Z vboxsync $
2;; @file
3; IPRT - No-CRT setjmp & longjmp - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2007 Sun Microsystems, Inc.
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.215389.xyz. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27; Clara, CA 95054 USA or visit http://www.sun.com if you need
28; additional information or have any questions.
29;
30
31%include "iprt/asmdefs.mac"
32
33
34BEGINCODE
35
36
37BEGINPROC RT_NOCRT(setjmp)
38%ifdef RT_ARCH_AMD64
39 %ifdef ASM_CALL64_MSC
40 %error "port me"
41 %endif
42 mov rax, [rsp]
43 mov [rdi + 00h], rax ; rip
44 lea rcx, [rsp + 8]
45 mov [rdi + 08h], rcx ; rsp
46 mov [rdi + 10h], rbp
47 mov [rdi + 18h], r15
48 mov [rdi + 20h], r14
49 mov [rdi + 28h], r13
50 mov [rdi + 30h], r12
51 mov [rdi + 38h], rbx
52 ;; @todo Must save XMM registers ... can ignore in RC/R0?
53%else
54 mov edx, [esp + 4h]
55 mov eax, [esp]
56 mov [edx + 00h], eax ; eip
57 lea ecx, [esp + 4h]
58 mov [edx + 04h], ecx ; esp
59 mov [edx + 08h], ebp
60 mov [edx + 0ch], ebx
61 mov [edx + 10h], edi
62 mov [edx + 14h], esi
63%endif
64 xor eax, eax
65 ret
66ENDPROC RT_NOCRT(setjmp)
67
68
69BEGINPROC RT_NOCRT(longjmp)
70%ifdef RT_ARCH_AMD64
71 %ifdef ASM_CALL64_MSC
72 %error "port me"
73 %endif
74 mov rbx, [rdi + 38h]
75 mov r12, [rdi + 30h]
76 mov r13, [rdi + 28h]
77 mov r14, [rdi + 20h]
78 mov r15, [rdi + 18h]
79 mov rbp, [rdi + 10h]
80 mov eax, esi
81 test eax, eax
82 jnz .fine
83 inc al
84.fine:
85 mov rsp, [rdi + 08h]
86 jmp qword [rdi + 00h]
87%else
88 mov edx, [esp + 4h]
89 mov eax, [esp + 8h]
90 mov esi, [edx + 14h]
91 mov edi, [edx + 10h]
92 mov ebx, [edx + 0ch]
93 mov ebp, [edx + 08h]
94 test eax, eax
95 jnz .fine
96 inc al
97.fine:
98 mov esp, [edx + 04h]
99 jmp dword [edx + 00h]
100%endif
101ENDPROC RT_NOCRT(longjmp)
102
Note: See TracBrowser for help on using the repository browser.

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