Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 #ifndef _ASM_S390_KPROBES_H
0003 #define _ASM_S390_KPROBES_H
0004 /*
0005  *  Kernel Probes (KProbes)
0006  *
0007  * Copyright IBM Corp. 2002, 2006
0008  *
0009  * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
0010  *      Probes initial implementation ( includes suggestions from
0011  *      Rusty Russell).
0012  * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli
0013  *      <ananth@in.ibm.com>
0014  * 2005-Dec Used as a template for s390 by Mike Grundy
0015  *      <grundym@us.ibm.com>
0016  */
0017 #include <linux/types.h>
0018 #include <asm-generic/kprobes.h>
0019 
0020 #define BREAKPOINT_INSTRUCTION  0x0002
0021 
0022 #define FIXUP_PSW_NORMAL    0x08
0023 #define FIXUP_BRANCH_NOT_TAKEN  0x04
0024 #define FIXUP_RETURN_REGISTER   0x02
0025 #define FIXUP_NOT_REQUIRED  0x01
0026 
0027 int probe_is_prohibited_opcode(u16 *insn);
0028 int probe_get_fixup_type(u16 *insn);
0029 int probe_is_insn_relative_long(u16 *insn);
0030 
0031 #ifdef CONFIG_KPROBES
0032 #include <linux/ptrace.h>
0033 #include <linux/percpu.h>
0034 #include <linux/sched/task_stack.h>
0035 
0036 #define __ARCH_WANT_KPROBES_INSN_SLOT
0037 
0038 struct pt_regs;
0039 struct kprobe;
0040 
0041 typedef u16 kprobe_opcode_t;
0042 
0043 /* Maximum instruction size is 3 (16bit) halfwords: */
0044 #define MAX_INSN_SIZE       0x0003
0045 #define MAX_STACK_SIZE      64
0046 #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
0047     (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR))) \
0048     ? (MAX_STACK_SIZE) \
0049     : (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR)))
0050 
0051 #define kretprobe_blacklist_size 0
0052 
0053 /* Architecture specific copy of original instruction */
0054 struct arch_specific_insn {
0055     /* copy of original instruction */
0056     kprobe_opcode_t *insn;
0057 };
0058 
0059 struct prev_kprobe {
0060     struct kprobe *kp;
0061     unsigned long status;
0062 };
0063 
0064 /* per-cpu kprobe control block */
0065 struct kprobe_ctlblk {
0066     unsigned long kprobe_status;
0067     unsigned long kprobe_saved_imask;
0068     unsigned long kprobe_saved_ctl[3];
0069     struct prev_kprobe prev_kprobe;
0070 };
0071 
0072 void arch_remove_kprobe(struct kprobe *p);
0073 void __kretprobe_trampoline(void);
0074 void trampoline_probe_handler(struct pt_regs *regs);
0075 
0076 int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
0077 int kprobe_exceptions_notify(struct notifier_block *self,
0078     unsigned long val, void *data);
0079 
0080 #define flush_insn_slot(p)  do { } while (0)
0081 
0082 #endif /* CONFIG_KPROBES */
0083 #endif  /* _ASM_S390_KPROBES_H */