target/mips32: pracc write cp0 status register first 14/7914/17
authorWalter Ji <walter.ji@oss.cipunited.com>
Fri, 17 Nov 2023 03:27:09 +0000 (11:27 +0800)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 1 Dec 2023 22:21:40 +0000 (22:21 +0000)
When user requested a change on cp0 status register,
it may contain changes on EXL/ERL bits, and changes on
these bits could lead to differnt behaviours on writing
to other cp0 registers.

Change-Id: Ic83039988c29c06ee134226b52de943c46d19da2
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7914
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/mips32_pracc.c

index 9f0d87cd9833b6454fa25655067a8fdde1115424..db50ef9285ce79f34e3dbbae3e6047cdd554038f 100644 (file)
@@ -842,12 +842,12 @@ int mips32_pracc_write_regs(struct mips32_common *mips32)
        };
 
        uint32_t cp0_write_data[] = {
+               /* status */
+               c0rs[0],
                /* lo */
                gprs[32],
                /* hi */
                gprs[33],
-               /* status */
-               c0rs[0],
                /* badvaddr */
                c0rs[1],
                /* cause */
@@ -856,6 +856,9 @@ int mips32_pracc_write_regs(struct mips32_common *mips32)
                c0rs[3],
        };
 
+       /* Write CP0 Status Register first, changes on EXL or ERL bits
+        * may lead to different behaviour on writing to other CP0 registers.
+        */
        for (size_t i = 0; i < ARRAY_SIZE(cp0_write_code); i++) {
                /* load CP0 value in $1 */
                pracc_add_li32(&ctx, 1, cp0_write_data[i], 0);

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)