From dd07a083882bb70315311fbacca452492c17803f Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 10 Jun 2023 11:06:41 -0400 Subject: [PATCH] Fix A1 allocator to map the correct pages --- src/hulk/hurl/a1.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hulk/hurl/a1.d b/src/hulk/hurl/a1.d index 9a9c483..f7bf2c5 100644 --- a/src/hulk/hurl/a1.d +++ b/src/hulk/hurl/a1.d @@ -35,17 +35,17 @@ struct A1 ulong address = Hurl.A1_BASE + allocated; - ulong mapped_limit = round_up_power_2(address, PAGE_SIZE); + ulong current_limit = round_up_power_2(address, PAGE_SIZE); allocated += size; ulong desired_limit = round_up_power_2(Hurl.A1_BASE + allocated, PAGE_SIZE); - while (desired_limit > mapped_limit) + while (desired_limit > current_limit) { void * page = Hippo.allocate_page(); - Hurl.map(Hurl.A1_BASE + mapped_limit, page, PT_WRITABLE); - mapped_limit += PAGE_SIZE; + Hurl.map(current_limit, page, PT_WRITABLE); + current_limit += PAGE_SIZE; } return cast(void *)address;