1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/linkage.h>
14#include <asm/thread_info.h>
15#include <asm/unistd.h>
16#include <asm/errno.h>
17#include <asm/setup.h>
18#include <asm/traps.h>
19#include <asm/asm-offsets.h>
20#include <asm/entry.h>
21
22.text
23
24.globl system_call
25.globl resume
26.globl ret_from_exception
27.globl sys_call_table
28.globl bad_interrupt
29.globl inthandler1
30.globl inthandler2
31.globl inthandler3
32.globl inthandler4
33.globl inthandler5
34.globl inthandler6
35.globl inthandler7
36
37badsys:
38 movel
39 jra ret_from_exception
40
41do_trace:
42 movel
43 subql
44 SAVE_SWITCH_STACK
45 jbsr syscall_trace_enter
46 RESTORE_SWITCH_STACK
47 addql
48 movel %sp@(PT_OFF_ORIG_D0),%d1
49 movel
50 cmpl
51 jcc 1f
52 lsl
53 lea sys_call_table, %a0
54 jbsr %a0@(%d1)
55
561: movel %d0,%sp@(PT_OFF_D0)
57 subql
58 SAVE_SWITCH_STACK
59 jbsr syscall_trace_leave
60 RESTORE_SWITCH_STACK
61 addql
62 jra ret_from_exception
63
64ENTRY(system_call)
65 SAVE_ALL_SYS
66
67
68 pea %sp@
69 jbsr set_esp0
70 addql
71
72 movel %sp@(PT_OFF_ORIG_D0),%d0
73
74 movel %sp,%d1
75 andl
76 movel %d1,%a2
77 btst
78 jne do_trace
79 cmpl
80 jcc badsys
81 lsl
82 lea sys_call_table,%a0
83 movel %a0@(%d0), %a0
84 jbsr %a0@
85 movel %d0,%sp@(PT_OFF_D0)
86
87ret_from_exception:
88 btst
89 jeq Luser_return
90
91Lkernel_return:
92 RESTORE_ALL
93
94Luser_return:
95
96
97
98 andw
99
100 movel %sp,%d1
101 andl
102 movel %d1,%a2
1031:
104 move %a2@(TINFO_FLAGS),%d1
105 jne Lwork_to_do
106 RESTORE_ALL
107
108Lwork_to_do:
109 movel %a2@(TINFO_FLAGS),%d1
110 btst
111 jne reschedule
112
113Lsignal_return:
114 subql
115 SAVE_SWITCH_STACK
116 pea %sp@(SWITCH_STACK_SIZE)
117 bsrw do_notify_resume
118 addql
119 RESTORE_SWITCH_STACK
120 addql
121 jra 1b
122
123
124
125
126inthandler1:
127 SAVE_ALL_INT
128 movew %sp@(PT_OFF_FORMATVEC), %d0
129 and
130
131 movel %sp,%sp@-
132 movel
133 jbsr process_int
1343: addql
135 bra ret_from_exception
136
137inthandler2:
138 SAVE_ALL_INT
139 movew %sp@(PT_OFF_FORMATVEC), %d0
140 and
141
142 movel %sp,%sp@-
143 movel
144 jbsr process_int
1453: addql
146 bra ret_from_exception
147
148inthandler3:
149 SAVE_ALL_INT
150 movew %sp@(PT_OFF_FORMATVEC), %d0
151 and
152
153 movel %sp,%sp@-
154 movel
155 jbsr process_int
1563: addql
157 bra ret_from_exception
158
159inthandler4:
160 SAVE_ALL_INT
161 movew %sp@(PT_OFF_FORMATVEC), %d0
162 and
163
164 movel %sp,%sp@-
165 movel
166 jbsr process_int
1673: addql
168 bra ret_from_exception
169
170inthandler5:
171 SAVE_ALL_INT
172 movew %sp@(PT_OFF_FORMATVEC), %d0
173 and
174
175 movel %sp,%sp@-
176 movel
177 jbsr process_int
1783: addql
179 bra ret_from_exception
180
181inthandler6:
182 SAVE_ALL_INT
183 movew %sp@(PT_OFF_FORMATVEC), %d0
184 and
185
186 movel %sp,%sp@-
187 movel
188 jbsr process_int
1893: addql
190 bra ret_from_exception
191
192inthandler7:
193 SAVE_ALL_INT
194 movew %sp@(PT_OFF_FORMATVEC), %d0
195 and
196
197 movel %sp,%sp@-
198 movel
199 jbsr process_int
2003: addql
201 bra ret_from_exception
202
203inthandler:
204 SAVE_ALL_INT
205 movew %sp@(PT_OFF_FORMATVEC), %d0
206 and
207
208 movel %sp,%sp@-
209 movel %d0,%sp@-
210 jbsr process_int
2113: addql
212 bra ret_from_exception
213
214
215
216
217ENTRY(bad_interrupt)
218 addql
219 rte
220
221
222
223
224
225
226ENTRY(resume)
227 movel %a0,%d1
228 movew %sr,%a0@(TASK_THREAD+THREAD_SR)
229 SAVE_SWITCH_STACK
230 movel %sp,%a0@(TASK_THREAD+THREAD_KSP)
231 movel %usp,%a3
232 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
233
234 movel %a1@(TASK_THREAD+THREAD_USP),%a3
235 movel %a3,%usp
236 movel %a1@(TASK_THREAD+THREAD_KSP),%sp
237 RESTORE_SWITCH_STACK
238 movew %a1@(TASK_THREAD+THREAD_SR),%sr
239 rts
240
241