target: arm: disassembler: add v5T Thumb BLX decoding 93/3893/2
authorPaul Fertser <fercerpav@gmail.com>
Fri, 2 Dec 2016 16:04:17 +0000 (19:04 +0300)
committerPaul Fertser <fercerpav@gmail.com>
Sat, 13 Jan 2018 08:36:03 +0000 (08:36 +0000)
Reported by thesourcerer on IRC.

Change-Id: I36d4d95de176a19fdd0bf80d8b419be6ca637e98
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/3893
Tested-by: jenkins
src/target/arm_disassembler.c

index 3f1daca4d16309e9a4db50803c209670fea48d47..f0266d023158172bf97a3fd480b221e3bd134ed9 100644 (file)
@@ -2896,12 +2896,26 @@ static int t2ev_b_bl(uint32_t opcode, uint32_t address,
        address += 4;
        address += offset << 1;
 
-       instruction->type = (opcode & (1 << 14)) ? ARM_BL : ARM_B;
+       char *inst;
+       switch ((opcode >> 12) & 0x5) {
+       case 0x1:
+               inst = "B.W";
+               instruction->type = ARM_B;
+               break;
+       case 0x4:
+               inst = "BLX";
+               instruction->type = ARM_BLX;
+               break;
+       case 0x5:
+               inst = "BL";
+               instruction->type = ARM_BL;
+               break;
+       default:
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       }
        instruction->info.b_bl_bx_blx.reg_operand = -1;
        instruction->info.b_bl_bx_blx.target_address = address;
-       sprintf(cp, "%s\t%#8.8" PRIx32,
-                       (opcode & (1 << 14)) ? "BL" : "B.W",
-                       address);
+       sprintf(cp, "%s\t%#8.8" PRIx32, inst, address);
 
        return ERROR_OK;
 }
@@ -3078,10 +3092,9 @@ static int t2ev_b_misc(uint32_t opcode, uint32_t address,
 
        switch ((opcode >> 12) & 0x5) {
                case 0x1:
+               case 0x4:
                case 0x5:
                        return t2ev_b_bl(opcode, address, instruction, cp);
-               case 0x4:
-                       goto undef;
                case 0:
                        if (((opcode >> 23) & 0x07) != 0x07)
                                return t2ev_cond_b(opcode, address, instruction, cp);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)