]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/riscv: Improve the scause logic
authorAlistair Francis <Alistair.Francis@wdc.com>
Sat, 20 Apr 2019 02:27:02 +0000 (02:27 +0000)
committerPalmer Dabbelt <palmer@sifive.com>
Fri, 24 May 2019 19:09:24 +0000 (12:09 -0700)
No functional change, just making the code easier to read.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
target/riscv/cpu_helper.c

index 7318da289f6e79034c9e60a99797c88a09b83646..c577a262b8b4521bca4841230dff018347abe92e 100644 (file)
@@ -515,7 +515,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
         s = set_field(s, MSTATUS_SPP, env->priv);
         s = set_field(s, MSTATUS_SIE, 0);
         env->mstatus = s;
-        env->scause = cause | ~(((target_ulong)-1) >> async);
+        env->scause = cause | ((target_ulong)async << (TARGET_LONG_BITS - 1));
         env->sepc = env->pc;
         env->sbadaddr = tval;
         env->pc = (env->stvec >> 2 << 2) +