mem: change TO_PHYS and TO_VIRT
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
8d2cb24237
commit
569f24aea1
3 changed files with 6 additions and 7 deletions
|
|
@ -35,7 +35,7 @@ static void mem_init_zones()
|
|||
|
||||
if (usable) {
|
||||
struct mem_zone *zone;
|
||||
vaddr_t zone_vbase = TO_VIRT(ent->base);
|
||||
vaddr_t zone_vbase = (vaddr_t)TO_VIRT(ent->base);
|
||||
if (last_usable && last->virt_base + last->len == zone_vbase) {
|
||||
zone = &zones[n_zones - 1];
|
||||
zone->len += ent->length;
|
||||
|
|
|
|||
|
|
@ -114,21 +114,21 @@ static void map_hhdm_zones(pgd_t *pgd_table)
|
|||
device_base = hhdm_end;
|
||||
|
||||
for (paddr_t p = 0; p < top_paddr; p += 0x200000) {
|
||||
vaddr_t v = TO_VIRT(p);
|
||||
vaddr_t v =(vaddr_t) TO_VIRT(p);
|
||||
|
||||
pgd_t *pgd_entry = &pgd_table[pgd_index(v)];
|
||||
if (!(pgd_entry->pgd & PAGE_PRESENT)) {
|
||||
pgd_entry->pgd = TO_PHYS((u64)pt_alloc()) | PAGE_PRESENT | PAGE_RW;
|
||||
}
|
||||
|
||||
pud_t *pud_table = (pud_t *)TO_VIRT(pgd_entry->pgd & PAGE_MASK);
|
||||
pud_t *pud_table = TO_VIRT(pgd_entry->pgd & PAGE_MASK);
|
||||
pud_t *pud_entry = &pud_table[pud_index(v)];
|
||||
if (!(pud_entry->pud & PAGE_PRESENT)) {
|
||||
pud_entry->pud = TO_PHYS((u64)pt_alloc()) | PAGE_PRESENT | PAGE_RW;
|
||||
}
|
||||
|
||||
/* use PAGE_PS for 2MB pages */
|
||||
pmd_t *pmd_table = (pmd_t *)TO_VIRT(pud_entry->pud & PAGE_MASK);
|
||||
pmd_t *pmd_table = TO_VIRT(pud_entry->pud & PAGE_MASK);
|
||||
pmd_t *pmd_entry = &pmd_table[pmd_index(v)];
|
||||
|
||||
pmd_entry->pmd = p | PAGE_PRESENT | PAGE_RW | PAGE_PS;
|
||||
|
|
|
|||
Loading…
Reference in a new issue