[smart] feat: add unmap for null mapper (#9186)

Do unmap before shrink so we don't see mapped entry on page table
insertion, which is not acceptable for riscv implementation of
architecture porting.

Changes:
- add un-mapping of pte on `_null_shrink()`

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell 2024-07-16 20:38:55 +08:00 committed by GitHub
parent d8294de640
commit 1d78d11567
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 0 deletions

View File

@ -70,11 +70,29 @@ static void _null_page_fault(struct rt_varea *varea,
static rt_err_t _null_shrink(rt_varea_t varea, void *new_start, rt_size_t size) static rt_err_t _null_shrink(rt_varea_t varea, void *new_start, rt_size_t size)
{ {
char *varea_start = varea->start;
void *rm_start;
void *rm_end;
if (varea_start == (char *)new_start)
{
rm_start = varea_start + size;
rm_end = varea_start + varea->size;
}
else /* if (varea_start < (char *)new_start) */
{
RT_ASSERT(varea_start < (char *)new_start);
rm_start = varea_start;
rm_end = new_start;
}
rt_varea_unmap_range(varea, rm_start, rm_end - rm_start);
return RT_EOK; return RT_EOK;
} }
static rt_err_t _null_split(struct rt_varea *existed, void *unmap_start, rt_size_t unmap_len, struct rt_varea *subset) static rt_err_t _null_split(struct rt_varea *existed, void *unmap_start, rt_size_t unmap_len, struct rt_varea *subset)
{ {
rt_varea_unmap_range(existed, unmap_start, unmap_len);
return RT_EOK; return RT_EOK;
} }