From 59b1a2144d40b1c335ed89e0e57c925a4e0754ed Mon Sep 17 00:00:00 2001 From: Christoph Kirsch Date: Mon, 11 Sep 2023 09:34:32 +0200 Subject: [PATCH] Reverting change to highest virtual address --- selfie.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/selfie.c b/selfie.c index 3411bb13..0567b536 100644 --- a/selfie.c +++ b/selfie.c @@ -1527,7 +1527,8 @@ uint64_t PAGETABLETREE = 1; // two-level page table is default uint64_t PHYSICALMEMORYSIZE = 0; // total amount of physical memory available for frames uint64_t PHYSICALMEMORYEXCESS = 2; // tolerate more allocation than physically available -uint64_t HIGHESTVIRTUALADDRESS = 4294967295; // VIRTUALMEMORYSIZE * GIGABYTE - 1 (avoiding 32-bit overflow) +// target-dependent, see init_target() +uint64_t HIGHESTVIRTUALADDRESS = 4294967288; // VIRTUALMEMORYSIZE * GIGABYTE - WORDSIZE // host-dependent, see init_memory() uint64_t NUMBEROFLEAFPTES = 512; // number of leaf page table entries == PAGESIZE / sizeof(uint64_t*) @@ -2641,6 +2642,8 @@ void init_target() { e_ehsize = 52; // elf header size 52 bytes (ELFCLASS32) e_phentsize = 32; // size of program header entry 32 bytes (ELFCLASS32) } + + HIGHESTVIRTUALADDRESS = VIRTUALMEMORYSIZE * GIGABYTE - WORDSIZE; } void turn_on_gc_library(uint64_t period, char* name) { @@ -8530,8 +8533,8 @@ uint64_t virtual_address_of_page(uint64_t page) { } uint64_t is_virtual_address_valid(uint64_t vaddr, uint64_t alignment) { - // is address in range? - if (vaddr <= HIGHESTVIRTUALADDRESS) + // is address virtual? + if (vaddr <= HIGHESTVIRTUALADDRESS + (WORDSIZE - alignment)) // is address aligned? if (vaddr % alignment == 0) return 1;