Skip to content

Commit

Permalink
Reverting change to highest virtual address
Browse files Browse the repository at this point in the history
  • Loading branch information
ckirsch committed Sep 11, 2023
1 parent 7f2c101 commit 59b1a21
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions selfie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 59b1a21

Please sign in to comment.