On 2022/4/16 上午9:04, Richard Henderson wrote:
+int cpu_csr_offset(unsigned csr_num);
...
+static const uint64_t csr_offsets[] = {
There's no reason for this array to be uint64_t.
It really should match the function.
Yes, we shoud do this.
If we use 'int', we may get a warning:
../target/loongarch/csr_helper.c:49:30: warning: overflow in implicit
constant conversion [-Woverflow]
[LOONGARCH_CSR_CPUID] = offsetof(CPUState, cpu_index)
^~~~~~~~
How about use 'long'? I had tested it no warning.
Thanks.
Xiaojuan