Skip to content

Commit 17b3c35

Browse files
philmdrth7680
authored andcommitted
target/riscv: Restrict cpu_exec_interrupt() handler to sysemu
Restrict cpu_exec_interrupt() and its callees to sysemu. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Warner Losh <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Bin Meng <[email protected]> Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent f725245 commit 17b3c35

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

target/riscv/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,10 @@ static const struct SysemuCPUOps riscv_sysemu_ops = {
644644
static const struct TCGCPUOps riscv_tcg_ops = {
645645
.initialize = riscv_translate_init,
646646
.synchronize_from_tb = riscv_cpu_synchronize_from_tb,
647-
.cpu_exec_interrupt = riscv_cpu_exec_interrupt,
648647
.tlb_fill = riscv_cpu_tlb_fill,
649648

650649
#ifndef CONFIG_USER_ONLY
650+
.cpu_exec_interrupt = riscv_cpu_exec_interrupt,
651651
.do_interrupt = riscv_cpu_do_interrupt,
652652
.do_transaction_failed = riscv_cpu_do_transaction_failed,
653653
.do_unaligned_access = riscv_cpu_do_unaligned_access,

target/riscv/cpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ int riscv_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
334334
int cpuid, void *opaque);
335335
int riscv_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
336336
int riscv_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
337-
bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request);
338337
bool riscv_cpu_fp_enabled(CPURISCVState *env);
339338
bool riscv_cpu_virt_enabled(CPURISCVState *env);
340339
void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable);
@@ -362,6 +361,7 @@ void riscv_cpu_list(void);
362361
#define cpu_mmu_index riscv_cpu_mmu_index
363362

364363
#ifndef CONFIG_USER_ONLY
364+
bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request);
365365
void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env);
366366
int riscv_cpu_claim_interrupts(RISCVCPU *cpu, uint32_t interrupts);
367367
uint32_t riscv_cpu_update_mip(RISCVCPU *cpu, uint32_t mask, uint32_t value);

target/riscv/cpu_helper.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ static int riscv_cpu_local_irq_pending(CPURISCVState *env)
7575
return RISCV_EXCP_NONE; /* indicates no pending interrupt */
7676
}
7777
}
78-
#endif
7978

8079
bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
8180
{
82-
#if !defined(CONFIG_USER_ONLY)
8381
if (interrupt_request & CPU_INTERRUPT_HARD) {
8482
RISCVCPU *cpu = RISCV_CPU(cs);
8583
CPURISCVState *env = &cpu->env;
@@ -90,12 +88,9 @@ bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
9088
return true;
9189
}
9290
}
93-
#endif
9491
return false;
9592
}
9693

97-
#if !defined(CONFIG_USER_ONLY)
98-
9994
/* Return true is floating point support is currently enabled */
10095
bool riscv_cpu_fp_enabled(CPURISCVState *env)
10196
{

0 commit comments

Comments
 (0)