Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / aarch64-all / include / aros / cpu.h
blobf890c164ff781201646cbf2473954a7f2faf3f56
1 #ifndef AROS_AARCH64_CPU_H
2 #define AROS_AARCH64_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.h include file for aarch64-le systems
11 Lang: english
14 /* Translate __ARM_ARCH_X__ definitions to a common one. Makes it easier to write conditional code. */
15 #ifdef __ARM_ARCH_8A__
16 #define __ARM_ARCH__ 8
17 #endif
19 typedef unsigned int cpuid_t;
20 typedef unsigned int cpumask_t;
22 /* Information about size and alignment,
23 * the defines have to be numeric constants */
24 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
25 #define AROS_BIG_ENDIAN 0 /* Big or little endian */
26 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
27 #define AROS_SIZEOFPTR 8 /* Size of a PTR */
28 #define AROS_WORDALIGN 2 /* Alignment for WORD */
29 #define AROS_LONGALIGN 4 /* Alignment for LONG */
30 #define AROS_QUADALIGN 8 /* Alignment for QUAD */
31 #define AROS_PTRALIGN 8 /* Alignment for PTR */
32 #define AROS_IPTRALIGN 8 /* Alignment for IPTR */
33 #define AROS_DOUBLEALIGN 8 /* Alignment for double */
34 #define AROS_WORSTALIGN 16 /* Worst case alignment */
35 #define AROS_STACKALIGN 16 /* FIXME: is this really needed? */
37 /* define this if we have no support for linear varargs in the compiler */
38 #define NO_LINEAR_VARARGS 1
40 /* Do not use patched compiler. */
41 #define AROS_SLOWSTACKTAGS 1
42 #define AROS_SLOWSTACKMETHODS 1
43 #define AROS_SLOWSTACKHOOKS 1
44 #define AROS_SLOWSTACKFORMAT 1
46 #define AROS_32BIT_TYPE int
47 #define AROS_64BIT_TYPE long
48 #define AROS_64BIT_STACKTYPE long
50 #define AROS_MAKE_INT64(i) i ## L
51 #define AROS_MAKE_UINT64(i) i ## UL
53 #define __WORDSIZE 64
55 #define STACKED __attribute__((aligned(8)))
57 /* Use C pointer and string for the BCPL pointers and strings
58 * For a normal ABI these should not be defined for maximum source code
59 * compatibility.
61 #define AROS_FAST_BPTR 1
62 #define AROS_FAST_BSTR 1
64 /* do we need a function attribute to get parameters on the stack? */
65 #define __stackparm
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");
74 #endif
77 One entry in a libraries' jumptable. For assembler compatibility, the
78 field jmp should contain the code for an absolute jmp to a 32bit
79 address. There are also a couple of macros which you should use to
80 access the vector table from C.
82 struct FullJumpVec
84 unsigned long jmp;
85 unsigned long vec;
87 #define __AROS_SET_FULLJMP(v,a) \
88 do \
89 { \
90 struct FullJumpVec *_v = (v); \
91 _v->jmp = 0xe51ff004; /* ldr pc, [pc, #-4] */ \
92 _v->vec = (a); /* target_address */ \
93 } while (0)
95 struct JumpVec
97 void * vec;
100 /* Use these to acces a vector table */
101 #define LIB_VECTSIZE ((int)sizeof (struct JumpVec))
102 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(long)(n)])
103 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
104 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
105 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
107 /* Register preservation is still useful. At least for stack swapping functions. */
108 #undef UseExecstubs
109 #define UseExecstubs 1
111 /* Macros to test/set failure of AllocEntry() */
112 #define AROS_ALLOCENTRY_FAILED(memType) \
113 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
114 #define AROS_CHECK_ALLOCENTRY(memList) \
115 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
118 Find the next valid alignment for a structure if the next x bytes must
119 be skipped.
121 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
123 /* Prototypes */
124 extern void _aros_not_implemented ();
126 /* How much stack do we need ? Lots :-) */
127 #define AROS_STACKSIZE 40960
129 /* How to map function arguments to CPU registers */
131 The ARM processor does have enough registers to map the m68k
132 register set onto them but we will ignore this and use the compiler's calling
133 convention. The library base is mapped to the last argument so that
134 it can be ignored by the function.
137 /* What to do with the library base in header, prototype and call */
138 #define __AROS_LH_BASE(basetype,basename) basetype basename
139 #define __AROS_LP_BASE(basetype,basename) void *
140 #define __AROS_LC_BASE(basetype,basename) basename
141 #define __AROS_LD_BASE(basetype,basename) basetype
143 /* How to transform an argument in header, opt prototype, call and forced
144 prototype. */
145 #define __AROS_LHA(type,name,reg) type name
146 #define __AROS_LPA(type,name,reg) type
147 #define __AROS_LCA(type,name,reg) name
148 #define __AROS_LDA(type,name,reg) type
149 #define __AROS_UFHA(type,name,reg) type name
150 #define __AROS_UFPA(type,name,reg) type
151 #define __AROS_UFCA(type,name,reg) name
152 #define __AROS_UFDA(type,name,reg) type
153 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
154 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
155 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
156 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
158 /* Prefix for library function in header, prototype and call */
159 #define __AROS_LH_PREFIX /* eps */
160 #define __AROS_LP_PREFIX /* eps */
161 #define __AROS_LC_PREFIX /* eps */
162 #define __AROS_LD_PREFIX /* eps */
163 #define __AROS_UFH_PREFIX /* eps */
164 #define __AROS_UFP_PREFIX /* eps */
165 #define __AROS_UFC_PREFIX /* eps */
166 #define __AROS_UFD_PREFIX /* eps */
168 #endif /* AROS_AARCH64_CPU_H */