ptrace.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * linux/arch/cris/kernel/ptrace.c
  3. *
  4. * Parts taken from the m68k port.
  5. *
  6. * Copyright (c) 2000, 2001, 2002 Axis Communications AB
  7. *
  8. * Authors: Bjorn Wesen
  9. *
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/sched.h>
  13. #include <linux/mm.h>
  14. #include <linux/smp.h>
  15. #include <linux/errno.h>
  16. #include <linux/ptrace.h>
  17. #include <linux/user.h>
  18. #include <linux/tracehook.h>
  19. #include <asm/uaccess.h>
  20. #include <asm/page.h>
  21. #include <asm/pgtable.h>
  22. #include <asm/processor.h>
  23. /* notification of userspace execution resumption
  24. * - triggered by current->work.notify_resume
  25. */
  26. extern int do_signal(int canrestart, struct pt_regs *regs);
  27. void do_notify_resume(int canrestart, struct pt_regs *regs,
  28. __u32 thread_info_flags)
  29. {
  30. /* deal with pending signal delivery */
  31. if (thread_info_flags & _TIF_SIGPENDING)
  32. do_signal(canrestart,regs);
  33. if (thread_info_flags & _TIF_NOTIFY_RESUME) {
  34. clear_thread_flag(TIF_NOTIFY_RESUME);
  35. tracehook_notify_resume(regs);
  36. }
  37. }
  38. void do_work_pending(int syscall, struct pt_regs *regs,
  39. unsigned int thread_flags)
  40. {
  41. do {
  42. if (likely(thread_flags & _TIF_NEED_RESCHED)) {
  43. schedule();
  44. } else {
  45. if (unlikely(!user_mode(regs)))
  46. return;
  47. local_irq_enable();
  48. if (thread_flags & _TIF_SIGPENDING) {
  49. do_signal(syscall, regs);
  50. syscall = 0;
  51. } else {
  52. clear_thread_flag(TIF_NOTIFY_RESUME);
  53. tracehook_notify_resume(regs);
  54. }
  55. }
  56. local_irq_disable();
  57. thread_flags = current_thread_info()->flags;
  58. } while (thread_flags & _TIF_WORK_MASK);
  59. }