VirtualBox

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

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

typo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1; $Id: setjmp.asm 25568 2009-12-22 14:34:52Z vboxsync $
2;; @file
3; IPRT - No-CRT setjmp & longjmp - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 (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
37;;
38; @param x86:[esp+4] msc:rcx gcc:rdi The jump buffer pointer.
39BEGINPROC RT_NOCRT(setjmp)
40%ifdef RT_ARCH_AMD64
41 %ifndef ASM_CALL64_MSC
42 mov rcx, rdi
43 %endif
44 mov rax, [rsp]
45 mov [rcx + 0h*8], rax ; 0 - rip
46 lea rdx, [rsp + 8]
47 mov [rcx + 1h*8], rdx ; 1 - rsp
48 mov [rcx + 2h*8], rbp
49 mov [rcx + 3h*8], r15
50 mov [rcx + 4h*8], r14
51 mov [rcx + 5h*8], r13
52 mov [rcx + 6h*8], r12
53 mov [rcx + 7h*8], rbx
54 %ifdef ASM_CALL64_MSC
55 mov [rcx + 8h*8], rsi
56 mov [rcx + 9h*8], rdi
57 movdqa [rcx + 0ah*8], xmm6
58 movdqa [rcx + 0ch*8], xmm7
59 movdqa [rcx + 0eh*8], xmm8
60 movdqa [rcx + 10h*8], xmm9
61 movdqa [rcx + 12h*8], xmm10
62 movdqa [rcx + 14h*8], xmm11
63 movdqa [rcx + 16h*8], xmm12
64 movdqa [rcx + 18h*8], xmm13
65 movdqa [rcx + 1ah*8], xmm14
66 movdqa [rcx + 1ch*8], xmm15
67 %ifndef RT_OS_WINDOWS
68 %error "Fix setjmp.h"
69 %endif
70 %endif
71%else
72 mov edx, [esp + 4h]
73 mov eax, [esp]
74 mov [edx + 0h*4], eax ; eip
75 lea ecx, [esp + 4h]
76 mov [edx + 1h*4], ecx ; esp
77 mov [edx + 2h*4], ebp
78 mov [edx + 3h*4], ebx
79 mov [edx + 4h*4], edi
80 mov [edx + 5h*4], esi
81%endif
82 xor eax, eax
83 ret
84ENDPROC RT_NOCRT(setjmp)
85
86
87;;
88; @param x86:[esp+4] msc:rcx gcc:rdi The jump buffer pointer.
89; @param x86:[esp+8] msc:rdx gcc:rsi Return value.
90BEGINPROC RT_NOCRT(longjmp)
91%ifdef RT_ARCH_AMD64
92 %ifdef ASM_CALL64_MSC
93 mov eax, edx ; ret
94 %else
95 mov rcx, rdi ; jmp_buf
96 mov eax, esi ; ret
97 %endif
98 mov rbp, [rcx + 2h*8]
99 mov r15, [rcx + 3h*8]
100 mov r14, [rcx + 4h*8]
101 mov r13, [rcx + 5h*8]
102 mov r12, [rcx + 6h*8]
103 mov rbx, [rcx + 7h*8]
104 %ifdef ASM_CALL64_MSC
105 mov rsi, [rcx + 8h*8]
106 mov rdi, [rcx + 9h*8]
107 movdqa xmm6, [rcx + 0ah*8]
108 movdqa xmm7, [rcx + 0ch*8]
109 movdqa xmm8, [rcx + 0eh*8]
110 movdqa xmm9, [rcx + 10h*8]
111 movdqa xmm10, [rcx + 12h*8]
112 movdqa xmm11, [rcx + 14h*8]
113 movdqa xmm12, [rcx + 16h*8]
114 movdqa xmm13, [rcx + 18h*8]
115 movdqa xmm14, [rcx + 1ah*8]
116 movdqa xmm15, [rcx + 1ch*8]
117 %ifndef RT_OS_WINDOWS
118 %error "Fix setjmp.h"
119 %endif
120 %endif
121 test eax, eax
122 jnz .fine
123 inc al
124.fine:
125 mov rsp, [rcx + 1h*8]
126 jmp qword [rcx + 0h*8]
127%else
128 mov edx, [esp + 4h] ; jmp_buf
129 mov eax, [esp + 8h] ; ret
130 mov esi, [edx + 5h*4]
131 mov edi, [edx + 4h*4]
132 mov ebx, [edx + 3h*4]
133 mov ebp, [edx + 2h*4]
134 test eax, eax
135 jnz .fine
136 inc al
137.fine:
138 mov esp, [edx + 1h*4]
139 jmp dword [edx+ 0h*4]
140%endif
141ENDPROC RT_NOCRT(longjmp)
142
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