1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/sys.h>
16#include <linux/linkage.h>
17#include <asm/thread_info.h>
18#include <asm/unistd.h>
19#include <asm/errno.h>
20#include <asm/setup.h>
21#include <asm/segment.h>
22#include <asm/traps.h>
23#include <asm/asm-offsets.h>
24#include <asm/entry.h>
25
26.text
27
28.globl system_call
29.globl resume
30.globl ret_from_exception
31.globl ret_from_signal
32.globl sys_call_table
33.globl ret_from_interrupt
34.globl bad_interrupt
35.globl inthandler
36
37badsys:
38 movel
39 jra ret_from_exception
40
41do_trace:
42 movel
43 subql
44 SAVE_SWITCH_STACK
45 jbsr syscall_trace
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
60
61ret_from_signal:
62 RESTORE_SWITCH_STACK
63 addql
64 jra ret_from_exception
65
66ENTRY(system_call)
67 SAVE_ALL
68
69
70 pea %sp@
71 jbsr set_esp0
72 addql
73
74 btst
75 jne do_trace
76 cmpl
77 jcc badsys
78 lsl
79 lea sys_call_table,%a0
80 movel %a0@(%d0), %a0
81 jbsr %a0@
82 movel %d0,%sp@(PT_OFF_D0)
83
84ret_from_exception:
85 btst
86 jeq Luser_return
87
88Lkernel_return:
89 RESTORE_ALL
90
91Luser_return:
92
93
94
95 andw
96
97 movel %sp,%d1
98 andl
99 movel %d1,%a2
100 move %a2@(TI_FLAGS),%d1
101 andl
102 jne Lwork_to_do
103 RESTORE_ALL
104
105Lwork_to_do:
106 movel %a2@(TI_FLAGS),%d1
107 btst
108 jne reschedule
109
110Lsignal_return:
111 subql
112 SAVE_SWITCH_STACK
113 pea %sp@(SWITCH_STACK_SIZE)
114 clrl %sp@-
115 bsrw do_signal
116 addql
117 RESTORE_SWITCH_STACK
118 addql
119Lreturn:
120 RESTORE_ALL
121
122
123
124
125inthandler:
126 SAVE_ALL
127 movew %sp@(PT_OFF_VECTOR), %d0
128 and.l
129 lsr.l
130
131 movel %sp,%sp@-
132 movel %d0,%sp@-
133 jbsr do_IRQ
1343: addql
135 bra ret_from_interrupt
136
137ret_from_interrupt:
138 jeq 1f
1392:
140 RESTORE_ALL
1411:
142 moveb %sp@(PT_OFF_SR), %d0
143 and
144 jhi 2b
145
146
147 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
148 jeq ret_from_exception
149
150 pea ret_from_exception
151 jra do_softirq
152
153
154
155
156
157bad_interrupt:
158 addql
159 rte
160
161
162
163
164
165
166ENTRY(resume)
167 movel %a0,%d1
168 movew %sr,%a0@(TASK_THREAD+THREAD_SR)
169 movel %usp,%a2
170 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
171
172 SAVE_SWITCH_STACK
173 movel %sp,%a0@(TASK_THREAD+THREAD_KSP)
174 movel %a1@(TASK_THREAD+THREAD_KSP),%sp
175 RESTORE_SWITCH_STACK
176
177 movel %a1@(TASK_THREAD+THREAD_USP),%a0
178 movel %a0,%usp
179 movew %a1@(TASK_THREAD+THREAD_SR),%sr
180 rts
181
182