- Removed unused HandleEvent method.
[AROS.git] / arch / m68k-all / include / aros / cpu.h
blob67a6f70121cd4fa20b782318f750630130c9dad2
1 #ifndef AROS_M68K_CPU_H
2 #define AROS_M68K_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:CPU-specific definitions for Motorola m68k processors
11 Lang: english
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_NOFPU 1
30 /* do we need a function attribute to get parameters on the stack? */
31 #define __stackparm
33 #define STACKED
35 /* types and limits for sig_atomic_t */
36 #define AROS_SIG_ATOMIC_T int
37 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
38 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
40 #define AROS_GET_SP ({register unsigned char * sp asm("%sp"); sp;})
43 One entry in a libraries' jumptable. For assembler compatibility, the
44 field jmp should contain the code for an absolute jmp to a 32bit
45 address. There are also a couple of macros which you should use to
46 access the vector table from C.
48 struct JumpVec
50 unsigned short jmp;
51 void *vec;
55 /* Any jump to an unimplemented vector will cause an access to this address */
56 #define _aros_empty_vector 0xc0ed0000
58 /* Internal macros */
59 #define __AROS_ASMJMP 0x4EF9
60 #define __AROS_SET_VEC(v,a) ((v)->vec=(a))
61 #define __AROS_GET_VEC(v) ((v)->vec)
62 #define __AROS_USE_FULLJMP
64 struct FullJumpVec
66 unsigned short jmp;
67 void *vec;
69 #define __AROS_SET_FULLJMP(v,a) \
70 do \
71 { \
72 struct FullJumpVec *_v = v; \
73 _v->jmp = __AROS_ASMJMP; \
74 _v->vec = ((void *)(a)); \
75 } while(0)
78 /* Use these to acces a vector table */
79 #define LIB_VECTSIZE (sizeof (struct JumpVec))
80 #define __AROS_GETJUMPVEC(lib,n) (&(((struct JumpVec *)(lib))[-(n)]))
81 #define __AROS_GETVECADDR(lib,n) ((void *)__AROS_GETJUMPVEC(lib,n))
82 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
83 #define __AROS_INITVEC(lib,n) __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
84 __AROS_SETVECADDR(lib,n,_aros_empty_vector | (n << 8) | 1)
86 #define KERNEL_PANIC_BUFFER (char*)0x800
89 We want to activate the execstubs and preserve all registers
90 when calling obtainsemaphore, obtainsemaphoreshared, releasesemaphore,
91 getcc, permit, forbid, enable, disable
93 #undef UseExecstubs
94 //#define UseExecstubs 1
96 /* Macros to test/set failure of AllocEntry() */
97 #define AROS_ALLOCENTRY_FAILED(memType) \
98 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
99 #define AROS_CHECK_ALLOCENTRY(memList) \
100 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
103 Find the next valid alignment for a structure if the next x bytes must
104 be skipped.
106 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
108 /* Prototypes */
109 extern void _aros_not_implemented ();
110 extern void aros_not_implemented ();
113 How much stack do we need ? Lots :-) ?
114 Not so much, I think (schulz) ;-))
117 #define AROS_STACKSIZE 0x4000
119 //#define AROS_NEEDS___MAIN
121 #define AROS_COMPAT_SETD0(x) do { asm volatile ( "move.l %0,%%d0\n" : "=g" (x)); return; } while (0)
123 #define A0 a0
124 #define A1 a1
125 #define A2 a2
126 #define A3 a3
127 #define A4 a4
128 #define A5 a5
129 #define A6 a6
130 #define D0 d0
131 #define D1 d1
132 #define D2 d2
133 #define D3 d3
134 #define D4 d4
135 #define D5 d5
136 #define D6 d6
137 #define D7 d7
139 /* This must match your compiler's idea of where the
140 * Frame Pointer register is. AROS's m68k gcc patches
141 * set this as A5, but unpatched GCCs can be made to
142 * generate correct code by setting these two defines
143 * to 'A6' and '"A6"'
145 #define __AROS_FP_REG A5
146 #define __AROS_FP_SREG "A5"
148 #define ___AROS_ISREG(reg,regcmp) (0x##reg == 0x##regcmp)
149 #define __AROS_ISREG(type,name,reg,regcmp) ___AROS_ISREG(reg,regcmp)
151 /* #defines for cpu specific asm and lib calls */
152 #define __AROS_ASMCALL_H_FILE "aros/m68k/asmcall.h"
153 #define __AROS_LIBCALL_H_FILE "aros/m68k/libcall.h"
155 /* Function declaration for program startup style code
157 #define AROS_ENTRY(t, n, a1, a2, bt, bn) \
158 AROS_UFH2(t, n, AROS_UFHA(a1), AROS_UFHA(a2)) \
159 bt bn = *((bt *)4);
161 #define AROS_SWAP_BYTES_LONG_CPU(l) \
162 ({ ULONG v; __asm__ __volatile__("ror.w #8,%0\nswap %0\nror.w #8,%0":"=d"(v):"0"(l)); v;})
163 #define AROS_SWAP_BYTES_WORD_CPU(l) \
164 ({ UWORD w; __asm__ __volatile__("ror.w #8,%d0\n":"=d"(w):"0"(l)); w;})
166 #endif /* AROS_M68K_CPU_H */