5 Copyright � 1995-2011, The AROS Development Team. All rights reserved.
8 NOTE: This file must compile *without* any other header !
10 Desc: cpu.h include file for arm-le systems
14 /* Translate __ARM_ARCH_X__ definitions to a common one. Makes it easier to write conditional code. */
16 #define __ARM_ARCH__ 2
19 #define __ARM_ARCH__ 3
22 #define __ARM_ARCH__ 4
25 #define __ARM_ARCH__ 5
28 #define __ARM_ARCH__ 6
30 #ifdef __ARM_ARCH_7A__
31 #define __ARM_ARCH__ 7
34 typedef unsigned int cpuid_t
;
35 typedef unsigned int cpumask_t
;
37 /* Information about size and alignment,
38 * the defines have to be numeric constants */
39 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
40 #define AROS_BIG_ENDIAN 0 /* Big or little endian */
41 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
42 #define AROS_SIZEOFPTR 4 /* Size of a PTR */
43 #define AROS_WORDALIGN 2 /* Alignment for WORD */
44 #define AROS_LONGALIGN 4 /* Alignment for LONG */
45 #define AROS_QUADALIGN 4 /* Alignment for QUAD */
46 #define AROS_PTRALIGN 4 /* Alignment for PTR */
47 #define AROS_IPTRALIGN 4 /* Alignment for IPTR */
48 #define AROS_DOUBLEALIGN 4 /* Alignment for double */
49 #define AROS_WORSTALIGN 16 /* Worst case alignment */
50 #define AROS_STACKALIGN 16 /* FIXME: is this really needed? */
52 /* define this if we have no support for linear varargs in the compiler */
53 #define NO_LINEAR_VARARGS 1
55 /* Do not use patched compiler. */
56 #define AROS_SLOWSTACKTAGS 1
57 #define AROS_SLOWSTACKMETHODS 1
58 #define AROS_SLOWSTACKHOOKS 1
59 #define AROS_SLOWSTACKFORMAT 1
61 #define AROS_32BIT_TYPE int
63 /* Use C pointer and string for the BCPL pointers and strings
64 * For a normal ABI these should not be defined for maximum source code
67 #define AROS_FAST_BPTR 1
68 #define AROS_FAST_BSTR 1
70 /* do we need a function attribute to get parameters on the stack? */
73 /* types and limits for sig_atomic_t */
74 #define AROS_SIG_ATOMIC_T int
75 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
76 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
78 #if defined(__GNUC__) && !defined(__clang__)
79 register unsigned char* AROS_GET_SP
__asm__("%sp");
83 One entry in a libraries' jumptable. For assembler compatibility, the
84 field jmp should contain the code for an absolute jmp to a 32bit
85 address. There are also a couple of macros which you should use to
86 access the vector table from C.
93 #define __AROS_SET_FULLJMP(v,a) \
96 struct FullJumpVec *_v = (v); \
97 _v->jmp = 0xe51ff004; /* ldr pc, [pc, #-4] */ \
98 _v->vec = (ULONG)(a); /* .word target_address */ \
106 /* Use these to acces a vector table */
107 #define LIB_VECTSIZE (sizeof (struct JumpVec))
108 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(n)])
109 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
110 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
111 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
113 /* Register preservation is still useful. At least for stack swapping functions. */
115 #define UseExecstubs 1
117 /* Macros to test/set failure of AllocEntry() */
118 #define AROS_ALLOCENTRY_FAILED(memType) \
119 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
120 #define AROS_CHECK_ALLOCENTRY(memList) \
121 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
124 Find the next valid alignment for a structure if the next x bytes must
127 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
130 extern void _aros_not_implemented ();
131 extern void aros_not_implemented ();
133 /* How much stack do we need ? Lots :-) */
134 #define AROS_STACKSIZE 40960
136 /* How to map function arguments to CPU registers */
138 The ARM processor does have enough registers to map the m68k
139 register set onto them but we will ignore this and use the compiler's calling
140 convention. The library base is mapped to the last argument so that
141 it can be ignored by the function.
144 /* What to do with the library base in header, prototype and call */
145 #define __AROS_LH_BASE(basetype,basename) basetype basename
146 #define __AROS_LP_BASE(basetype,basename) void *
147 #define __AROS_LC_BASE(basetype,basename) basename
148 #define __AROS_LD_BASE(basetype,basename) basetype
150 /* How to transform an argument in header, opt prototype, call and forced
152 #define __AROS_LHA(type,name,reg) type name
153 #define __AROS_LPA(type,name,reg) type
154 #define __AROS_LCA(type,name,reg) name
155 #define __AROS_LDA(type,name,reg) type
156 #define __AROS_UFHA(type,name,reg) type name
157 #define __AROS_UFPA(type,name,reg) type
158 #define __AROS_UFCA(type,name,reg) name
159 #define __AROS_UFDA(type,name,reg) type
160 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
161 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
162 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
163 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
165 /* Prefix for library function in header, prototype and call */
166 #define __AROS_LH_PREFIX /* eps */
167 #define __AROS_LP_PREFIX /* eps */
168 #define __AROS_LC_PREFIX /* eps */
169 #define __AROS_LD_PREFIX /* eps */
170 #define __AROS_UFH_PREFIX /* eps */
171 #define __AROS_UFP_PREFIX /* eps */
172 #define __AROS_UFC_PREFIX /* eps */
173 #define __AROS_UFD_PREFIX /* eps */
176 * This must be placed before every call to host OS on hosted AROS.
177 * On ARM it tells that r9 register is clobbered. Some OSes (iOS again)
178 * define r9 as volatile. It can be used as scratchpad but calls will
180 * AROS code expects it is nonvolatile (as defined in the AAPCS).
182 #define AROS_HOST_BARRIER asm volatile("":::"r9");
184 #define AROS_SWAP_BYTES_LONG_CPU(l) __builtin_bswap32(l)
185 #define AROS_SWAP_BYTES_WORD_CPU(l) __builtin_bswap16(l)
187 #endif /* AROS_ARM_CPU_H */