1 /**************************************************************************/
2 /* */
3 /* OCaml */
4 /* */
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 2000 Institut National de Recherche en Informatique et */
8 /* en Automatique. */
9 /* */
10 /* All rights reserved. This file is distributed under the terms of */
11 /* the GNU Lesser General Public License version 2.1, with the */
12 /* special exception on linking described in the file LICENSE. */
13 /* */
14 /**************************************************************************/
15
16 #ifdef SYS_macosx
17 #define ALIGN 4
18 #else
19 #define ALIGN 16
20 #endif
21
22 #ifdef SYS_macosx
23 #define CALL_GEN_CODE _call_gen_code
24 #define CAML_C_CALL _caml_c_call
25 #define CAML_NEGF_MASK _caml_negf_mask
26 #define CAML_ABSF_MASK _caml_absf_mask
27 #else
28 #define CALL_GEN_CODE call_gen_code
29 #define CAML_C_CALL caml_c_call
30 #define CAML_NEGF_MASK caml_negf_mask
31 #define CAML_ABSF_MASK caml_absf_mask
32 #endif
33
34 .globl CALL_GEN_CODE
35 .align ALIGN
36 CALL_GEN_CODE:
37 pushq %rbx
38 pushq %rbp
39 pushq %r12
40 pushq %r13
41 pushq %r14
42 pushq %r15
43 movq %rdi, %r10
44 movq %rsi, %rax
45 movq %rdx, %rbx
46 movq %rcx, %rdi
47 movq %r8, %rsi
48 call *%r10
49 popq %r15
50 popq %r14
51 popq %r13
52 popq %r12
53 popq %rbp
54 popq %rbx
55 ret
56
57 .globl CAML_C_CALL
58 .align ALIGN
59 CAML_C_CALL:
60 jmp *%rax
61
62 #ifdef SYS_macosx
63 .literal16
64 #elif defined(SYS_mingw64) || defined(SYS_cygwin)
65 .section .rodata.cst8
66 #else
67 .section .rodata.cst8,"aM",@progbits,8
68 #endif
69 .globl CAML_NEGF_MASK
70 .align ALIGN
71 CAML_NEGF_MASK:
72 .quad 0x8000000000000000, 0
73 .globl CAML_ABSF_MASK
74 .align ALIGN
75 CAML_ABSF_MASK:
76 .quad 0x7FFFFFFFFFFFFFFF, 0
77
78 .comm young_limit, 8
79
80 #if defined(SYS_linux)
81 /* Mark stack as non-executable */
82 .section .note.GNU-stack,"",%progbits
83 #endif
84