d0iasm / rvemu

RISC-V emulator for CLI and Web written in Rust with WebAssembly. It supports xv6 and Linux (ongoing).
https://rvemu.app/
MIT License
770 stars 57 forks source link

Remove unused public constant SSTATUS_VS #7

Closed RinHizakura closed 3 years ago

RinHizakura commented 3 years ago

Hello, as a beginner at the RISC-V emulator, I really learn a lot from this project. So I would like to thank you for this first :)

When I read the codes, I found that there's a mask named SSTATUS_VS which would never be used. According to what I read from the RISC-V instruction set manual, I didn't see any field in sstatus named VS. Also, the mask 0x00000600 is marked to WPRI on the manual. So I think SSTATUS_VS won't be used in the future, too. We are able to remove this mask.

image

d0iasm commented 3 years ago

Sorry for the late response. Thank you for pointing it out and your PR!

I added SSTATUS_VS because RISC-V Spike, which is a defacto standard for RISC-V emulator, defines it: https://github.com/riscv/riscv-isa-sim/blob/master/riscv/encoding.h#L48

VS stands for a virtual supervisor. I think the spec for the hypervisor mode (and VS-mode) is not well defined yet so the spec omits SSTATUS_VS for now. I believe VS will be defined at the WPRI field in the future.

But we don't have to have it as you commented. SSTATUS_VS is meaningless in this emulator. To simplify the code, I'll merge your PR. Thank you for working on this!

RinHizakura commented 3 years ago

Now I get it! Thanks for your patient explanation!