提交 eb474b86 编写于 作者: O openharmony_ci 提交者: Gitee

!77 Optimization for physics memory

Merge pull request !77 from Harylee/master
......@@ -76,7 +76,12 @@ VOID OsVmPageStartup(VOID)
OsVmPhysAreaSizeAdjust(ROUNDUP((g_vmBootMemBase - KERNEL_ASPACE_BASE), PAGE_SIZE));
nPage = OsVmPhysPageNumGet();
/*
* Pages getting from OsVmPhysPageNumGet() interface here contain the memory
* struct LosVmPage occupied, which satisfies the equation:
* nPage * sizeof(LosVmPage) + nPage * PAGE_SIZE = OsVmPhysPageNumGet() * PAGE_SIZE.
*/
nPage = OsVmPhysPageNumGet() * PAGE_SIZE / (sizeof(LosVmPage) + PAGE_SIZE);
g_vmPageArraySize = nPage * sizeof(LosVmPage);
g_vmPageArray = (LosVmPage *)OsVmBootMemAlloc(g_vmPageArraySize);
......
......@@ -108,12 +108,12 @@ VOID OsVmPhysSegAdd(VOID)
VOID OsVmPhysAreaSizeAdjust(size_t size)
{
INT32 i;
for (i = 0; i < (sizeof(g_physArea) / sizeof(g_physArea[0])); i++) {
g_physArea[i].start += size;
g_physArea[i].size -= size;
}
/*
* The first physics memory segment is used for kernel image and kernel heap,
* so just need to adjust the first one here.
*/
g_physArea[0].start += size;
g_physArea[0].size -= size;
}
UINT32 OsVmPhysPageNumGet(VOID)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册