[PATCH] w1: Adds a sysfs entry (w1_master_search) that allows you to disable/enable...
[linux-2.6/verdex.git] / include / asm-m68k / entry.h
blob0396495cd97de0d3f6187b83bed39d3db4520f6e
1 #ifndef __M68K_ENTRY_H
2 #define __M68K_ENTRY_H
4 #include <linux/config.h>
5 #include <asm/setup.h>
6 #include <asm/page.h>
8 /*
9 * Stack layout in 'ret_from_exception':
11 * This allows access to the syscall arguments in registers d1-d5
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
30 * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
31 * the whole kernel.
34 /* the following macro is used when enabling interrupts */
35 #if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES)
36 /* block out HSYNC on the atari */
37 #define ALLOWINT (~0x400)
38 #define MAX_NOINT_IPL 3
39 #else
40 /* portable version */
41 #define ALLOWINT (~0x700)
42 #define MAX_NOINT_IPL 0
43 #endif /* machine compilation types */
45 #ifdef __ASSEMBLY__
47 #define curptr a2
49 LFLUSH_I_AND_D = 0x00000808
50 LSIGTRAP = 5
52 /* process bits for task_struct.ptrace */
53 PT_TRACESYS_OFF = 3
54 PT_TRACESYS_BIT = 1
55 PT_PTRACED_OFF = 3
56 PT_PTRACED_BIT = 0
57 PT_DTRACE_OFF = 3
58 PT_DTRACE_BIT = 2
60 #define SAVE_ALL_INT save_all_int
61 #define SAVE_ALL_SYS save_all_sys
62 #define RESTORE_ALL restore_all
64 * This defines the normal kernel pt-regs layout.
66 * regs a3-a6 and d6-d7 are preserved by C code
67 * the kernel doesn't mess with usp unless it needs to
71 * a -1 in the orig_d0 field signifies
72 * that the stack frame is NOT for syscall
74 .macro save_all_int
75 clrl %sp@- | stk_adj
76 pea -1:w | orig d0
77 movel %d0,%sp@- | d0
78 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
79 .endm
81 .macro save_all_sys
82 clrl %sp@- | stk_adj
83 movel %d0,%sp@- | orig d0
84 movel %d0,%sp@- | d0
85 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
86 .endm
88 .macro restore_all
89 moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
90 movel %sp@+,%d0
91 addql #4,%sp | orig d0
92 addl %sp@+,%sp | stk adj
93 rte
94 .endm
96 #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
98 #define SAVE_SWITCH_STACK save_switch_stack
99 #define RESTORE_SWITCH_STACK restore_switch_stack
100 #define GET_CURRENT(tmp) get_current tmp
102 .macro save_switch_stack
103 moveml %a3-%a6/%d6-%d7,%sp@-
104 .endm
106 .macro restore_switch_stack
107 moveml %sp@+,%a3-%a6/%d6-%d7
108 .endm
110 .macro get_current reg=%d0
111 movel %sp,\reg
112 andw #-THREAD_SIZE,\reg
113 movel \reg,%curptr
114 movel %curptr@,%curptr
115 .endm
117 #else /* C source */
119 #define STR(X) STR1(X)
120 #define STR1(X) #X
122 #define PT_OFF_ORIG_D0 0x24
123 #define PT_OFF_FORMATVEC 0x32
124 #define PT_OFF_SR 0x2C
125 #define SAVE_ALL_INT \
126 "clrl %%sp@-;" /* stk_adj */ \
127 "pea -1:w;" /* orig d0 = -1 */ \
128 "movel %%d0,%%sp@-;" /* d0 */ \
129 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
130 #define GET_CURRENT(tmp) \
131 "movel %%sp,"#tmp"\n\t" \
132 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
133 "movel "#tmp",%%a2\n\t" \
134 "movel %%a2@,%%a2"
136 #endif
138 #endif /* __M68K_ENTRY_H */