]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/x86/include/asm/kprobes.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[mv-sheeva.git] / arch / x86 / include / asm / kprobes.h
index 4fe681de1e76c164eedb543bad7333aa57de4b6d..4ffa345a8ccbd7d2b7db8debd7caa090aceaf8a5 100644 (file)
@@ -32,7 +32,10 @@ struct kprobe;
 
 typedef u8 kprobe_opcode_t;
 #define BREAKPOINT_INSTRUCTION 0xcc
-#define RELATIVEJUMP_INSTRUCTION 0xe9
+#define RELATIVEJUMP_OPCODE 0xe9
+#define RELATIVEJUMP_SIZE 5
+#define RELATIVECALL_OPCODE 0xe8
+#define RELATIVE_ADDR_SIZE 4
 #define MAX_INSN_SIZE 16
 #define MAX_STACK_SIZE 64
 #define MIN_STACK_SIZE(ADDR)                                          \
@@ -44,6 +47,17 @@ typedef u8 kprobe_opcode_t;
 
 #define flush_insn_slot(p)     do { } while (0)
 
+/* optinsn template addresses */
+extern kprobe_opcode_t optprobe_template_entry;
+extern kprobe_opcode_t optprobe_template_val;
+extern kprobe_opcode_t optprobe_template_call;
+extern kprobe_opcode_t optprobe_template_end;
+#define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
+#define MAX_OPTINSN_SIZE                               \
+       (((unsigned long)&optprobe_template_end -       \
+         (unsigned long)&optprobe_template_entry) +    \
+        MAX_OPTIMIZED_LENGTH + RELATIVEJUMP_SIZE)
+
 extern const int kretprobe_blacklist_size;
 
 void arch_remove_kprobe(struct kprobe *p);
@@ -64,6 +78,21 @@ struct arch_specific_insn {
        int boostable;
 };
 
+struct arch_optimized_insn {
+       /* copy of the original instructions */
+       kprobe_opcode_t copied_insn[RELATIVE_ADDR_SIZE];
+       /* detour code buffer */
+       kprobe_opcode_t *insn;
+       /* the size of instructions copied to detour code buffer */
+       size_t size;
+};
+
+/* Return true (!0) if optinsn is prepared for optimization. */
+static inline int arch_prepared_optinsn(struct arch_optimized_insn *optinsn)
+{
+       return optinsn->size;
+}
+
 struct prev_kprobe {
        struct kprobe *kp;
        unsigned long status;