Anyone can explain the spike how to exit in baremental mode,
I would suggest looking at how github.com/riscv/riscv-tests works. Since spike is simulating a cpu, and a cpu doesn’t “exit”, I think there is some trickery with the htif (host-target interface?) where writing a value to a special location tells htif to shutdown the cpu.
Yeah it seems to just write an exit code to “tohost” in a loop (I presume because Spike only checks every N instructions).