clang doesnt support global registers
[AROS.git] / arch / x86_64-all / include / aros / cpu.h
blobbd1e9d3b2a65d1ba765aea4f58e1a39d955fcc0b
1 #ifndef AROS_X86_64_CPU_H
2 #define AROS_X86_64_CPU_H
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
8 NOTE: This file must compile *without* any other header !
10 Desc: machine.h include file for Linux/x86_64 (work in progres...)
11 Lang: english
14 /* Information about size and alignment,
15 * the defines have to be numeric constants */
16 #define AROS_STACK_GROWS_DOWNWARDS 1
17 #define AROS_BIG_ENDIAN 0
18 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
19 #define AROS_SIZEOFPTR 8 /* Size of a PTR */
20 #define AROS_WORDALIGN 2 /* Alignment for WORD */
21 #define AROS_LONGALIGN 4 /* Alignment for LONG */
22 #define AROS_QUADALIGN 8 /* Alignment for QUAD */
23 #define AROS_PTRALIGN 8 /* Alignment for PTR */
24 #define AROS_IPTRALIGN 8 /* Alignment for IPTR */
25 #define AROS_DOUBLEALIGN 8 /* Alignment for double */
26 #define AROS_WORSTALIGN 16 /* Worst case alignment */
27 #define AROS_STACKALIGN 16 /* Clean stack alignment */
29 /* define this if we have no support for linear varargs in the compiler */
30 #define NO_LINEAR_VARARGS 1
32 #define AROS_SLOWSTACKTAGS 1
33 #define AROS_SLOWSTACKMETHODS 1
34 #define AROS_SLOWSTACKHOOKS 1
36 #define AROS_32BIT_TYPE int
37 #define AROS_64BIT_TYPE long
38 #define AROS_64BIT_STACKTYPE long
40 #define AROS_MAKE_INT64(i) i ## L
41 #define AROS_MAKE_UINT64(i) i ## UL
43 #define __WORDSIZE 64
45 #define STACKED __attribute__((aligned(8)))
47 /* Use C pointer and string for the BCPL pointers and strings
48 * For a normal ABI these should not be defined for maximum source code
49 * compatibility.
51 #define AROS_FAST_BPTR 1
52 #define AROS_FAST_BSTR 1
54 /* types and limits for sig_atomic_t */
55 #define AROS_SIG_ATOMIC_T int
56 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
57 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
59 #if defined(__GNUC__) && !defined(__clang__) && !defined(__TINYC__)
60 register unsigned char * AROS_GET_SP __asm__("%rsp");
61 #endif
63 /*do we need a function attribute to get parameters on the stack? */
64 #define __stackparm
67 * Structure representing a jump code.
68 * Used to build proper seglist header, for example by LoadSeg()
69 * On x86-64 we use this code:
70 * movabsq $vec, %r11
71 * jmpq *%r11
73 struct FullJumpVec
75 unsigned short movabsq;
76 void *vec;
77 unsigned short jmp1;
78 unsigned char jmp2;
79 } __attribute__((packed));
81 #define __AROS_SET_FULLJMP(v,a) \
82 do \
83 { \
84 struct FullJumpVec *_v = v; \
85 _v->movabsq = 0xBB49; \
86 _v->vec = (a); \
87 _v->jmp1 = 0xFF41; \
88 _v->jmp2 = 0xE3; \
89 } while (0)
92 * One entry in libraries' vector table.
93 * On x86-64 we use vector table consisting only of pointers.
94 * We do not include jump code in them.
96 struct JumpVec
98 void *vec;
101 /* Use these to access a vector table */
102 #define LIB_VECTSIZE ((int)sizeof (struct JumpVec))
103 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(long)(n)])
104 #define __AROS_GETVECADDR(lib,n) (__AROS_GETJUMPVEC(lib,n)->vec)
105 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_GETJUMPVEC(lib,n)->vec = (addr))
106 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
109 We want to activate the execstubs and preserve all registers
110 when calling obtainsemaphore, obtainsemaphoreshared, releasesemaphore,
111 getcc, permit, forbid, enable, disable
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 (char *);
131 /* How much stack do we need ? Lots :-) */
132 #define AROS_STACKSIZE 40960
134 /* How to map function arguments to CPU registers */
136 The i386 processor doesn't have enough registers to map the m68k
137 register set onto them - so simply use the compiler's calling
138 convention. The library base is mapped to the last argument so that
139 it can be ignored by the function.
142 /* What to do with the library base in header, prototype and call */
143 #define __AROS_LH_BASE(basetype,basename) basetype basename
144 #define __AROS_LP_BASE(basetype,basename) void *
145 #define __AROS_LC_BASE(basetype,basename) basename
146 #define __AROS_LD_BASE(basetype,basename) basetype
148 /* How to transform an argument in header, opt prototype, call and forced
149 prototype. */
150 #define __AROS_LHA(type,name,reg) type name
151 #define __AROS_LPA(type,name,reg) type
152 #define __AROS_LCA(type,name,reg) name
153 #define __AROS_LDA(type,name,reg) type
154 #define __AROS_UFHA(type,name,reg) type name
155 #define __AROS_UFPA(type,name,reg) type
156 #define __AROS_UFCA(type,name,reg) name
157 #define __AROS_UFDA(type,name,reg) type
158 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
159 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
160 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
161 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
163 /* Prefix for library function in header, prototype and call */
164 #define __AROS_LH_PREFIX /* eps */
165 #define __AROS_LP_PREFIX /* eps */
166 #define __AROS_LC_PREFIX /* eps */
167 #define __AROS_LD_PREFIX /* eps */
168 #define __AROS_UFH_PREFIX /* eps */
169 #define __AROS_UFP_PREFIX /* eps */
170 #define __AROS_UFC_PREFIX /* eps */
171 #define __AROS_UFD_PREFIX /* eps */
173 #endif /* AROS_X86_64_CPU_H */