]>
git.saurik.com Git - apple/libc.git/blob - include/asm.h
c320363b84091cd66304f629ea29768d6099603e
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
31 #define __NO_UNDERSCORES__ 1
149 #define tmp0 r0 /* Temporary GPR remapping (603e specific) */
156 #define dmiss 976 /* ea that missed */
157 #define dcmp 977 /* compare value for the va that missed */
158 #define hash1 978 /* pointer to first hash pteg */
159 #define hash2 979 /* pointer to second hash pteg */
160 #define imiss 980 /* ea that missed */
161 #define icmp 981 /* compare value for the va that missed */
162 #define rpa 982 /* required physical address register */
164 #define iabr 1010 /* instruction address breakpoint register */
165 #define pir 1023 /* Processor ID Register */
167 /* MQ register on the 601 */
168 #define mq 0 /* spr number for mq register on 601 */
245 * Macros to access high and low word values of an address
249 #define HIGH_CADDR(x) ha16(x)
250 #define HIGH_ADDR(x) hi16(x)
251 #define LOW_ADDR(x) lo16(x)
253 #define HIGH_CADDR(x) x@ha
254 #define HIGH_ADDR(x) x@h
255 #define LOW_ADDR(x) x@l
258 #endif /* ASSEMBLER */
260 /* Tags are placed before Immediately Following Code (IFC) for the debugger
261 * to be able to deduce where to find various registers when backtracing
263 * We only define the values as we use them, see SVR4 ABI PowerPc Supplement
264 * for more details (defined in ELF spec).
267 #define TAG_NO_FRAME_USED 0x00000000
269 /* (should use genassym to get these offsets) */
272 /* TODO NMGS FM_SIZE 8 is ok according to EABI specs, but gcc uses 16 */
274 #define FM_LR_SAVE 4 /* gcc 2.7.1 is now following eabi spec correctly */
275 #define FM_SIZE 16 /* minimum frame contents, backptr and LR save */
279 #define FM_LR_SAVE 8 /* Rhapsody iS NOT following the ABI at the moment.. */
280 #define FM_SIZE 72 /* minimum frame contents, backptr and LR save */
284 #define FM_ELF_ARG0 8
285 #define FM_MACHO_ARG0 56
286 #define MACHO_SYSCALL_BEGIN 0x2000
287 #define PK_SYSCALL_BEGIN 0x7000
290 /* redzone is the area under the stack pointer which must be preserved
291 * when taking a trap, interrupt etc. This is no longer needed as gcc
292 * (2.7.2 and above) now follows ELF spec correctly and never loads/stores
293 * below the frame pointer
296 #define FM_REDZONE 0 /* was ((32-14+1)*4) */
298 #define FM_REDZONE 224 /* is ((32-14+1)*4) */
301 #define COPYIN_ARG0_OFFSET FM_ARG0
303 #ifdef MACH_KERNEL_BUILD
304 #include <mach_kdb.h>
305 #else /* MACH_KERNEL */
307 #endif /* MACH_KERNEL */
309 #define BREAKPOINT_TRAP twge r2,r2
311 /* There is another definition of ALIGN for .c sources */
312 #ifndef __LANGUAGE_ASSEMBLY
314 #endif /* __LANGUAGE_ASSEMBLY */
317 #define FALIGN 2 /* Align functions on words for now. Cachelines is better */
322 #ifndef __NO_UNDERSCORES__
323 #define LCL(x) L ## x
324 #define EXT(x) _ ## x
325 #define LEXT(x) _ ## x ## :
327 #define LCL(x) .L ## x
329 #define LEXT(x) x ## :
331 #define LBc(x,n) n ## :
332 #define LBb(x,n) n ## b
333 #define LBf(x,n) n ## f
335 #ifndef __NO_UNDERSCORES__
336 #define LCL(x) L/**/x
337 #define EXT(x) _/**/x
338 #define LEXT(x) _/**/x/**/:
339 #else /* __NO_UNDERSCORES__ */
340 #define LCL(x) .L/**/x
342 #define LEXT(x) x/**/:
343 #endif /* __NO_UNDERSCORES__ */
344 #define LBc(x,n) n/**/:
345 #define LBb(x,n) n/**/b
346 #define LBf(x,n) n/**/f
347 #endif /* __STDC__ */
349 #define String .asciz
351 #define Times(a,b) (a*b)
352 #define Divide(a,b) (a/b)
354 #define data16 .byte 0x66
355 #define addr16 .byte 0x67
360 #elif defined(__SHARED__)
361 #define MCOUNT ; .data;\
367 leal Gotoff(LBb(x,8)),%edx;\
368 Egaddr(%eax,_mcount_ptr);\
372 #else /* !GPROF, !__SHARED__ */
373 #define MCOUNT ; .data;\
377 movl $LBb(x,8),%edx;\
378 call *EXT(_mcount_ptr);
383 #define ELF_FUNC(x) .type x,@function
384 #define ELF_DATA(x) .type x,@object
385 #define ELF_SIZE(x,s) .size x,s
389 #define ELF_SIZE(x,s)
393 #define Entry(x,tag) .globl EXT(x); ELF_FUNC(EXT(x)); .long tag;.align FALIGN; LEXT(x)
394 #define ENTRY(x,tag) Entry(x,tag) MCOUNT
395 #define ENTRY2(x,y,tag) .globl EXT(x); .globl EXT(y); \
396 ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
397 .align FALIGN; LEXT(x); LEXT(y) \
400 #define ASENTRY(x) .globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
402 #define ASENTRY(x) .globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
403 #endif /* __STDC__ */
404 #define DATA(x) .globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
408 #define Entry(x,tag) .text@.align FALIGN@ .globl EXT(x)@ LEXT(x)
409 #define ENTRY(x,tag) Entry(x,tag)@MCOUNT
410 #define ENTRY2(x,y,tag) .text@ .align FALIGN@ .globl EXT(x)@ .globl EXT(y)@ \
414 #define ASENTRY(x) .globl x @ .align FALIGN; x ## @ MCOUNT
416 #define ASENTRY(x) .globl x @ .align FALIGN; x @ MCOUNT
417 #endif /* __STDC__ */
418 #define DATA(x) .globl EXT(x) @ .align ALIGN @ LEXT(x)
423 #define End(x) ELF_SIZE(x,.-x)
424 #define END(x) End(EXT(x))
425 #define ENDDATA(x) END(x)
426 #define Enddata(x) End(x)
428 /* These defines are here for .c files that wish to reference global symbols
429 * within __asm__ statements.
431 #ifndef __NO_UNDERSCORES__
432 #define CC_SYM_PREFIX "_"
434 #define CC_SYM_PREFIX ""
435 #endif /* __NO_UNDERSCORES__ */
437 #endif /* _PPC_ASM_H_ */