Root/
Source at commit 1276 created 12 years 11 months ago. By azimutz, Ids maintenance. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2007 Apple Inc. All rights reserved.␊ |
3 | */␊ |
4 | /*␊ |
5 | * @OSF_COPYRIGHT@␊ |
6 | */␊ |
7 | /* ␊ |
8 | * Mach Operating System␊ |
9 | * Copyright (c) 1991,1990,1989 Carnegie Mellon University␊ |
10 | * All Rights Reserved.␊ |
11 | * ␊ |
12 | * Permission to use, copy, modify and distribute this software and its␊ |
13 | * documentation is hereby granted, provided that both the copyright␊ |
14 | * notice and this permission notice appear in all copies of the␊ |
15 | * software, derivative works or modified versions, and any portions␊ |
16 | * thereof, and that both notices appear in supporting documentation.␊ |
17 | * ␊ |
18 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"␊ |
19 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR␊ |
20 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.␊ |
21 | * ␊ |
22 | * Carnegie Mellon requests users of this software to return to␊ |
23 | * ␊ |
24 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU␊ |
25 | * School of Computer Science␊ |
26 | * Carnegie Mellon University␊ |
27 | * Pittsburgh PA 15213-3890␊ |
28 | * ␊ |
29 | * any improvements or extensions that they make and grant Carnegie Mellon␊ |
30 | * the rights to redistribute these changes.␊ |
31 | */␊ |
32 | ␊ |
33 | #ifndef␉_ARM_ASM_H_␊ |
34 | #define␉_ARM_ASM_H_␊ |
35 | ␊ |
36 | #include <arm/arch.h>␊ |
37 | ␊ |
38 | #ifdef _KERNEL␊ |
39 | #include <gprof.h>␊ |
40 | #endif␉/* _KERNEL */␊ |
41 | ␊ |
42 | #ifdef MACH_KERNEL␊ |
43 | #include <mach_kdb.h>␊ |
44 | #else␉/* !MACH_KERNEL */␊ |
45 | #define␉MACH_KDB 0␊ |
46 | #endif␉/* !MACH_KERNEL */␊ |
47 | ␊ |
48 | ␊ |
49 | #if␉defined(MACH_KERNEL) || defined(_KERNEL)␊ |
50 | #include <gprof.h>␊ |
51 | #endif␉/* MACH_KERNEL || _KERNEL */␊ |
52 | ␊ |
53 | ␊ |
54 | #define FRAME␉pushl %ebp; movl %esp, %ebp␊ |
55 | #define EMARF␉leave␊ |
56 | ␊ |
57 | ␊ |
58 | /* There is another definition of ALIGN for .c sources */␊ |
59 | #ifdef ASSEMBLER␊ |
60 | #define ALIGN 4␊ |
61 | #endif /* ASSEMBLER */␊ |
62 | ␊ |
63 | #ifndef FALIGN␊ |
64 | #define FALIGN ALIGN␊ |
65 | #endif␊ |
66 | ␊ |
67 | #define LB(x,n) n␊ |
68 | #if␉__STDC__␊ |
69 | #ifndef __NO_UNDERSCORES__␊ |
70 | #define␉LCL(x)␉L ## x␊ |
71 | #define EXT(x) _ ## x␊ |
72 | #define LEXT(x) _ ## x ## :␊ |
73 | #else␊ |
74 | #define␉LCL(x)␉.L ## x␊ |
75 | #define EXT(x) x␊ |
76 | #define LEXT(x) x ## :␊ |
77 | #endif␊ |
78 | #define LBc(x,n) n ## :␊ |
79 | #define LBb(x,n) n ## b␊ |
80 | #define LBf(x,n) n ## f␊ |
81 | #else /* __STDC__ */␊ |
82 | #ifndef __NO_UNDERSCORES__␊ |
83 | #define LCL(x) L/**/x␊ |
84 | #define EXT(x) _/**/x␊ |
85 | #define LEXT(x) _/**/x/**/:␊ |
86 | #else /* __NO_UNDERSCORES__ */␊ |
87 | #define␉LCL(x)␉.L/**/x␊ |
88 | #define EXT(x) x␊ |
89 | #define LEXT(x) x/**/:␊ |
90 | #endif /* __NO_UNDERSCORES__ */␊ |
91 | #define LBc(x,n) n/**/:␊ |
92 | #define LBb(x,n) n/**/b␊ |
93 | #define LBf(x,n) n/**/f␊ |
94 | #endif /* __STDC__ */␊ |
95 | ␊ |
96 | #define String␉.asciz␊ |
97 | #define Value␉.word␊ |
98 | #define Times(a,b) (a*b)␊ |
99 | #define Divide(a,b) (a/b)␊ |
100 | ␊ |
101 | #if 0 /* TOTOJK */␊ |
102 | #ifdef __ELF__␊ |
103 | #define ELF_FUNC(x)␉.type x,@function␊ |
104 | #define ELF_DATA(x)␉.type x,@object␊ |
105 | #define ELF_SIZE(x,s)␉.size x,s␊ |
106 | #else␊ |
107 | #define ELF_FUNC(x)␊ |
108 | #define ELF_DATA(x)␊ |
109 | #define ELF_SIZE(x,s)␊ |
110 | #endif␊ |
111 | #else␊ |
112 | #define ELF_FUNC(x)␊ |
113 | #define ELF_DATA(x)␊ |
114 | #define ELF_SIZE(x,s)␊ |
115 | #endif /* TODOJK */␊ |
116 | ␊ |
117 | #define␉Entry(x)␉.globl EXT(x); ELF_FUNC(EXT(x)); .align FALIGN; LEXT(x)␊ |
118 | #define␉ENTRY(x)␉Entry(x) MCOUNT␊ |
119 | #define␉ENTRY2(x,y)␉.globl EXT(x); .globl EXT(y); \␊ |
120 | ␉␉␉ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \␊ |
121 | ␉␉␉.align FALIGN; LEXT(x); LEXT(y) \␊ |
122 | ␉␉␉MCOUNT␊ |
123 | #if __STDC__␊ |
124 | #define␉ASENTRY(x) ␉.globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT␊ |
125 | #else␊ |
126 | #define␉ASENTRY(x) ␉.globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT␊ |
127 | #endif /* __STDC__ */␊ |
128 | ␊ |
129 | #define␉DATA(x)␉␉.globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)␊ |
130 | ␊ |
131 | #define End(x)␉␉ELF_SIZE(x,.-x)␊ |
132 | #define END(x)␉␉End(EXT(x))␊ |
133 | #define ENDDATA(x)␉END(x)␊ |
134 | #define Enddata(x)␉End(x)␊ |
135 | ␊ |
136 | #ifdef ASSEMBLER␊ |
137 | #if␉MACH_KDB␊ |
138 | #include <ddb/stab.h>␊ |
139 | /*␊ |
140 | * This pseudo-assembler line is added so that there will be at least␊ |
141 | *␉one N_SO entry in the symbol stable to define the current file name.␊ |
142 | */␊ |
143 | #endif␉/* MACH_KDB */␊ |
144 | ␊ |
145 | #define MCOUNT␊ |
146 | ␊ |
147 | #else /* NOT ASSEMBLER */␊ |
148 | ␊ |
149 | /* These defines are here for .c files that wish to reference global symbols␊ |
150 | * within __asm__ statements. ␊ |
151 | */␊ |
152 | #ifndef __NO_UNDERSCORES__␊ |
153 | #define CC_SYM_PREFIX "_"␊ |
154 | #else␊ |
155 | #define CC_SYM_PREFIX ""␊ |
156 | #endif /* __NO_UNDERSCORES__ */␊ |
157 | #endif /* ASSEMBLER */␊ |
158 | ␊ |
159 | #ifdef ASSEMBLER␊ |
160 | ␊ |
161 | #if defined (_ARM_ARCH_4T)␊ |
162 | # define RET bx lr␊ |
163 | # define RETeq bxeq lr␊ |
164 | # define RETne bxne lr␊ |
165 | # ifdef __STDC__␊ |
166 | # define RETc(c) bx##c lr␊ |
167 | # else␊ |
168 | # define RETc(c) bx/**/c lr␊ |
169 | # endif␊ |
170 | #else␊ |
171 | # define RET mov pc, lr␊ |
172 | # define RETeq moveq pc, lr␊ |
173 | # define RETne movne pc, lr␊ |
174 | # ifdef __STDC__␊ |
175 | # define RETc(c) mov##c pc, lr␊ |
176 | # else␊ |
177 | # define RETc(c) mov/**/c pc, lr␊ |
178 | # endif␊ |
179 | #endif␊ |
180 | ␊ |
181 | #if defined (__thumb__)␊ |
182 | # define BRANCH_EXTERN(x)␉ldr␉pc, [pc, #-4] ;␉\␊ |
183 | ␉␉␉␉.long␉EXT(x)␊ |
184 | #else␊ |
185 | # define BRANCH_EXTERN(x)␉b␉EXT(x)␊ |
186 | #endif␊ |
187 | ␊ |
188 | #endif /* ASSEMBLER */␊ |
189 | ␊ |
190 | #endif /* _ARM_ASM_H_ */␊ |
191 |