]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/asm.h
2 * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
35 #define STRINGD .ascii
51 #define tmp0 r0 /* Temporary GPR remapping (603e specific) */
58 #define mq 0 /* MQ register for 601 emulation */
59 #define rtcu 4 /* RTCU - upper word of RTC for 601 emulation */
60 #define rtcl 5 /* RTCL - lower word of RTC for 601 emulation */
69 #define vrsave 256 /* Vector Register save */
112 #define ummcr2 928 /* Performance monitor control */
113 #define upmc5 929 /* Performance monitor counter */
114 #define upmc6 930 /* Performance monitor counter */
115 #define ubamr 935 /* Performance monitor mask */
116 #define ummcr0 936 /* Performance monitor control */
117 #define upmc1 937 /* Performance monitor counter */
118 #define upmc2 938 /* Performance monitor counter */
119 #define usia 939 /* User sampled instruction address */
120 #define ummcr1 940 /* Performance monitor control */
121 #define upmc3 941 /* Performance monitor counter */
122 #define upmc4 942 /* Performance monitor counter */
123 #define usda 943 /* User sampled data address */
124 #define mmcr2 944 /* Performance monitor control */
125 #define pmc5 945 /* Performance monitor counter */
126 #define pmc6 946 /* Performance monitor counter */
127 #define bamr 951 /* Performance monitor mask */
135 #define sda 959 /* Sampled data address */
136 #define dmiss 976 /* ea that missed */
138 #define dcmp 977 /* compare value for the va that missed */
140 #define hash1 978 /* pointer to first hash pteg */
142 #define hash2 979 /* pointer to second hash pteg */
143 #define imiss 980 /* ea that missed */
144 #define tlbmiss 980 /* ea that missed */
145 #define icmp 981 /* compare value for the va that missed */
146 #define ptehi 981 /* compare value for the va that missed */
147 #define rpa 982 /* required physical address register */
148 #define ptelo 982 /* required physical address register */
149 #define l3pdet 984 /* l3pdet */
151 #define HID0 1008 /* Checkstop and misc enables */
152 #define hid0 1008 /* Checkstop and misc enables */
153 #define HID1 1009 /* Clock configuration */
154 #define hid1 1009 /* Clock configuration */
155 #define HID2 1016 /* Other processor controls */
156 #define hid2 1016 /* Other processor controls */
157 #define iabr 1010 /* Instruction address breakpoint register */
158 #define ictrl 1011 /* Instruction Cache Control */
159 #define ldstdb 1012 /* Load/Store Debug */
160 #define hid4 1012 /* Misc stuff */
161 #define dabr 1013 /* Data address breakpoint register */
162 #define msscr0 1014 /* Memory subsystem control */
163 #define hid5 1014 /* Misc stuff */
164 #define msscr1 1015 /* Memory subsystem debug */
165 #define msssr0 1015 /* Memory Subsystem Status */
166 #define ldstcr 1016 /* Load/Store Status/Control */
167 #define l2cr2 1016 /* L2 Cache control 2 */
168 #define l2cr 1017 /* L2 Cache control */
169 #define l3cr 1018 /* L3 Cache control */
170 #define ictc 1019 /* I-cache throttling control */
171 #define thrm1 1020 /* Thermal management 1 */
172 #define thrm2 1021 /* Thermal management 2 */
173 #define thrm3 1022 /* Thermal management 3 */
174 #define pir 1023 /* Processor ID Register */
177 /* SPR registers (64-bit, PPC970 specific) */
193 #define ummcra_gp 770
202 #define ummcr0_gp 779
205 #define ummcr1_gp 782
231 #define emcpm 0x80000000
233 #define dbpm 0x40000000
235 #define ebam 0x20000000
237 #define ebdm 0x10000000
239 #define sbclkm 0x08000000
241 #define eclkm 0x02000000
243 #define parm 0x01000000
245 #define stenm 0x01000000
247 #define dnapm 0x01000000
249 #define dozem 0x00800000
251 #define napm 0x00400000
253 #define sleepm 0x00200000
255 #define dpmm 0x00100000
257 #define risegm 0x00080000
259 #define eiecm 0x00040000
261 #define mumm 0x00020000
263 #define nhrm 0x00010000
265 #define icem 0x00008000
267 #define dcem 0x00004000
269 #define ilockm 0x00002000
271 #define dlockm 0x00001000
274 #define icfim 0x00000800
276 #define dcfim 0x00000400
278 #define spdm 0x00000200
280 #define hdicem 0x00000100
282 #define sgem 0x00000080
284 #define dcfam 0x00000040
286 #define bticm 0x00000020
288 #define lrstkm 0x00000010
290 #define abem 0x00000008
292 #define foldm 0x00000008
294 #define bhtm 0x00000004
296 #define nopdstm 0x00000002
298 #define noptim 0x00000001
301 #define hid1pcem 0xF8000000
302 #define hid1prem 0x06000000
304 #define hid1dfs0m 0x00800000
306 #define hid1dfs1m 0x00400000
308 #define hid1pi0m 0x00020000
309 #define hid1FCPErr 14
311 #define hid1FCD0PErr 15
312 #define hid1psm 0x00010000
313 #define hid1pc0 0x0000F800
314 #define hid1pr0 0x00000600
315 #define hid1pc1 0x000000F8
316 #define hid1pc0 0x0000F800
317 #define hid1pr1 0x00000006
318 #define hid1FCD1PErr 16
319 #define hid1FIERATErr 17
323 #define hid2vminm 0x00002000
327 #define shdenm 0x80000000
329 #define shdenm3 0x40000000
332 #define l1intvb 0x38000000
335 #define l2intvb 0x07000000
337 #define dl1hwfm 0x00800000
339 #define dbsizm 0x00400000
341 #define emodem 0x00200000
343 #define abgdm 0x00100000
346 #define tfstm 0x000000C0
349 #define l2pfem 0x00000003
353 #define cqdm 0x00010000
356 #define csqm 0x60000000
382 #define icmckm 0x40000000
384 #define dcmckm 0x20000000
386 #define l2mckm 0x10000000
388 #define tlbmckm 0x08000000
390 #define brmckm 0x04000000
392 #define othmckm 0x00200000
394 #define l2dpmckm 0x00100000
396 #define mcpmckm 0x00080000
398 #define teamckm 0x00040000
400 #define dpmckm 0x00020000
402 #define apmckm 0x00010000
415 #define mckUETwDfr 17
423 #define AsyMCKSrc 0x0226
424 #define AsyMCKRSrc 0x0227
429 #define AsyMCKncstp 4
433 #define cFIRrst 0x0310
434 #define cFIRICachePE 0
435 #define cFIRITagPE0 1
436 #define cFIRITagPE1 2
437 #define cFIRIEratPE 3
438 #define cFIRIFUL2UE 4
440 #define cFIRDCachePE 6
442 #define cFIRDEratPE 8
448 #define CoreErrI 0x0350
459 #define l2FIRrst 0x0410
462 #define busFIR 0x0A00
463 #define busFIRrst 0x0A10
470 #define hid4EnSPTW 27
471 #define hid4L1DCFI 28
472 #define hid4DisDERpg 31
473 #define hid4DisDCTpg 36
474 #define hid4DisDCpg 41
475 #define hid4DisTLBpg 48
476 #define hid4DisSLBpg 54
477 #define hid4MckEIEna 55
481 #define l2em 0x80000000
483 #define l2pem 0x40000000
486 #define l2sizm 0x30000000
489 #define l2clkm 0x0E000000
492 #define l2ramm 0x01800000
494 #define l2dom 0x00400000
496 #define l2im 0x00200000
498 #define l2ctlm 0x00100000
500 #define l2ionlym 0x00100000
502 #define l2wtm 0x00080000
504 #define l2tsm 0x00040000
507 #define l2ohm 0x00030000
509 #define l2donlym 0x00010000
511 #define l2slm 0x00008000
513 #define l2dfm 0x00004000
515 #define l2bypm 0x00002000
517 #define l2fam 0x00001000
519 #define l2hwfm 0x00000800
521 #define l2iom 0x00000400
523 #define l2clkstpm 0x00000200
525 #define l2drom 0x00000100
528 #define l2ctrm 0x000000FE
530 #define l2ipm 0x00000001
534 #define l3em 0x80000000
536 #define l3pem 0x40000000
538 #define l3sizm 0x10000000
540 #define l3clkenm 0x08000000
542 #define l3dxm 0x04000000
545 #define l3clkm 0x03800000
547 #define l3iom 0x00400000
549 #define l3spom 0x00040000
552 #define l3ckspm 0x00030000
555 #define l3pspm 0x0000E000
557 #define l3repm 0x00001000
559 #define l3hwfm 0x00000800
561 #define l3im 0x00000400
564 #define l3rtm 0x00000300
566 #define l3drom 0x00000100
568 #define l3cyam 0x00000080
570 #define l3donlym 0x00000040
572 #define l3dmemm 0x00000004
574 #define l3dmsizm 0x00000001
577 #define thrmtinm 0x80000000
579 #define thrmtivm 0x40000000
582 #define thrmthrm 0x3F800000
584 #define thrmtidm 0x00000004
586 #define thrmtiem 0x00000002
588 #define thrmvm 0x00000001
592 #define thrmsitvm 0x0001FFFE
594 #define thrmem 0x00000001
598 #define ictcfim 0x000001FE
600 #define ictcem 0x00000001
606 #define slbVm 0x08000000
610 * Macros to access high and low word values of an address
613 #define HIGH_CADDR(x) ha16(x)
614 #define HIGH_ADDR(x) hi16(x)
615 #define LOW_ADDR(x) lo16(x)
617 #endif /* ASSEMBLER */
660 /* GUS Mode Register */
661 #define GUSModeReg 0x0430
662 #define GUSMdmapen 0x00008000
663 #define GUSMstgtdis 0x00000080
664 #define GUSMstgttim 0x00000038
665 #define GUSMstgttoff 0x00000004
668 #define PowerTuneControlReg 0x0AA001
669 #define PowerTuneStatusReg 0x408001
672 // The following bits are always on in the MSR when injected code is executing
673 #define ijemon 0x00000010
674 // The following bits are always off in the MSR when injected code it executing
675 #define ijemoff 0x0000C620
676 #define ijemtrap ijemon|1
677 // The following is the inject exit trap
678 #define ijtrap 0x0FFFC9C9
681 #define srr1clr 0x783F0000
683 /* Tags are placed before Immediately Following Code (IFC) for the debugger
684 * to be able to deduce where to find various registers when backtracing
686 * We only define the values as we use them, see SVR4 ABI PowerPc Supplement
687 * for more details (defined in ELF spec).
690 #define TAG_NO_FRAME_USED 0x00000000
692 /* (should use genassym to get these offsets) */
696 #define FM_LR_SAVE 8 /* MacOSX is NOT following the ABI at the moment.. */
697 #define FM_SIZE 64 /* minimum frame contents, backptr and LR save. Make sure it is quadaligned */
699 #define FM_ALIGN(l) ((l+15)&-16)
700 #define PK_SYSCALL_BEGIN 0x7000
703 /* redzone is the area under the stack pointer which must be preserved
704 * when taking a trap, interrupt etc.
706 #define FM_REDZONE 224 /* is ((32-14+1)*4) */
708 #define COPYIN_ARG0_OFFSET FM_ARG0
711 #include <mach_kdb.h>
712 #else /* MACH_KERNEL */
714 #endif /* MACH_KERNEL */
716 #define BREAKPOINT_TRAP tw 4,r4,r4
718 /* There is another definition of ALIGN for .c sources */
719 #ifndef __LANGUAGE_ASSEMBLY
721 #endif /* __LANGUAGE_ASSEMBLY */
724 #define FALIGN 4 /* Align functions on words for now. Cachelines is better */
729 #define LCL(x) L ## x
730 #define EXT(x) _ ## x
731 #define LEXT(x) _ ## x ## :
732 #define LBc(x,n) n ## :
733 #define LBb(x,n) n ## b
734 #define LBf(x,n) n ## f
736 #define LCL(x) L/**/x
737 #define EXT(x) _/**/x
738 #define LEXT(x) _/**/x/**/:
739 #define LBc(x,n) n/**/:
740 #define LBb(x,n) n/**/b
741 #define LBf(x,n) n/**/f
742 #endif /* __STDC__ */
744 #define String .asciz
746 #define Times(a,b) (a*b)
747 #define Divide(a,b) (a/b)
749 #define data16 .byte 0x66
750 #define addr16 .byte 0x67
756 #define ELF_SIZE(x,s)
758 #define Entry(x,tag) .text@.align FALIGN@ .globl EXT(x)@ LEXT(x)
759 #define ENTRY(x,tag) Entry(x,tag)@MCOUNT
760 #define ENTRY2(x,y,tag) .text@ .align FALIGN@ .globl EXT(x)@ .globl EXT(y)@ \
764 #define ASENTRY(x) .globl x @ .align FALIGN; x ## @ MCOUNT
766 #define ASENTRY(x) .globl x @ .align FALIGN; x @ MCOUNT
767 #endif /* __STDC__ */
768 #define DATA(x) .globl EXT(x) @ .align ALIGN @ LEXT(x)
771 #define End(x) ELF_SIZE(x,.-x)
772 #define END(x) End(EXT(x))
773 #define ENDDATA(x) END(x)
774 #define Enddata(x) End(x)
776 /* These defines are here for .c files that wish to reference global symbols
777 * within __asm__ statements.
779 #define CC_SYM_PREFIX "_"
781 #endif /* _PPC_ASM_H_ */