Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / m68k / include / asm / entry_mm.h
blob73b8c8fbed9cdbad94c505db43e98a3972d72d5d
1 #ifndef __M68K_ENTRY_H
2 #define __M68K_ENTRY_H
4 #include <asm/setup.h>
5 #include <asm/page.h>
6 #ifdef __ASSEMBLY__
7 #include <asm/thread_info.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 /* the following macro is used when enabling interrupts */
37 #if defined(MACH_ATARI_ONLY)
38 /* block out HSYNC on the atari */
39 #define ALLOWINT (~0x400)
40 #define MAX_NOINT_IPL 3
41 #else
42 /* portable version */
43 #define ALLOWINT (~0x700)
44 #define MAX_NOINT_IPL 0
45 #endif /* machine compilation types */
47 #ifdef __ASSEMBLY__
49 #define curptr a2
51 LFLUSH_I_AND_D = 0x00000808
53 #define SAVE_ALL_INT save_all_int
54 #define SAVE_ALL_SYS save_all_sys
55 #define RESTORE_ALL restore_all
57 * This defines the normal kernel pt-regs layout.
59 * regs a3-a6 and d6-d7 are preserved by C code
60 * the kernel doesn't mess with usp unless it needs to
64 * a -1 in the orig_d0 field signifies
65 * that the stack frame is NOT for syscall
67 .macro save_all_int
68 clrl %sp@- | stk_adj
69 pea -1:w | orig d0
70 movel %d0,%sp@- | d0
71 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
72 .endm
74 .macro save_all_sys
75 clrl %sp@- | stk_adj
76 movel %d0,%sp@- | orig d0
77 movel %d0,%sp@- | d0
78 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
79 .endm
81 .macro restore_all
82 moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
83 movel %sp@+,%d0
84 addql #4,%sp | orig d0
85 addl %sp@+,%sp | stk adj
86 rte
87 .endm
89 #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
91 #define SAVE_SWITCH_STACK save_switch_stack
92 #define RESTORE_SWITCH_STACK restore_switch_stack
93 #define GET_CURRENT(tmp) get_current tmp
95 .macro save_switch_stack
96 moveml %a3-%a6/%d6-%d7,%sp@-
97 .endm
99 .macro restore_switch_stack
100 moveml %sp@+,%a3-%a6/%d6-%d7
101 .endm
103 .macro get_current reg=%d0
104 movel %sp,\reg
105 andw #-THREAD_SIZE,\reg
106 movel \reg,%curptr
107 movel %curptr@,%curptr
108 .endm
110 #else /* C source */
112 #define STR(X) STR1(X)
113 #define STR1(X) #X
115 #define SAVE_ALL_INT \
116 "clrl %%sp@-;" /* stk_adj */ \
117 "pea -1:w;" /* orig d0 = -1 */ \
118 "movel %%d0,%%sp@-;" /* d0 */ \
119 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
120 #define GET_CURRENT(tmp) \
121 "movel %%sp,"#tmp"\n\t" \
122 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
123 "movel "#tmp",%%a2\n\t" \
124 "movel %%a2@,%%a2"
126 #endif
128 #endif /* __M68K_ENTRY_H */