1// SPDX-License-Identifier: GPL-2.0 2/* 3 * linux/arch/cris/kernel/ptrace.c 4 * 5 * Parts taken from the m68k port. 6 * 7 * Copyright (c) 2000, 2001, 2002 Axis Communications AB 8 * 9 * Authors: Bjorn Wesen 10 * 11 */ 12 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> 21 22#include <linux/uaccess.h> 23#include <asm/page.h> 24#include <asm/pgtable.h> 25#include <asm/processor.h> 26 27 28/* notification of userspace execution resumption 29 * - triggered by current->work.notify_resume 30 */ 31extern int do_signal(int canrestart, struct pt_regs *regs); 32 33 34void do_notify_resume(int canrestart, struct pt_regs *regs, 35 __u32 thread_info_flags) 36{ 37 /* deal with pending signal delivery */ 38 if (thread_info_flags & _TIF_SIGPENDING) 39 do_signal(canrestart,regs); 40 41 if (thread_info_flags & _TIF_NOTIFY_RESUME) { 42 clear_thread_flag(TIF_NOTIFY_RESUME); 43 tracehook_notify_resume(regs); 44 } 45} 46 47void 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} 69