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