Merge tag 'amlogic-dt64-3' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman...
[linux-2.6-microblaze.git] / tools / objtool / arch / x86 / decode.c
index 0e8c8ec..34a579f 100644 (file)
@@ -208,14 +208,14 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
                break;
 
        case 0x89:
-               if (rex == 0x48 && modrm == 0xe5) {
+               if (rex_w && !rex_r && modrm_mod == 3 && modrm_reg == 4) {
 
-                       /* mov %rsp, %rbp */
+                       /* mov %rsp, reg */
                        *type = INSN_STACK;
                        op->src.type = OP_SRC_REG;
                        op->src.reg = CFI_SP;
                        op->dest.type = OP_DEST_REG;
-                       op->dest.reg = CFI_BP;
+                       op->dest.reg = op_to_cfi_reg[modrm_rm][rex_b];
                        break;
                }
 
@@ -284,11 +284,16 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
        case 0x8d:
                if (sib == 0x24 && rex_w && !rex_b && !rex_x) {
 
-                       /* lea disp(%rsp), reg */
                        *type = INSN_STACK;
-                       op->src.type = OP_SRC_ADD;
+                       if (!insn.displacement.value) {
+                               /* lea (%rsp), reg */
+                               op->src.type = OP_SRC_REG;
+                       } else {
+                               /* lea disp(%rsp), reg */
+                               op->src.type = OP_SRC_ADD;
+                               op->src.offset = insn.displacement.value;
+                       }
                        op->src.reg = CFI_SP;
-                       op->src.offset = insn.displacement.value;
                        op->dest.type = OP_DEST_REG;
                        op->dest.reg = op_to_cfi_reg[modrm_reg][rex_r];