|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: #ifndef _PPC_ASM_H_
26: #define _PPC_ASM_H_
27:
28: #define ARG0 r3
29: #define ARG1 r4
30: #define ARG2 r5
31: #define ARG3 r6
32: #define ARG4 r7
33: #define ARG5 r8
34: #define ARG6 r9
35: #define ARG7 r10
36:
37: #define tmp0 r0 /* Temporary GPR remapping (603e specific) */
38: #define tmp1 r1
39: #define tmp2 r2
40: #define tmp3 r3
41:
42: /* SPR registers as taken from 603e user guide */
43:
44: #define dmiss 976 /* ea that missed */
45: #define dcmp 977 /* compare value for the va that missed */
46: #define hash1 978 /* pointer to first hash pteg */
47: #define hash2 979 /* pointer to second hash pteg */
48: #define imiss 980 /* ea that missed */
49: #define icmp 981 /* compare value for the va that missed */
50: #define rpa 982 /* required physical address register */
51:
52: #define iabr 1010 /* instruction address breakpoint register */
53: #define dabr 1013 /* data address breakpoint register */
54:
55: #define CR0 cr0
56: #define CR1 cr1
57: #define CR2 cr2
58: #define CR3 cr3
59: #define CR4 cr4
60: #define CR5 cr5
61: #define CR6 cr6
62: #define CR7 cr7
63: /* Tags are placed before Immediately Following Code (IFC) for the debugger
64: * to be able to deduce where to find various registers when backtracing
65: *
66: * We only define the values as we use them, see SVR4 ABI PowerPc Supplement
67: * for more details (defined in ELF spec).
68: */
69:
70: #define TAG_NO_FRAME_USED 0x00000000
71:
72: #define COPYIN_ARG0_OFFSET FM_ARG0
73:
74: #define MACH_KDB 0
75:
76: #define BREAKPOINT_TRAP twge r2,r2
77:
78: /* There is another definition of ALIGNMENT for .c sources */
79: #ifndef __LANGUAGE_ASSEMBLY
80: #define ALIGNMENT 4
81: #endif /* __LANGUAGE_ASSEMBLY */
82:
83: #ifndef FALIGNMENT
84: #define FALIGNMENT 4 /* Align functions on words for now. Cachelines is better */
85: #endif
86:
87: #define LB(x,n) n
88: #if __STDC__
89: #ifndef __NO_UNDERSCORES__
90: #define LCL(x) L ## x
91: #define EXT(x) _ ## x
92: #define LEXT(x) _ ## x ## :
93: #else
94: #define LCL(x) .L ## x
95: #define EXT(x) x
96: #define LEXT(x) x ## :
97: #endif
98: #define LBc(x,n) n ## :
99: #define LBb(x,n) n ## b
100: #define LBf(x,n) n ## f
101: #else /* __STDC__ */
102: #ifndef __NO_UNDERSCORES__
103: #define LCL(x) L/**/x
104: #define EXT(x) _/**/x
105: #define LEXT(x) _/**/x/**/:
106: #else /* __NO_UNDERSCORES__ */
107: #define LCL(x) .L/**/x
108: #define EXT(x) x
109: #define LEXT(x) x/**/:
110: #endif /* __NO_UNDERSCORES__ */
111: #define LBc(x,n) n/**/:
112: #define LBb(x,n) n/**/b
113: #define LBf(x,n) n/**/f
114: #endif /* __STDC__ */
115:
116: #define String .asciz
117: #define Value .word
118: #define Times(a,b) (a*b)
119: #define Divide(a,b) (a/b)
120:
121: #define data16 .byte 0x66
122: #define addr16 .byte 0x67
123:
124: #define MCOUNT
125:
126: #ifdef __ELF__
127: #define ELF_FUNC(x) .type x,@function
128: #define ELF_DATA(x) .type x,@object
129: #define ELF_SIZE(x,s) .size x,s
130: #else
131: #define ELF_FUNC(x)
132: #define ELF_DATA(x)
133: #define ELF_SIZE(x,s)
134: #endif
135:
136: #define Entry(x,tag) .globl EXT(x) @ ELF_FUNC(EXT(x)) @ .long tag @ .align FALIGNMENT @ LEXT(x)
137: #define ENTRY(x,tag) Entry(x,tag) MCOUNT
138: #define ENTRY2(x,y,tag) .globl EXT(x) @ .globl EXT(y) @ \
139: ELF_FUNC(EXT(x)) @ ELF_FUNC(EXT(y)) @ \
140: .align FALIGNMENT @ LEXT(x) @ LEXT(y) \
141: MCOUNT
142: #if __STDC__
143: #define ASENTRY(x) .globl x @ .align FALIGNMENT @ x ## : ELF_FUNC(x) MCOUNT
144: #else
145: #define ASENTRY(x) .globl x @ .align FALIGNMENT @ x: ELF_FUNC(x) MCOUNT
146: #endif /* __STDC__ */
147:
148: #define DATA(x) .globl EXT(x) @ ELF_DATA(EXT(x)) @ .align ALIGNMENT @ LEXT(x)
149:
150: #define End(x) ELF_SIZE(x,.-x)
151: #define END(x) End(EXT(x))
152: #define ENDDATA(x) END(x)
153: #define Enddata(x) End(x)
154:
155: /* These defines are here for .c files that wish to reference global symbols
156: * within __asm__ statements.
157: */
158: #ifdef __LANGUAGE_ASSEMBLY
159: #ifndef __NO_UNDERSCORES__
160: #define CC_SYM_PREFIX "_"
161: #else
162: #define CC_SYM_PREFIX ""
163: #endif /* __NO_UNDERSCORES__ */
164: #endif /* __LANGUAGE_ASSEMBLY */
165:
166: #endif /* _PPC_ASM_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.