ARM: kprobes: enable OPTPROBES for ARM 32
[deliverable/linux.git] / arch / arm / include / asm / kprobes.h
index 56f9ac68fbd180e2b889fcfc904cc9a27d76fd96..50ff3bc7928e91b59fd657fbc9577a4ec9e96651 100644 (file)
@@ -50,5 +50,34 @@ 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;
+
+#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 */
This page took 0.041554 seconds and 5 git commands to generate.