Skip to content

Commit

Permalink
[mm] Bugs fix for page_install on shadow region (#8308)
Browse files Browse the repository at this point in the history
Signed-off-by: Shell <[email protected]>
  • Loading branch information
polarvid committed Nov 30, 2023
1 parent 6c48d53 commit c87872c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/mm/mm_page.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit c87872c

Please sign in to comment.