aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/include/asm/entry_mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/include/asm/entry_mm.h')
-rw-r--r--arch/m68k/include/asm/entry_mm.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/arch/m68k/include/asm/entry_mm.h b/arch/m68k/include/asm/entry_mm.h
new file mode 100644
index 000000000000..5202f5a5b420
--- /dev/null
+++ b/arch/m68k/include/asm/entry_mm.h
@@ -0,0 +1,137 @@
1#ifndef __M68K_ENTRY_H
2#define __M68K_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6
7/*
8 * Stack layout in 'ret_from_exception':
9 *
10 * This allows access to the syscall arguments in registers d1-d5
11 *
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
26 */
27
28/*
29 * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
30 * the whole kernel.
31 */
32
33/* the following macro is used when enabling interrupts */
34#if defined(MACH_ATARI_ONLY)
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 */
43
44#ifdef __ASSEMBLY__
45
46#define curptr a2
47
48LFLUSH_I_AND_D = 0x00000808
49LSIGTRAP = 5
50
51/* process bits for task_struct.ptrace */
52PT_TRACESYS_OFF = 3
53PT_TRACESYS_BIT = 1
54PT_PTRACED_OFF = 3
55PT_PTRACED_BIT = 0
56PT_DTRACE_OFF = 3
57PT_DTRACE_BIT = 2
58
59#define SAVE_ALL_INT save_all_int
60#define SAVE_ALL_SYS save_all_sys
61#define RESTORE_ALL restore_all
62/*
63 * This defines the normal kernel pt-regs layout.
64 *
65 * regs a3-a6 and d6-d7 are preserved by C code
66 * the kernel doesn't mess with usp unless it needs to
67 */
68
69/*
70 * a -1 in the orig_d0 field signifies
71 * that the stack frame is NOT for syscall
72 */
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
79
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
86
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
94
95#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
96
97#define SAVE_SWITCH_STACK save_switch_stack
98#define RESTORE_SWITCH_STACK restore_switch_stack
99#define GET_CURRENT(tmp) get_current tmp
100
101.macro save_switch_stack
102 moveml %a3-%a6/%d6-%d7,%sp@-
103.endm
104
105.macro restore_switch_stack
106 moveml %sp@+,%a3-%a6/%d6-%d7
107.endm
108
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
115
116#else /* C source */
117
118#define STR(X) STR1(X)
119#define STR1(X) #X
120
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"
134
135#endif
136
137#endif /* __M68K_ENTRY_H */