riscv-test-env icon indicating copy to clipboard operation
riscv-test-env copied to clipboard

Unable to run tests in QEMU (HTIF tohost must be 8 bytes)

Open andrewt0301 opened this issue 6 years ago • 2 comments

I am not sure whether this issue is related to QEMU for RISC-V or the test infrastructure.

When I am trying to run a test (e.g. one from riscv-tests/isa or one generated by riscv-torture) in QEMU for RISC-V, I get the following error:

    HTIF tohost must be 8 bytes

When I comment out the following lines of code in the riscv_test.h file and recompile the test, the problem disappears:

    .pushsection .tohost,"aw",@progbits;                            \
    .align 6; .global tohost; tohost: .dword 0;                     \
    .align 6; .global fromhost; fromhost: .dword 0;                 \
    .popsection;`

andrewt0301 avatar Jul 02 '18 11:07 andrewt0301

It's been 4 years. I see the same issue. However if I comment it out, tests dont compile because they're referencing this symbols.

Anyone else faced this issue with qemu and know how to get past it?

deepak0414 avatar Oct 04 '22 18:10 deepak0414

6 years, I got here. Sad to see no progress.

I'm trying to test qemu with riscof, but

cmd:

qemu-riscv32-static ./qemu/riscof_work/rv32i_m/I/src/add-01.S/ref/ref.elf

It's just stuck.

cmd:

# riscv32-xxxxxxxxxx-objcopy -I demo.elf demo.img
qemu-system-riscv32 -bios none -serial stdio -display none -kernel ./qemu/riscof_work/rv32i_m/I/src/add-01.S/ref/ref.img

output:

qemu-system-riscv32: HTIF tohost must be 8 bytes

spike can handle tohost correctly, qemu-system-riscv32 use spike as machine by default, but it doesn't work

trdthg avatar Sep 06 '24 02:09 trdthg