aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform/68360/entry.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/m68knommu/platform/68360/entry.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/m68knommu/platform/68360/entry.S')
-rw-r--r--arch/m68knommu/platform/68360/entry.S184
1 files changed, 184 insertions, 0 deletions
diff --git a/arch/m68knommu/platform/68360/entry.S b/arch/m68knommu/platform/68360/entry.S
new file mode 100644
index 000000000000..f7bc80a60e0f
--- /dev/null
+++ b/arch/m68knommu/platform/68360/entry.S
@@ -0,0 +1,184 @@
1/*
2 * linux/arch/m68knommu/platform/68360/entry.S
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2001 SED Systems, a Division of Calian Ltd.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file README.legal in the main directory of this archive
9 * for more details.
10 *
11 * Linux/m68k support by Hamish Macdonald
12 * M68360 Port by SED Systems, and Lineo.
13 */
14
15#include <linux/config.h>
16#include <linux/sys.h>
17#include <linux/linkage.h>
18#include <asm/thread_info.h>
19#include <asm/unistd.h>
20#include <asm/errno.h>
21#include <asm/setup.h>
22#include <asm/segment.h>
23#include <asm/traps.h>
24#include <asm/asm-offsets.h>
25#include <asm/entry.h>
26
27.text
28
29.globl system_call
30.globl resume
31.globl ret_from_exception
32.globl ret_from_signal
33.globl sys_call_table
34.globl ret_from_interrupt
35.globl bad_interrupt
36.globl inthandler
37
38badsys:
39 movel #-ENOSYS,%sp@(PT_D0)
40 jra ret_from_exception
41
42do_trace:
43 movel #-ENOSYS,%sp@(PT_D0) /* needed for strace*/
44 subql #4,%sp
45 SAVE_SWITCH_STACK
46 jbsr syscall_trace
47 RESTORE_SWITCH_STACK
48 addql #4,%sp
49 movel %sp@(PT_ORIG_D0),%d1
50 movel #-ENOSYS,%d0
51 cmpl #NR_syscalls,%d1
52 jcc 1f
53 lsl #2,%d1
54 lea sys_call_table, %a0
55 jbsr %a0@(%d1)
56
571: movel %d0,%sp@(PT_D0) /* save the return value */
58 subql #4,%sp /* dummy return address */
59 SAVE_SWITCH_STACK
60 jbsr syscall_trace
61
62ret_from_signal:
63 RESTORE_SWITCH_STACK
64 addql #4,%sp
65 jra ret_from_exception
66
67ENTRY(system_call)
68 SAVE_ALL
69
70 /* save top of frame*/
71 pea %sp@
72 jbsr set_esp0
73 addql #4,%sp
74
75 btst #PF_TRACESYS_BIT,%a2@(TASK_FLAGS+PF_TRACESYS_OFF)
76 jne do_trace
77 cmpl #NR_syscalls,%d0
78 jcc badsys
79 lsl #2,%d0
80 lea sys_call_table,%a0
81 movel %a0@(%d0), %a0
82 jbsr %a0@
83 movel %d0,%sp@(PT_D0) /* save the return value*/
84
85ret_from_exception:
86 btst #5,%sp@(PT_SR) /* check if returning to kernel*/
87 jeq Luser_return /* if so, skip resched, signals*/
88
89Lkernel_return:
90 RESTORE_ALL
91
92Luser_return:
93 /* only allow interrupts when we are really the last one on the*/
94 /* kernel stack, otherwise stack overflow can occur during*/
95 /* heavy interrupt load*/
96 andw #ALLOWINT,%sr
97
98 movel %sp,%d1 /* get thread_info pointer */
99 andl #0xffffe000,%d1
100 movel %d1,%a2
101 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
102 andl #_TIF_WORK_MASK,%d1
103 jne Lwork_to_do
104 RESTORE_ALL
105
106Lwork_to_do:
107 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
108 btst #TIF_NEED_RESCHED,%d1
109 jne reschedule
110
111Lsignal_return:
112 subql #4,%sp /* dummy return address*/
113 SAVE_SWITCH_STACK
114 pea %sp@(SWITCH_STACK_SIZE)
115 clrl %sp@-
116 bsrw do_signal
117 addql #8,%sp
118 RESTORE_SWITCH_STACK
119 addql #4,%sp
120Lreturn:
121 RESTORE_ALL
122
123/*
124 * This is the main interrupt handler, responsible for calling process_int()
125 */
126inthandler:
127 SAVE_ALL
128 addql #1,local_irq_count /* put exception # in d0*/
129 movew %sp@(PT_VECTOR), %d0
130 and.l #0x3ff, %d0
131 lsr.l #0x02, %d0
132
133 movel %sp,%sp@-
134 movel %d0,%sp@- /* put vector # on stack*/
135 jbsr process_int /* process the IRQ*/
1363: addql #8,%sp /* pop parameters off stack*/
137 bra ret_from_interrupt
138
139ret_from_interrupt:
140 subql #1,local_irq_count
141 jeq 1f
1422:
143 RESTORE_ALL
1441:
145 moveb %sp@(PT_SR), %d0
146 and #7, %d0
147 jhi 2b
148 /* check if we need to do software interrupts */
149
150 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
151 jeq ret_from_exception
152
153 pea ret_from_exception
154 jra do_softirq
155
156
157/*
158 * Handler for uninitialized and spurious interrupts.
159 */
160bad_interrupt:
161 addql #1,num_spurious
162 rte
163
164/*
165 * Beware - when entering resume, prev (the current task) is
166 * in a0, next (the new task) is in a1,so don't change these
167 * registers until their contents are no longer needed.
168 */
169ENTRY(resume)
170 movel %a0,%d1 /* save prev thread in d1 */
171 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
172 movel %usp,%a2 /* save usp */
173 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
174
175 SAVE_SWITCH_STACK
176 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
177 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
178 RESTORE_SWITCH_STACK
179
180 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
181 movel %a0,%usp
182 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */
183 rts
184