rcore-os / rCore-Tutorial-v3

Let's write an OS which can run on RISC-V in Rust from scratch!
https://rcore-os.github.io/rCore-Tutorial-Book-v3/index.html
GNU General Public License v3.0
1.58k stars 452 forks source link

使用rustsbi-qemu教育版规避rustsbi某些版本与qemu不兼容导致卡死的问题 #110

Open wyfcyx opened 1 year ago

wyfcyx commented 1 year ago

如题。@Ydrmaster在做一个rustsbi-tutorial,应该能够满足我们的tutorial项目的需求,我们正在跟进该项目的进展。

PorterLu commented 1 year ago

ch7 sig_test不能运行,我本来在ch7测过,到ch8还是不能运行。我定位bug到时间中断没有触发。好像是rustsbi在时间中断没有委托到rCore中, 改为opensbi后正常运行。同时ch8中的一个forktest,改为opensbi也不会卡死可以正常运行。 上回我提交了一个pull request也是rustsbi的问题,rCore中不应该 if getchar() == 0 这样语句,sbi没读到字符串应该判断是否是-1,只是rustsbi读字符串是阻塞实现的,没读到字符不会返回,所以rCore中没出现问题。

wyfcyx commented 1 year ago

暂时的解决方案是:内核使用sbi-rt crate尽量避免使用legacy call从而能够跟上rustsbi,然后使用最新版rustsbi。目前各个分支应该能够支持qemu7.0-7.2了。