Skip to content

Illegal instruction  #16

@sunmin89

Description

@sunmin89

hi!

I want to run a guest os under qemu-kvm of qemu-system-riscv64, but came across an issue.

  • It complains: "Illegal instruction"
[    0.401411] Freeing unused kernel image (initmem) memory: 2236K
[    0.402047] Run /init as init process
           _  _
          | ||_|
          | | _ ____  _   _  _  _
          | || |  _ \| | | |\ \/ /
          | || | | | | |_| |/    \
          |_||_|_| |_|\____|\_/\_/

               Busybox Rootfs

Please press Enter to activate this console.
/ # insmod apps/kvm.ko
[   21.622901] kvm [47]: hypervisor extension available
[   21.623098] kvm [47]: using Sv57x4 G-stage page table format
[   21.623289] kvm [47]: VMID 14 bits available
/ # ./apps/lkvm-static run -m 128 -c2 --console serial -p "console=ttyS0 earlyco
n" -k ./apps/Image --debug
[   39.348346] lkvm-static[48]: unhandled signal 4 code 0x1 at 0x0000000000016526 in lkvm-static[10000+c3000]
[   39.348753] CPU: 0 PID: 48 Comm: lkvm-static Not tainted 6.7.0-rc7 #1
[   39.348977] Hardware name: riscv-virtio,qemu (DT)
[   39.349144] epc : 0000000000016526 ra : 0000000000016512 sp : 00007ffff8d210b0
[   39.349427]  gp : 0000000000194f30 tp : 000000000019e760 t0 : 0000000000001000
[   39.349641]  t1 : 0000000000000038 t2 : 0000000000000001 s0 : 00000000001a12c0
[   39.349912]  s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000
[   39.350079]  a2 : 00000000000d74d8 a3 : 0000000000196208 a4 : 00000000001a12c0
[   39.350383]  a5 : 00000000000d74d8 a6 : 6e692064656c6261 a7 : 00000000001929a8
[   39.350615]  s2 : 0000000000196000 s3 : 0000000000096e60 s4 : 0000000000091ff8
[   39.350916]  s5 : 00000000000930c0 s6 : 00007ffff8d22b78 s7 : 00000000001a0950
[   39.351202]  s8 : 0000000000000009 s9 : 00007ffff8d22a20 s10: 00007ffff8d23a20
[   39.351534]  s11: 000000000019f4e0 t3 : ffffffffffffffff t4 : 00000000001a0f58
[   39.351857]  t5 : 0000000000000016 t6 : 0000000000000001
[   39.352093] status: 0000000200004020 badaddr: 000000005ac7548b cause: 0000000000000002
[   39.352581] Code: 0693 2089 ed31 77b7 000d 8793 4d87 5684 6790 8722 (548b) 5ac7
Illegal instruction
  • this is my gnu tool info
$ /home/sunmin/bins/gnu-toolchain-bins-rvv-1.0/bin/riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/home/sunmin/bins/gnu-toolchain-bins-rvv-1.0/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/sunmin/bins/gnu-toolchain-bins-rvv-1.0/bin/../libexec/gcc/riscv64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /home/sunmin/aosp-out/riscv-gnu-toolchain/build-rvv-1.0-cintrinsic/../gcc/configure --target=riscv64-unknown-linux-gnu --prefix=/home/sunmin/aosp-out/gnu-toolchain-bins-rvv-1.0 --with-sysroot=/home/sunmin/aosp-out/gnu-toolchain-bins-rvv-1.0/sysroot --with-pkgversion=g80ae426a195 --with-system-zlib --enable-shared --enable-tls --enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap --src=../../gcc --disable-multilib --with-abi=lp64d --with-arch=rv64gczve32x --with-tune=rocket --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2    -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2    -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230702 (experimental) (g80ae426a195)
  • qemu info
$ ./qemu/build/qemu-system-riscv64 --version
QEMU emulator version 9.0.0 (v9.0.0)
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
  • Could anyone give me some guideline? thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions