home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / include / aros / machine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  3.9 KB  |  111 lines

  1. #ifndef AROS_MACHINE_H
  2. #define AROS_MACHINE_H
  3. /*
  4.     (C) 1995-96 AROS - The Amiga Replacement OS
  5.     $Id: machine.h,v 1.9 1996/10/24 15:40:03 aros Exp $
  6.  
  7.     NOTE: This file must compile *without* any other header !
  8.  
  9.     Desc: machine.h include file for Linux/i386 and FreeBSD/i386
  10.     Lang: english
  11. */
  12.  
  13. /* Information generated by machine.c */
  14. #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
  15. #define AROS_BIG_ENDIAN        0 /* Big or little endian */
  16. #define AROS_SIZEOFULONG       4 /* Size of an ULONG */
  17. #define AROS_WORDALIGN           2 /* Alignment for WORD */
  18. #define AROS_LONGALIGN           4 /* Alignment for LONG */
  19. #define AROS_PTRALIGN           4 /* Alignment for PTR */
  20. #define AROS_IPTRALIGN           4 /* Alignment for IPTR */
  21. #define AROS_DOUBLEALIGN       4 /* Alignment for double */
  22. #define AROS_WORSTALIGN        4 /* Worst case alignment */
  23.  
  24. /* ??? */
  25. #define SP_OFFSET 0
  26.  
  27. /*
  28.     Replace BPTRs by simple APTRs for this machine. On Amiga with binary
  29.     compatibility, this would look like this:
  30.  
  31.     typedef ULONG BPTR;
  32.     #define MKBADDR(a)      (((BPTR)(a))>>2)
  33.     #define BADDR(a)        (((APTR)(a))<<2)
  34. */
  35. #define AROS_BPTR_TYPE    APTR
  36. #define MKBADDR(a)      ((APTR)(a))
  37. #define BADDR(a)        (a)
  38.  
  39. /*
  40.     One entry in a libraries' jumptable. For assembler compatibility, the
  41.     field jmp should contain the code for an absolute jmp to a 32bit
  42.     address. There are also a couple of macros which you should use to
  43.     access the vector table from C.
  44. */
  45. struct JumpVec
  46. {
  47.     unsigned char jmp;
  48.     unsigned char vec[4];
  49. };
  50. /* Internal macros */
  51. #define __AROS_ASMJMP            0xE9
  52. #define __AROS_SET_VEC(v,a)             (*(ULONG*)(v)->vec=(ULONG)(a)-(ULONG)(v)-5)
  53. #define __AROS_GET_VEC(v)               ((APTR)(*(ULONG*)(v)->vec+(ULONG)(v)+5))
  54.  
  55. /* Use these to acces a vector table */
  56. #define LIB_VECTSIZE            (sizeof (struct JumpVec))
  57. #define __AROS_GETJUMPVEC(lib,n)        ((struct JumpVec *)(((UBYTE *)lib)-(n*LIB_VECTSIZE)))
  58. #define __AROS_GETVECADDR(lib,n)        (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
  59. #define __AROS_SETVECADDR(lib,n,addr)   (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
  60. #define __AROS_INITVEC(lib,n)           __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
  61.                     __AROS_SETVECADDR(lib,n,_aros_not_implemented)
  62.  
  63. /* ??? */
  64. #define RDFCALL(hook,data,dptr) ((void(*)(UBYTE,APTR))(hook))(data,dptr);
  65.  
  66. /*
  67.     Find the next valid alignment for a structure if the next x bytes must
  68.     be skipped.
  69. */
  70. #define AROS_ALIGN(x)        (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
  71.  
  72. /* Prototypes */
  73. extern void _aros_not_implemented (void);
  74.  
  75. /* How much stack do we need ? Lots :-) */
  76. #define AROS_STACKSIZE    100000
  77.  
  78. /* How to map function arguments to CPU registers */
  79. /*
  80.     The i386 processor doesn't have enough registers to map the m68k
  81.     register set onto them - so simply use the compiler's calling
  82.     convention. The library base is mapped to the last argument so that
  83.     it can be ignored by the function.
  84. */
  85.  
  86. /* What to do with the library base in header, prototype and call */
  87. #define __AROS_LH_BASE(basetype,basename)   basetype basename
  88. #define __AROS_LP_BASE(basetype,basename)   void *
  89. #define __AROS_LC_BASE(basetype,basename)   basename
  90.  
  91. /* How to transform an argument in header, prototype and call */
  92. #define __AROS_LHA(type,name,reg)     type name
  93. #define __AROS_LPA(type,name,reg)     type
  94. #define __AROS_LCA(type,name,reg)     name
  95. #define __AROS_UFHA(type,name,reg)    type name
  96. #define __AROS_UFPA(type,name,reg)    type
  97. #define __AROS_UFCA(type,name,reg)    name
  98.  
  99. /* Prefix for library function in header, prototype and call */
  100. #define __AROS_LH_PREFIX    /* eps */
  101. #define __AROS_LP_PREFIX    /* eps */
  102. #define __AROS_LC_PREFIX    /* eps */
  103. #define __AROS_UFH_PREFIX   /* eps */
  104. #define __AROS_UFP_PREFIX   /* eps */
  105. #define __AROS_UFC_PREFIX   /* eps */
  106.  
  107. /* if this is defined, all AROS_LP*-macros will expand to nothing. */
  108. #define __AROS_USE_MACROS_FOR_LIBCALL
  109.  
  110. #endif /* AROS_MACHINE_H */
  111.