RISC-V OS Using Rust: Memory Management Unit
osblog.stephenmarz.com
osblog.stephenmarz.com
If anyone's wondering, I explained the reason:
https://github.com/pavehawk2007/osblog/issues/11
TL;DR: You're expected to still use the bits as access/dirty flags, but instead of the hardware automagically setting them, you set them yourself from the page fault handler. (Or if you don't need to track those things, you just set the flags to 1 from the start.)
I'd encourage him to start in Supervisor mode instead and use one of the standard bootloaders (bbl or openSBI) to deal with machine mode. This would be compatible with Linux and be more portable as different platforms will supply platform specific boot loaders.
http://osblog.stephenmarz.com/index.html
Edit: original post I could’ve sworn was worded to imply it was what was what GP linked, but either I misread or it was edited, so changed my reply accordingly.
When you do use hardware, you're interested in things like power budget and price for comparable performance. RISC-V is now reaching competitiveness in some cases, and companies/people will now start choosing to use it on the merits. If, there is, there's an OS available and a bunch of supporting tools and libraries.
You need to know "dirty" to know whether a page needs to be written back to a swap file (or needs to be duplicated in lazy copying cases), you may want to know "accessed" if you want to do the accounting to push out less often used pages when memory gets short
Going through RISCS I've implemented MMU code for:
MIPS - Has what they call a Dirty bit, but no separate RO bit, the dirty bit is really the ~RO bit.
SH* - See MIPS (lol, that could be their tagline)
Sparc - Doesn't really specify an MMU, but the "Reference MMU" does specify that the Modified bit (AKA the Dirty bit) is filled in by the MMU
PowerPC - Referenced and Changed bits in the PTEs are updated by the MMU.
ARM - Doesn't specify any A&D like construct.
Am I missing any? I can't think of an arch off the top of my head that has separate A&D from RWX, and doesn't have the MMU fill them in for you. Well other than RISC-V, lol.
The big advantage of handling this stuff in software is that any hardware doing this has to go through the system caches which is just really messy - better to use the existing coherent paths already provided and provide hardware support so you don't have to do this often
I like rust and more architectures are sorely needed, but this seems... Calculated