4 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
7 NOTE: This file must compile *without* any other header !
9 Desc: cpu.h include file for powerpc arch
14 * Some compilers may not provide these legacy defines
15 * but many code out there relies on them
24 /* Information about size and alignment,
25 * the defines have to be numeric constants */
26 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
27 #define AROS_BIG_ENDIAN 1 /* Big or little endian */
28 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
29 #define AROS_SIZEOFPTR 4 /* Size of a PTR */
30 #define AROS_WORDALIGN 2 /* Alignment for WORD */
31 #define AROS_LONGALIGN 4 /* Alignment for LONG */
32 #define AROS_QUADALIGN 8 /* Alignment for QUAD */
33 #define AROS_PTRALIGN 4 /* Alignment for PTR */
34 #define AROS_IPTRALIGN 4 /* Alignment for IPTR */
35 #define AROS_DOUBLEALIGN 4 /* Alignment for double */
36 #define AROS_WORSTALIGN 16 /* Worst case alignment */
37 #define AROS_STACKALIGN 16 /* Stack alignment, see note below */
41 * Some (or maybe even all) PowerPC machines expect the stack to be aligned on 16-byte boundary.
42 * This is the reason number one for AROS_WORSTALIGN=16. The second reason is, the 440 CPU will
43 * generate an alignment exception if floating point data *crosses* the 16-byte boundary.
46 #define AROS_32BIT_TYPE int
47 /* For ABI V1 this should be done in common cpu.h */
48 #define AROS_LARGEST_TYPE long long
50 /* Use C pointer and string for the BCPL pointers and strings
51 * For a normal ABI these should not be defined for maximum source code
54 #define AROS_FAST_BPTR 1
55 #define AROS_FAST_BSTR 1
57 /* do we need a function attribute to get parameters on the stack? */
60 /* define this if we have no support for linear varargs in the compiler */
61 #define NO_LINEAR_VARARGS 1
63 #define AROS_SLOWSTACKTAGS 1
64 #define AROS_SLOWSTACKMETHODS 1
65 #define AROS_SLOWSTACKHOOKS 1
66 #define AROS_SLOWSTACKFORMAT 1
68 /* types and limits for sig_atomic_t */
69 #define AROS_SIG_ATOMIC_T int
70 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
71 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
73 #if defined(__GNUC__) && !defined(__clang__)
74 register unsigned char* AROS_GET_SP
__asm__("%sp");
78 An offset value sometimes added to
79 or subtracted from the stack limits.
82 #define SP_OFFSET 0x10
85 One entry in a libraries' jumptable. For assembler compatibility, the
86 field jmp should contain the code for an absolute jmp to a 32bit
87 address. There are also a couple of macros which you should use to
88 access the vector table from C.
92 unsigned long addis
; // simplified: lis 11, a@h
93 unsigned long ori
; // : li 11, a@l
94 unsigned long mtspr
; // : mtctr 11
95 unsigned long jmp
; // bcctr : bctr 11
97 /* browse MPCFPE32B.pdf to understand opcode creation */
98 #define __AROS_SET_FULLJMP(v,a)\
100 struct FullJumpVec *_v = (v); \
101 _v->addis = (15 << 26) | (11 << 21) | ((ULONG)(a) >> 16); \
102 _v->ori = (24 << 26) | (11 << 21) | (11 << 16) | ((ULONG)(a) & 0x0000FFFF);\
103 _v->mtspr = (31 << 26) | (11 << 21) | ( 9 << 16) | (467 << 1); \
104 _v->jmp = (19 << 26) | (20 << 21) | (528 << 1); \
112 /* Use these to access a vector table */
113 #define LIB_VECTSIZE (sizeof (struct JumpVec))
114 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(n)])
115 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
116 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
117 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
118 #define __AROS_USE_FULLJMP
121 No, we do not want to preserve the all registers in case of Semaphore and
122 multitasking handling functions. It made sence on m68k native target. On all
123 other targets the standard ABI rules the AROS world anyway...
127 /* Macros to test/set failure of AllocEntry() */
128 #define AROS_ALLOCENTRY_FAILED(memType) \
129 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
130 #define AROS_CHECK_ALLOCENTRY(memList) \
131 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
134 Find the next valid alignment for a structure if the next x bytes must
137 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
140 extern void _aros_not_implemented (char *);
142 /* How much stack do we need ? Lots :-) */
143 #define AROS_STACKSIZE 40960
145 /* How to map function arguments to CPU registers */
147 The i386 processor doesn't have enough registers to map the m68k
148 register set onto them - so simply use the compiler's calling
149 convention. The library base is mapped to the last argument so that
150 it can be ignored by the function.
153 /* What to do with the library base in header, prototype and call */
154 #define __AROS_LH_BASE(basetype,basename) basetype basename
155 #define __AROS_LP_BASE(basetype,basename) void *
156 #define __AROS_LC_BASE(basetype,basename) basename
157 #define __AROS_LD_BASE(basetype,basename) basetype
159 /* How to transform an argument in header, opt prototype, call and forced
161 #define __AROS_LHA(type,name,reg) type name
162 #define __AROS_LPA(type,name,reg) type
163 #define __AROS_LCA(type,name,reg) name
164 #define __AROS_LDA(type,name,reg) type
165 #define __AROS_UFHA(type,name,reg) type name
166 #define __AROS_UFPA(type,name,reg) type
167 #define __AROS_UFCA(type,name,reg) name
168 #define __AROS_UFDA(type,name,reg) type
169 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
170 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
171 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
172 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
174 /* Prefix for library function in header, prototype and call */
175 #define __AROS_LH_PREFIX /* eps */
176 #define __AROS_LP_PREFIX /* eps */
177 #define __AROS_LC_PREFIX /* eps */
178 #define __AROS_LD_PREFIX /* eps */
179 #define __AROS_UFH_PREFIX /* eps */
180 #define __AROS_UFP_PREFIX /* eps */
181 #define __AROS_UFC_PREFIX /* eps */
182 #define __AROS_UFD_PREFIX /* eps */
184 #endif /* AROS_PPC_CPU_H */