ARM: use a function table for determining instruction interpreter action
[firefly-linux-kernel-4.4.55.git] / arch / arm / kernel / kprobes.c
index 54e7b46a329508460428b98e65bcc39136b20b3a..a757c3c2238119ed1c79c38971d6e932f2bb177b 100644 (file)
@@ -56,6 +56,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
        unsigned long addr = (unsigned long)p->addr;
        bool thumb;
        kprobe_decode_insn_t *decode_insn;
+       const union decode_action *actions;
        int is;
 
        if (in_exception_text(addr))
@@ -69,20 +70,24 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
                insn <<= 16;
                insn |= ((u16 *)addr)[1];
                decode_insn = thumb32_kprobe_decode_insn;
-       } else
+               actions = kprobes_t32_actions;
+       } else {
                decode_insn = thumb16_kprobe_decode_insn;
+               actions = kprobes_t16_actions;
+       }
 #else /* !CONFIG_THUMB2_KERNEL */
        thumb = false;
        if (addr & 0x3)
                return -EINVAL;
        insn = *p->addr;
        decode_insn = arm_kprobe_decode_insn;
+       actions = kprobes_arm_actions;
 #endif
 
        p->opcode = insn;
        p->ainsn.insn = tmp_insn;
 
-       switch ((*decode_insn)(insn, &p->ainsn)) {
+       switch ((*decode_insn)(insn, &p->ainsn, actions)) {
        case INSN_REJECTED:     /* not supported */
                return -EINVAL;