1 #ifndef __M68KNOMMU_ENTRY_H
2 #define __M68KNOMMU_ENTRY_H
4 #include <linux/config.h>
9 * Stack layout in 'ret_from_exception':
11 * This allows access to the syscall arguments in registers d1-d5
23 * 28(sp) - stack adjustment
24 * 2C(sp) - [ sr ] [ format & vector ]
25 * 2E(sp) - [ pc ] [ sr ]
26 * 30(sp) - [ format & vector ] [ pc ]
27 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
31 #define ALLOWINT 0xf8ff
35 /* process bits for task_struct.flags */
51 #define SWITCH_STACK_SIZE (6*4+4) /* Includes return address */
54 * This defines the normal kernel pt-regs layout.
56 * regs are a2-a6 and d6-d7 preserved by C code
57 * the kernel doesn't mess with usp unless it needs to
60 #ifdef CONFIG_COLDFIRE
62 * This is made a little more tricky on the ColdFire. There is no
63 * separate kernel and user stack pointers. Need to artificially
64 * construct a usp in software... When doing this we need to disable
65 * interrupts, otherwise bad things could happen.
68 move #0x2700,%sr /* disable intrs */
69 btst #5,%sp@(2) /* from user? */
70 bnes 6f /* no, skip */
71 movel %sp,sw_usp /* save user sp */
72 addql #8,sw_usp /* remove exception */
73 movel sw_ksp,%sp /* kernel sp */
74 subql #8,%sp /* room for exception */
75 clrl %sp@- /* stk_adj */
76 movel %d0,%sp@- /* orig d0 */
77 movel %d0,%sp@- /* d0 */
78 subl #32,%sp /* space for 8 regs */
79 moveml %d1-%d5/%a0-%a2,%sp@
80 movel sw_usp,%a0 /* get usp */
81 moveml %a0@(-8),%d1-%d2 /* get exception */
82 moveml %d1-%d2,%sp@(LFORMATVEC) /* copy exception */
85 clrl %sp@- /* stk_adj */
86 movel %d0,%sp@- /* orig d0 */
87 movel %d0,%sp@- /* d0 */
88 subl #32,%sp /* space for 7 regs */
89 moveml %d1-%d5/%a0-%a2,%sp@
94 btst #5,%sp@(LSR) /* going user? */
95 bnes 8f /* no, skip */
96 move #0x2700,%sr /* disable intrs */
97 movel sw_usp,%a0 /* get usp */
98 moveml %sp@(LFORMATVEC),%d1-%d2 /* copy exception */
99 moveml %d1-%d2,%a0@(-8)
100 moveml %sp@,%d1-%d5/%a0-%a2
101 addl #32,%sp /* space for 8 regs */
103 addql #4,%sp /* orig d0 */
104 addl %sp@+,%sp /* stk adj */
105 addql #8,%sp /* remove exception */
106 movel %sp,sw_ksp /* save ksp */
107 subql #8,sw_usp /* set exception */
108 movel sw_usp,%sp /* restore usp */
111 moveml %sp@,%d1-%d5/%a0-%a2
112 addl #32,%sp /* space for 8 regs */
114 addql #4,%sp /* orig d0 */
115 addl %sp@+,%sp /* stk adj */
120 * Quick exception save, use current stack only.
123 move #0x2700,%sr /* disable intrs */
124 clrl %sp@- /* stk_adj */
125 movel %d0,%sp@- /* orig d0 */
126 movel %d0,%sp@- /* d0 */
127 subl #32,%sp /* space for 8 regs */
128 moveml %d1-%d5/%a0-%a2,%sp@
132 moveml %sp@,%d1-%d5/%a0-%a2
133 addl #32,%sp /* space for 8 regs */
135 addql #4,%sp /* orig d0 */
136 addl %sp@+,%sp /* stk adj */
140 .macro SAVE_SWITCH_STACK
141 subl #24,%sp /* 6 regs */
142 moveml %a3-%a6/%d6-%d7,%sp@
145 .macro RESTORE_SWITCH_STACK
146 moveml %sp@,%a3-%a6/%d6-%d7
147 addl #24,%sp /* 6 regs */
151 * Software copy of the user and kernel stack pointers... Ugh...
152 * Need these to get around ColdFire not having separate kernel
153 * and user stack pointers.
158 #else /* !CONFIG_COLDFIRE */
161 * Standard 68k interrupt entry and exit macros.
164 clrl %sp@- /* stk_adj */
165 movel %d0,%sp@- /* orig d0 */
166 movel %d0,%sp@- /* d0 */
167 moveml %d1-%d5/%a0-%a2,%sp@-
171 moveml %sp@+,%a0-%a2/%d1-%d5
173 addql #4,%sp /* orig d0 */
174 addl %sp@+,%sp /* stk adj */
178 .macro SAVE_SWITCH_STACK
179 moveml %a3-%a6/%d6-%d7,%sp@-
182 .macro RESTORE_SWITCH_STACK
183 moveml %sp@+,%a3-%a6/%d6-%d7
186 #endif /* !CONFIG_COLDFIRE */
187 #endif /* __ASSEMBLY__ */
188 #endif /* __M68KNOMMU_ENTRY_H */