Fix mapping issue

This commit is contained in:
Mathieu Maret 2021-11-02 22:33:04 +01:00
parent 7b60e1bdac
commit ebc90d3f06

View File

@ -162,7 +162,8 @@ int pageMap(vaddr_t vaddr, paddr_t paddr, int flags)
__native_flush_tlb_single((vaddr_t)pt); __native_flush_tlb_single((vaddr_t)pt);
memset((void *)pt, 0, PAGE_SIZE); memset((void *)pt, 0, PAGE_SIZE);
} else { }
{
// Already mapped ? Remove old mapping // Already mapped ? Remove old mapping
if (pt[ptEntry].present) { if (pt[ptEntry].present) {
@ -223,7 +224,7 @@ paddr_t pagingGetPaddr(vaddr_t vaddr)
/* Get the page directory entry and table entry index for this /* Get the page directory entry and table entry index for this
address */ address */
unsigned pdEntry = vaddr >> PD_SHIFT; unsigned pdEntry = vaddr >> PD_SHIFT;
unsigned ptEntry = vaddr >> PT_SHIFT; unsigned ptEntry = vaddr >> PT_SHIFT & PTE_MASK;
unsigned pageOffset = vaddr & PAGE_MASK; unsigned pageOffset = vaddr & PAGE_MASK;
// Thank to mirroring, we can access the PD // Thank to mirroring, we can access the PD