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