18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _ARC_KPROBES_H
78c2ecf20Sopenharmony_ci#define _ARC_KPROBES_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <asm-generic/kprobes.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_KPROBES
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_citypedef u16 kprobe_opcode_t;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define UNIMP_S_INSTRUCTION 0x79e0
168c2ecf20Sopenharmony_ci#define TRAP_S_2_INSTRUCTION 0x785e
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define MAX_INSN_SIZE   8
198c2ecf20Sopenharmony_ci#define MAX_STACK_SIZE  64
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct arch_specific_insn {
228c2ecf20Sopenharmony_ci	int is_short;
238c2ecf20Sopenharmony_ci	kprobe_opcode_t *t1_addr, *t2_addr;
248c2ecf20Sopenharmony_ci	kprobe_opcode_t t1_opcode, t2_opcode;
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define flush_insn_slot(p)  do {  } while (0)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define kretprobe_blacklist_size    0
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistruct kprobe;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_civoid arch_remove_kprobe(struct kprobe *p);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciint kprobe_exceptions_notify(struct notifier_block *self,
368c2ecf20Sopenharmony_ci			     unsigned long val, void *data);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct prev_kprobe {
398c2ecf20Sopenharmony_ci	struct kprobe *kp;
408c2ecf20Sopenharmony_ci	unsigned long status;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct kprobe_ctlblk {
448c2ecf20Sopenharmony_ci	unsigned int kprobe_status;
458c2ecf20Sopenharmony_ci	struct prev_kprobe prev_kprobe;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciint kprobe_fault_handler(struct pt_regs *regs, unsigned long cause);
498c2ecf20Sopenharmony_civoid kretprobe_trampoline(void);
508c2ecf20Sopenharmony_civoid trap_is_kprobe(unsigned long address, struct pt_regs *regs);
518c2ecf20Sopenharmony_ci#else
528c2ecf20Sopenharmony_ci#define trap_is_kprobe(address, regs)
538c2ecf20Sopenharmony_ci#endif /* CONFIG_KPROBES */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif /* _ARC_KPROBES_H */
56