Skip to content

Commit

Permalink
arm-a/shm: fix issue when use shm in arm-a
Browse files Browse the repository at this point in the history
When the l1entry first add to shm, mssing l1entry add.
shm mmu flags should use udata flags.
l1entry record in shm[] and should not use ~SECTION_MASK

Signed-off-by: buxiasen <[email protected]>
  • Loading branch information
jasonbu authored and acassis committed Feb 15, 2025
1 parent 71888c5 commit af0aa78
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arch/arm/src/armv7-a/arm_addrenv_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,18 @@ int up_shmat(uintptr_t *pages, unsigned int npages, uintptr_t vaddr)
/* Initialize the page table */

memset(l2table, 0, ENTRIES_PER_L2TABLE * sizeof(uint32_t));

/* In case first time set shm l1 entry */

mmu_l1_setentry(paddr, vaddr, MMU_L1_PGTABFLAGS);
}
else
{
/* Get the physical address of the L2 page table from the L1 page
* table entry.
*/

paddr = (uintptr_t)l1entry & ~SECTION_MASK;
paddr = (uintptr_t)l1entry;
flags = enter_critical_section();

/* Get the virtual address corresponding to the physical page\
Expand All @@ -148,7 +152,7 @@ int up_shmat(uintptr_t *pages, unsigned int npages, uintptr_t vaddr)
DEBUGASSERT(get_l2_entry(l2table, vaddr) == 0);

paddr = *pages++;
set_l2_entry(l2table, paddr, vaddr, MMU_MEMFLAGS);
set_l2_entry(l2table, paddr, vaddr, MMU_L2_UDATAFLAGS);
nmapped++;
vaddr += MM_PGSIZE;

Expand Down Expand Up @@ -224,7 +228,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages)
* table entry.
*/

paddr = (uintptr_t)l1entry & ~SECTION_MASK;
paddr = (uintptr_t)l1entry;
flags = enter_critical_section();

/* Get the virtual address corresponding to the physical page
Expand Down

0 comments on commit af0aa78

Please sign in to comment.