1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <linux/linkage.h>
30 #include <asm/unistd.h>
31 #include <asm/thread_info.h>
32 #include <asm/errno.h>
33 #include <asm/setup.h>
34 #include <asm/segment.h>
35 #include <asm/asm-offsets.h>
36 #include <asm/entry.h>
37
38 #ifdef CONFIG_COLDFIRE_SW_A7
39
40
41
42 .bss
43 sw_ksp:
44 .long 0
45 sw_usp:
46 .long 0
47 #endif
48
49 .text
50
51 .globl system_call
52 .globl resume
53 .globl ret_from_exception
54 .globl ret_from_signal
55 .globl sys_call_table
56 .globl inthandler
57
58 enosys:
59 mov.l #sys_ni_syscall,%d3
60 bra 1f
61
62 ENTRY(system_call)
63 SAVE_ALL_SYS
64 move #0x2000,%sr
65 GET_CURRENT(%d2)
66
67 cmpl #NR_syscalls,%d0
68 jcc enosys
69 lea sys_call_table,%a0
70 lsll #2,%d0
71 movel %a0@(%d0),%d3
72 jeq enosys
73
74 1:
75 movel %sp,%d2
76 andl #-THREAD_SIZE,%d2
77 movel %d2,%a0
78 movel %a0@,%a1
79 movel %sp,%a1@(TASK_THREAD+THREAD_ESP0)
80 btst #(TIF_SYSCALL_TRACE%8),%a0@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
81 bnes 1f
82
83 movel %d3,%a0
84 jbsr %a0@
85 movel %d0,%sp@(PT_OFF_D0)
86 jra ret_from_exception
87 1:
88 movel #-ENOSYS,%d2
89 movel %d2,PT_OFF_D0(%sp)
90 subql #4,%sp
91 SAVE_SWITCH_STACK
92 jbsr syscall_trace_enter
93 RESTORE_SWITCH_STACK
94 addql #4,%sp
95 movel %d3,%a0
96 jbsr %a0@
97 movel %d0,%sp@(PT_OFF_D0)
98 subql #4,%sp
99 SAVE_SWITCH_STACK
100 jbsr syscall_trace_leave
101
102 ret_from_signal:
103 RESTORE_SWITCH_STACK
104 addql #4,%sp
105
106 ret_from_exception:
107 move #0x2700,%sr
108 btst #5,%sp@(PT_OFF_SR)
109 jeq Luser_return
110
111 #ifdef CONFIG_PREEMPT
112 movel %sp,%d1
113 andl #-THREAD_SIZE,%d1
114 movel %d1,%a0
115 movel %a0@(TINFO_FLAGS),%d1
116 andl #(1<<TIF_NEED_RESCHED),%d1
117 jeq Lkernel_return
118
119 movel %a0@(TINFO_PREEMPT),%d1
120 cmpl #0,%d1
121 jne Lkernel_return
122
123 pea Lkernel_return
124 jmp preempt_schedule_irq
125 #endif
126
127 Lkernel_return:
128 moveml %sp@,%d1-%d5/%a0-%a2
129 lea %sp@(32),%sp
130 movel %sp@+,%d0
131 addql #4,%sp
132 addl %sp@+,%sp
133 rte
134
135 Luser_return:
136 movel %sp,%d1
137 andl #-THREAD_SIZE,%d1
138 movel %d1,%a0
139 moveb %a0@(TINFO_FLAGS+3),%d1
140 jne Lwork_to_do
141
142 Lreturn:
143 RESTORE_USER
144
145 Lwork_to_do:
146 movel %a0@(TINFO_FLAGS),%d1
147 move #0x2000,%sr
148 btst #TIF_NEED_RESCHED,%d1
149 jne reschedule
150
151 Lsignal_return:
152 subql #4,%sp
153 SAVE_SWITCH_STACK
154 pea %sp@(SWITCH_STACK_SIZE)
155 jsr do_notify_resume
156 addql #4,%sp
157 RESTORE_SWITCH_STACK
158 addql #4,%sp
159 jmp Luser_return
160
161
162
163
164
165 ENTRY(inthandler)
166 SAVE_ALL_INT
167 GET_CURRENT(%d2)
168
169 movew %sp@(PT_OFF_FORMATVEC),%d0
170 andl #0x03fc,%d0
171
172 movel %sp,%sp@-
173 lsrl #2,%d0
174 movel %d0,%sp@-
175 jbsr do_IRQ
176 lea %sp@(8),%sp
177
178 bra ret_from_exception
179
180
181
182
183
184
185 ENTRY(resume)
186 movew %sr,%d1
187 movew %d1,%a0@(TASK_THREAD+THREAD_SR)
188 movel %a0,%d1
189 SAVE_SWITCH_STACK
190 movel %sp,%a0@(TASK_THREAD+THREAD_KSP)
191 RDUSP
192 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
193 #ifdef CONFIG_MMU
194 movel %a1,%a2
195 #endif
196 movel %a1@(TASK_THREAD+THREAD_USP),%a3
197 WRUSP
198 movel %a1@(TASK_THREAD+THREAD_KSP),%sp
199 movew %a1@(TASK_THREAD+THREAD_SR),%d7
200 movew %d7,%sr
201 RESTORE_SWITCH_STACK
202 rts
203