On 4/29/22 03:07, Xiaojuan Yang wrote:
+ [LOONGARCH_CSR_CPUID] = { + .offset = -1, + .flags = CSRFL_READONLY, + .readfn = gen_helper_csrrd_cpuid, + .writefn = NULL + },
The offset should be (int)offsetof(CPUState, cpu_index) - (int)offsetof(LoongArchCPU, env) at which point you don't need the readfn.
+target_ulong helper_csrrd_tval(CPULoongArchState *env) +{ + LoongArchCPU *cpu = LOONGARCH_CPU(env_cpu(env));
cpu = env_archcpu(env). Several other instances in the file. Otherwise it looks good. r~