Skip to content

Commit

Permalink
target/riscv: Check for async flag in case of RISCV_EXCP_SEMIHOST.
Browse files Browse the repository at this point in the history
RISCV_EXCP_SEMIHOST is set to 0x10, which can be a local interrupt id
as well. This change moves RISCV_EXCP_SEMIHOST to switch case so that
async flag check is performed before invoking semihosting logic.

Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20231016111736.28721-3-rkanwal@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
rajnesh-kanwal authored and alistair23 committed Nov 7, 2023
1 parent a7b6917 commit d17bcae
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions target/riscv/cpu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,15 +1605,13 @@ void riscv_cpu_do_interrupt(CPUState *cs)
target_ulong htval = 0;
target_ulong mtval2 = 0;

if (cause == RISCV_EXCP_SEMIHOST) {
do_common_semihosting(cs);
env->pc += 4;
return;
}

if (!async) {
/* set tval to badaddr for traps with address information */
switch (cause) {
case RISCV_EXCP_SEMIHOST:
do_common_semihosting(cs);
env->pc += 4;
return;
case RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT:
case RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT:
case RISCV_EXCP_LOAD_ADDR_MIS:
Expand Down

0 comments on commit d17bcae

Please sign in to comment.