David Brownell <david-b@pacbell.net>:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 15 Jul 2009 23:48:54 +0000 (23:48 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 15 Jul 2009 23:48:54 +0000 (23:48 +0000)
More instructions decoded:

A5.3.5 Load/store multiple

The preferred PUSH/POP syntax is shown when appropriate.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2539 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/arm_disassembler.c

index 63166932f0b270d5f8467dcc2c01195b3d992698..29bc039410b9968bd7cb608bce6bf8eb7e0cfec2 100644 (file)
@@ -2940,6 +2940,55 @@ static int t2ev_mul64_div(uint32_t opcode, uint32_t address,
        return ERROR_OK;
 }
 
+static int t2ev_ldm_stm(uint32_t opcode, uint32_t address,
+               arm_instruction_t *instruction, char *cp)
+{
+       int rn = (opcode >> 16) & 0xf;
+       int op = (opcode >> 22) & 0x6;
+       int t = (opcode >> 21) & 1;
+       unsigned registers = opcode & 0xffff;
+
+       if (opcode & (1 << 20))
+               op |= 1;
+
+       switch (op) {
+       case 2:
+               sprintf(cp, "STMB\tr%d%s, ", rn, t ? "!" : "");
+               break;
+       case 3:
+               if (rn == 13 && t)
+                       sprintf(cp, "POP\t");
+               else
+                       sprintf(cp, "LDM\tr%d%s, ", rn, t ? "!" : "");
+               break;
+       case 4:
+               if (rn == 13 && t)
+                       sprintf(cp, "PUSH\t");
+               else
+                       sprintf(cp, "STM\tr%d%s, ", rn, t ? "!" : "");
+               break;
+       case 5:
+               sprintf(cp, "LDMB\tr%d%s, ", rn, t ? "!" : "");
+               break;
+       default:
+               return ERROR_INVALID_ARGUMENTS;
+       }
+
+       cp = strchr(cp, 0);
+       *cp++ = '{';
+       for (t = 0; registers; t++, registers >>= 1) {
+               if ((registers & 1) == 0)
+                       continue;
+               registers &= ~1;
+               sprintf(cp, "r%d%s", t, registers ? "," : "");
+               cp = strchr(cp, 0);
+       }
+       *cp++ = '}';
+       *cp++ = 0;
+
+       return ERROR_OK;
+}
+
 /*
  * REVISIT for Thumb2 instructions, instruction->type and friends aren't
  * always set.  That means eventual arm_simulate_step() support for Thumb2
@@ -2999,6 +3048,10 @@ int thumb2_opcode(target_t *target, uint32_t address, arm_instruction_t *instruc
        else if ((opcode & 0x18008000) == 0x10008000)
                retval = t2ev_b_misc(opcode, address, instruction, cp);
 
+       /* ARMv7-M: A5.3.5 Load/store multiple */
+       else if ((opcode & 0x1e400000) == 0x08000000)
+               retval = t2ev_ldm_stm(opcode, address, instruction, cp);
+
        /* ARMv7-M: A5.3.10 Store single data item */
        else if ((opcode & 0x1f100000) == 0x18000000)
                retval = t2ev_store_single(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)