mm: fix pagetable calculation in get_physaddr & map_page
This commit is contained in:
@@ -78,7 +78,7 @@ void *get_physaddr(void *virtualaddr) {
|
|||||||
unsigned long *pd = (unsigned long *)0xFFFFF000;
|
unsigned long *pd = (unsigned long *)0xFFFFF000;
|
||||||
// Here you need to check whether the PD entry is present.
|
// Here you need to check whether the PD entry is present.
|
||||||
|
|
||||||
unsigned long *pt = ((unsigned long *)0xFFC00000) + (0x400 * pdindex);
|
uint32_t *pt = (uint32_t*)(0xFFC00000 + (pdindex << 12));
|
||||||
// Here you need to check whether the PT entry is present.
|
// Here you need to check whether the PT entry is present.
|
||||||
|
|
||||||
return (void *)((pt[ptindex] & ~0xFFF) + ((unsigned long)virtualaddr & 0xFFF));
|
return (void *)((pt[ptindex] & ~0xFFF) + ((unsigned long)virtualaddr & 0xFFF));
|
||||||
@@ -109,7 +109,7 @@ void map_page(void *physaddr, void *virtualaddr, unsigned int flags) {
|
|||||||
pd[pdindex] = (uint32_t)new_pt | (flags & 0x7); // Add User bit if needed
|
pd[pdindex] = (uint32_t)new_pt | (flags & 0x7); // Add User bit if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long *pt = ((unsigned long *)0xFFC00000) + (0x400 * pdindex);
|
uint32_t *pt = (uint32_t*)(0xFFC00000 + (pdindex << 12));
|
||||||
// Here you need to check whether the PT entry is present.
|
// Here you need to check whether the PT entry is present.
|
||||||
// When it is, then there is already a mapping present. What do you do now?
|
// When it is, then there is already a mapping present. What do you do now?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user