mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
🆕 malloc 、printf
This commit is contained in:
@ -680,13 +680,15 @@ void mm_map_proc_page_table(ul proc_page_table_addr, bool is_phys, ul virt_addr_
|
||||
uint64_t mm_do_brk(uint64_t old_brk_end_addr, int64_t offset)
|
||||
{
|
||||
// 暂不支持缩小堆内存
|
||||
if(offset <0)
|
||||
if (offset < 0)
|
||||
return old_brk_end_addr;
|
||||
|
||||
uint64_t end_addr = old_brk_end_addr + offset;
|
||||
for (uint64_t i = old_brk_end_addr; i < end_addr; i += PAGE_2M_SIZE)
|
||||
mm_map_proc_page_table(current_pcb->mm->pgd, true, i, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED), PAGE_2M_SIZE, PAGE_USER_PAGE, true);
|
||||
|
||||
{
|
||||
kdebug("map [%d]", i);
|
||||
mm_map_proc_page_table((uint64_t)current_pcb->mm->pgd, true, i, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED)->addr_phys, PAGE_2M_SIZE, PAGE_USER_PAGE, true);
|
||||
}
|
||||
current_pcb->mm->brk_end = end_addr;
|
||||
return end_addr;
|
||||
}
|
Reference in New Issue
Block a user