作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
正在阅读Linux内核,对MMU相关的部分比较感兴趣。在ARM64 cpu中,有如下代码:
__create_page_tables:
pgtbl x25, x26, x28 // idmap_pg_dir and swapper_pg_dir addresses
mov x27, lr
/*
* Invalidate the idmap and swapper page tables to avoid potential
* dirty cache lines being evicted.
*/
mov x0, x25
add x1, x26, #SWAPPER_DIR_SIZE
bl __inval_cache_range
/*
* Clear the idmap and swapper page tables.
*/
mov x0, x25
add x6, x26, #SWAPPER_DIR_SIZE
1: stp xzr, xzr, [x0], #16
stp xzr, xzr, [x0], #16
stp xzr, xzr, [x0], #16
stp xzr, xzr, [x0], #16
cmp x0, x6
b.lo 1b
ldr x7, =MM_MMUFLAGS
/*
* Create the identity mapping.
*/
**add x0, x25, #PAGE_SIZE // section table address**
ldr x3, =KERNEL_START
add x3, x3, x28 // __pa(KERNEL_START)
create_pgd_entry x25, x0, x3, x5, x6
ldr x6, =KERNEL_END
mov x5, x3 // __pa(KERNEL_START)
add x6, x6, x28 // __pa(KERNEL_END)
create_block_map x0, x7, x3, x5, x6
我不明白这段代码:
add x0, x25, #PAGE_SIZE
我的理解是x25
是地址idmap_pg_dir
,不需要加PAGE_SIZE
。为什么要将 PAGE_SIZE
添加到 x25
?
最佳答案
函数create_pgd_entry是在PGD中创建一个表项,在“add x0,x25,#PAGE_SIZE”之后,x0指向下一级表。
有两个4KB@idmap_pg_dir,第一个4KB是PGD,第二个4KB是下一级表。
注意:PGD 中只使用了一个条目。
关于Linux 内核 mmu create_page_tables,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47589226/
正在阅读Linux内核,对MMU相关的部分比较感兴趣。在ARM64 cpu中,有如下代码: __create_page_tables: pgtbl x25, x26, x28
我是一名优秀的程序员,十分优秀!