解决多页映射时只映射第一个页的问题
This commit is contained in:
parent
2d680b011b
commit
6f049d9ca2
|
@ -110,17 +110,19 @@ bool memm_map_pageframes_to(
|
||||||
return false;
|
return false;
|
||||||
while (size != 0)
|
while (size != 0)
|
||||||
{
|
{
|
||||||
|
// 这是当前需要映射的页的内存对齐(或者说是当前映射的页的大小)
|
||||||
memm_page_size align = memm_get_page_align(physical);
|
memm_page_size align = memm_get_page_align(physical);
|
||||||
if (align == MEMM_PAGE_SIZE_1G)
|
if (align == MEMM_PAGE_SIZE_1G)
|
||||||
{
|
{
|
||||||
if (size < (usize)align * MEMM_PAGE_SIZE / 2)
|
if (size < (usize)align * MEMM_PAGE_SIZE / 2)
|
||||||
align = MEMM_2M_ALIGN_MASK;
|
align = MEMM_2M_ALIGN_MASK + 1;
|
||||||
}
|
}
|
||||||
if (align == MEMM_PAGE_SIZE_2M)
|
if (align == MEMM_PAGE_SIZE_2M)
|
||||||
{
|
{
|
||||||
if (size < (usize)align * MEMM_PAGE_SIZE / 2)
|
if (size < (usize)align * MEMM_PAGE_SIZE / 2)
|
||||||
align = MEMM_4K_ALIGN_MASK;
|
align = MEMM_4K_ALIGN_MASK + 1;
|
||||||
}
|
}
|
||||||
|
align /= MEMM_PAGE_SIZE;
|
||||||
|
|
||||||
map_pageframe_to(target, physical, user, write, align);
|
map_pageframe_to(target, physical, user, write, align);
|
||||||
|
|
||||||
|
|
Reference in New Issue