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-hiword ] [ sr ]
26 * 30(sp) - [ pc-loword ] [ pc-hiword ]
27 * 32(sp) - [ format & vector ] [ pc-loword ]
28 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
32 #define ALLOWINT 0xf8ff
36 /* process bits for task_struct.flags */
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.
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 */
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@
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 */
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 */
109 addql #4,%sp /* orig d0 */
110 addl %sp@+,%sp /* stkadj */
115 * Quick exception save, use current stack only.
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@
127 moveml %sp@,%d1-%d5/%a0-%a2
128 lea %sp@(32),%sp /* space for 8 regs */
130 addql #4,%sp /* orig d0 */
131 addl %sp@+,%sp /* stkadj */
135 .macro SAVE_SWITCH_STACK
136 lea %sp@(-24),%sp /* 6 regs */
137 moveml %a3-%a6/%d6-%d7,%sp@
140 .macro RESTORE_SWITCH_STACK
141 moveml %sp@,%a3-%a6/%d6-%d7
142 lea %sp@(24),%sp /* 6 regs */
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.
153 #else /* !CONFIG_COLDFIRE */
156 * Standard 68k interrupt entry and exit macros.
159 clrl %sp@- /* stkadj */
160 movel %d0,%sp@- /* orig d0 */
161 movel %d0,%sp@- /* d0 */
162 moveml %d1-%d5/%a0-%a2,%sp@-
166 moveml %sp@+,%a0-%a2/%d1-%d5
168 addql #4,%sp /* orig d0 */
169 addl %sp@+,%sp /* stkadj */
173 .macro SAVE_SWITCH_STACK
174 moveml %a3-%a6/%d6-%d7,%sp@-
177 .macro RESTORE_SWITCH_STACK
178 moveml %sp@+,%a3-%a6/%d6-%d7
181 #endif /* !CONFIG_COLDFIRE */
182 #endif /* __ASSEMBLY__ */
183 #endif /* __M68KNOMMU_ENTRY_H */