~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/m68knommu/platform/68328/entry.S

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  linux/arch/m68knommu/platform/68328/entry.S
3
 
 *
4
 
 *  Copyright (C) 1991, 1992  Linus Torvalds
5
 
 *
6
 
 * This file is subject to the terms and conditions of the GNU General Public
7
 
 * License.  See the file README.legal in the main directory of this archive
8
 
 * for more details.
9
 
 *
10
 
 * Linux/m68k support by Hamish Macdonald
11
 
 */
12
 
 
13
 
#include <linux/sys.h>
14
 
#include <linux/linkage.h>
15
 
#include <asm/thread_info.h>
16
 
#include <asm/unistd.h>
17
 
#include <asm/errno.h>
18
 
#include <asm/setup.h>
19
 
#include <asm/segment.h>
20
 
#include <asm/traps.h>
21
 
#include <asm/asm-offsets.h>
22
 
#include <asm/entry.h>
23
 
 
24
 
.text
25
 
 
26
 
.globl system_call
27
 
.globl resume
28
 
.globl ret_from_exception
29
 
.globl ret_from_signal
30
 
.globl sys_call_table
31
 
.globl ret_from_interrupt
32
 
.globl bad_interrupt
33
 
.globl inthandler1
34
 
.globl inthandler2
35
 
.globl inthandler3
36
 
.globl inthandler4
37
 
.globl inthandler5
38
 
.globl inthandler6
39
 
.globl inthandler7
40
 
 
41
 
badsys:
42
 
        movel   #-ENOSYS,%sp@(PT_OFF_D0)
43
 
        jra     ret_from_exception
44
 
 
45
 
do_trace:
46
 
        movel   #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
47
 
        subql   #4,%sp
48
 
        SAVE_SWITCH_STACK
49
 
        jbsr    syscall_trace_enter
50
 
        RESTORE_SWITCH_STACK
51
 
        addql   #4,%sp
52
 
        movel   %sp@(PT_OFF_ORIG_D0),%d1
53
 
        movel   #-ENOSYS,%d0
54
 
        cmpl    #NR_syscalls,%d1
55
 
        jcc     1f
56
 
        lsl     #2,%d1
57
 
        lea     sys_call_table, %a0
58
 
        jbsr    %a0@(%d1)
59
 
 
60
 
1:      movel   %d0,%sp@(PT_OFF_D0)     /* save the return value */
61
 
        subql   #4,%sp                  /* dummy return address */
62
 
        SAVE_SWITCH_STACK
63
 
        jbsr    syscall_trace_leave
64
 
 
65
 
ret_from_signal:
66
 
        RESTORE_SWITCH_STACK
67
 
        addql   #4,%sp
68
 
        jra     ret_from_exception
69
 
 
70
 
ENTRY(system_call)
71
 
        SAVE_ALL
72
 
 
73
 
        /* save top of frame*/
74
 
        pea     %sp@
75
 
        jbsr    set_esp0
76
 
        addql   #4,%sp
77
 
 
78
 
        movel   %sp@(PT_OFF_ORIG_D0),%d0
79
 
 
80
 
        movel   %sp,%d1                 /* get thread_info pointer */
81
 
        andl    #-THREAD_SIZE,%d1
82
 
        movel   %d1,%a2
83
 
        btst    #(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
84
 
        jne     do_trace
85
 
        cmpl    #NR_syscalls,%d0
86
 
        jcc     badsys
87
 
        lsl     #2,%d0
88
 
        lea     sys_call_table,%a0
89
 
        movel   %a0@(%d0), %a0
90
 
        jbsr    %a0@
91
 
        movel   %d0,%sp@(PT_OFF_D0)     /* save the return value*/
92
 
 
93
 
ret_from_exception:
94
 
        btst    #5,%sp@(PT_OFF_SR)      /* check if returning to kernel*/
95
 
        jeq     Luser_return            /* if so, skip resched, signals*/
96
 
 
97
 
Lkernel_return:
98
 
        RESTORE_ALL
99
 
 
100
 
Luser_return:
101
 
        /* only allow interrupts when we are really the last one on the*/
102
 
        /* kernel stack, otherwise stack overflow can occur during*/
103
 
        /* heavy interrupt load*/
104
 
        andw    #ALLOWINT,%sr
105
 
 
106
 
        movel   %sp,%d1                 /* get thread_info pointer */
107
 
        andl    #-THREAD_SIZE,%d1
108
 
        movel   %d1,%a2
109
 
1:
110
 
        move    %a2@(TI_FLAGS),%d1      /* thread_info->flags */
111
 
        jne     Lwork_to_do
112
 
        RESTORE_ALL
113
 
 
114
 
Lwork_to_do:
115
 
        movel   %a2@(TI_FLAGS),%d1      /* thread_info->flags */
116
 
        btst    #TIF_NEED_RESCHED,%d1
117
 
        jne     reschedule
118
 
 
119
 
Lsignal_return:
120
 
        subql   #4,%sp                  /* dummy return address*/
121
 
        SAVE_SWITCH_STACK
122
 
        pea     %sp@(SWITCH_STACK_SIZE)
123
 
        bsrw    do_signal
124
 
        addql   #4,%sp
125
 
        RESTORE_SWITCH_STACK
126
 
        addql   #4,%sp
127
 
        jra     1b
128
 
 
129
 
/*
130
 
 * This is the main interrupt handler, responsible for calling process_int()
131
 
 */
132
 
inthandler1:
133
 
        SAVE_ALL
134
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
135
 
        and     #0x3ff, %d0
136
 
 
137
 
        movel   %sp,%sp@-
138
 
        movel   #65,%sp@-               /*  put vector # on stack*/
139
 
        jbsr    process_int             /*  process the IRQ*/
140
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
141
 
        bra     ret_from_interrupt
142
 
 
143
 
inthandler2:
144
 
        SAVE_ALL
145
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
146
 
        and     #0x3ff, %d0
147
 
 
148
 
        movel   %sp,%sp@-
149
 
        movel   #66,%sp@-               /*  put vector # on stack*/
150
 
        jbsr    process_int             /*  process the IRQ*/
151
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
152
 
        bra     ret_from_interrupt
153
 
 
154
 
inthandler3:
155
 
        SAVE_ALL
156
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
157
 
        and     #0x3ff, %d0
158
 
 
159
 
        movel   %sp,%sp@-
160
 
        movel   #67,%sp@-               /*  put vector # on stack*/
161
 
        jbsr    process_int             /*  process the IRQ*/
162
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
163
 
        bra     ret_from_interrupt
164
 
 
165
 
inthandler4:
166
 
        SAVE_ALL
167
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
168
 
        and     #0x3ff, %d0
169
 
 
170
 
        movel   %sp,%sp@-
171
 
        movel   #68,%sp@-               /*  put vector # on stack*/
172
 
        jbsr    process_int             /*  process the IRQ*/
173
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
174
 
        bra     ret_from_interrupt
175
 
 
176
 
inthandler5:
177
 
        SAVE_ALL
178
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
179
 
        and     #0x3ff, %d0
180
 
 
181
 
        movel   %sp,%sp@-
182
 
        movel   #69,%sp@-               /*  put vector # on stack*/
183
 
        jbsr    process_int             /*  process the IRQ*/
184
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
185
 
        bra     ret_from_interrupt
186
 
 
187
 
inthandler6:
188
 
        SAVE_ALL
189
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
190
 
        and     #0x3ff, %d0
191
 
 
192
 
        movel   %sp,%sp@-
193
 
        movel   #70,%sp@-               /*  put vector # on stack*/
194
 
        jbsr    process_int             /*  process the IRQ*/
195
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
196
 
        bra     ret_from_interrupt
197
 
 
198
 
inthandler7:
199
 
        SAVE_ALL
200
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
201
 
        and     #0x3ff, %d0
202
 
 
203
 
        movel   %sp,%sp@-
204
 
        movel   #71,%sp@-               /*  put vector # on stack*/
205
 
        jbsr    process_int             /*  process the IRQ*/
206
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
207
 
        bra     ret_from_interrupt
208
 
 
209
 
inthandler:
210
 
        SAVE_ALL
211
 
        movew   %sp@(PT_OFF_FORMATVEC), %d0
212
 
        and     #0x3ff, %d0
213
 
 
214
 
        movel   %sp,%sp@-
215
 
        movel   %d0,%sp@-               /*  put vector # on stack*/
216
 
        jbsr    process_int             /*  process the IRQ*/
217
 
3:      addql   #8,%sp                  /*  pop parameters off stack*/
218
 
        bra     ret_from_interrupt
219
 
 
220
 
ret_from_interrupt:
221
 
        jeq     1f
222
 
2:
223
 
        RESTORE_ALL
224
 
1:
225
 
        moveb   %sp@(PT_OFF_SR), %d0
226
 
        and     #7, %d0
227
 
        jhi     2b
228
 
 
229
 
        /* check if we need to do software interrupts */
230
 
        jeq     ret_from_exception
231
 
 
232
 
        pea     ret_from_exception
233
 
        jra     do_softirq
234
 
 
235
 
 
236
 
/*
237
 
 * Handler for uninitialized and spurious interrupts.
238
 
 */
239
 
ENTRY(bad_interrupt)
240
 
        addql   #1,num_spurious
241
 
        rte
242
 
 
243
 
/*
244
 
 * Beware - when entering resume, prev (the current task) is
245
 
 * in a0, next (the new task) is in a1,so don't change these
246
 
 * registers until their contents are no longer needed.
247
 
 */
248
 
ENTRY(resume)
249
 
        movel   %a0,%d1                         /* save prev thread in d1 */
250
 
        movew   %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
251
 
        movel   %usp,%a2                        /* save usp */
252
 
        movel   %a2,%a0@(TASK_THREAD+THREAD_USP)
253
 
 
254
 
        SAVE_SWITCH_STACK
255
 
        movel   %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
256
 
        movel   %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
257
 
        RESTORE_SWITCH_STACK
258
 
 
259
 
        movel   %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
260
 
        movel   %a0,%usp
261
 
        movew   %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */
262
 
        rts
263