diff options
| author | Shell <[email protected]> | 2023-11-30 22:00:54 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-30 22:00:54 +0800 |
| commit | c87872c9c7994e0317530ea5a8f9d4e7d3f95517 (patch) | |
| tree | 79d645c5e65a166561c008bb171d60eb19aad3b1 | |
| parent | 6c48d53636471a2aaaffae80312a2e7220aa7b0b (diff) | |
[mm] Bugs fix for page_install on shadow region (#8308)
Signed-off-by: Shell <[email protected]>
| -rw-r--r-- | components/mm/mm_page.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/components/mm/mm_page.c b/components/mm/mm_page.c index e7b408d2c1..cc46ed46da 100644 --- a/components/mm/mm_page.c +++ b/components/mm/mm_page.c @@ -9,6 +9,7 @@ * 2022-12-13 WangXiaoyao Hot-pluggable, extensible * page management algorithm * 2023-02-20 WangXiaoyao Multi-list page-management + * 2023-11-28 Shell Bugs fix for page_install on shadow region */ #include <rtthread.h> @@ -862,11 +863,16 @@ static int _load_mpr_area(void *head, void *tail) int rt_page_install(rt_region_t region) { int err = -RT_EINVAL; + rt_region_t shadow; + void *head, *tail; + if (region.end != region.start && !(region.start & ARCH_PAGE_MASK) && !(region.end & ARCH_PAGE_MASK)) { - void *head = addr_to_page(page_start, (void *)region.start); - void *tail = addr_to_page(page_start, (void *)region.end); + shadow.start = region.start & ~shadow_mask; + shadow.end = FLOOR(region.end, shadow_mask + 1); + head = addr_to_page(page_start, (void *)shadow.start); + tail = addr_to_page(page_start, (void *)shadow.end); page_nr += ((region.end - region.start) >> ARCH_PAGE_SHIFT); |
