From a64f3588ff5da7f148659ccb0eff844ccfb57088 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 23 Dec 2021 19:18:07 +0200 Subject: Fixups to four previous commits + Christ, I'm shit at git etiquette --- arch/riscv/kernel/vmem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'arch/riscv/kernel/vmem.c') diff --git a/arch/riscv/kernel/vmem.c b/arch/riscv/kernel/vmem.c index 80644bd..bf49716 100644 --- a/arch/riscv/kernel/vmem.c +++ b/arch/riscv/kernel/vmem.c @@ -97,11 +97,6 @@ void map_vmem(struct vm_branch_t *branch, while (top != order) { size_t idx = vm_to_index(vaddr, top); - if (is_branch(branch->leaf[idx])){ - __destroy_branch(branch->leaf[idx]); - branch->leaf[idx] = 0; - } - if (!branch->leaf[idx]) branch->leaf[idx] = __create_leaf(); @@ -111,6 +106,9 @@ void map_vmem(struct vm_branch_t *branch, } size_t idx = vm_to_index(vaddr, top); + if (is_branch(branch->leaf[idx])) /* something has gone terribly wrong */ + __destroy_branch(branch->leaf[idx]); + branch->leaf[idx] = (struct vm_branch_t *)to_pte(paddr, flags); } -- cgit v1.3