1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

set new page table entry before we flush the TLB

This commit is contained in:
Stefan Lankes 2015-08-12 20:58:08 +02:00
parent ecc71937fa
commit 579feaa64f

View file

@ -152,12 +152,19 @@ int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits)
}
}
else { /* PGT */
int8_t flush = 0;
/* do we have to flush the TLB? */
if (self[lvl][vpn] & PG_PRESENT)
flush = 1;
self[lvl][vpn] = phyaddr | bits | PG_PRESENT;
if (flush)
/* There's already a page mapped at this address.
* We have to flush a single TLB entry. */
tlb_flush_one_page(vpn << PAGE_BITS);
self[lvl][vpn] = phyaddr | bits | PG_PRESENT;
phyaddr += PAGE_SIZE;
}
}