Replies: 2 comments
-
对第1个问题:感觉可以按此思路试一下。gen_offset就是在取指定的percpu变量在所属percpu area中的相对偏移,而Primary CPU使用的area是静态存在于.percpu这个段里面的,基于它计算获得的相对偏移对所有cpu都是一致的。原理上感觉没有问题,只是要验证一下,用rust 宏写出来的效果是否与当前实现一致。 |
Beta Was this translation helpful? Give feedback.
-
初步重构percpu为arch无关: https://github.com/[ZR233/percpu](https://github.com/ZR233/percpu) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
实际用变量链接地址减去段基地址就可以得到,为何这样设计?
percpu riscv 使用 gp 寄存器保存基地址,实际编译器开启relax功能后,会编译出操作gp寄存器的代码,造成地址混乱,这个功能默认开启。riscv 手册要求用sscratch存放hart 相关内容, 不知为何使用gp?
而axhal riscv trap 中又通过 sscratch 是否 == 0 判断 user 还是 kernel trap,需要一起修改
如果改为使用sscratch,对宏内核是否有影响?
Beta Was this translation helpful? Give feedback.
All reactions