71 lines | 2339 chars
1 | /**************************************************************************/ |
2 | /* */ |
3 | /* OCaml */ |
4 | /* */ |
5 | /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ |
6 | /* */ |
7 | /* Copyright 1996 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 | /* Linux with ELF binaries does not prefix identifiers with _. |
17 | Linux with a.out binaries, FreeBSD, and NextStep do. */ |
18 | |
19 | #if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \ |
20 | || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_gnu) |
21 | #define G(x) x |
22 | #define FUNCTION_ALIGN 16 |
23 | #else |
24 | #define G(x) _##x |
25 | #define FUNCTION_ALIGN 4 |
26 | #endif |
27 | |
28 | .globl G(call_gen_code) |
29 | .align FUNCTION_ALIGN |
30 | G(call_gen_code): |
31 | pushl %ebp |
32 | movl %esp,%ebp |
33 | pushl %ebx |
34 | pushl %esi |
35 | pushl %edi |
36 | movl 12(%ebp),%eax |
37 | movl 16(%ebp),%ebx |
38 | movl 20(%ebp),%ecx |
39 | movl 24(%ebp),%edx |
40 | call *8(%ebp) |
41 | popl %edi |
42 | popl %esi |
43 | popl %ebx |
44 | popl %ebp |
45 | ret |
46 | |
47 | .globl G(caml_c_call) |
48 | .align FUNCTION_ALIGN |
49 | G(caml_c_call): |
50 | jmp *%eax |
51 | |
52 | .comm G(Caml_state), 4 |
53 | |
54 | /* Some tests are designed to cause registers to spill; on |
55 | * x86 we require the caml_extra_params symbol from the RTS. */ |
56 | .data |
57 | .globl G(caml_extra_params) |
58 | G(caml_extra_params): |
59 | #ifndef SYS_solaris |
60 | .space 64 |
61 | #else |
62 | .zero 64 |
63 | #endif |
64 | |
65 | |
66 | |
67 | #if defined(SYS_linux_elf) |
68 | /* Mark stack as non-executable */ |
69 | .section .note.GNU-stack,"",%progbits |
70 | #endif |
71 |