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
67 /* types and limits for sig_atomic_t */
68 #define AROS_SIG_ATOMIC_T int
69 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
70 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
72 #if defined(__GNUC__) && !defined(__clang__)
73 register unsigned char* AROS_GET_SP
__asm__("%sp");
77 An offset value sometimes added to
78 or subtracted from the stack limits.
81 #define SP_OFFSET 0x10
84 One entry in a libraries' jumptable. For assembler compatibility, the
85 field jmp should contain the code for an absolute jmp to a 32bit
86 address. There are also a couple of macros which you should use to
87 access the vector table from C.
91 unsigned long addis
; // simplified: lis 11, a@h
92 unsigned long ori
; // : li 11, a@l
93 unsigned long mtspr
; // : mtctr 11
94 unsigned long jmp
; // bcctr : bctr 11
96 /* browse MPCFPE32B.pdf to understand opcode creation */
97 #define __AROS_SET_FULLJMP(v,a)\
99 struct FullJumpVec *_v = (v); \
100 _v->addis = (15 << 26) | (11 << 21) | ((ULONG)(a) >> 16); \
101 _v->ori = (24 << 26) | (11 << 21) | (11 << 16) | ((ULONG)(a) & 0x0000FFFF);\
102 _v->mtspr = (31 << 26) | (11 << 21) | ( 9 << 16) | (467 << 1); \
103 _v->jmp = (19 << 26) | (20 << 21) | (528 << 1); \
111 /* Use these to access a vector table */
112 #define LIB_VECTSIZE (sizeof (struct JumpVec))
113 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(n)])
114 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
115 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
116 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
117 #define __AROS_USE_FULLJMP
120 No, we do not want to preserve the all registers in case of Semaphore and
121 multitasking handling functions. It made sence on m68k native target. On all
122 other targets the standard ABI rules the AROS world anyway...
126 /* Macros to test/set failure of AllocEntry() */
127 #define AROS_ALLOCENTRY_FAILED(memType) \
128 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
129 #define AROS_CHECK_ALLOCENTRY(memList) \
130 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
133 Find the next valid alignment for a structure if the next x bytes must
136 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
139 extern void _aros_not_implemented (char *);
141 /* How much stack do we need ? Lots :-) */
142 #define AROS_STACKSIZE 40960
144 /* How to map function arguments to CPU registers */
146 The i386 processor doesn't have enough registers to map the m68k
147 register set onto them - so simply use the compiler's calling
148 convention. The library base is mapped to the last argument so that
149 it can be ignored by the function.
152 /* What to do with the library base in header, prototype and call */
153 #define __AROS_LH_BASE(basetype,basename) basetype basename
154 #define __AROS_LP_BASE(basetype,basename) void *
155 #define __AROS_LC_BASE(basetype,basename) basename
156 #define __AROS_LD_BASE(basetype,basename) basetype
158 /* How to transform an argument in header, opt prototype, call and forced
160 #define __AROS_LHA(type,name,reg) type name
161 #define __AROS_LPA(type,name,reg) type
162 #define __AROS_LCA(type,name,reg) name
163 #define __AROS_LDA(type,name,reg) type
164 #define __AROS_UFHA(type,name,reg) type name
165 #define __AROS_UFPA(type,name,reg) type
166 #define __AROS_UFCA(type,name,reg) name
167 #define __AROS_UFDA(type,name,reg) type
168 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
169 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
170 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
171 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
173 /* Prefix for library function in header, prototype and call */
174 #define __AROS_LH_PREFIX /* eps */
175 #define __AROS_LP_PREFIX /* eps */
176 #define __AROS_LC_PREFIX /* eps */
177 #define __AROS_LD_PREFIX /* eps */
178 #define __AROS_UFH_PREFIX /* eps */
179 #define __AROS_UFP_PREFIX /* eps */
180 #define __AROS_UFC_PREFIX /* eps */
181 #define __AROS_UFD_PREFIX /* eps */
183 #endif /* AROS_PPC_CPU_H */