traps.c (b74b953b998bcc2db91b694446f3a2619ec32de6) traps.c (7f788d2d53085815d474559cd51ef1f38b0a9bb8)
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 01, 06 Ralf Baechle
7 * Copyright (C) 1995, 1996 Paul M. Antoine
8 * Copyright (C) 1998 Ulf Carlsson

--- 14 unchanged lines hidden (view full) ---

23#include <linux/bootmem.h>
24#include <linux/interrupt.h>
25#include <linux/ptrace.h>
26#include <linux/kgdb.h>
27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
29#include <linux/notifier.h>
30#include <linux/kdb.h>
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 01, 06 Ralf Baechle
7 * Copyright (C) 1995, 1996 Paul M. Antoine
8 * Copyright (C) 1998 Ulf Carlsson

--- 14 unchanged lines hidden (view full) ---

23#include <linux/bootmem.h>
24#include <linux/interrupt.h>
25#include <linux/ptrace.h>
26#include <linux/kgdb.h>
27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
29#include <linux/notifier.h>
30#include <linux/kdb.h>
31#include <linux/irq.h>
32#include <linux/perf_event.h>
31
32#include <asm/bootinfo.h>
33#include <asm/branch.h>
34#include <asm/break.h>
35#include <asm/cop2.h>
36#include <asm/cpu.h>
37#include <asm/dsp.h>
38#include <asm/fpu.h>

--- 7 unchanged lines hidden (view full) ---

46#include <asm/system.h>
47#include <asm/tlbdebug.h>
48#include <asm/traps.h>
49#include <asm/uaccess.h>
50#include <asm/watch.h>
51#include <asm/mmu_context.h>
52#include <asm/types.h>
53#include <asm/stacktrace.h>
33
34#include <asm/bootinfo.h>
35#include <asm/branch.h>
36#include <asm/break.h>
37#include <asm/cop2.h>
38#include <asm/cpu.h>
39#include <asm/dsp.h>
40#include <asm/fpu.h>

--- 7 unchanged lines hidden (view full) ---

48#include <asm/system.h>
49#include <asm/tlbdebug.h>
50#include <asm/traps.h>
51#include <asm/uaccess.h>
52#include <asm/watch.h>
53#include <asm/mmu_context.h>
54#include <asm/types.h>
55#include <asm/stacktrace.h>
54#include <asm/irq.h>
55#include <asm/uasm.h>
56
57extern void check_wait(void);
58extern asmlinkage void r4k_wait(void);
59extern asmlinkage void rollback_handle_int(void);
60extern asmlinkage void handle_int(void);
61extern asmlinkage void handle_tlbm(void);
62extern asmlinkage void handle_tlbl(void);

--- 508 unchanged lines hidden (view full) ---

571 * ll uses the opcode of lwc0 and sc uses the opcode of swc0. That is both
572 * opcodes are supposed to result in coprocessor unusable exceptions if
573 * executed on ll/sc-less processors. That's the theory. In practice a
574 * few processors such as NEC's VR4100 throw reserved instruction exceptions
575 * instead, so we're doing the emulation thing in both exception handlers.
576 */
577static int simulate_llsc(struct pt_regs *regs, unsigned int opcode)
578{
56#include <asm/uasm.h>
57
58extern void check_wait(void);
59extern asmlinkage void r4k_wait(void);
60extern asmlinkage void rollback_handle_int(void);
61extern asmlinkage void handle_int(void);
62extern asmlinkage void handle_tlbm(void);
63extern asmlinkage void handle_tlbl(void);

--- 508 unchanged lines hidden (view full) ---

572 * ll uses the opcode of lwc0 and sc uses the opcode of swc0. That is both
573 * opcodes are supposed to result in coprocessor unusable exceptions if
574 * executed on ll/sc-less processors. That's the theory. In practice a
575 * few processors such as NEC's VR4100 throw reserved instruction exceptions
576 * instead, so we're doing the emulation thing in both exception handlers.
577 */
578static int simulate_llsc(struct pt_regs *regs, unsigned int opcode)
579{
579 if ((opcode & OPCODE) == LL)
580 if ((opcode & OPCODE) == LL) {
581 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
582 1, 0, regs, 0);
580 return simulate_ll(regs, opcode);
583 return simulate_ll(regs, opcode);
581 if ((opcode & OPCODE) == SC)
584 }
585 if ((opcode & OPCODE) == SC) {
586 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
587 1, 0, regs, 0);
582 return simulate_sc(regs, opcode);
588 return simulate_sc(regs, opcode);
589 }
583
584 return -1; /* Must be something else ... */
585}
586
587/*
588 * Simulate trapping 'rdhwr' instructions to provide user accessible
589 * registers not implemented in hardware.
590 */
591static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode)
592{
593 struct thread_info *ti = task_thread_info(current);
594
595 if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) {
596 int rd = (opcode & RD) >> 11;
597 int rt = (opcode & RT) >> 16;
590
591 return -1; /* Must be something else ... */
592}
593
594/*
595 * Simulate trapping 'rdhwr' instructions to provide user accessible
596 * registers not implemented in hardware.
597 */
598static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode)
599{
600 struct thread_info *ti = task_thread_info(current);
601
602 if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) {
603 int rd = (opcode & RD) >> 11;
604 int rt = (opcode & RT) >> 16;
605 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
606 1, 0, regs, 0);
598 switch (rd) {
599 case 0: /* CPU number */
600 regs->regs[rt] = smp_processor_id();
601 return 0;
602 case 1: /* SYNCI length */
603 regs->regs[rt] = min(current_cpu_data.dcache.linesz,
604 current_cpu_data.icache.linesz);
605 return 0;

--- 19 unchanged lines hidden (view full) ---

625 }
626
627 /* Not ours. */
628 return -1;
629}
630
631static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
632{
607 switch (rd) {
608 case 0: /* CPU number */
609 regs->regs[rt] = smp_processor_id();
610 return 0;
611 case 1: /* SYNCI length */
612 regs->regs[rt] = min(current_cpu_data.dcache.linesz,
613 current_cpu_data.icache.linesz);
614 return 0;

--- 19 unchanged lines hidden (view full) ---

634 }
635
636 /* Not ours. */
637 return -1;
638}
639
640static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
641{
633 if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC)
642 if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) {
643 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
644 1, 0, regs, 0);
634 return 0;
645 return 0;
646 }
635
636 return -1; /* Must be something else ... */
637}
638
639asmlinkage void do_ov(struct pt_regs *regs)
640{
641 siginfo_t info;
642

--- 1116 unchanged lines hidden ---
647
648 return -1; /* Must be something else ... */
649}
650
651asmlinkage void do_ov(struct pt_regs *regs)
652{
653 siginfo_t info;
654

--- 1116 unchanged lines hidden ---