Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Roman Zippel and committed by
Linus Torvalds
92445eaa f2325ece

+71 -108
+6 -6
arch/m68k/atari/ataints.c
··· 314 314 "rte"); 315 315 316 316 /* Defined in entry.S; only increments 'num_spurious' */ 317 - asmlinkage void bad_interrupt(void); 317 + asmlinkage void bad_inthandler(void); 318 318 319 319 extern void atari_microwire_cmd( int cmd ); 320 320 ··· 337 337 338 338 /* initialize the vector table */ 339 339 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; 341 341 } 342 342 343 343 /* Initialize the MFP(s) */ ··· 461 461 return -EINVAL; 462 462 } 463 463 464 - if (vectors[vector] == bad_interrupt) { 464 + if (vectors[vector] == bad_inthandler) { 465 465 /* int has no handler yet */ 466 466 irq_handler[irq].handler = handler; 467 467 irq_handler[irq].dev_id = dev_id; ··· 528 528 } 529 529 530 530 vector = IRQ_SOURCE_TO_VECTOR(irq); 531 - if (vectors[vector] == bad_interrupt) 531 + if (vectors[vector] == bad_inthandler) 532 532 goto not_found; 533 533 534 534 local_irq_save(flags); ··· 542 542 irq_handler[irq].handler = NULL; 543 543 irq_handler[irq].dev_id = NULL; 544 544 irq_param[irq].devname = NULL; 545 - vectors[vector] = bad_interrupt; 545 + vectors[vector] = bad_inthandler; 546 546 /* If MFP int, also disable it */ 547 547 atari_disable_irq(irq); 548 548 atari_turnoff_irq(irq); ··· 617 617 int i; 618 618 619 619 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) 621 621 continue; 622 622 if (i < STMFP_SOURCE_BASE) 623 623 seq_printf(p, "auto %2d: %10u ",
+42 -42
arch/m68k/kernel/entry.S
··· 45 45 #include <asm/asm-offsets.h> 46 46 47 47 .globl system_call, buserr, trap, resume 48 - .globl inthandler, sys_call_table 48 + .globl sys_call_table 49 49 .globl sys_fork, sys_clone, sys_vfork 50 50 .globl ret_from_interrupt, bad_interrupt 51 51 ··· 191 191 jbra resume_userspace 192 192 193 193 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) 194 + /* This is the main interrupt handler for autovector interrupts */ 200 195 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 222 - 223 - /* 224 - ** This is the main interrupt handler, responsible for calling process_int() 225 - */ 226 - inthandler: 196 + ENTRY(auto_inthandler) 227 197 SAVE_ALL_INT 228 198 GET_CURRENT(%d0) 229 199 addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 230 200 | 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 232 203 233 204 movel %sp,%sp@- 234 205 movel %d0,%sp@- | put vector # on stack ··· 212 241 jbra 3f 213 242 1: 214 243 #endif 215 - jbsr process_int | process the IRQ 244 + jsr m68k_handle_int | process the IRQ 216 245 3: addql #8,%sp | pop parameters off stack 217 246 218 247 ret_from_interrupt: 219 248 subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 220 - jeq 1f 221 - 2: 222 - RESTORE_ALL 223 - 1: 249 + jeq ret_from_last_interrupt 250 + 2: RESTORE_ALL 251 + 252 + ALIGN 253 + ret_from_last_interrupt: 224 254 moveq #(~ALLOWINT>>8)&0xff,%d0 225 255 andb %sp@(PT_SR),%d0 226 256 jne 2b ··· 232 260 pea ret_from_exception 233 261 jra do_softirq 234 262 263 + /* Handler for user defined interrupt vectors */ 264 + 265 + ENTRY(mach_inthandler) 266 + SAVE_ALL_INT 267 + GET_CURRENT(%d0) 268 + addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 269 + | put exception # in d0 270 + bfextu %sp@(PT_VECTOR){#4,#10},%d0 271 + 272 + movel %sp,%sp@- 273 + movel %d0,%sp@- | put vector # on stack 274 + movel mach_process_int,%a0 275 + jsr %a0@ | process the IRQ 276 + addql #8,%sp | pop parameters off stack 277 + 278 + subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 279 + jeq ret_from_last_interrupt 280 + RESTORE_ALL 235 281 236 282 /* Handler for uninitialized and spurious interrupts */ 237 283 238 - bad_interrupt: 239 - addql #1,num_spurious 240 - rte 284 + ENTRY(bad_inthandler) 285 + SAVE_ALL_INT 286 + GET_CURRENT(%d0) 287 + addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 288 + 289 + movel %sp,%sp@- 290 + jsr handle_badint 291 + addql #4,%sp 292 + 293 + subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 294 + jeq ret_from_last_interrupt 295 + RESTORE_ALL 296 + 241 297 242 298 ENTRY(sys_fork) 243 299 SAVE_SWITCH_STACK
+9 -12
arch/m68k/kernel/ints.c
··· 248 248 printk("calling uninitialized disable_irq()\n"); 249 249 } 250 250 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) 252 252 { 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); 264 261 } 265 262 266 263 int show_interrupts(struct seq_file *p, void *v)
+7 -48
arch/m68k/kernel/traps.c
··· 45 45 asmlinkage void system_call(void); 46 46 asmlinkage void buserr(void); 47 47 asmlinkage void trap(void); 48 - asmlinkage void inthandler(void); 49 48 asmlinkage void nmihandler(void); 50 49 #ifdef CONFIG_M68KFPU_EMU 51 50 asmlinkage void fpu_emu(void); ··· 52 53 53 54 e_vector vectors[256] = { 54 55 [VEC_BUSERR] = buserr, 55 - [VEC_ADDRERR] = trap, 56 - [VEC_ILLEGAL] = trap, 57 - [VEC_ZERODIV] = trap, 58 - [VEC_CHK] = trap, 59 - [VEC_TRAP] = trap, 60 - [VEC_PRIV] = trap, 61 - [VEC_TRACE] = trap, 62 - [VEC_LINE10] = trap, 63 - [VEC_LINE11] = trap, 64 - [VEC_RESV12] = trap, 65 - [VEC_COPROC] = trap, 66 - [VEC_FORMAT] = trap, 67 - [VEC_UNINT] = trap, 68 - [VEC_RESV16] = trap, 69 - [VEC_RESV17] = trap, 70 - [VEC_RESV18] = trap, 71 - [VEC_RESV19] = trap, 72 - [VEC_RESV20] = trap, 73 - [VEC_RESV21] = trap, 74 - [VEC_RESV22] = trap, 75 - [VEC_RESV23] = trap, 76 - [VEC_SPUR] = inthandler, 77 - [VEC_INT1] = inthandler, 78 - [VEC_INT2] = inthandler, 79 - [VEC_INT3] = inthandler, 80 - [VEC_INT4] = inthandler, 81 - [VEC_INT5] = inthandler, 82 - [VEC_INT6] = inthandler, 83 - [VEC_INT7] = inthandler, 84 56 [VEC_SYS] = system_call, 85 - [VEC_TRAP1] = trap, 86 - [VEC_TRAP2] = trap, 87 - [VEC_TRAP3] = trap, 88 - [VEC_TRAP4] = trap, 89 - [VEC_TRAP5] = trap, 90 - [VEC_TRAP6] = trap, 91 - [VEC_TRAP7] = trap, 92 - [VEC_TRAP8] = trap, 93 - [VEC_TRAP9] = trap, 94 - [VEC_TRAP10] = trap, 95 - [VEC_TRAP11] = trap, 96 - [VEC_TRAP12] = trap, 97 - [VEC_TRAP13] = trap, 98 - [VEC_TRAP14] = trap, 99 - [VEC_TRAP15] = trap, 100 57 }; 101 58 102 59 /* nmi handler for the Amiga */ ··· 87 132 { 88 133 int i; 89 134 90 - for (i = 48; i < 64; i++) 135 + vectors[VEC_SPUR] = bad_inthandler; 136 + for (i = VEC_INT1; i <= VEC_INT7; i++) 137 + vectors[i] = auto_inthandler; 138 + 139 + for (i = 0; i < VEC_USER; i++) 91 140 if (!vectors[i]) 92 141 vectors[i] = trap; 93 142 94 - for (i = 64; i < 256; i++) 95 - vectors[i] = inthandler; 143 + for (i = VEC_USER; i < 256; i++) 144 + vectors[i] = mach_inthandler; 96 145 97 146 #ifdef CONFIG_M68KFPU_EMU 98 147 if (FPU_IS_EMU)
+7
include/asm-m68k/traps.h
··· 13 13 14 14 #ifndef __ASSEMBLY__ 15 15 16 + #include <linux/linkage.h> 17 + #include <asm/ptrace.h> 18 + 16 19 typedef void (*e_vector)(void); 20 + 21 + asmlinkage void auto_inthandler(void); 22 + asmlinkage void mach_inthandler(void); 23 + asmlinkage void bad_inthandler(void); 17 24 18 25 extern e_vector vectors[]; 19 26