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