home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / c / gcc233.lha / os-include / inline / misc.h < prev    next >
C/C++ Source or Header  |  1992-12-29  |  1KB  |  53 lines

  1. #ifndef _INLINE_MISC_H
  2. #define _INLINE_MISC_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct MiscBase*  MiscBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME MiscBase
  18. #endif
  19.  
  20. static __inline UBYTE *
  21. AllocMiscResource (BASE_PAR_DECL unsigned long unitNum,UBYTE *name)
  22. {
  23.   BASE_EXT_DECL
  24.   register UBYTE * _res  __asm("d0");
  25.   register struct MiscBase* a6 __asm("a6") = BASE_NAME;
  26.   register unsigned long d0 __asm("d0") = unitNum;
  27.   register UBYTE *a1 __asm("a1") = name;
  28.   __asm __volatile ("jsr a6@(-0x6)"
  29.   : "=r" (_res)
  30.   : "r" (a6), "r" (d0), "r" (a1)
  31.   : "a0","a1","d0","d1", "memory");
  32.   return _res;
  33. }
  34. static __inline void 
  35. FreeMiscResource (BASE_PAR_DECL unsigned long unitNum)
  36. {
  37.   BASE_EXT_DECL
  38.   register struct MiscBase* a6 __asm("a6") = BASE_NAME;
  39.   register unsigned long d0 __asm("d0") = unitNum;
  40.   __asm __volatile ("jsr a6@(-0xc)"
  41.   : /* no output */
  42.   : "r" (a6), "r" (d0)
  43.   : "a0","a1","d0","d1", "memory");
  44. }
  45. #undef BASE_EXT_DECL
  46. #undef BASE_PAR_DECL
  47. #undef BASE_PAR_DECL0
  48. #undef BASE_NAME
  49.  
  50. __END_DECLS
  51.  
  52. #endif /* _INLINE_MISC_H */
  53.