home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / kaffe-0.5p4-src.tgz / tar.out / contrib / kaffe / config / m68k / amigaos / md.h < prev   
C/C++ Source or Header  |  1996-09-28  |  3KB  |  78 lines

  1. /*
  2.  * m68k/amigaos/md.h
  3.  * AmigaOS specific functions.
  4.  *
  5.  * Copyright (c) 1996 Matthias Hopf <mshopf@informatik.uni-erlangen.de>
  6.  *
  7.  * Permission granted for Tim Wilkinson to include this source in his
  8.  * Kaffe system, Copyright (c) 1996 Systems Architecture Research Centre,
  9.  *               City University, London, UK.
  10.  *
  11.  * See the file "license.terms" for information on usage and redistribution
  12.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  13.  */
  14.  
  15. #ifndef __m68k_amigaos_md_h
  16. #define __m68k_amigaos_md_h
  17.  
  18.  
  19. #include <sys/time.h>                 /* don't change! */
  20. struct timerequest;                   /* Hack!! needed to get files including md.h *and* sys/time.h before working. */
  21. #define DEVICES_TIMER_H  1            /* devices/timer.h (included from exec/exec.h) is broken due to an other struct timeval definition. */
  22.  
  23. #ifdef IMPORT                         /* Hack!! needed to get rid of IMPORT redefined warnings */
  24. #  define _AMIGA_IMPORT    IMPORT
  25. #  undef  IMPORT
  26. #endif
  27.  
  28. #include <stdio.h>
  29.  
  30. #include <exec/exec.h>
  31. #include <proto/exec.h>
  32.  
  33. /* #include "m68k/amigaos/threads.h" */
  34.  
  35. #include "m68k/threads.h"
  36.  
  37.  
  38. extern struct Task *AmigaThisTask;
  39.  
  40.  
  41. #undef  THREADINFO
  42. #define THREADINFO(ee)                                               \
  43.           do {                                               \
  44.               AmigaThisTask = FindTask (NULL);               \
  45.               M68K_THREADINFO (ee);                          \
  46.               if ((uint8 *) AmigaThisTask->tc_SPLower > (ee)->stackBase) \
  47.               {                                              \
  48.               fprintf (stderr, "stack size too low - stack left: %ld, stack needed: %ld\n", \
  49.                    (ee)->stackEnd - (uint8 *) AmigaThisTask->tc_SPLower, threadStackSize); \
  50.               exit (20);                                 \
  51.               }                                              \
  52.           } while (0)
  53.  
  54. #undef  THREADSWITCH
  55. /* we should use StackSwap instead of native code, but that would be too
  56.  * complicated and extra overhead...
  57.  * we *should* surround this with Forbid()/Permit() (Task struct stack
  58.  * consistency), but overhead is too high. */
  59. #define THREADSWITCH(to, from)                                       \
  60.           do {                                               \
  61.               AmigaThisTask->tc_SPLower = (to)->stackBase;   \
  62.               AmigaThisTask->tc_SPUpper = (to)->stackEnd;    \
  63. DBG(                  printf ("setting task stack info from %x to %x\n", (to)->stackBase, (to)->stackEnd); )                           \
  64.               M68K_THREADSWITCH(to, from);                   \
  65.           } while (0)
  66.  
  67. #if defined(TRANSLATOR)
  68. #include "m68k/jit-md.h"
  69. #endif
  70.  
  71. #undef  IMPORT
  72. #ifdef _AMIGA_IMPORT
  73. #  define IMPORT        _AMIGA_IMPORT
  74. #  undef  _AMIGA_IMPORT
  75. #endif
  76.  
  77. #endif
  78.