-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[CPU/AARCH64] 增加libcpu/aarch64 KERNEL_ASPACE_START配置 #10757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
libcpu/aarch64/common/mmu.c
Outdated
/* restrict virtual address on usage of RT_NULL */ | ||
#ifndef KERNEL_VADDR_START | ||
#define KERNEL_VADDR_START (ARCH_RAM_OFFSET + ARCH_TEXT_OFFSET) | ||
#define KERNEL_VADDR_START 0x1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个其他平台也是这个值吗?可以kconfig配出这个值吗?
ARCH_RAM_OFFSET 和 ARCH_TEXT_OFFSET
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以前一直都是0x1000,这个值和libcpu\aarch64\link.lds.S 关联,不能随便配,代表内存的起始地址
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARCH_RAM_OFFSET 和 ARCH_TEXT_OFFSET配置不出来就再加个配置配置出来,反正不要写死 |
我这个值配出来了,加起来是0x8008000,并且需要正确链接到.ld文件里,但是rt_hw_board_init ->rt_hw_mmu_map_init -> rt_aspace_init要用的这个值,范围需要包含我前面的地址,原本的范围是0x1000-0x?现在成了0x80080000-0x?,假设有个串口寄存器0x28000000,如果不走rt_aspace_init流程我这个地址就写不进去。您看有没有更好的方案,不把这两个需求耦合在一起 |
考虑使用 如果存在比较大的修改,也可以考虑在 BSP 的配置中强制对 config KERNEL_VADDR_START
hex
default 0x1000 |
这种改方法很不方便,因为我也适配了rtsmart,我开启rtsmart配置时,也需要rtsmart的默认值0xffff000000000000,如果在我的bsp里强加这样一个配置就会和libcpu的Kconfig的值冲突, |
这样可以么?
|
|
那就再添加一个配置宏,如果没有这个宏就默认为 |
有没有示例写法,我试一下,KERNEL_VADDR_START,不好被覆盖,我也不好每次开关smart都要手写 |
类似这样: #ifndef KERNEL_VADDR_START
#ifdef KERNEL_ASPACE_START
#define KERNEL_VADDR_START KERNEL_ASPACE_START
#else
#define KERNEL_VADDR_START (ARCH_RAM_OFFSET + ARCH_TEXT_OFFSET)
#endif
#endif /* KERNEL_VADDR_START */ KERNEL_ASPACE_START 可以由 BSP 自行定义 |
已修改 |
@messigogogo 麻烦规范下PR的标题吧,请说明清楚PR修改了什么内容 |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
#10441 修改了 KERNEL_VADDR_START 未定义时的默认值:由原先的 0x1000 改为 ARCH_RAM_OFFSET + ARCH_TEXT_OFFSET。
这一调整在执行 rt_hw_board_init ->rt_hw_mmu_map_init -> rt_aspace_init 时,改变了非 rt-smart 模式下 MMU 虚拟地址与物理地址一一映射的逻辑,我方ARCH_RAM_OFFSET + ARCH_TEXT_OFFSET = 0x80080000,导致 80080000 之前的地址段未被映射,从而引发启动失败。
你的解决方案是什么 (what is your solution)
修改回原来的写法
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up