From ce2a24ad0ffeb8b67480c481d471169c24316938 Mon Sep 17 00:00:00 2001 From: Huaqi Fang <578567190@qq.com> Date: Wed, 6 Dec 2023 11:11:00 +0800 Subject: [PATCH] hw/intc: Fix time csr rdtime_fn not implement issue which cause time illegal instruction issue Also fix issue in gdb info reg time time Could not fetch register "time"; remote failure reply 'E14' Signed-off-by: Huaqi Fang <578567190@qq.com> --- hw/intc/nuclei_systimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/nuclei_systimer.c b/hw/intc/nuclei_systimer.c index 8bada4bc0992..cc6d7c45bfc3 100644 --- a/hw/intc/nuclei_systimer.c +++ b/hw/intc/nuclei_systimer.c @@ -36,7 +36,6 @@ int hart_numbers = 0; static uint64_t nuclei_cpu_riscv_read_rtc(void *opaque) { - uint64_t timebase_freq = *(uint64_t*)opaque; return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), timebase_freq, NANOSECONDS_PER_SECOND); @@ -463,6 +462,7 @@ DeviceState *nuclei_systimer_create(hwaddr addr, hwaddr size, uint32_t hartid_ba if(eclic != NULL) { //env->features |= (1ULL << RISCV_FEATURE_ECLIC); + riscv_cpu_set_rdtime_fn(env, nuclei_cpu_riscv_read_rtc, &(s->timebase_freq)); env->mtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &nuclei_mtimecmp_cb, cpu); env->mtimecmp = 0;