重构内存分配器、增加中断支持、整理rust运行时环境 #4

Merged
pointer-to-bios merged 39 commits from downstream into main 2024-04-11 00:36:14 +08:00
3 changed files with 52 additions and 39 deletions
Showing only changes of commit c52d9f4960 - Show all commits

View File

@ -250,4 +250,21 @@ extern void reload_pml4();
? MEMM_PAGE_SIZE_2M \
: MEMM_PAGE_SIZE_4K))
/**
* @name memm_page_counter
* @addindex
*
*
*
* @if arch == x86_64
* 使`4KB``2MB``1GB`
* @endif
*/
typedef struct __memm_page_counter
{
usize mapped_4k_page;
usize mapped_2m_page;
usize mapped_1g_page;
} memm_page_counter;
#endif

View File

@ -186,11 +186,7 @@ typedef struct __mem_manager_t
// 已经映射的页数量。若不是最小的页会被视作多个最小页计数。
usize mapped_page_amount;
#ifdef __x86_64__
usize mapped_4k_page;
usize mapped_2m_page;
usize mapped_1g_page;
#endif
memm_page_counter platformed_page_counter;
// 页地图。每个bit都表示这个页是否被映射。
u8 *page_map;

View File

@ -126,11 +126,11 @@ bool memm_map_pageframes_to(
switch (align)
{
case MEMM_PAGE_SIZE_4K:
mm->mapped_4k_page++;
mm->platformed_page_counter.mapped_4k_page++;
case MEMM_PAGE_SIZE_2M:
mm->mapped_2m_page++;
mm->platformed_page_counter.mapped_2m_page++;
case MEMM_PAGE_SIZE_1G:
mm->mapped_1g_page++;
mm->platformed_page_counter.mapped_1g_page++;
}
for (usize i = physical / MEMM_PAGE_SIZE; i < physical / MEMM_PAGE_SIZE + align; i++)
{