feat(mm): 实现缺页中断处理,支持页面延迟分配和写时拷贝,以及用户栈自动拓展 (#715)

* 实现缺页中断处理

* 完善页表拷贝逻辑

* 优化代码结构

* 完善缺页异常信息

* 修改大页映射逻辑

* 修正大页映射错误

* 添加缺页中断支持标志

* 实现用户栈自动拓展功能
This commit is contained in:
MemoryShore
2024-04-22 15:10:47 +08:00
committed by GitHub
parent cb02d0bbc2
commit a17651b14b
16 changed files with 1657 additions and 135 deletions

View File

@ -131,6 +131,7 @@ impl ElfLoader {
prot_flags,
MapFlags::MAP_ANONYMOUS | MapFlags::MAP_FIXED_NOREPLACE,
false,
true,
);
if r.is_err() {
kerror!("set_elf_brk: map_anonymous failed, err={:?}", r);
@ -256,7 +257,7 @@ impl ElfLoader {
// kdebug!("total_size={}", total_size);
map_addr = user_vm_guard
.map_anonymous(addr_to_map, total_size, tmp_prot, *map_flags, false)
.map_anonymous(addr_to_map, total_size, tmp_prot, *map_flags, false, true)
.map_err(map_err_handler)?
.virt_address();
// kdebug!("map ok: addr_to_map={:?}", addr_to_map);
@ -288,7 +289,7 @@ impl ElfLoader {
// kdebug!("total size = 0");
map_addr = user_vm_guard
.map_anonymous(addr_to_map, map_size, tmp_prot, *map_flags, false)?
.map_anonymous(addr_to_map, map_size, tmp_prot, *map_flags, false, true)?
.virt_address();
// kdebug!(
// "map ok: addr_to_map={:?}, map_addr={map_addr:?},beginning_page_offset={beginning_page_offset:?}",