xref: /linux/arch/um/include/asm/ptrace-generic.h (revision 20bed0d6ff62d985fe8222958825504b8aad4e88)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4  */
5 
6 #ifndef __UM_PTRACE_GENERIC_H
7 #define __UM_PTRACE_GENERIC_H
8 
9 #ifndef __ASSEMBLER__
10 
11 #include <sysdep/ptrace.h>
12 
13 struct pt_regs {
14 	struct uml_pt_regs regs;
15 };
16 
17 #define arch_has_single_step()	(1)
18 
19 #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }
20 
21 #define PT_REGS_IP(r) UPT_IP(&(r)->regs)
22 #define PT_REGS_SP(r) UPT_SP(&(r)->regs)
23 
24 #define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs)
25 
26 #define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs)
27 
28 #define instruction_pointer(regs) PT_REGS_IP(regs)
29 
30 #define PTRACE_OLDSETOPTIONS 21
31 
32 #ifdef CONFIG_BINFMT_ELF_FDPIC
33 #define PTRACE_GETFDPIC		31
34 #define PTRACE_GETFDPIC_EXEC	0
35 #define PTRACE_GETFDPIC_INTERP	1
36 #endif
37 
38 struct task_struct;
39 
40 extern long subarch_ptrace(struct task_struct *child, long request,
41 	unsigned long addr, unsigned long data);
42 extern unsigned long getreg(struct task_struct *child, int regno);
43 extern int putreg(struct task_struct *child, int regno, unsigned long value);
44 
45 extern int poke_user(struct task_struct *child, long addr, long data);
46 extern int peek_user(struct task_struct *child, long addr, long data);
47 
48 extern int arch_set_tls(struct task_struct *new, unsigned long tls);
49 extern void clear_flushed_tls(struct task_struct *task);
50 extern int syscall_trace_enter(struct pt_regs *regs);
51 extern void syscall_trace_leave(struct pt_regs *regs);
52 
53 #endif
54 
55 #endif
56