entry_mm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef __M68K_ENTRY_H
  2. #define __M68K_ENTRY_H
  3. #include <asm/setup.h>
  4. #include <asm/page.h>
  5. #ifdef __ASSEMBLY__
  6. #include <asm/thread_info.h>
  7. #endif
  8. /*
  9. * Stack layout in 'ret_from_exception':
  10. *
  11. * This allows access to the syscall arguments in registers d1-d5
  12. *
  13. * 0(sp) - d1
  14. * 4(sp) - d2
  15. * 8(sp) - d3
  16. * C(sp) - d4
  17. * 10(sp) - d5
  18. * 14(sp) - a0
  19. * 18(sp) - a1
  20. * 1C(sp) - a2
  21. * 20(sp) - d0
  22. * 24(sp) - orig_d0
  23. * 28(sp) - stack adjustment
  24. * 2C(sp) - sr
  25. * 2E(sp) - pc
  26. * 32(sp) - format & vector
  27. */
  28. /*
  29. * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
  30. * the whole kernel.
  31. */
  32. /* the following macro is used when enabling interrupts */
  33. #if defined(MACH_ATARI_ONLY)
  34. /* block out HSYNC on the atari */
  35. #define ALLOWINT (~0x400)
  36. #define MAX_NOINT_IPL 3
  37. #else
  38. /* portable version */
  39. #define ALLOWINT (~0x700)
  40. #define MAX_NOINT_IPL 0
  41. #endif /* machine compilation types */
  42. #ifdef __ASSEMBLY__
  43. #define curptr a2
  44. LFLUSH_I_AND_D = 0x00000808
  45. #define SAVE_ALL_INT save_all_int
  46. #define SAVE_ALL_SYS save_all_sys
  47. #define RESTORE_ALL restore_all
  48. /*
  49. * This defines the normal kernel pt-regs layout.
  50. *
  51. * regs a3-a6 and d6-d7 are preserved by C code
  52. * the kernel doesn't mess with usp unless it needs to
  53. */
  54. /*
  55. * a -1 in the orig_d0 field signifies
  56. * that the stack frame is NOT for syscall
  57. */
  58. .macro save_all_int
  59. clrl %sp@- | stk_adj
  60. pea -1:w | orig d0
  61. movel %d0,%sp@- | d0
  62. moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
  63. .endm
  64. .macro save_all_sys
  65. clrl %sp@- | stk_adj
  66. movel %d0,%sp@- | orig d0
  67. movel %d0,%sp@- | d0
  68. moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
  69. .endm
  70. .macro restore_all
  71. moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
  72. movel %sp@+,%d0
  73. addql #4,%sp | orig d0
  74. addl %sp@+,%sp | stk adj
  75. rte
  76. .endm
  77. #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
  78. #define SAVE_SWITCH_STACK save_switch_stack
  79. #define RESTORE_SWITCH_STACK restore_switch_stack
  80. #define GET_CURRENT(tmp) get_current tmp
  81. .macro save_switch_stack
  82. moveml %a3-%a6/%d6-%d7,%sp@-
  83. .endm
  84. .macro restore_switch_stack
  85. moveml %sp@+,%a3-%a6/%d6-%d7
  86. .endm
  87. .macro get_current reg=%d0
  88. movel %sp,\reg
  89. andw #-THREAD_SIZE,\reg
  90. movel \reg,%curptr
  91. movel %curptr@,%curptr
  92. .endm
  93. #else /* C source */
  94. #define STR(X) STR1(X)
  95. #define STR1(X) #X
  96. #define SAVE_ALL_INT \
  97. "clrl %%sp@-;" /* stk_adj */ \
  98. "pea -1:w;" /* orig d0 = -1 */ \
  99. "movel %%d0,%%sp@-;" /* d0 */ \
  100. "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
  101. #define GET_CURRENT(tmp) \
  102. "movel %%sp,"#tmp"\n\t" \
  103. "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
  104. "movel "#tmp",%%a2\n\t" \
  105. "movel %%a2@,%%a2"
  106. #endif
  107. #endif /* __M68K_ENTRY_H */