Skip to content

Commit 92445ea

Browse files
Roman ZippelLinus Torvalds
authored andcommitted
[PATCH] m68k: separate handler for auto and user vector interrupt
Use separate entry points for auto and user vector interrupts and cleanup naming a little. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent f2325ec commit 92445ea

5 files changed

Lines changed: 71 additions & 108 deletions

File tree

‎arch/m68k/atari/ataints.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ __ALIGN_STR "\n\t"
314314
"rte");
315315

316316
/* Defined in entry.S; only increments 'num_spurious' */
317-
asmlinkage void bad_interrupt(void);
317+
asmlinkage void bad_inthandler(void);
318318

319319
extern void atari_microwire_cmd( int cmd );
320320

@@ -337,7 +337,7 @@ void __init atari_init_IRQ(void)
337337

338338
/* initialize the vector table */
339339
for (i = 0; i < NUM_INT_SOURCES; ++i) {
340-
vectors[IRQ_SOURCE_TO_VECTOR(i)] = bad_interrupt;
340+
vectors[IRQ_SOURCE_TO_VECTOR(i)] = bad_inthandler;
341341
}
342342

343343
/* Initialize the MFP(s) */
@@ -461,7 +461,7 @@ int atari_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, stru
461461
return -EINVAL;
462462
}
463463

464-
if (vectors[vector] == bad_interrupt) {
464+
if (vectors[vector] == bad_inthandler) {
465465
/* int has no handler yet */
466466
irq_handler[irq].handler = handler;
467467
irq_handler[irq].dev_id = dev_id;
@@ -528,7 +528,7 @@ void atari_free_irq(unsigned int irq, void *dev_id)
528528
}
529529

530530
vector = IRQ_SOURCE_TO_VECTOR(irq);
531-
if (vectors[vector] == bad_interrupt)
531+
if (vectors[vector] == bad_inthandler)
532532
goto not_found;
533533

534534
local_irq_save(flags);
@@ -542,7 +542,7 @@ void atari_free_irq(unsigned int irq, void *dev_id)
542542
irq_handler[irq].handler = NULL;
543543
irq_handler[irq].dev_id = NULL;
544544
irq_param[irq].devname = NULL;
545-
vectors[vector] = bad_interrupt;
545+
vectors[vector] = bad_inthandler;
546546
/* If MFP int, also disable it */
547547
atari_disable_irq(irq);
548548
atari_turnoff_irq(irq);
@@ -617,7 +617,7 @@ int show_atari_interrupts(struct seq_file *p, void *v)
617617
int i;
618618

619619
for (i = 0; i < NUM_INT_SOURCES; ++i) {
620-
if (vectors[IRQ_SOURCE_TO_VECTOR(i)] == bad_interrupt)
620+
if (vectors[IRQ_SOURCE_TO_VECTOR(i)] == bad_inthandler)
621621
continue;
622622
if (i < STMFP_SOURCE_BASE)
623623
seq_printf(p, "auto %2d: %10u ",

‎arch/m68k/kernel/entry.S‎

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include <asm/asm-offsets.h>
4646

4747
.globl system_call, buserr, trap, resume
48-
.globl inthandler, sys_call_table
48+
.globl sys_call_table
4949
.globl sys_fork, sys_clone, sys_vfork
5050
.globl ret_from_interrupt, bad_interrupt
5151

@@ -191,44 +191,15 @@ do_delayed_trace:
191191
jbra resume_userspace
192192

193193

194-
#if 0
195-
#ifdef CONFIG_AMIGA
196-
ami_inthandler:
197-
addql #1,irq_stat+CPUSTAT_LOCAL_IRQ_COUNT
198-
SAVE_ALL_INT
199-
GET_CURRENT(%d0)
200-
201-
bfextu %sp@(PT_VECTOR){#4,#12},%d0
202-
movel %d0,%a0
203-
addql #1,%a0@(kstat+STAT_IRQ-VECOFF(VEC_SPUR))
204-
movel %a0@(autoirq_list-VECOFF(VEC_SPUR)),%a0
205-
206-
| amiga vector int handler get the req mask instead of irq vector
207-
lea CUSTOMBASE,%a1
208-
movew %a1@(C_INTREQR),%d0
209-
andw %a1@(C_INTENAR),%d0
210-
211-
| prepare stack (push frame pointer, dev_id & req mask)
212-
pea %sp@
213-
movel %a0@(IRQ_DEVID),%sp@-
214-
movel %d0,%sp@-
215-
pea %pc@(ret_from_interrupt:w)
216-
jbra @(IRQ_HANDLER,%a0)@(0)
217-
218-
ENTRY(nmi_handler)
219-
rte
220-
#endif
221-
#endif
194+
/* This is the main interrupt handler for autovector interrupts */
222195

223-
/*
224-
** This is the main interrupt handler, responsible for calling process_int()
225-
*/
226-
inthandler:
196+
ENTRY(auto_inthandler)
227197
SAVE_ALL_INT
228198
GET_CURRENT(%d0)
229199
addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
230200
| put exception # in d0
231-
bfextu %sp@(PT_VECTOR){#4,#10},%d0
201+
bfextu %sp@(PT_VECTOR){#4,#10},%d0
202+
subw #VEC_SPUR,%d0
232203

233204
movel %sp,%sp@-
234205
movel %d0,%sp@- | put vector # on stack
@@ -241,15 +212,16 @@ inthandler:
241212
jbra 3f
242213
1:
243214
#endif
244-
jbsr process_int | process the IRQ
215+
jsr m68k_handle_int | process the IRQ
245216
3: addql #8,%sp | pop parameters off stack
246217

247218
ret_from_interrupt:
248219
subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
249-
jeq 1f
250-
2:
251-
RESTORE_ALL
252-
1:
220+
jeq ret_from_last_interrupt
221+
2: RESTORE_ALL
222+
223+
ALIGN
224+
ret_from_last_interrupt:
253225
moveq #(~ALLOWINT>>8)&0xff,%d0
254226
andb %sp@(PT_SR),%d0
255227
jne 2b
@@ -260,12 +232,40 @@ ret_from_interrupt:
260232
pea ret_from_exception
261233
jra do_softirq
262234

235+
/* Handler for user defined interrupt vectors */
236+
237+
ENTRY(mach_inthandler)
238+
SAVE_ALL_INT
239+
GET_CURRENT(%d0)
240+
addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
241+
| put exception # in d0
242+
bfextu %sp@(PT_VECTOR){#4,#10},%d0
243+
244+
movel %sp,%sp@-
245+
movel %d0,%sp@- | put vector # on stack
246+
movel mach_process_int,%a0
247+
jsr %a0@ | process the IRQ
248+
addql #8,%sp | pop parameters off stack
249+
250+
subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
251+
jeq ret_from_last_interrupt
252+
RESTORE_ALL
263253

264254
/* Handler for uninitialized and spurious interrupts */
265255

266-
bad_interrupt:
267-
addql #1,num_spurious
268-
rte
256+
ENTRY(bad_inthandler)
257+
SAVE_ALL_INT
258+
GET_CURRENT(%d0)
259+
addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
260+
261+
movel %sp,%sp@-
262+
jsr handle_badint
263+
addql #4,%sp
264+
265+
subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
266+
jeq ret_from_last_interrupt
267+
RESTORE_ALL
268+
269269

270270
ENTRY(sys_fork)
271271
SAVE_SWITCH_STACK

‎arch/m68k/kernel/ints.c‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,19 +248,16 @@ static void dummy_free_irq(unsigned int irq, void *dev_id)
248248
printk("calling uninitialized disable_irq()\n");
249249
}
250250

251-
asmlinkage void process_int(unsigned long vec, struct pt_regs *fp)
251+
asmlinkage void m68k_handle_int(unsigned int irq, struct pt_regs *regs)
252252
{
253-
if (vec >= VEC_INT1 && vec <= VEC_INT7 && !MACH_IS_BVME6000) {
254-
vec -= VEC_SPUR;
255-
kstat_cpu(0).irqs[vec]++;
256-
irq_list[vec].handler(vec, irq_list[vec].dev_id, fp);
257-
} else {
258-
if (mach_process_int)
259-
mach_process_int(vec, fp);
260-
else
261-
panic("Can't process interrupt vector %ld\n", vec);
262-
return;
263-
}
253+
kstat_cpu(0).irqs[irq]++;
254+
irq_list[irq].handler(irq, irq_list[irq].dev_id, regs);
255+
}
256+
257+
asmlinkage void handle_badint(struct pt_regs *regs)
258+
{
259+
kstat_cpu(0).irqs[0]++;
260+
printk("unexpected interrupt from %u\n", regs->vector);
264261
}
265262

266263
int show_interrupts(struct seq_file *p, void *v)

‎arch/m68k/kernel/traps.c‎

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,59 +45,14 @@
4545
asmlinkage void system_call(void);
4646
asmlinkage void buserr(void);
4747
asmlinkage void trap(void);
48-
asmlinkage void inthandler(void);
4948
asmlinkage void nmihandler(void);
5049
#ifdef CONFIG_M68KFPU_EMU
5150
asmlinkage void fpu_emu(void);
5251
#endif
5352

5453
e_vector vectors[256] = {
5554
[VEC_BUSERR] = buserr,
56-
[VEC_ADDRERR] = trap,
57-
[VEC_ILLEGAL] = trap,
58-
[VEC_ZERODIV] = trap,
59-
[VEC_CHK] = trap,
60-
[VEC_TRAP] = trap,
61-
[VEC_PRIV] = trap,
62-
[VEC_TRACE] = trap,
63-
[VEC_LINE10] = trap,
64-
[VEC_LINE11] = trap,
65-
[VEC_RESV12] = trap,
66-
[VEC_COPROC] = trap,
67-
[VEC_FORMAT] = trap,
68-
[VEC_UNINT] = trap,
69-
[VEC_RESV16] = trap,
70-
[VEC_RESV17] = trap,
71-
[VEC_RESV18] = trap,
72-
[VEC_RESV19] = trap,
73-
[VEC_RESV20] = trap,
74-
[VEC_RESV21] = trap,
75-
[VEC_RESV22] = trap,
76-
[VEC_RESV23] = trap,
77-
[VEC_SPUR] = inthandler,
78-
[VEC_INT1] = inthandler,
79-
[VEC_INT2] = inthandler,
80-
[VEC_INT3] = inthandler,
81-
[VEC_INT4] = inthandler,
82-
[VEC_INT5] = inthandler,
83-
[VEC_INT6] = inthandler,
84-
[VEC_INT7] = inthandler,
8555
[VEC_SYS] = system_call,
86-
[VEC_TRAP1] = trap,
87-
[VEC_TRAP2] = trap,
88-
[VEC_TRAP3] = trap,
89-
[VEC_TRAP4] = trap,
90-
[VEC_TRAP5] = trap,
91-
[VEC_TRAP6] = trap,
92-
[VEC_TRAP7] = trap,
93-
[VEC_TRAP8] = trap,
94-
[VEC_TRAP9] = trap,
95-
[VEC_TRAP10] = trap,
96-
[VEC_TRAP11] = trap,
97-
[VEC_TRAP12] = trap,
98-
[VEC_TRAP13] = trap,
99-
[VEC_TRAP14] = trap,
100-
[VEC_TRAP15] = trap,
10156
};
10257

10358
/* nmi handler for the Amiga */
@@ -132,12 +87,16 @@ void __init trap_init (void)
13287
{
13388
int i;
13489

135-
for (i = 48; i < 64; i++)
90+
vectors[VEC_SPUR] = bad_inthandler;
91+
for (i = VEC_INT1; i <= VEC_INT7; i++)
92+
vectors[i] = auto_inthandler;
93+
94+
for (i = 0; i < VEC_USER; i++)
13695
if (!vectors[i])
13796
vectors[i] = trap;
13897

139-
for (i = 64; i < 256; i++)
140-
vectors[i] = inthandler;
98+
for (i = VEC_USER; i < 256; i++)
99+
vectors[i] = mach_inthandler;
141100

142101
#ifdef CONFIG_M68KFPU_EMU
143102
if (FPU_IS_EMU)

‎include/asm-m68k/traps.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@
1313

1414
#ifndef __ASSEMBLY__
1515

16+
#include <linux/linkage.h>
17+
#include <asm/ptrace.h>
18+
1619
typedef void (*e_vector)(void);
1720

21+
asmlinkage void auto_inthandler(void);
22+
asmlinkage void mach_inthandler(void);
23+
asmlinkage void bad_inthandler(void);
24+
1825
extern e_vector vectors[];
1926

2027
#endif

0 commit comments

Comments
 (0)