entry_mm.h 2.6 KB

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