找不到可以正常支持loongarch架构example正常运行的,支持kcontext特性的commit #10
-
我之前尝试了rcore第七章修改好的代码,并且可以在loongarch上正常运行,后面自己修改我们的内核,可以在riscv64上正常运行,但是切换到loongarch上后编译可以通过,然而在执行qemu上板模拟的时候就出现卡死的情况,卡在了输出OPENSBI的前一步,我又测试rcore的第七章,发现也无法正常模拟,于是尝试了内置的example,同样出现了类似的问题,我在官网寻找各个版本之后,发现0.1.3的代码可以正常运行example,但是我的项目适配的是0.1.0版本,重点似乎是kcontext特性,但是我在各个commit却没有找到可以支持example执行完上板模拟的commit,请问哪一个版本可以支持我正常运行,还是说是bootloader的问题 Compiling example v0.1.0 (/mnt/rcore/polyhal-ver/example) error[E0432]: unresolved import For more information about this error, try |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 40 replies
-
warning: polyhal (lib) generated 1 warning 某些版本还出现了这样的问题 |
Beta Was this translation helpful? Give feedback.
-
您是否可以给定一个 确定的仓库和 commit id 让我可以更加方便的复现这个问题 |
Beta Was this translation helpful? Give feedback.
-
你可以展示一下你运行 qemu-system-loongarch64 的 command,我尝试了 https://github.com/yfblock/rcore-tutorial-v3-with-hal-component 其中使用 cd os && make ARCH=loongarch64 run 去运行,发现也是卡住并不能输出。经过检查发现时在运行的时候没有指定内存大小导致的 (qemu-system-loongarch64 需要 1G 的内存,也就是 -m 1G,旧版本小于 1G 会报错,且默认 1G,新版本的qemu需要自己指定)。
希望这个能解决你的问题,还有说明一下,之前版本有一些让人迷惑的地方,loongarch64 qemu 的内存开始地址时 0x8000_0000,而不是 example 中的 0x9000_0000,之前是为了在内核前运行一段程序,所以这样设计,目前在 新版本中已经修正。 |
Beta Was this translation helpful? Give feedback.
-
您好,我刚刚才知道,我们使用的环境有一些问题,我使用wsl,在主目录下先执行make docker,再进入到os下执行make ARCH=riscv64 run,我刚刚提交了一次 |
Beta Was this translation helpful? Give feedback.
-
对于 riscv64 来说 确实是 用 -drive 来挂载的,只是 loongarch64 没有走这个方式
|
Beta Was this translation helpful? Give feedback.
是将内核放在 0x0000_0000 - 0x1000_0000 可以解决这个问题,因为当内存小的时候,只有这个范围上会有可用的内存,如果在一个地址上没有物理内存,那么指定的程序就没有办法被加载到这里,也就没办法找到任务可用指令,程序运行的时候会触发异常 FetchException,然后跳转到异常处理的程序中,但是因为系统没有初始化,异常处理地址为 0,所以会跳转到 0,地址 0 处没有内容。
而在 loongarch64 上没有 sbi 的存在,所以就没有办法输出 sbi 的图标,rustsbi 无法在 loongarch64 上使用,所以指定 sbi 会导致异常,尝试使用
qemu-system-loongarch64 -kernel target/loongarch64-unknown-none/release/os -nographic -drive file=../user/target/loongarch64-unknown-none/release/fs.img,if=none,format=raw,id=x0 -m 1G -smp 1 -D qemu.log -d in_asm,int,pcall,cpu_reset,guest_errors