Open wangrunji0408 opened 5 years ago
I started porting today. Log the problems here.
mstatus.VM
controls the paging mode, but it can't be accessed in S-Mode.
So we have to setup a page table and enable paging before entering S-Mode.
Thus OpenSBI needs to be modified.sfence.vm
instead of sfence.vma
, and their coding are different.
So we can't use sfence.vma
in asm, and have to put the raw code of sfence.vm
.
riscv
crate needs to be modified.mbadaddr
instead of mtval
, which means we can't get the instruction code when handling illegal instruction exception.
So the current instruction emulation in OpenSBI is broken, then rdtime
will cause an exception.
We have to modify OpenSBI: load instruction code from memory according to mepc
.sstatus.SUM
is still PUM
which has opposite meaning!
So we will failed to access user memory.
Don't set SUM bit!Now rCore is working on K210! @ 2019.04.21 But the RAM is too small (6M) to run Busybox (~1M).
TODO in the future:
In a new development enviroment, many errors will be encountered when compiling the old version of rCore for K210. So fixed the necessary dependencies , then compiled and passed. See: https://github.com/rcore-os/rCore/pull/65 But it does not run on k210 board normally.
@wangrunji0408 did you ever document your findings somewhere? as the K210 made it into the linux kernel (with NOMMU to my knowledge) i am wondering if an actual MMU Linux Kernel for K210 would be possible. Would love to hear your thoughts.
@z3cko All my findings are recorded here. As far as I know, the MMU feature in the K210 is not official documented. We can only assume that K210 has an MMU complies with the RISC-V spec v1.9.1, and it seems to be. So I think an MMU Linux kernel for K210 is possible in technical, but I'm not sure if the Linux community would like to accept that for an undocumented hardware.
I was surprised to learn that K210 has S-Mode and Sv39 MMU! So it's possible to run rCore on it!
But K210 is based on priv v1.9.1 spec, which has some differences compared to current v1.10. For example:
sptbr
in v1.9.1,satp
in v1.10.Proof: MAIX MMU example: run 32MB GBA on FATFS!