1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _METAG_PTRACE_H
3 #define _METAG_PTRACE_H
5 #include <linux/compiler.h>
6 #include <uapi/asm/ptrace.h>
11 /* this struct defines the way the registers are stored on the
12 stack during a system call. */
16 TBICTXEXTCB0 extcb0[5];
19 #define user_mode(regs) (((regs)->ctx.SaveMask & TBICTX_PRIV_BIT) > 0)
21 #define instruction_pointer(regs) ((unsigned long)(regs)->ctx.CurrPC)
22 #define profile_pc(regs) instruction_pointer(regs)
24 #define task_pt_regs(task) \
25 ((struct pt_regs *)(task_stack_page(task) + \
26 sizeof(struct thread_info)))
28 #define current_pt_regs() \
29 ((struct pt_regs *)((char *)current_thread_info() + \
30 sizeof(struct thread_info)))
32 int syscall_trace_enter(struct pt_regs *regs);
33 void syscall_trace_leave(struct pt_regs *regs);
35 /* copy a struct user_gp_regs out to user */
36 int metag_gp_regs_copyout(const struct pt_regs *regs,
37 unsigned int pos, unsigned int count,
38 void *kbuf, void __user *ubuf);
39 /* copy a struct user_gp_regs in from user */
40 int metag_gp_regs_copyin(struct pt_regs *regs,
41 unsigned int pos, unsigned int count,
42 const void *kbuf, const void __user *ubuf);
43 /* copy a struct user_cb_regs out to user */
44 int metag_cb_regs_copyout(const struct pt_regs *regs,
45 unsigned int pos, unsigned int count,
46 void *kbuf, void __user *ubuf);
47 /* copy a struct user_cb_regs in from user */
48 int metag_cb_regs_copyin(struct pt_regs *regs,
49 unsigned int pos, unsigned int count,
50 const void *kbuf, const void __user *ubuf);
51 /* copy a struct user_rp_state out to user */
52 int metag_rp_state_copyout(const struct pt_regs *regs,
53 unsigned int pos, unsigned int count,
54 void *kbuf, void __user *ubuf);
55 /* copy a struct user_rp_state in from user */
56 int metag_rp_state_copyin(struct pt_regs *regs,
57 unsigned int pos, unsigned int count,
58 const void *kbuf, const void __user *ubuf);
60 #endif /* __ASSEMBLY__ */
61 #endif /* _METAG_PTRACE_H */