~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/m32r/kernel/ptrace.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
580
580
        }
581
581
}
582
582
 
 
583
void user_enable_single_step(struct task_struct *child)
 
584
{
 
585
        unsigned long next_pc;
 
586
        unsigned long pc, insn;
 
587
 
 
588
        clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 
589
 
 
590
        /* Compute next pc.  */
 
591
        pc = get_stack_long(child, PT_BPC);
 
592
 
 
593
        if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0)
 
594
            != sizeof(insn))
 
595
                return -EIO;
 
596
 
 
597
        compute_next_pc(insn, pc, &next_pc, child);
 
598
        if (next_pc & 0x80000000)
 
599
                return -EIO;
 
600
 
 
601
        if (embed_debug_trap(child, next_pc))
 
602
                return -EIO;
 
603
 
 
604
        invalidate_cache();
 
605
        return 0;
 
606
}
 
607
 
 
608
void user_disable_single_step(struct task_struct *child)
 
609
{
 
610
        unregister_all_debug_traps(child);
 
611
        invalidate_cache();
 
612
}
583
613
 
584
614
/*
585
615
 * Called by kernel/ptrace.c when detaching..
592
622
}
593
623
 
594
624
long
595
 
arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
625
arch_ptrace(struct task_struct *child, long request,
 
626
            unsigned long addr, unsigned long data)
596
627
{
597
628
        int ret;
 
629
        unsigned long __user *datap = (unsigned long __user *) data;
598
630
 
599
631
        switch (request) {
600
632
        /*
609
641
         * read the word at location addr in the USER area.
610
642
         */
611
643
        case PTRACE_PEEKUSR:
612
 
                ret = ptrace_read_user(child, addr,
613
 
                                       (unsigned long __user *)data);
 
644
                ret = ptrace_read_user(child, addr, datap);
614
645
                break;
615
646
 
616
647
        /*
630
661
                ret = ptrace_write_user(child, addr, data);
631
662
                break;
632
663
 
633
 
        /*
634
 
         * continue/restart and stop at next (return from) syscall
635
 
         */
636
 
        case PTRACE_SYSCALL:
637
 
        case PTRACE_CONT:
638
 
                ret = -EIO;
639
 
                if (!valid_signal(data))
640
 
                        break;
641
 
                if (request == PTRACE_SYSCALL)
642
 
                        set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
643
 
                else
644
 
                        clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
645
 
                child->exit_code = data;
646
 
                wake_up_process(child);
647
 
                ret = 0;
648
 
                break;
649
 
 
650
 
        /*
651
 
         * make the child exit.  Best I can do is send it a sigkill.
652
 
         * perhaps it should be put in the status that it wants to
653
 
         * exit.
654
 
         */
655
 
        case PTRACE_KILL: {
656
 
                ret = 0;
657
 
                unregister_all_debug_traps(child);
658
 
                invalidate_cache();
659
 
                if (child->exit_state == EXIT_ZOMBIE)   /* already dead */
660
 
                        break;
661
 
                child->exit_code = SIGKILL;
662
 
                wake_up_process(child);
663
 
                break;
664
 
        }
665
 
 
666
 
        /*
667
 
         * execute single instruction.
668
 
         */
669
 
        case PTRACE_SINGLESTEP: {
670
 
                unsigned long next_pc;
671
 
                unsigned long pc, insn;
672
 
 
673
 
                ret = -EIO;
674
 
                if (!valid_signal(data))
675
 
                        break;
676
 
                clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
677
 
 
678
 
                /* Compute next pc.  */
679
 
                pc = get_stack_long(child, PT_BPC);
680
 
 
681
 
                if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0)
682
 
                    != sizeof(insn))
683
 
                        break;
684
 
 
685
 
                compute_next_pc(insn, pc, &next_pc, child);
686
 
                if (next_pc & 0x80000000)
687
 
                        break;
688
 
 
689
 
                if (embed_debug_trap(child, next_pc))
690
 
                        break;
691
 
 
692
 
                invalidate_cache();
693
 
                child->exit_code = data;
694
 
 
695
 
                /* give it a chance to run. */
696
 
                wake_up_process(child);
697
 
                ret = 0;
698
 
                break;
699
 
        }
700
 
 
701
664
        case PTRACE_GETREGS:
702
 
                ret = ptrace_getregs(child, (void __user *)data);
 
665
                ret = ptrace_getregs(child, datap);
703
666
                break;
704
667
 
705
668
        case PTRACE_SETREGS:
706
 
                ret = ptrace_setregs(child, (void __user *)data);
 
669
                ret = ptrace_setregs(child, datap);
707
670
                break;
708
671
 
709
672
        default: