SCM Repository
Annotation of /sml/trunk/src/runtime/include/asm-base.h
Parent Directory
|
Revision Log
Revision 810 - (view) (download) (as text)
1 : | monnier | 249 | /* asm-base.h |
2 : | * | ||
3 : | * COPYRIGHT (c) 1992 AT&T Bell Laboratories | ||
4 : | * | ||
5 : | * Common definitions for assembly files in the SML/NJ system. | ||
6 : | */ | ||
7 : | |||
8 : | #ifndef _ASM_BASE_ | ||
9 : | #define _ASM_BASE_ | ||
10 : | |||
11 : | #ifndef _ML_BASE_ | ||
12 : | #include "ml-base.h" | ||
13 : | #endif | ||
14 : | |||
15 : | /* bool_t values for assembly code */ | ||
16 : | #define FALSE 0 | ||
17 : | #define TRUE 1 | ||
18 : | |||
19 : | george | 810 | #if (!defined(GLOBALS_HAVE_UNDERSCORE)) && (defined(OPSYS_SUNOS) || defined(OPSYS_FREEBSD) || defined(OPSYS_NETBSD) || defined(OPSYS_NEXTSTEP) || defined(OPSYS_WIN32) || defined(OPSYS_DARWIN)) |
20 : | monnier | 249 | # define GLOBALS_HAVE_UNDERSCORE |
21 : | #endif | ||
22 : | |||
23 : | /* we should probably consider factoring this out into ml-unixdep.h -- JHR */ | ||
24 : | #ifdef GLOBALS_HAVE_UNDERSCORE | ||
25 : | # define CSYM(ID) CONCAT(_,ID) | ||
26 : | #else | ||
27 : | # define CSYM(ID) ID | ||
28 : | #endif | ||
29 : | |||
30 : | #if defined(HOST_SPARC) | ||
31 : | # if defined(OPSYS_SUNOS) | ||
32 : | # include <machine/asm_linkage.h> | ||
33 : | # include <machine/trap.h> | ||
34 : | # undef ENTRY | ||
35 : | # elif defined(OPSYS_SOLARIS) | ||
36 : | # define _ASM | ||
37 : | # include <sys/stack.h> | ||
38 : | # include <sys/trap.h> | ||
39 : | # endif | ||
40 : | # define GLOBAL(ID) .global CSYM(ID) | ||
41 : | # define LABEL(ID) ID: | ||
42 : | # define ALIGN4 .align 4 | ||
43 : | # define WORD(W) .word W | ||
44 : | # if defined(OPSYS_NEXTSTEP) | ||
45 : | # define TEXT .text | ||
46 : | # define DATA .data | ||
47 : | # else | ||
48 : | # define TEXT .seg "text" | ||
49 : | # define DATA .seg "data" | ||
50 : | # endif | ||
51 : | # define BEGIN_PROC(P) | ||
52 : | # define END_PROC(P) | ||
53 : | |||
54 : | #elif defined(HOST_MIPS) | ||
55 : | # if defined(OPSYS_MACH) | ||
56 : | # include <mips/regdef.h> | ||
57 : | # elif defined(OPSYS_IRIX5) | ||
58 : | # define _MIPS_SIM 1 /* IRIX 5.x needs this in <regdef.h> */ | ||
59 : | # include <regdef.h> | ||
60 : | # else | ||
61 : | # include <regdef.h> | ||
62 : | # endif | ||
63 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
64 : | # define LABEL(ID) ID: | ||
65 : | # define ALIGN4 .align 2 | ||
66 : | # define WORD(W) .word W | ||
67 : | # define TEXT .text | ||
68 : | # define DATA .data | ||
69 : | # define BEGIN_PROC(P) .ent CSYM(P) | ||
70 : | # define END_PROC(P) .end CSYM(P) | ||
71 : | |||
72 : | #elif defined(HOST_ALPHA32) | ||
73 : | # include <regdef.h> | ||
74 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
75 : | # define LABEL(ID) ID: | ||
76 : | # define ALIGN4 .align 2 | ||
77 : | # define WORD(W) .word W | ||
78 : | # define TEXT .text | ||
79 : | # define DATA .data | ||
80 : | # define BEGIN_PROC(P) .align 3; .ent CSYM(P) | ||
81 : | # define END_PROC(P) .end CSYM(P) | ||
82 : | |||
83 : | #elif defined(HOST_HPPA) | ||
84 : | # define GLOBAL(ID) .export ID,DATA | ||
85 : | # define LABEL(ID) .label ID | ||
86 : | # define ALIGN4 .align 8 | ||
87 : | # define BEGIN_PROC(P) | ||
88 : | # define END_PROC(P) | ||
89 : | # define __SC__ ! | ||
90 : | |||
91 : | #elif (defined(HOST_RS6000) || defined(HOST_PPC)) | ||
92 : | # if defined(OPSYS_AIX) | ||
93 : | # define CFUNSYM(ID) CONCAT(.,ID) | ||
94 : | # define USE_TOC | ||
95 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
96 : | # define TEXT .csect [PR] | ||
97 : | # define DATA .csect [RW] | ||
98 : | # define RO_DATA .csect [RO] | ||
99 : | # define ALIGN4 .align 2 | ||
100 : | # define ALIGN8 .align 3 | ||
101 : | # define DOUBLE(V) .double V | ||
102 : | # define LABEL(ID) ID: | ||
103 : | george | 810 | |
104 : | george | 693 | # elif (defined(OPSYS_LINUX) && defined(TARGET_PPC)) |
105 : | monnier | 249 | # define CFUNSYM(ID) ID |
106 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
107 : | # define TEXT .section ".text" | ||
108 : | # define DATA .section ".data" | ||
109 : | # define RO_DATA .section ".rodata" | ||
110 : | # define ALIGN4 .align 2 | ||
111 : | # define ALIGN8 .align 3 | ||
112 : | # define DOUBLE(V) .double V | ||
113 : | # define LABEL(ID) ID: | ||
114 : | george | 810 | |
115 : | # elif (defined(OPSYS_DARWIN) && defined(TARGET_PPC)) | ||
116 : | # define CFUNSYM(ID) CSYM(ID) | ||
117 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
118 : | # define TEXT .text | ||
119 : | # define DATA .data | ||
120 : | # define RO_DATA .data | ||
121 : | # define ALIGN4 .align 2 | ||
122 : | # define ALIGN8 .align 3 | ||
123 : | # define DOUBLE(V) .double V | ||
124 : | # define LABEL(ID) ID: | ||
125 : | # define __SC__ @ | ||
126 : | monnier | 249 | # endif |
127 : | |||
128 : | # define CENTRY(ID) \ | ||
129 : | george | 810 | .globl CFUNSYM(ID) __SC__ \ |
130 : | monnier | 249 | LABEL(CFUNSYM(ID)) |
131 : | |||
132 : | #elif defined(HOST_X86) | ||
133 : | # if defined(OPSYS_WIN32) | ||
134 : | # include "x86-masm.h" | ||
135 : | # define WORD(W) WORD32(W) | ||
136 : | # else | ||
137 : | # define GLOBAL(ID) .globl CSYM(ID) | ||
138 : | # define LABEL(ID) CONCAT(ID,:) | ||
139 : | # define IMMED(ID) CONCAT($,ID) | ||
140 : | # define ALIGN4 .align 2 | ||
141 : | # define WORD(W) .word W | ||
142 : | # define TEXT .text | ||
143 : | # define DATA .data | ||
144 : | # define BEGIN_PROC(P) .ent P | ||
145 : | # define END_PROC(P) .end P | ||
146 : | george | 810 | |
147 : | monnier | 249 | # endif |
148 : | |||
149 : | #else | ||
150 : | |||
151 : | # error missing asm definitions | ||
152 : | |||
153 : | #endif | ||
154 : | |||
155 : | #ifndef __SC__ | ||
156 : | # define __SC__ ; | ||
157 : | #endif | ||
158 : | |||
159 : | george | 810 | #define ENTRY(ID) \ |
160 : | GLOBAL(ID) __SC__ \ | ||
161 : | monnier | 249 | LABEL(CSYM(ID)) |
162 : | |||
163 : | #define ML_CODE_HDR(name) \ | ||
164 : | george | 810 | GLOBAL(name) __SC__ \ |
165 : | monnier | 249 | ALIGN4 __SC__ \ |
166 : | LABEL(CSYM(name)) | ||
167 : | |||
168 : | #endif /* !_ASM_BASE_ */ | ||
169 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |