2.2.0-final
[davej-history.git] / include / asm-m68k / entry.h
blob647764bd17421ef335db8e2d023df44513bac9ed
1 #ifndef __M68K_ENTRY_H
2 #define __M68K_ENTRY_H
4 #include <linux/config.h>
5 #include <asm/setup.h>
6 #ifdef CONFIG_KGDB
7 #include <asm/kgdb.h>
8 #endif
11 * Stack layout in 'ret_from_exception':
13 * This allows access to the syscall arguments in registers d1-d5
15 * 0(sp) - d1
16 * 4(sp) - d2
17 * 8(sp) - d3
18 * C(sp) - d4
19 * 10(sp) - d5
20 * 14(sp) - a0
21 * 18(sp) - a1
22 * 1C(sp) - a2
23 * 20(sp) - d0
24 * 24(sp) - orig_d0
25 * 28(sp) - stack adjustment
26 * 2C(sp) - sr
27 * 2E(sp) - pc
28 * 32(sp) - format & vector
32 * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
33 * the whole kernel.
36 #ifdef __ASSEMBLY__
38 #define curptr a2
40 /* the following macro is used when enabling interrupts */
41 #if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES)
42 /* block out HSYNC on the atari */
43 #define ALLOWINT 0xfbff
44 #define MAX_NOINT_IPL 3
45 #else
46 /* portable version */
47 #define ALLOWINT 0xf8ff
48 #define MAX_NOINT_IPL 0
49 #endif /* machine compilation types */
51 LFLUSH_I_AND_D = 0x00000808
52 LSIGTRAP = 5
54 /* process bits for task_struct.flags */
55 PF_TRACESYS_OFF = 3
56 PF_TRACESYS_BIT = 5
57 PF_PTRACED_OFF = 3
58 PF_PTRACED_BIT = 4
59 PF_DTRACE_OFF = 1
60 PF_DTRACE_BIT = 5
62 #define SAVE_ALL_INT save_all_int
63 #define SAVE_ALL_SYS save_all_sys
64 #define RESTORE_ALL restore_all
66 * This defines the normal kernel pt-regs layout.
68 * regs a3-a6 and d6-d7 are preserved by C code
69 * the kernel doesn't mess with usp unless it needs to
71 #ifndef CONFIG_KGDB
73 * a -1 in the orig_d0 field signifies
74 * that the stack frame is NOT for syscall
76 .macro save_all_int
77 clrl %sp@- | stk_adj
78 pea -1:w | orig d0
79 movel %d0,%sp@- | d0
80 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
81 .endm
83 .macro save_all_sys
84 clrl %sp@- | stk_adj
85 movel %d0,%sp@- | orig d0
86 movel %d0,%sp@- | d0
87 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
88 .endm
89 #else
90 /* Need to save the "missing" registers for kgdb...
92 .macro save_all_int
93 clrl %sp@- | stk_adj
94 pea -1:w | orig d0
95 movel %d0,%sp@- | d0
96 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
97 moveml %d6-%d7,kgdb_registers+GDBOFFA_D6
98 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3
99 .endm
101 .macro save_all_sys
102 clrl %sp@- | stk_adj
103 movel %d0,%sp@- | orig d0
104 movel %d0,%sp@- | d0
105 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
106 moveml %d6-%d7,kgdb_registers+GDBOFFA_D6
107 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3
108 .endm
109 #endif
111 .macro restore_all
112 moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
113 movel %sp@+,%d0
114 addql #4,%sp | orig d0
115 addl %sp@+,%sp | stk adj
117 .endm
119 #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
121 #define SAVE_SWITCH_STACK save_switch_stack
122 #define RESTORE_SWITCH_STACK restore_switch_stack
123 #define GET_CURRENT(tmp) get_current tmp
125 .macro save_switch_stack
126 moveml %a3-%a6/%d6-%d7,%sp@-
127 .endm
129 .macro restore_switch_stack
130 moveml %sp@+,%a3-%a6/%d6-%d7
131 .endm
133 .macro get_current reg=%d0
134 movel %sp,\reg
135 andw #-8192,\reg
136 movel \reg,%curptr
137 .endm
139 #else /* C source */
141 #define STR(X) STR1(X)
142 #define STR1(X) #X
144 #define PT_OFF_ORIG_D0 0x24
145 #define PT_OFF_FORMATVEC 0x32
146 #define PT_OFF_SR 0x2C
147 #ifndef CONFIG_KGDB
148 #define SAVE_ALL_INT \
149 "clrl %%sp@-;" /* stk_adj */ \
150 "pea -1:w;" /* orig d0 = -1 */ \
151 "movel %%d0,%%sp@-;" /* d0 */ \
152 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
153 #else
154 #define SAVE_ALL_INT \
155 "clrl %%sp@-\n\t" /* stk_adj */ \
156 "pea -1:w\n\t" /* orig d0 = -1 */ \
157 "movel %%d0,%%sp@-\n\t" /* d0 */ \
158 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-\n\t" \
159 "moveml %%d6-%%d7,kgdb_registers+"STR(GDBOFFA_D6)"\n\t" \
160 "moveml %%a3-%%a6,kgdb_registers+"STR(GDBOFFA_A3)
161 #endif
162 #define GET_CURRENT(tmp) \
163 "movel %%sp,"#tmp"\n\t" \
164 "andw #-8192,"#tmp"\n\t" \
165 "movel "#tmp",%%a2"
167 #endif
169 #endif /* __M68K_ENTRY_H */