[CONNECTOR]: Update documentation to match reality.
[linux-2.6/verdex.git] / include / asm-m68knommu / entry.h
blob06f5aa70b0b524ed6e129ceff8aa7d934e3292c2
1 #ifndef __M68KNOMMU_ENTRY_H
2 #define __M68KNOMMU_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 ] [ format & vector ]
25 * 2E(sp) - [ pc-hiword ] [ sr ]
26 * 30(sp) - [ pc-loword ] [ pc-hiword ]
27 * 32(sp) - [ format & vector ] [ pc-loword ]
28 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
29 * M68K COLDFIRE
32 #define ALLOWINT 0xf8ff
34 #ifdef __ASSEMBLY__
36 /* process bits for task_struct.flags */
37 PF_TRACESYS_OFF = 3
38 PF_TRACESYS_BIT = 5
39 PF_PTRACED_OFF = 3
40 PF_PTRACED_BIT = 4
41 PF_DTRACE_OFF = 1
42 PF_DTRACE_BIT = 5
44 LENOSYS = 38
46 #define SWITCH_STACK_SIZE (6*4+4) /* Includes return address */
49 * This defines the normal kernel pt-regs layout.
51 * regs are a2-a6 and d6-d7 preserved by C code
52 * the kernel doesn't mess with usp unless it needs to
55 #ifdef CONFIG_COLDFIRE
57 * This is made a little more tricky on the ColdFire. There is no
58 * separate kernel and user stack pointers. Need to artificially
59 * construct a usp in software... When doing this we need to disable
60 * interrupts, otherwise bad things could happen.
62 .macro SAVE_ALL
63 move #0x2700,%sr /* disable intrs */
64 btst #5,%sp@(2) /* from user? */
65 bnes 6f /* no, skip */
66 movel %sp,sw_usp /* save user sp */
67 addql #8,sw_usp /* remove exception */
68 movel sw_ksp,%sp /* kernel sp */
69 subql #8,%sp /* room for exception */
70 clrl %sp@- /* stkadj */
71 movel %d0,%sp@- /* orig d0 */
72 movel %d0,%sp@- /* d0 */
73 lea %sp@(-32),%sp /* space for 8 regs */
74 moveml %d1-%d5/%a0-%a2,%sp@
75 movel sw_usp,%a0 /* get usp */
76 movel %a0@-,%sp@(PT_PC) /* copy exception program counter */
77 movel %a0@-,%sp@(PT_FORMATVEC)/* copy exception format/vector/sr */
78 bra 7f
80 clrl %sp@- /* stkadj */
81 movel %d0,%sp@- /* orig d0 */
82 movel %d0,%sp@- /* d0 */
83 lea %sp@(-32),%sp /* space for 8 regs */
84 moveml %d1-%d5/%a0-%a2,%sp@
86 .endm
88 .macro RESTORE_ALL
89 btst #5,%sp@(PT_SR) /* going user? */
90 bnes 8f /* no, skip */
91 move #0x2700,%sr /* disable intrs */
92 movel sw_usp,%a0 /* get usp */
93 movel %sp@(PT_PC),%a0@- /* copy exception program counter */
94 movel %sp@(PT_FORMATVEC),%a0@-/* copy exception format/vector/sr */
95 moveml %sp@,%d1-%d5/%a0-%a2
96 lea %sp@(32),%sp /* space for 8 regs */
97 movel %sp@+,%d0
98 addql #4,%sp /* orig d0 */
99 addl %sp@+,%sp /* stkadj */
100 addql #8,%sp /* remove exception */
101 movel %sp,sw_ksp /* save ksp */
102 subql #8,sw_usp /* set exception */
103 movel sw_usp,%sp /* restore usp */
106 moveml %sp@,%d1-%d5/%a0-%a2
107 lea %sp@(32),%sp /* space for 8 regs */
108 movel %sp@+,%d0
109 addql #4,%sp /* orig d0 */
110 addl %sp@+,%sp /* stkadj */
112 .endm
115 * Quick exception save, use current stack only.
117 .macro SAVE_LOCAL
118 move #0x2700,%sr /* disable intrs */
119 clrl %sp@- /* stkadj */
120 movel %d0,%sp@- /* orig d0 */
121 movel %d0,%sp@- /* d0 */
122 lea %sp@(-32),%sp /* space for 8 regs */
123 moveml %d1-%d5/%a0-%a2,%sp@
124 .endm
126 .macro RESTORE_LOCAL
127 moveml %sp@,%d1-%d5/%a0-%a2
128 lea %sp@(32),%sp /* space for 8 regs */
129 movel %sp@+,%d0
130 addql #4,%sp /* orig d0 */
131 addl %sp@+,%sp /* stkadj */
133 .endm
135 .macro SAVE_SWITCH_STACK
136 lea %sp@(-24),%sp /* 6 regs */
137 moveml %a3-%a6/%d6-%d7,%sp@
138 .endm
140 .macro RESTORE_SWITCH_STACK
141 moveml %sp@,%a3-%a6/%d6-%d7
142 lea %sp@(24),%sp /* 6 regs */
143 .endm
146 * Software copy of the user and kernel stack pointers... Ugh...
147 * Need these to get around ColdFire not having separate kernel
148 * and user stack pointers.
150 .globl sw_usp
151 .globl sw_ksp
153 #else /* !CONFIG_COLDFIRE */
156 * Standard 68k interrupt entry and exit macros.
158 .macro SAVE_ALL
159 clrl %sp@- /* stkadj */
160 movel %d0,%sp@- /* orig d0 */
161 movel %d0,%sp@- /* d0 */
162 moveml %d1-%d5/%a0-%a2,%sp@-
163 .endm
165 .macro RESTORE_ALL
166 moveml %sp@+,%a0-%a2/%d1-%d5
167 movel %sp@+,%d0
168 addql #4,%sp /* orig d0 */
169 addl %sp@+,%sp /* stkadj */
171 .endm
173 .macro SAVE_SWITCH_STACK
174 moveml %a3-%a6/%d6-%d7,%sp@-
175 .endm
177 .macro RESTORE_SWITCH_STACK
178 moveml %sp@+,%a3-%a6/%d6-%d7
179 .endm
181 #endif /* !CONFIG_COLDFIRE */
182 #endif /* __ASSEMBLY__ */
183 #endif /* __M68KNOMMU_ENTRY_H */