1 #ifndef AROS_M68K_CPU_H
2 #define AROS_M68K_CPU_H
5 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
8 NOTE: This file must compile *without* any other header !
10 Desc: CPU-specific definitions for Motorola m68k processors
14 /* Information about size and alignment,
15 * the defines have to be numeric constants */
16 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
17 #define AROS_BIG_ENDIAN 1 /* Big or little endian */
18 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
19 #define AROS_SIZEOFPTR 4 /* Size of a PTR */
20 #define AROS_WORDALIGN 2 /* Alignment for WORD */
21 #define AROS_LONGALIGN 2 /* Alignment for LONG */
22 #define AROS_QUADALIGN 2 /* Alignment for QUAD */
23 #define AROS_PTRALIGN 2 /* Alignment for PTR */
24 #define AROS_IPTRALIGN 2 /* Alignment for IPTR */
25 #define AROS_DOUBLEALIGN 2 /* Alignment for double */
26 #define AROS_WORSTALIGN 4 /* Worst case alignment */
28 #define AROS_SLOWSTACKFORMAT 1
32 /* do we need a function attribute to get parameters on the stack? */
37 /* types and limits for sig_atomic_t */
38 #define AROS_SIG_ATOMIC_T int
39 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
40 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
42 #define AROS_GET_SP ({register unsigned char * sp asm("%sp"); sp;})
45 One entry in a libraries' jumptable. For assembler compatibility, the
46 field jmp should contain the code for an absolute jmp to a 32bit
47 address. There are also a couple of macros which you should use to
48 access the vector table from C.
57 /* Any jump to an unimplemented vector will cause an access to this address */
58 #define _aros_empty_vector 0xc0ed0000
61 #define __AROS_ASMJMP 0x4EF9
62 #define __AROS_SET_VEC(v,a) ((v)->vec=(a))
63 #define __AROS_GET_VEC(v) ((v)->vec)
64 #define __AROS_USE_FULLJMP
71 #define __AROS_SET_FULLJMP(v,a) \
74 struct FullJumpVec *_v = v; \
75 _v->jmp = __AROS_ASMJMP; \
76 _v->vec = ((void *)(a)); \
80 /* Use these to acces a vector table */
81 #define LIB_VECTSIZE (sizeof (struct JumpVec))
82 #define __AROS_GETJUMPVEC(lib,n) (&(((struct JumpVec *)(lib))[-(n)]))
83 #define __AROS_GETVECADDR(lib,n) ((void *)__AROS_GETJUMPVEC(lib,n))
84 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
85 #define __AROS_INITVEC(lib,n) __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
86 __AROS_SETVECADDR(lib,n,_aros_empty_vector | (n << 8) | 1)
88 #define KERNEL_PANIC_BUFFER (char*)0x800
91 We want to activate the execstubs and preserve all registers
92 when calling obtainsemaphore, obtainsemaphoreshared, releasesemaphore,
93 getcc, permit, forbid, enable, disable
96 //#define UseExecstubs 1
98 /* Macros to test/set failure of AllocEntry() */
99 #define AROS_ALLOCENTRY_FAILED(memType) \
100 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
101 #define AROS_CHECK_ALLOCENTRY(memList) \
102 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
105 Find the next valid alignment for a structure if the next x bytes must
108 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
111 extern void _aros_not_implemented ();
112 extern void aros_not_implemented ();
115 How much stack do we need ? Lots :-) ?
116 Not so much, I think (schulz) ;-))
119 #define AROS_STACKSIZE 0x4000
121 //#define AROS_NEEDS___MAIN
123 #define AROS_COMPAT_SETD0(x) do { asm volatile ( "move.l %0,%%d0\n" : "=g" (x)); return; } while (0)
141 /* This must match your compiler's idea of where the
142 * Frame Pointer register is. AROS's m68k gcc patches
143 * set this as A5, but unpatched GCCs can be made to
144 * generate correct code by setting these two defines
147 #define __AROS_FP_REG A5
148 #define __AROS_FP_SREG "A5"
150 #define ___AROS_ISREG(reg,regcmp) (0x##reg == 0x##regcmp)
151 #define __AROS_ISREG(type,name,reg,regcmp) ___AROS_ISREG(reg,regcmp)
153 /* #defines for cpu specific asm and lib calls */
154 #define __AROS_ASMCALL_H_FILE "aros/m68k/asmcall.h"
155 #define __AROS_LIBCALL_H_FILE "aros/m68k/libcall.h"
157 /* Function declaration for program startup style code
159 #define AROS_PROCH(n, _argptr, _argsize, _SysBase) \
160 AROS_UFH2(SIPTR, n, \
161 AROS_UFHA(STRPTR, _argptr, A0), \
162 AROS_UFHA(ULONG , _argsize, D0)) \
163 struct ExecBase *_SysBase = *((struct ExecBase **)4);
164 #define AROS_PROCP(n) \
165 AROS_UFP2(SIPTR, n, \
166 AROS_UFPA(STRPTR, _argptr, A0), \
167 AROS_UFPA(ULONG , _argsize, D0))
168 #define AROS_PROCC(n, _argptr, _argsize, _SysBase) \
169 AROS_UFC2(SIPTR, n, \
170 AROS_UFCA(STRPTR, _argptr, A0), \
171 AROS_UFCA(ULONG , _argsize, D0))
173 #define AROS_SWAP_BYTES_LONG_CPU(l) \
174 ({ ULONG v; __asm__ __volatile__("ror.w #8,%0\nswap %0\nror.w #8,%0":"=d"(v):"0"(l)); v;})
175 #define AROS_SWAP_BYTES_WORD_CPU(l) \
176 ({ UWORD w; __asm__ __volatile__("ror.w #8,%d0\n":"=d"(w):"0"(l)); w;})
178 #endif /* AROS_M68K_CPU_H */