entry.h 2.8 KB

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