xref: /linux/arch/sparc/include/asm/uprobes.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*1ccea77eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2e8f4aa60SAllen Pais #ifndef _ASM_UPROBES_H
3e8f4aa60SAllen Pais #define _ASM_UPROBES_H
4e8f4aa60SAllen Pais /*
5e8f4aa60SAllen Pais  * User-space Probes (UProbes) for sparc
6e8f4aa60SAllen Pais  *
7e8f4aa60SAllen Pais  * Copyright (C) 2013 Oracle, Inc.
8e8f4aa60SAllen Pais  *
9e8f4aa60SAllen Pais  * Authors:
10e8f4aa60SAllen Pais  *     Jose E. Marchesi <jose.marchesi@oracle.com>
11e8f4aa60SAllen Pais  *	Eric Saint Etienne <eric.saint.etienne@oracle.com>
12e8f4aa60SAllen Pais  */
13e8f4aa60SAllen Pais 
14e8f4aa60SAllen Pais typedef u32 uprobe_opcode_t;
15e8f4aa60SAllen Pais 
16e8f4aa60SAllen Pais #define MAX_UINSN_BYTES		4
17e8f4aa60SAllen Pais #define UPROBE_XOL_SLOT_BYTES	(MAX_UINSN_BYTES * 2)
18e8f4aa60SAllen Pais 
19e8f4aa60SAllen Pais #define UPROBE_SWBP_INSN_SIZE	4
20e8f4aa60SAllen Pais #define UPROBE_SWBP_INSN	0x91d02073 /* ta 0x73 */
21e8f4aa60SAllen Pais #define UPROBE_STP_INSN		0x91d02074 /* ta 0x74 */
22e8f4aa60SAllen Pais 
23e8f4aa60SAllen Pais #define ANNUL_BIT (1 << 29)
24e8f4aa60SAllen Pais 
25e8f4aa60SAllen Pais struct arch_uprobe {
26e8f4aa60SAllen Pais 	union {
27e8f4aa60SAllen Pais 		u8  insn[MAX_UINSN_BYTES];
28e8f4aa60SAllen Pais 		u32 ixol;
29e8f4aa60SAllen Pais 	};
30e8f4aa60SAllen Pais };
31e8f4aa60SAllen Pais 
32e8f4aa60SAllen Pais struct arch_uprobe_task {
33269d8523SEric Saint Etienne 	u64 saved_tpc;
34269d8523SEric Saint Etienne 	u64 saved_tnpc;
35e8f4aa60SAllen Pais };
36e8f4aa60SAllen Pais 
37e8f4aa60SAllen Pais struct task_struct;
38e8f4aa60SAllen Pais struct notifier_block;
39e8f4aa60SAllen Pais 
40e8f4aa60SAllen Pais extern int  arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
41e8f4aa60SAllen Pais extern int  arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
42e8f4aa60SAllen Pais extern int  arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
43e8f4aa60SAllen Pais extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
44e8f4aa60SAllen Pais extern int  arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
45e8f4aa60SAllen Pais extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
46e8f4aa60SAllen Pais 
47e8f4aa60SAllen Pais #endif	/* _ASM_UPROBES_H */
48