added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / compiler / include / aros / cpu.h
blobfb53340626badcfb8630cdaf73a4711769d799a2
1 #ifndef AROS_CPU_H
2 #define AROS_CPU_H
3 /*
4 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 $Id$
7 CPU independent version of the <aros/cpu.h> header. This is the one
8 that normal programs can include.
9 */
11 #define AROS_CPU_IA32 1
12 #define AROS_CPU_M68K 2
13 #define AROS_CPU_PPC32 3
14 #define AROS_CPU_PPC64 4
15 #define AROS_CPU_AXP 5
16 #define AROS_CPU_SPARC32 6
17 #define AROS_CPU_SPARC64 7
18 #define AROS_CPU_IA64 8
19 #define AROS_CPU_X8664 9
22 Firstly, include the sub-include file for a particular CPU.
24 #if defined __i386__
25 # include <aros/i386/cpu.h>
26 #elif defined __x86_64__
27 # include <aros/x86_64/cpu.h>
28 #elif defined __mc68000__
29 # include <aros/m68k/cpu.h>
30 #elif defined __powerpc__
31 # include <aros/ppc/cpu.h>
32 #else
33 # error unsupported CPU type
34 #endif
37 Now, for any optional define that hasn't been provided, we must provide
38 an implementation of it here. This is somewhat tedious...
41 #ifndef AROS_INTPTR_TYPE
42 #define AROS_INTPTR_TYPE long
43 #endif
45 #ifndef AROS_32BIT_TYPE
46 #define AROS_32BIT_TYPE long
47 #endif
49 #ifndef AROS_16BIT_TYPE
50 #define AROS_16BIT_TYPE short
51 #endif
53 #ifndef AROS_8BIT_TYPE
54 #define AROS_8BIT_TYPE char
55 #endif
57 #ifndef AROS_64BIT_TYPE
58 #define AROS_64BIT_TYPE long long
59 #endif
61 #ifndef AROS_INTPTR_STACKTYPE
62 #define AROS_INTPTR_STACKTYPE long
63 #endif
65 #ifndef AROS_64BIT_STACKTYPE
66 #define AROS_64BIT_STACKTYPE long long
67 #endif
69 #ifndef AROS_32BIT_STACKTYPE
70 #define AROS_32BIT_STACKTYPE long
71 #endif
73 #ifndef AROS_16BIT_STACKTYPE
74 #define AROS_16BIT_STACKTYPE long
75 #endif
77 #ifndef AROS_8BIT_STACKTYPE
78 #define AROS_8BIT_STACKTYPE long
79 #endif
81 #ifndef AROS_FLOAT_STACKTYPE
82 #define AROS_FLOAT_STACKTYPE float
83 #endif
85 #ifndef AROS_DOUBLE_STACKTYPE
86 #define AROS_DOUBLE_STACKTYPE double
87 #endif
89 #ifndef AROS_LARGEST_TYPE
90 #define AROS_LARGEST_TYPE long
91 #endif
93 #ifndef AROS_ATOMIC_TYPE
94 #define AROS_ATOMIC_TYPE int
95 #endif
98 * AROS_xBIT_LEAST: A type that holds at least a certain bit width.
100 #ifndef AROS_8BIT_LEASTTYPE
101 # define AROS_8BIT_LEASTTYPE AROS_8BIT_TYPE
102 #endif
103 #ifndef AROS_16BIT_LEASTTYPE
104 # define AROS_16BIT_LEASTTYPE AROS_16BIT_TYPE
105 #endif
106 #ifndef AROS_32BIT_LEASTTYPE
107 # define AROS_32BIT_LEASTTYPE AROS_32BIT_TYPE
108 #endif
109 #ifndef AROS_64BIT_LEASTTYPE
110 # ifdef AROS_64BIT_TYPE
111 # define AROS_64BIT_LEASTTYPE AROS_64BIT_TYPE
112 # endif
113 #endif
115 #ifndef AROS_8BIT_LEASTMIN
116 # define AROS_8BIT_LEASTMIN AROS_8BIT_MIN
117 #endif
118 #ifndef AROS_16BIT_LEASTMIN
119 # define AROS_16BIT_LEASTMIN AROS_16BIT_MIN
120 #endif
121 #ifndef AROS_32BIT_LEASTMIN
122 # define AROS_32BIT_LEASTMIN AROS_32BIT_MIN
123 #endif
124 #ifndef AROS_64BIT_LEASTMIN
125 # ifdef AROS_64BIT_MIN
126 # define AROS_64BIT_LEASTMIN AROS_64BIT_MIN
127 # endif
128 #endif
130 #ifndef AROS_8BIT_LEASTMAX
131 # define AROS_8BIT_LEASTMAX AROS_8BIT_MAX
132 #endif
133 #ifndef AROS_16BIT_LEASTMAX
134 # define AROS_16BIT_LEASTMAX AROS_16BIT_MAX
135 #endif
136 #ifndef AROS_32BIT_LEASTMAX
137 # define AROS_32BIT_LEASTMAX AROS_32BIT_MAX
138 #endif
139 #ifndef AROS_64BIT_LEASTMAX
140 # ifdef AROS_64BIT_MAX
141 # define AROS_64BIT_LEASTMAX AROS_64BIT_MAX
142 # endif
143 #endif
147 * AROS_xBIT_FAST: A type that is fast for operating quickly
149 #ifndef AROS_8BIT_FASTTYPE
150 # define AROS_8BIT_FASTTYPE AROS_8BIT_TYPE
151 #endif
152 #ifndef AROS_16BIT_FASTTYPE
153 # define AROS_16BIT_FASTTYPE AROS_16BIT_TYPE
154 #endif
155 #ifndef AROS_32BIT_FASTTYPE
156 # define AROS_32BIT_FASTTYPE AROS_32BIT_TYPE
157 #endif
158 #ifndef AROS_64BIT_FASTTYPE
159 # ifdef AROS_64BIT_TYPE
160 # define AROS_64BIT_FASTTYPE AROS_64BIT_TYPE
161 # endif
162 #endif
164 #ifndef AROS_8BIT_FASTMIN
165 # define AROS_8BIT_FASTMIN AROS_8BIT_MIN
166 #endif
167 #ifndef AROS_16BIT_FASTMIN
168 # define AROS_16BIT_FASTMIN AROS_16BIT_MIN
169 #endif
170 #ifndef AROS_32BIT_FASTMIN
171 # define AROS_32BIT_FASTMIN AROS_32BIT_MIN
172 #endif
173 #ifndef AROS_64BIT_FASTMIN
174 # ifdef AROS_64BIT_MIN
175 # define AROS_64BIT_FASTMIN AROS_64BIT_MIN
176 # endif
177 #endif
179 #ifndef AROS_8BIT_FASTMAX
180 # define AROS_8BIT_FASTMAX AROS_8BIT_MAX
181 #endif
182 #ifndef AROS_16BIT_FASTMAX
183 # define AROS_16BIT_FASTMAX AROS_16BIT_MAX
184 #endif
185 #ifndef AROS_32BIT_FASTMAX
186 # define AROS_32BIT_FASTMAX AROS_32BIT_MAX
187 #endif
188 #ifndef AROS_64BIT_FASTMAX
189 # ifdef AROS_64BIT_MAX
190 # define AROS_64BIT_FASTMAX AROS_64BIT_MAX
191 # endif
192 #endif
195 The SP_OFFSET should be defined *ONLY* when not defined before.
196 Otherwise it would redefine defaults from cpu-arch.h or machine.h file
198 #ifndef SP_OFFSET
199 #define SP_OFFSET 0
200 #endif /* SP_OFFSET */
202 #ifndef AROS_COMPAT_SETD0
203 #define AROS_COMPAT_SETD0(x) (void)x
204 #endif /* AROS_COMPAT_SETD0 */
206 /* These macros will produce a value that can be stored in a AROS_64BIT_TYPE */
207 #ifndef AROS_MAKE_INT64
208 #define AROS_MAKE_INT64(i) i ## LL
209 #endif
210 #ifndef AROS_MAKE_UINT64
211 #define AROS_MAKE_UINT64(i) i ## ULL
212 #endif
214 #ifndef __WORDSIZE
215 #define __WORDSIZE 32
216 #endif
218 #ifndef STACKED
219 #define STACKED __attribute__((aligned(4)))
220 #endif
222 #endif /* AROS_CPU_H */