-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RV32 U-Mode JIT is nonconformant and slow on ctx switch #133
Comments
No CSR access is happening in rv32 umode (at least not before it crashes). I'd assume kernel never uses smth like rv32 S-mode so S-mode CSRs can't be messed up this way. SV32 MMU doesn't seem to be used at all. |
Sign-extending or zero-extending rv32 VA pointers in SV39/SV48 translation doesn't help. The kernel always faults on some magical address 0x3803b0af8. Perhaps this could lead debugging somewhere. |
Crashes are caused by This is due to invalid IRQ mask computed for origin priv_mode and not the one we are switched into on IRQ. |
Fixed the interpreter side in 8aef67b |
RV32 U-Mode somewhat works with JIT since e108450. Note it still isn't spec conformant (RVJIT should sign-extend 32-bit results to 64-bit register, but doesn't now). |
The issue
Steps to reproduce
rvvm fw_jump.bin -k linux_6.8 -i rootfs_rv32.ext2 -nojit
Investigation
sxlen_t
:RVVM/src/riscv_cpu.h
Line 422 in 9929fdd
xlen_t
which is unsigned 32-bit in rv32. It's okay for bare or SV32 MMU, but apparently rv32 U-mode uses an SV39/48 MMU so the upper VA half is not properly sign-extended. Eitherriscv_mmu
should manually sign-extend rv32 addresses on SV39, or switch to sxlen_t addresses in interpreter and making Bare/SV32 modes work with this.The text was updated successfully, but these errors were encountered: