18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __ASM_UPROBES_H
78c2ecf20Sopenharmony_ci#define __ASM_UPROBES_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/notifier.h>
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/break.h>
138c2ecf20Sopenharmony_ci#include <asm/inst.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * We want this to be defined as union mips_instruction but that makes the
178c2ecf20Sopenharmony_ci * generic code blow up.
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_citypedef u32 uprobe_opcode_t;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * Classic MIPS (note this implementation doesn't consider microMIPS yet)
238c2ecf20Sopenharmony_ci * instructions are always 4 bytes but in order to deal with branches and
248c2ecf20Sopenharmony_ci * their delay slots, we treat instructions as having 8 bytes maximum.
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci#define MAX_UINSN_BYTES			8
278c2ecf20Sopenharmony_ci#define UPROBE_XOL_SLOT_BYTES		128	/* Max. cache line size */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define UPROBE_BRK_UPROBE		0x000d000d	/* break 13 */
308c2ecf20Sopenharmony_ci#define UPROBE_BRK_UPROBE_XOL		0x000e000d	/* break 14 */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define UPROBE_SWBP_INSN		UPROBE_BRK_UPROBE
338c2ecf20Sopenharmony_ci#define UPROBE_SWBP_INSN_SIZE		4
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct arch_uprobe {
368c2ecf20Sopenharmony_ci	unsigned long	resume_epc;
378c2ecf20Sopenharmony_ci	u32	insn[2];
388c2ecf20Sopenharmony_ci	u32	ixol[2];
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct arch_uprobe_task {
428c2ecf20Sopenharmony_ci	unsigned long saved_trap_nr;
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* __ASM_UPROBES_H */
46