added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / ppc-all / common / include / aros / machine.h
blobb5a01bc37a2ab6a8f43d0c2a53fb00bef5b71038
1 #pragma pack(2)
2 #ifndef AROS_MACHINE_H
3 #define AROS_MACHINE_H
5 /*
6 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
7 $Id$
9 NOTE: This file must compile *without* any other header !
11 Desc: machine.h include file for PPC systems
12 Lang: english
15 /* Information generated by machine.c */
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_WORDALIGN 2 /* Alignment for WORD */
20 #define AROS_LONGALIGN 2 /* Alignment for LONG */
21 #define AROS_PTRALIGN 2 /* Alignment for PTR */
22 #define AROS_IPTRALIGN 2 /* Alignment for IPTR */
23 #define AROS_DOUBLEALIGN 2 /* Alignment for double */
24 #define AROS_WORSTALIGN 8 /* Worst case alignment */
26 #define AROS_GET_SYSBASE extern struct ExecBase * SysBase;
27 #define AROS_GET_DOSBASE extern struct DosLibrary * DOSBase;
29 /* do we need a function attribute to get parameters on the stack? */
30 #define __stackparm __attribute__((stackparm))
32 #define AROS_SLOWSTACKTAGS 1
33 #define AROS_SLOWSTACKMETHODS 1
36 How much do I have to add to sp to get the address of the first
37 byte on the stack?
39 Note for PPC. This includes the proper stack offset needed for frame
40 linking. Usually it is 32 bytes
42 #define SP_OFFSET 0x20
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.
50 struct JumpVec
52 unsigned short jmp;
53 unsigned char vec[4];
56 /* Any jump to an unimplemented vector will cause an access to this address */
57 #define _aros_empty_vector 0xc0edbabe
59 /* Internal macros */
60 #define __AROS_ASMJMP 0x4EF9
61 #define __AROS_FAKEJMP 0xDEAD
62 #define __AROS_SET_VEC(v,a) (*(ULONG*)(v)->vec=(ULONG)(a))
63 #define __AROS_GET_VEC(v) ((APTR)(*(ULONG*)(v)->vec))
65 /* Use these to acces a vector table */
66 #define LIB_VECTSIZE (sizeof (struct JumpVec))
67 #define __AROS_GETJUMPVEC(lib,n) ((struct JumpVec *)(((UBYTE *)lib)-(n*LIB_VECTSIZE)))
68 #define __AROS_GETVECADDR(lib,n) (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
69 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
70 #define __AROS_INITVEC(lib,n) __AROS_SETVECADDR(lib,n,_aros_not_implemented)
73 We want to activate the execstubs and preserve all registers
74 when calling obtainsemaphore, obtainsemaphoreshared, releasesemaphore,
75 getcc, permit, forbid, enable, disable
77 #undef UseExecstubs
78 #define UseExecstubs 1
80 /* Macros to test/set failure of AllocEntry() */
81 #define AROS_ALLOCENTRY_FAILED(memType) \
82 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
83 #define AROS_CHECK_ALLOCENTRY(memList) \
84 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
87 Find the next valid alignment for a structure if the next x bytes must
88 be skipped.
90 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
92 /* Prototypes */
93 extern void _aros_not_implemented (void);
94 extern void aros_not_implemented (void);
96 /* How much stack do we need ? Lots :-) */
97 #define AROS_STACKSIZE 32768
99 /* RawDoFmt hook */
100 #define RDFCALL(hook,data,dptr) ((void(*)(UBYTE __d0,APTR __a3))(hook))(data,dptr);
102 /* What to do with the library base in header, prototype and call */
103 #define __AROS_LH_BASE(basetype,basename) basetype basename = (basetype)__A6
104 #define __AROS_LP_BASE(basetype,basename) basetype __base = basename
105 #define __AROS_LC_BASE(basetype,basename) __A6 = (LONG)__base
106 #define __AROS_LD_BASE(basetype,basename) basetype basename
108 /* How to transform an argument in header, prototype and call */
109 #define __AROS_LHA(type,name,reg) type name = (type) __##reg
110 #define __AROS_LPA(type,name,reg) type r##reg = name
111 #define __AROS_LCA(type,name,reg) __##reg = (LONG)r##reg
112 #define __AROS_LDA(type,name,reg) type
113 #define __AROS_UFHA(type,name,reg) type name = (type) __##reg
114 #define __AROS_UFPA(type,name,reg) type r##reg = name
115 #define __AROS_UFCA(type,name,reg) __##reg = (LONG)r##reg
116 #define __AROS_UFDA(type,name,reg) type
118 /* Prefix for library function in header, prototype and call */
119 #define __AROS_LH_PREFIX /* eps */
120 #define __AROS_LP_PREFIX /* eps */
121 #define __AROS_LC_PREFIX /* eps */
122 #define __AROS_LD_PREFIX /* eps */
123 #define __AROS_UFH_PREFIX /* eps */
124 #define __AROS_UFP_PREFIX /* eps */
125 #define __AROS_UFC_PREFIX /* eps */
126 #define __AROS_UFD_PREFIX /* eps */
128 /* if this is defined, all AROS_LP*-macros will expand to nothing. */
129 //#define __AROS_USE_MACROS_FOR_LIBCALL
131 #endif /* AROS_MACHINE_H */
134 #pragma pack()