I'm currently using qemu 7.0.0
for risc-v system emulation. However, the current version of device tree compiler might caught problem. If we use git clone
to get the qemu source and compile it, the qemu does not work properly as it gets stuck in a loop before jumping to the kernel. The execution trace of this loop shows below. It causes RustABI in an infinite loop around address 0x80001b00
:
(gdb) si
0x0000000080001b00 in ?? ()
(gdb) si
0x0000000080001b04 in ?? ()
(gdb) si
0x0000000080001b08 in ?? ()
(gdb) si
0x0000000080001b0c in ?? ()
(gdb) si
0x0000000080001b10 in ?? ()
(gdb) si
0x0000000080004394 in ?? ()
(gdb) si
0x0000000080001b14 in ?? ()
(gdb) si
0x0000000080001b18 in ?? ()
(gdb) si
0x0000000080001b00 in ?? ()
(gdb) x/10i $pc
=> 0x80001b00: fence w,unknown
0x80001b04: lb a0,8(s1)
0x80001b08: fence r,rw
0x80001b0c: auipc ra,0x3
0x80001b10: jalr -1912(ra)
0x80001b14: zext.b a0,a0
0x80001b18: blez a0,0x80001b00
0x80001b1c: bne a0,s0,0x80001b26
0x80001b20: fence w,unknown
0x80001b24: j 0x80001b04
(gdb)
I infer this problem is caused by dtc
submodule is because if we download source code tar file of qemu 7.0.0
on official website, which include all of the component at that time including the full copy of old version dtc
, qemu will work as expected. The only difference between the git clone
version and .tar
file of qemu 7.0.0
is the submodules (including dtc
and a building system). I have tried many kinds of platform and it yields the same result.