revert between 56095 -> 55830 in arch
[AROS.git] / arch / arm-all / include / aros-armel / cpu-thumb2.h
blobbbfb63a669da6bec91879bf709d445d0974170e7
1 #ifndef AROS_ARM_CPU_H
2 #define AROS_ARM_CPU_H
4 /*
5 Copyright © 2016, The AROS Development Team. All rights reserved.
6 $Id$
8 NOTE: This file must compile *without* any other header !
10 Desc: cpu-thumb2.h include file for arm-le systems in thumb2 mode
11 Lang: english
14 /* Translate __ARM_ARCH_X__ definitions to a common one. Makes it easier to write conditional code. */
15 #ifdef __ARM_ARCH_2__
16 #define __ARM_ARCH__ 2
17 #endif
18 #ifdef __ARM_ARCH_3__
19 #define __ARM_ARCH__ 3
20 #endif
21 #ifdef __ARM_ARCH_4__
22 #define __ARM_ARCH__ 4
23 #endif
24 #ifdef __ARM_ARCH_5__
25 #define __ARM_ARCH__ 5
26 #endif
27 #ifdef __ARM_ARCH_6__
28 #define __ARM_ARCH__ 6
29 #endif
30 #ifdef __ARM_ARCH_7A__
31 #define __ARM_ARCH__ 7
32 #endif
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
60 #define AROS_32BIT_TYPE int
62 /* Use C pointer and string for the BCPL pointers and strings
63 * For a normal ABI these should not be defined for maximum source code
64 * compatibility.
66 #define AROS_FAST_BPTR 1
67 #define AROS_FAST_BSTR 1
69 /* do we need a function attribute to get parameters on the stack? */
70 #define __stackparm
72 /* types and limits for sig_atomic_t */
73 #define AROS_SIG_ATOMIC_T int
74 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
75 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
77 #if defined(__GNUC__) && !defined(__clang__)
78 register unsigned char* AROS_GET_SP __asm__("%sp");
79 #endif
82 One entry in a libraries' jumptable. For assembler compatibility, the
83 field jmp should contain the code for an absolute jmp to a 32bit
84 address. There are also a couple of macros which you should use to
85 access the vector table from C.
87 struct FullJumpVec
89 unsigned long jmp;
90 unsigned long vec;
92 #define __AROS_SET_FULLJMP(v,a) \
93 do \
94 { \
95 struct FullJumpVec *_v = (v); \
96 _v->jmp = 0xf85ff004; /* ldr.w pc, [pc, #-4] */ \
97 _v->vec = (ULONG)(a); /* .word target_address */ \
98 } while (0)
100 struct JumpVec
102 void * vec;
105 /* Use these to acces a vector table */
106 #define LIB_VECTSIZE (sizeof (struct JumpVec))
107 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(n)])
108 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
109 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
110 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
112 /* Register preservation is still useful. At least for stack swapping functions. */
113 #undef UseExecstubs
114 #define UseExecstubs 1
116 /* Macros to test/set failure of AllocEntry() */
117 #define AROS_ALLOCENTRY_FAILED(memType) \
118 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
119 #define AROS_CHECK_ALLOCENTRY(memList) \
120 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
123 Find the next valid alignment for a structure if the next x bytes must
124 be skipped.
126 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
128 /* Prototypes */
129 extern void _aros_not_implemented ();
130 extern void aros_not_implemented ();
132 /* How much stack do we need ? Lots :-) */
133 #define AROS_STACKSIZE 40960
135 /* How to map function arguments to CPU registers */
137 The ARM processor does have enough registers to map the m68k
138 register set onto them but we will ignore this and use the compiler's calling
139 convention. The library base is mapped to the last argument so that
140 it can be ignored by the function.
143 /* What to do with the library base in header, prototype and call */
144 #define __AROS_LH_BASE(basetype,basename) basetype basename
145 #define __AROS_LP_BASE(basetype,basename) void *
146 #define __AROS_LC_BASE(basetype,basename) basename
147 #define __AROS_LD_BASE(basetype,basename) basetype
149 /* How to transform an argument in header, opt prototype, call and forced
150 prototype. */
151 #define __AROS_LHA(type,name,reg) type name
152 #define __AROS_LPA(type,name,reg) type
153 #define __AROS_LCA(type,name,reg) name
154 #define __AROS_LDA(type,name,reg) type
155 #define __AROS_UFHA(type,name,reg) type name
156 #define __AROS_UFPA(type,name,reg) type
157 #define __AROS_UFCA(type,name,reg) name
158 #define __AROS_UFDA(type,name,reg) type
159 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
160 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
161 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
162 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
164 /* Prefix for library function in header, prototype and call */
165 #define __AROS_LH_PREFIX /* eps */
166 #define __AROS_LP_PREFIX /* eps */
167 #define __AROS_LC_PREFIX /* eps */
168 #define __AROS_LD_PREFIX /* eps */
169 #define __AROS_UFH_PREFIX /* eps */
170 #define __AROS_UFP_PREFIX /* eps */
171 #define __AROS_UFC_PREFIX /* eps */
172 #define __AROS_UFD_PREFIX /* eps */
175 * This must be placed before every call to host OS on hosted AROS.
176 * On ARM it tells that r9 register is clobbered. Some OSes (iOS again)
177 * define r9 as volatile. It can be used as scratchpad but calls will
178 * not preserve it.
179 * AROS code expects it is nonvolatile (as defined in the AAPCS).
181 #define AROS_HOST_BARRIER asm volatile("":::"r9");
183 #endif /* AROS_ARM_CPU_H */