Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / cris / kernel / ptrace.c
blobaf42789a15448248345c7acb9f10cf85a8858fe5
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/arch/cris/kernel/ptrace.c
5 * Parts taken from the m68k port.
7 * Copyright (c) 2000, 2001, 2002 Axis Communications AB
9 * Authors: Bjorn Wesen
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/mm.h>
16 #include <linux/smp.h>
17 #include <linux/errno.h>
18 #include <linux/ptrace.h>
19 #include <linux/user.h>
20 #include <linux/tracehook.h>
22 #include <linux/uaccess.h>
23 #include <asm/page.h>
24 #include <asm/pgtable.h>
25 #include <asm/processor.h>
28 /* notification of userspace execution resumption
29 * - triggered by current->work.notify_resume
31 extern int do_signal(int canrestart, struct pt_regs *regs);
34 void do_notify_resume(int canrestart, struct pt_regs *regs,
35 __u32 thread_info_flags)
37 /* deal with pending signal delivery */
38 if (thread_info_flags & _TIF_SIGPENDING)
39 do_signal(canrestart,regs);
41 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
42 clear_thread_flag(TIF_NOTIFY_RESUME);
43 tracehook_notify_resume(regs);
47 void do_work_pending(int syscall, struct pt_regs *regs,
48 unsigned int thread_flags)
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);
65 local_irq_disable();
66 thread_flags = current_thread_info()->flags;
67 } while (thread_flags & _TIF_WORK_MASK);