traps.c (3eb0f5193b497083391aa05d35210d5645211eef) | traps.c (75bfb9a1c89ae1f28cd09f7ae0d236ebde9b97ec) |
---|---|
1/* 2 * OpenRISC traps.c 3 * 4 * Linux architectural port borrowing liberally from similar works of 5 * others. All original copyrights apply as per the original source 6 * declaration. 7 * 8 * Modifications for the OpenRISC architecture: --- 236 unchanged lines hidden (view full) --- 245 246void __init trap_init(void) 247{ 248 /* Nothing needs to be done */ 249} 250 251asmlinkage void do_trap(struct pt_regs *regs, unsigned long address) 252{ | 1/* 2 * OpenRISC traps.c 3 * 4 * Linux architectural port borrowing liberally from similar works of 5 * others. All original copyrights apply as per the original source 6 * declaration. 7 * 8 * Modifications for the OpenRISC architecture: --- 236 unchanged lines hidden (view full) --- 245 246void __init trap_init(void) 247{ 248 /* Nothing needs to be done */ 249} 250 251asmlinkage void do_trap(struct pt_regs *regs, unsigned long address) 252{ |
253 siginfo_t info; 254 clear_siginfo(&info); 255 info.si_signo = SIGTRAP; 256 info.si_code = TRAP_TRACE; 257 info.si_addr = (void *)address; 258 force_sig_info(SIGTRAP, &info, current); | 253 force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current); |
259 260 regs->pc += 4; 261} 262 263asmlinkage void do_unaligned_access(struct pt_regs *regs, unsigned long address) 264{ | 254 255 regs->pc += 4; 256} 257 258asmlinkage void do_unaligned_access(struct pt_regs *regs, unsigned long address) 259{ |
265 siginfo_t info; 266 | |
267 if (user_mode(regs)) { 268 /* Send a SIGBUS */ | 260 if (user_mode(regs)) { 261 /* Send a SIGBUS */ |
269 clear_siginfo(&info); 270 info.si_signo = SIGBUS; 271 info.si_errno = 0; 272 info.si_code = BUS_ADRALN; 273 info.si_addr = (void __user *)address; 274 force_sig_info(SIGBUS, &info, current); | 262 force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)address, current); |
275 } else { 276 printk("KERNEL: Unaligned Access 0x%.8lx\n", address); 277 show_registers(regs); 278 die("Die:", regs, address); 279 } 280 281} 282 283asmlinkage void do_bus_fault(struct pt_regs *regs, unsigned long address) 284{ | 263 } else { 264 printk("KERNEL: Unaligned Access 0x%.8lx\n", address); 265 show_registers(regs); 266 die("Die:", regs, address); 267 } 268 269} 270 271asmlinkage void do_bus_fault(struct pt_regs *regs, unsigned long address) 272{ |
285 siginfo_t info; 286 | |
287 if (user_mode(regs)) { 288 /* Send a SIGBUS */ | 273 if (user_mode(regs)) { 274 /* Send a SIGBUS */ |
289 clear_siginfo(&info); 290 info.si_signo = SIGBUS; 291 info.si_errno = 0; 292 info.si_code = BUS_ADRERR; 293 info.si_addr = (void *)address; 294 force_sig_info(SIGBUS, &info, current); | 275 force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); |
295 } else { /* Kernel mode */ 296 printk("KERNEL: Bus error (SIGBUS) 0x%.8lx\n", address); 297 show_registers(regs); 298 die("Die:", regs, address); 299 } 300} 301 302static inline int in_delay_slot(struct pt_regs *regs) --- 158 unchanged lines hidden (view full) --- 461} 462 463#define INSN_LWA 0x1b 464#define INSN_SWA 0x33 465 466asmlinkage void do_illegal_instruction(struct pt_regs *regs, 467 unsigned long address) 468{ | 276 } else { /* Kernel mode */ 277 printk("KERNEL: Bus error (SIGBUS) 0x%.8lx\n", address); 278 show_registers(regs); 279 die("Die:", regs, address); 280 } 281} 282 283static inline int in_delay_slot(struct pt_regs *regs) --- 158 unchanged lines hidden (view full) --- 442} 443 444#define INSN_LWA 0x1b 445#define INSN_SWA 0x33 446 447asmlinkage void do_illegal_instruction(struct pt_regs *regs, 448 unsigned long address) 449{ |
469 siginfo_t info; | |
470 unsigned int op; 471 unsigned int insn = *((unsigned int *)address); 472 473 op = insn >> 26; 474 475 switch (op) { 476 case INSN_LWA: 477 simulate_lwa(regs, address, insn); --- 4 unchanged lines hidden (view full) --- 482 return; 483 484 default: 485 break; 486 } 487 488 if (user_mode(regs)) { 489 /* Send a SIGILL */ | 450 unsigned int op; 451 unsigned int insn = *((unsigned int *)address); 452 453 op = insn >> 26; 454 455 switch (op) { 456 case INSN_LWA: 457 simulate_lwa(regs, address, insn); --- 4 unchanged lines hidden (view full) --- 462 return; 463 464 default: 465 break; 466 } 467 468 if (user_mode(regs)) { 469 /* Send a SIGILL */ |
490 clear_siginfo(&info); 491 info.si_signo = SIGILL; 492 info.si_errno = 0; 493 info.si_code = ILL_ILLOPC; 494 info.si_addr = (void *)address; 495 force_sig_info(SIGBUS, &info, current); | 470 force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)address, current); |
496 } else { /* Kernel mode */ 497 printk("KERNEL: Illegal instruction (SIGILL) 0x%.8lx\n", 498 address); 499 show_registers(regs); 500 die("Die:", regs, address); 501 } 502} | 471 } else { /* Kernel mode */ 472 printk("KERNEL: Illegal instruction (SIGILL) 0x%.8lx\n", 473 address); 474 show_registers(regs); 475 die("Die:", regs, address); 476 } 477} |