mem,sim: Get the page size from the page table in SE mode.

The page table already knows the size of a page without having to
directly use any ISA specific constants.

Change-Id: I68b575e194697065620a2097d972076886766f74
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34172
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Gabe Black
2020-10-21 04:32:39 -07:00
parent 5bedc520fe
commit 22e27e1d61
7 changed files with 41 additions and 39 deletions

View File

@@ -319,7 +319,7 @@ Process::drain()
void
Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
{
int npages = divCeil(size, (int64_t)system->getPageBytes());
int npages = divCeil(size, pTable->pageSize());
Addr paddr = system->allocPhysPages(npages);
pTable->map(vaddr, paddr, size,
clobber ? EmulationPageTable::Clobber :
@@ -334,15 +334,14 @@ Process::replicatePage(Addr vaddr, Addr new_paddr, ThreadContext *old_tc,
new_paddr = system->allocPhysPages(1);
// Read from old physical page.
uint8_t *buf_p = new uint8_t[system->getPageBytes()];
old_tc->getVirtProxy().readBlob(vaddr, buf_p, system->getPageBytes());
uint8_t buf_p[pTable->pageSize()];
old_tc->getVirtProxy().readBlob(vaddr, buf_p, sizeof(buf_p));
// Create new mapping in process address space by clobbering existing
// mapping (if any existed) and then write to the new physical page.
bool clobber = true;
pTable->map(vaddr, new_paddr, system->getPageBytes(), clobber);
new_tc->getVirtProxy().writeBlob(vaddr, buf_p, system->getPageBytes());
delete[] buf_p;
pTable->map(vaddr, new_paddr, sizeof(buf_p), clobber);
new_tc->getVirtProxy().writeBlob(vaddr, buf_p, sizeof(buf_p));
}
bool
@@ -443,7 +442,7 @@ Process::updateBias()
// Determine how large the interpreters footprint will be in the process
// address space.
Addr interp_mapsize = roundUp(interp->mapSize(), system->getPageBytes());
Addr interp_mapsize = roundUp(interp->mapSize(), pTable->pageSize());
// We are allocating the memory area; set the bias to the lowest address
// in the allocated memory region.