]>
git.saurik.com Git - apple/libc.git/blob - include/asm.h
9 #define __NO_UNDERSCORES__ 1
127 #define tmp0 r0 /* Temporary GPR remapping (603e specific) */
134 #define dmiss 976 /* ea that missed */
135 #define dcmp 977 /* compare value for the va that missed */
136 #define hash1 978 /* pointer to first hash pteg */
137 #define hash2 979 /* pointer to second hash pteg */
138 #define imiss 980 /* ea that missed */
139 #define icmp 981 /* compare value for the va that missed */
140 #define rpa 982 /* required physical address register */
142 #define iabr 1010 /* instruction address breakpoint register */
143 #define pir 1023 /* Processor ID Register */
145 /* MQ register on the 601 */
146 #define mq 0 /* spr number for mq register on 601 */
223 * Macros to access high and low word values of an address
227 #define HIGH_CADDR(x) ha16(x)
228 #define HIGH_ADDR(x) hi16(x)
229 #define LOW_ADDR(x) lo16(x)
231 #define HIGH_CADDR(x) x@ha
232 #define HIGH_ADDR(x) x@h
233 #define LOW_ADDR(x) x@l
236 #endif /* ASSEMBLER */
238 /* Tags are placed before Immediately Following Code (IFC) for the debugger
239 * to be able to deduce where to find various registers when backtracing
241 * We only define the values as we use them, see SVR4 ABI PowerPc Supplement
242 * for more details (defined in ELF spec).
245 #define TAG_NO_FRAME_USED 0x00000000
247 /* (should use genassym to get these offsets) */
250 /* TODO NMGS FM_SIZE 8 is ok according to EABI specs, but gcc uses 16 */
252 #define FM_LR_SAVE 4 /* gcc 2.7.1 is now following eabi spec correctly */
253 #define FM_SIZE 16 /* minimum frame contents, backptr and LR save */
257 #define FM_LR_SAVE 8 /* Rhapsody iS NOT following the ABI at the moment.. */
258 #define FM_SIZE 72 /* minimum frame contents, backptr and LR save */
262 #define FM_ELF_ARG0 8
263 #define FM_MACHO_ARG0 56
264 #define MACHO_SYSCALL_BEGIN 0x2000
265 #define PK_SYSCALL_BEGIN 0x7000
268 /* redzone is the area under the stack pointer which must be preserved
269 * when taking a trap, interrupt etc. This is no longer needed as gcc
270 * (2.7.2 and above) now follows ELF spec correctly and never loads/stores
271 * below the frame pointer
274 #define FM_REDZONE 0 /* was ((32-14+1)*4) */
276 #define FM_REDZONE 224 /* is ((32-14+1)*4) */
279 #define COPYIN_ARG0_OFFSET FM_ARG0
281 #ifdef MACH_KERNEL_BUILD
282 #include <mach_kdb.h>
283 #else /* MACH_KERNEL */
285 #endif /* MACH_KERNEL */
287 #define BREAKPOINT_TRAP twge r2,r2
289 /* There is another definition of ALIGN for .c sources */
290 #ifndef __LANGUAGE_ASSEMBLY
292 #endif /* __LANGUAGE_ASSEMBLY */
295 #define FALIGN 2 /* Align functions on words for now. Cachelines is better */
300 #ifndef __NO_UNDERSCORES__
301 #define LCL(x) L ## x
302 #define EXT(x) _ ## x
303 #define LEXT(x) _ ## x ## :
305 #define LCL(x) .L ## x
307 #define LEXT(x) x ## :
309 #define LBc(x,n) n ## :
310 #define LBb(x,n) n ## b
311 #define LBf(x,n) n ## f
313 #ifndef __NO_UNDERSCORES__
314 #define LCL(x) L/**/x
315 #define EXT(x) _/**/x
316 #define LEXT(x) _/**/x/**/:
317 #else /* __NO_UNDERSCORES__ */
318 #define LCL(x) .L/**/x
320 #define LEXT(x) x/**/:
321 #endif /* __NO_UNDERSCORES__ */
322 #define LBc(x,n) n/**/:
323 #define LBb(x,n) n/**/b
324 #define LBf(x,n) n/**/f
325 #endif /* __STDC__ */
327 #define String .asciz
329 #define Times(a,b) (a*b)
330 #define Divide(a,b) (a/b)
332 #define data16 .byte 0x66
333 #define addr16 .byte 0x67
338 #elif defined(__SHARED__)
339 #define MCOUNT ; .data;\
345 leal Gotoff(LBb(x,8)),%edx;\
346 Egaddr(%eax,_mcount_ptr);\
350 #else /* !GPROF, !__SHARED__ */
351 #define MCOUNT ; .data;\
355 movl $LBb(x,8),%edx;\
356 call *EXT(_mcount_ptr);
361 #define ELF_FUNC(x) .type x,@function
362 #define ELF_DATA(x) .type x,@object
363 #define ELF_SIZE(x,s) .size x,s
367 #define ELF_SIZE(x,s)
371 #define Entry(x,tag) .globl EXT(x); ELF_FUNC(EXT(x)); .long tag;.align FALIGN; LEXT(x)
372 #define ENTRY(x,tag) Entry(x,tag) MCOUNT
373 #define ENTRY2(x,y,tag) .globl EXT(x); .globl EXT(y); \
374 ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
375 .align FALIGN; LEXT(x); LEXT(y) \
378 #define ASENTRY(x) .globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
380 #define ASENTRY(x) .globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
381 #endif /* __STDC__ */
382 #define DATA(x) .globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
386 #define Entry(x,tag) .text@.align FALIGN@ .globl EXT(x)@ LEXT(x)
387 #define ENTRY(x,tag) Entry(x,tag)@MCOUNT
388 #define ENTRY2(x,y,tag) .text@ .align FALIGN@ .globl EXT(x)@ .globl EXT(y)@ \
392 #define ASENTRY(x) .globl x @ .align FALIGN; x ## @ MCOUNT
394 #define ASENTRY(x) .globl x @ .align FALIGN; x @ MCOUNT
395 #endif /* __STDC__ */
396 #define DATA(x) .globl EXT(x) @ .align ALIGN @ LEXT(x)
401 #define End(x) ELF_SIZE(x,.-x)
402 #define END(x) End(EXT(x))
403 #define ENDDATA(x) END(x)
404 #define Enddata(x) End(x)
406 /* These defines are here for .c files that wish to reference global symbols
407 * within __asm__ statements.
409 #ifndef __NO_UNDERSCORES__
410 #define CC_SYM_PREFIX "_"
412 #define CC_SYM_PREFIX ""
413 #endif /* __NO_UNDERSCORES__ */
415 #endif /* _PPC_ASM_H_ */