Merge branch 'devel-stable' into for-next
This commit is contained in:
29
arch/arm/include/asm/insn.h
Normal file
29
arch/arm/include/asm/insn.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef __ASM_ARM_INSN_H
|
||||
#define __ASM_ARM_INSN_H
|
||||
|
||||
static inline unsigned long
|
||||
arm_gen_nop(void)
|
||||
{
|
||||
#ifdef CONFIG_THUMB2_KERNEL
|
||||
return 0xf3af8000; /* nop.w */
|
||||
#else
|
||||
return 0xe1a00000; /* mov r0, r0 */
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long
|
||||
__arm_gen_branch(unsigned long pc, unsigned long addr, bool link);
|
||||
|
||||
static inline unsigned long
|
||||
arm_gen_branch(unsigned long pc, unsigned long addr)
|
||||
{
|
||||
return __arm_gen_branch(pc, addr, false);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
arm_gen_branch_link(unsigned long pc, unsigned long addr)
|
||||
{
|
||||
return __arm_gen_branch(pc, addr, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#define __ARCH_WANT_KPROBES_INSN_SLOT
|
||||
#define MAX_INSN_SIZE 2
|
||||
#define MAX_STACK_SIZE 64 /* 32 would probably be OK */
|
||||
|
||||
#define flush_insn_slot(p) do { } while (0)
|
||||
#define kretprobe_blacklist_size 0
|
||||
@@ -51,5 +50,37 @@ int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
|
||||
int kprobe_exceptions_notify(struct notifier_block *self,
|
||||
unsigned long val, void *data);
|
||||
|
||||
/* optinsn template addresses */
|
||||
extern __visible kprobe_opcode_t optprobe_template_entry;
|
||||
extern __visible kprobe_opcode_t optprobe_template_val;
|
||||
extern __visible kprobe_opcode_t optprobe_template_call;
|
||||
extern __visible kprobe_opcode_t optprobe_template_end;
|
||||
extern __visible kprobe_opcode_t optprobe_template_sub_sp;
|
||||
extern __visible kprobe_opcode_t optprobe_template_add_sp;
|
||||
extern __visible kprobe_opcode_t optprobe_template_restore_begin;
|
||||
extern __visible kprobe_opcode_t optprobe_template_restore_orig_insn;
|
||||
extern __visible kprobe_opcode_t optprobe_template_restore_end;
|
||||
|
||||
#define MAX_OPTIMIZED_LENGTH 4
|
||||
#define MAX_OPTINSN_SIZE \
|
||||
((unsigned long)&optprobe_template_end - \
|
||||
(unsigned long)&optprobe_template_entry)
|
||||
#define RELATIVEJUMP_SIZE 4
|
||||
|
||||
struct arch_optimized_insn {
|
||||
/*
|
||||
* copy of the original instructions.
|
||||
* Different from x86, ARM kprobe_opcode_t is u32.
|
||||
*/
|
||||
#define MAX_COPIED_INSN DIV_ROUND_UP(RELATIVEJUMP_SIZE, sizeof(kprobe_opcode_t))
|
||||
kprobe_opcode_t copied_insn[MAX_COPIED_INSN];
|
||||
/* detour code buffer */
|
||||
kprobe_opcode_t *insn;
|
||||
/*
|
||||
* We always copy one instruction on ARM,
|
||||
* so size will always be 4, and unlike x86, there is no
|
||||
* need for a size field.
|
||||
*/
|
||||
};
|
||||
|
||||
#endif /* _ARM_KPROBES_H */
|
||||
|
||||
17
arch/arm/include/asm/patch.h
Normal file
17
arch/arm/include/asm/patch.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _ARM_KERNEL_PATCH_H
|
||||
#define _ARM_KERNEL_PATCH_H
|
||||
|
||||
void patch_text(void *addr, unsigned int insn);
|
||||
void __patch_text_real(void *addr, unsigned int insn, bool remap);
|
||||
|
||||
static inline void __patch_text(void *addr, unsigned int insn)
|
||||
{
|
||||
__patch_text_real(addr, insn, true);
|
||||
}
|
||||
|
||||
static inline void __patch_text_early(void *addr, unsigned int insn)
|
||||
{
|
||||
__patch_text_real(addr, insn, false);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef _ASM_PROBES_H
|
||||
#define _ASM_PROBES_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef u32 probes_opcode_t;
|
||||
|
||||
struct arch_probes_insn;
|
||||
@@ -38,6 +40,19 @@ struct arch_probes_insn {
|
||||
probes_check_cc *insn_check_cc;
|
||||
probes_insn_singlestep_t *insn_singlestep;
|
||||
probes_insn_fn_t *insn_fn;
|
||||
int stack_space;
|
||||
unsigned long register_usage_flags;
|
||||
bool kprobe_direct_exec;
|
||||
};
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/*
|
||||
* We assume one instruction can consume at most 64 bytes stack, which is
|
||||
* 'push {r0-r15}'. Instructions consume more or unknown stack space like
|
||||
* 'str r0, [sp, #-80]' and 'str r0, [sp, r1]' should be prohibit to probe.
|
||||
* Both kprobe and jprobe use this macro.
|
||||
*/
|
||||
#define MAX_STACK_SIZE 64
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user