OLD | NEW |
---|---|
1 /* | 1 /* |
2 * ==================================================== | 2 * ==================================================== |
3 * Copyright (C) 2007 by Ellips BV. All rights reserved. | 3 * Copyright (C) 2007 by Ellips BV. All rights reserved. |
4 * | 4 * |
5 * Permission to use, copy, modify, and distribute this | 5 * Permission to use, copy, modify, and distribute this |
6 * software is freely granted, provided that this notice | 6 * software is freely granted, provided that this notice |
7 * is preserved. | 7 * is preserved. |
8 * ==================================================== | 8 * ==================================================== |
9 */ | 9 */ |
10 | 10 |
11 /* | 11 /* |
12 ** jmp_buf: | 12 ** jmp_buf: |
13 ** rbx r12 r13 r14 rip ebp esp | 13 ** rbx r12 r13 r14 rip ebp esp |
14 ** 0 8 16 24 32 40 44 | 14 ** 0 8 16 24 32 40 44 |
15 */ | 15 */ |
16 | 16 |
17 #include "x86_64mach.h" | 17 #include "x86_64mach.h" |
18 | 18 |
19 .global SYM (setjmp) | 19 .global SYM (setjmp) |
20 .global SYM (longjmp) | 20 .global SYM (longjmp) |
21 SOTYPE_FUNCTION(setjmp) | 21 SOTYPE_FUNCTION(setjmp) |
22 SOTYPE_FUNCTION(longjmp) | 22 SOTYPE_FUNCTION(longjmp) |
23 | 23 |
24 SYM (setjmp): | 24 SYM (setjmp): |
25 movq rbx, %nacl: 0 (r15,rdi) | 25 movq rbx, %nacl: 0 (r15,rdi) |
26 movq r12, %nacl: 8 (r15,rdi) | 26 movq r12, %nacl: 8 (r15,rdi) |
27 movq r13, %nacl: 16 (r15,rdi) | 27 movq r13, %nacl: 16 (r15,rdi) |
28 movq r14, %nacl: 24 (r15,rdi) | 28 movq r14, %nacl: 24 (r15,rdi) |
29 movq (rsp), rax | 29 /* Avoid writing the top 32 bits of rip, rbp, and rsp into memory. */ |
30 movq rax, %nacl: 32 (r15,rdi) | 30 movl (rsp), eax |
Mark Seaborn
2015/02/11 02:23:45
Note: shorter as:
popq %rax
movl eax, %nacl: 3
Derek Schuff
2015/02/11 23:16:06
Done.
| |
31 leaq 8 (rsp), rax | 31 movl eax, %nacl: 32 (r15,rdi) |
32 leal 8 (rsp), eax | |
32 movl ebp, %nacl: 40 (r15,rdi) | 33 movl ebp, %nacl: 40 (r15,rdi) |
33 movl eax, %nacl: 44 (r15,rdi) | 34 movl eax, %nacl: 44 (r15,rdi) |
34 movq $0, rax | 35 movq $0, rax |
35 pop r11 | 36 pop r11 |
36 nacljmp r11d, r15 | 37 nacljmp r11d, r15 |
37 | 38 |
38 SYM (longjmp): | 39 SYM (longjmp): |
39 movq rsi, rax /* Return value */ | 40 movl esi, eax /* Return value */ |
Mark Seaborn
2015/02/11 02:23:45
I'm not sure why you're changing this. It looks l
Derek Schuff
2015/02/11 18:19:11
Yes, I noticed that it didn't conform and decided
| |
41 /* if val is zero, we must return 1 -- otherwise return val */ | |
42 movl $1, ebx | |
43 testl eax, eax | |
44 cmovz ebx, eax | |
40 | 45 |
41 naclrestbp %nacl: 40 (r15,rdi), r15 | 46 naclrestbp %nacl: 40 (r15,rdi), r15 |
42 | 47 |
43 __CLI | 48 __CLI |
44 naclrestsp %nacl: 44 (r15,rdi), r15 | 49 naclrestsp %nacl: 44 (r15,rdi), r15 |
45 pushq %nacl: 32 (r15,rdi) | 50 pushq %nacl: 32 (r15,rdi) |
46 movq %nacl: 0 (r15,rdi), rbx | 51 movq %nacl: 0 (r15,rdi), rbx |
47 movq %nacl: 8 (r15,rdi), r12 | 52 movq %nacl: 8 (r15,rdi), r12 |
48 movq %nacl: 16 (r15,rdi), r13 | 53 movq %nacl: 16 (r15,rdi), r13 |
49 movq %nacl: 24 (r15,rdi), r14 | 54 movq %nacl: 24 (r15,rdi), r14 |
50 __STI | 55 __STI |
51 | 56 |
52 pop r11 | 57 pop r11 |
53 nacljmp r11d, r15 | 58 nacljmp r11d, r15 |
OLD | NEW |