home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / config / m68k-emul / machine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-09  |  4.0 KB  |  124 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.2 1996/12/09 12:58:13 aros Exp $
  6.  
  7.     NOTE: This file must compile *without* any other header !
  8.  
  9.     Desc: machine.h include file for Linux/m68k (and others?)
  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            1 /* 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             2 /* Alignment for LONG */
  19. #define AROS_PTRALIGN              2 /* Alignment for PTR */
  20. #define AROS_IPTRALIGN             2 /* Alignment for IPTR */
  21. #define AROS_DOUBLEALIGN           2 /* Alignment for double */
  22. #define AROS_WORSTALIGN            8 /* Worst case alignment */
  23.  
  24. /*
  25.     How much do I have to add to sp to get the address of the first
  26.     byte on the stack?
  27. */
  28. #define SP_OFFSET 0
  29.  
  30. /*
  31.     Retain binary compatibility with AmigaOS.
  32.     Comment this out if you want APTRs.
  33. */
  34. #define AROS_BSTR_TYPE    long
  35. #define AROS_BPTR_TYPE    long
  36. #define MKBADDR(a)    (((LONG)(a)) >> 2)
  37. #define BADDR(a)    ((APTR)((ULONG)(a) << 2))
  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 short jmp;
  48.     unsigned char vec[4];
  49. };
  50.  
  51. /* Internal macros */
  52. #define __AROS_ASMJMP            0x4EF9
  53. #define __AROS_SET_VEC(v,a)             (*(ULONG*)(v)->vec=(ULONG)(a))
  54. #define __AROS_GET_VEC(v)               ((APTR)(*(ULONG*)(v)->vec))
  55.  
  56. /* Use these to acces a vector table */
  57. #define LIB_VECTSIZE            (sizeof (struct JumpVec))
  58. #define __AROS_GETJUMPVEC(lib,n)        ((struct JumpVec *)(((UBYTE *)lib)-(n*LIB_VECTSIZE)))
  59. #define __AROS_GETVECADDR(lib,n)        (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
  60. #define __AROS_SETVECADDR(lib,n,addr)   (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
  61. #define __AROS_INITVEC(lib,n)           __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
  62.                     __AROS_SETVECADDR(lib,n,_aros_not_implemented)
  63.  
  64. /* ??? */
  65. #define RDFCALL(hook,data,dptr) ((void(*)(UBYTE,APTR))(hook))(data,dptr);
  66.  
  67. /*
  68.     Find the next valid alignment for a structure if the next x bytes must
  69.     be skipped.
  70. */
  71. #define AROS_ALIGN(x)        (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
  72.  
  73. /* Prototypes */
  74. extern void _aros_not_implemented (void);
  75.  
  76. /* How much stack do we need ? Lots :-) */
  77. #define AROS_STACKSIZE    100000
  78.  
  79. /* How to map function arguments to CPU registers */
  80.  
  81. /* The registers */
  82. #define D0 "%d0"
  83. #define D1 "%d1"
  84. #define D2 "%d2"
  85. #define D3 "%d3"
  86. #define D4 "%d4"
  87. #define D5 "%d5"
  88. #define D6 "%d6"
  89. #define D7 "%d7"
  90. #define A0 "%a0"
  91. #define A1 "%a1"
  92. #define A2 "%a2"
  93. #define A3 "%a3"
  94. #define A4 "%a4"
  95. #define A5 "%a5"
  96. #define A6 "%a6"    /* This will only work with m68k-linux-gcc when
  97.                compiling with -O0 and -fomit-frame-pointer */
  98.  
  99. /* What to do with the library base in header, prototype and call */
  100. #define __AROS_LH_BASE(basetype,basename)   basetype basename
  101. #define __AROS_LP_BASE(basetype,basename)   void *
  102. #define __AROS_LC_BASE(basetype,basename)   basename
  103.  
  104. /* How to transform an argument in header, prototype and call */
  105. #define __AROS_LHA(type,name,reg)     type name
  106. #define __AROS_LPA(type,name,reg)     type
  107. #define __AROS_LCA(type,name,reg)     name
  108. #define __AROS_UFHA(type,name,reg)    type name
  109. #define __AROS_UFPA(type,name,reg)    type
  110. #define __AROS_UFCA(type,name,reg)    name
  111.  
  112. /* Prefix for library function in header, prototype and call */
  113. #define __AROS_LH_PREFIX    /* eps */
  114. #define __AROS_LP_PREFIX    /* eps */
  115. #define __AROS_LC_PREFIX    /* eps */
  116. #define __AROS_UFH_PREFIX   /* eps */
  117. #define __AROS_UFP_PREFIX   /* eps */
  118. #define __AROS_UFC_PREFIX   /* eps */
  119.  
  120. /* if this is defined, all AROS_LP*-macros will expand to nothing. */
  121. #define __AROS_USE_MACROS_FOR_LIBCALL
  122.  
  123. #endif /* AROS_MACHINE_H */
  124.