mips: delete kludgy code that modifies data sent to write_memory()
authorØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 31 Mar 2011 16:42:10 +0000 (18:42 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 31 Mar 2011 21:46:56 +0000 (23:46 +0200)
Could this cause confusion as data sent to write would be flipped
and then if the caller subsequently used the data, e.g. a
compare mismatch might happen?

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/mips_m4k.c

index 0508c35f80d7ab7dc99c9c5a113cfcb07eb42f15..589ba7a0b141edd1282c62649e308a31b0c98eee 100644 (file)
@@ -1004,19 +1004,34 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address,
                ejtag_info->fast_access_save = -1;
        }
 
+       uint8_t * t = NULL;
+
        /* TAP data register is loaded LSB first (little endian) */
        if (target->endianness == TARGET_BIG_ENDIAN)
        {
+               t = malloc(count * sizeof(uint32_t));
+               if (t == NULL)
+               {
+                       LOG_ERROR("Out of memory");
+                       return ERROR_FAIL;
+               }
+
                uint32_t i, t32;
                for(i = 0; i < (count * 4); i += 4)
                {
                        t32 = be_to_h_u32((uint8_t *) &buffer[i]);
-                       h_u32_to_le(&buffer[i], t32);
+                       h_u32_to_le(&t[i], t32);
                }
+
+               buffer = t;
        }
 
        retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, write_t, address,
                        count, (uint32_t*) (void *)buffer);
+
+       if (t != NULL)
+               free(t);
+
        if (retval != ERROR_OK)
        {
                /* FASTDATA access failed, try normal memory write */

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)