mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
target/riscv: Allocate itrigger timers only once
riscv_trigger_init() had been called on reset events that can happen
several times for a CPU and it allocated timers for itrigger. If old
timers were present, they were simply overwritten by the new timers,
resulting in a memory leak.
Divide riscv_trigger_init() into two functions, namely
riscv_trigger_realize() and riscv_trigger_reset() and call them in
appropriate timing. The timer allocation will happen only once for a
CPU in riscv_trigger_realize().
Fixes: 5a4ae64cac
("target/riscv: Add itrigger support when icount is enabled")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20230818034059.9146-1-akihiko.odaki@daynix.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
7d496bb502
commit
a7c272df82
3 changed files with 21 additions and 5 deletions
|
@ -143,7 +143,8 @@ void riscv_cpu_debug_excp_handler(CPUState *cs);
|
|||
bool riscv_cpu_debug_check_breakpoint(CPUState *cs);
|
||||
bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp);
|
||||
|
||||
void riscv_trigger_init(CPURISCVState *env);
|
||||
void riscv_trigger_realize(CPURISCVState *env);
|
||||
void riscv_trigger_reset_hold(CPURISCVState *env);
|
||||
|
||||
bool riscv_itrigger_enabled(CPURISCVState *env);
|
||||
void riscv_itrigger_update_priv(CPURISCVState *env);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue