entry_mm.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. /* process bits for task_struct.ptrace */
  46. PT_TRACESYS_OFF = 3
  47. PT_TRACESYS_BIT = 1
  48. PT_PTRACED_OFF = 3
  49. PT_PTRACED_BIT = 0
  50. PT_DTRACE_OFF = 3
  51. PT_DTRACE_BIT = 2
  52. #define SAVE_ALL_INT save_all_int
  53. #define SAVE_ALL_SYS save_all_sys
  54. #define RESTORE_ALL restore_all
  55. /*
  56. * This defines the normal kernel pt-regs layout.
  57. *
  58. * regs a3-a6 and d6-d7 are preserved by C code
  59. * the kernel doesn't mess with usp unless it needs to
  60. */
  61. /*
  62. * a -1 in the orig_d0 field signifies
  63. * that the stack frame is NOT for syscall
  64. */
  65. .macro save_all_int
  66. clrl %sp@- | stk_adj
  67. pea -1:w | orig d0
  68. movel %d0,%sp@- | d0
  69. moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
  70. .endm
  71. .macro save_all_sys
  72. clrl %sp@- | stk_adj
  73. movel %d0,%sp@- | orig d0
  74. movel %d0,%sp@- | d0
  75. moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
  76. .endm
  77. .macro restore_all
  78. moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
  79. movel %sp@+,%d0
  80. addql #4,%sp | orig d0
  81. addl %sp@+,%sp | stk adj
  82. rte
  83. .endm
  84. #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
  85. #define SAVE_SWITCH_STACK save_switch_stack
  86. #define RESTORE_SWITCH_STACK restore_switch_stack
  87. #define GET_CURRENT(tmp) get_current tmp
  88. .macro save_switch_stack
  89. moveml %a3-%a6/%d6-%d7,%sp@-
  90. .endm
  91. .macro restore_switch_stack
  92. moveml %sp@+,%a3-%a6/%d6-%d7
  93. .endm
  94. .macro get_current reg=%d0
  95. movel %sp,\reg
  96. andw #-THREAD_SIZE,\reg
  97. movel \reg,%curptr
  98. movel %curptr@,%curptr
  99. .endm
  100. #else /* C source */
  101. #define STR(X) STR1(X)
  102. #define STR1(X) #X
  103. #define SAVE_ALL_INT \
  104. "clrl %%sp@-;" /* stk_adj */ \
  105. "pea -1:w;" /* orig d0 = -1 */ \
  106. "movel %%d0,%%sp@-;" /* d0 */ \
  107. "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
  108. #define GET_CURRENT(tmp) \
  109. "movel %%sp,"#tmp"\n\t" \
  110. "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
  111. "movel "#tmp",%%a2\n\t" \
  112. "movel %%a2@,%%a2"
  113. #endif
  114. #endif /* __M68K_ENTRY_H */