LIU Zhiwei <zhiwei_...@linux.alibaba.com> writes:
> Hi folks, > > For TCG front end, we can test it with tools, such as RISU. But I > don't know if there are some tools that can help > to verify the correctness of a TCG backend. > > Can someone share the tools or the experience to debug RISC-V > backend? Thanks very much. It's mostly down to inspection or debugging failures. Sometimes you can attempt to shake out bugs by running a stacked QEMU. e.g. qemu-system-aarch64 on x86 host qemu-system-aarch64 on qemu-system-riscv64 on x86 host and see if the two aarch64 guests run the same. This of course gets very tricky running full OS kernels because as soon as time and async interrupts get involved you will get divergence anyway. This would work best with simple straight line test cases (e.g. check-tcg test cases). I've long wanted to have the ability to have TCG unit tests where a virtual processor could be defined for the purpose of directly exercising TCG. This would be mainly to check tcg_optimize() works correctly but no doubt could be extended to verify the eventual backend output. The problem with implementing such an approach has been the amount of boilerplate needed to define a simple frontend. Maybe this will get simpler as we slowly move to a single binary build but there is still quite of lot of things TCG needs to know about the guest it is emulating. If you would like to attempt improve the testing situation for TCG and its backend I'm fully supportive. -- Alex Bennée