From e1ac9629398027186ef4c2a66772aeff2b4c6792 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Wed, 3 Sep 2014 07:42:21 -0400 Subject: arch: Cleanup unused ISA traits constants This patch prunes unused values, and also unifies how the values are defined (not using an enum for ALPHA), aligning the use of int vs Addr etc. The patch also removes the duplication of PageBytes/PageShift and VMPageSize/LogVMPageSize. For all ISAs the two pairs had identical values and the latter has been removed. --- src/sim/process.cc | 4 ++-- src/sim/syscall_emul.cc | 12 ++++++------ src/sim/syscall_emul.hh | 10 +++++----- src/sim/system.cc | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/sim') diff --git a/src/sim/process.cc b/src/sim/process.cc index a738908e1..2ca1f1531 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -334,7 +334,7 @@ Process::sim_fd_obj(int tgt_fd) void Process::allocateMem(Addr vaddr, int64_t size, bool clobber) { - int npages = divCeil(size, (int64_t)VMPageSize); + int npages = divCeil(size, (int64_t)PageBytes); Addr paddr = system->allocPhysPages(npages); pTable->map(vaddr, paddr, size, clobber); } @@ -345,7 +345,7 @@ Process::fixupStackFault(Addr vaddr) // Check if this is already on the stack and there's just no page there // yet. if (vaddr >= stack_min && vaddr < stack_base) { - allocateMem(roundDown(vaddr, VMPageSize), VMPageSize); + allocateMem(roundDown(vaddr, PageBytes), PageBytes); return true; } diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index fa18b910f..13ea784e5 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -148,7 +148,7 @@ exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) { - return (int)VMPageSize; + return (int)PageBytes; } @@ -167,9 +167,9 @@ brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) if (new_brk > p->brk_point) { // might need to allocate some new pages for (ChunkGenerator gen(p->brk_point, new_brk - p->brk_point, - VMPageSize); !gen.done(); gen.next()) { + PageBytes); !gen.done(); gen.next()) { if (!p->pTable->translate(gen.addr())) - p->allocateMem(roundDown(gen.addr(), VMPageSize), VMPageSize); + p->allocateMem(roundDown(gen.addr(), PageBytes), PageBytes); // if the address is already there, zero it out else { @@ -177,14 +177,14 @@ brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SETranslatingPortProxy &tp = tc->getMemProxy(); // split non-page aligned accesses - Addr next_page = roundUp(gen.addr(), VMPageSize); + Addr next_page = roundUp(gen.addr(), PageBytes); uint32_t size_needed = next_page - gen.addr(); tp.memsetBlob(gen.addr(), zero, size_needed); - if (gen.addr() + VMPageSize > next_page && + if (gen.addr() + PageBytes > next_page && next_page < new_brk && p->pTable->translate(next_page)) { - size_needed = VMPageSize - size_needed; + size_needed = PageBytes - size_needed; tp.memsetBlob(next_page, zero, size_needed); } } diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index e971902cb..66c12f07d 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -822,9 +822,9 @@ mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext * if (use_provided_address) provided_address = process->getSyscallArg(tc, index); - if ((start % TheISA::VMPageSize != 0) || - (new_length % TheISA::VMPageSize != 0) || - (provided_address % TheISA::VMPageSize != 0)) { + if ((start % TheISA::PageBytes != 0) || + (new_length % TheISA::PageBytes != 0) || + (provided_address % TheISA::PageBytes != 0)) { warn("mremap failing: arguments not page aligned"); return -EINVAL; } @@ -1226,8 +1226,8 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } } - if ((start % TheISA::VMPageSize) != 0 || - (length % TheISA::VMPageSize) != 0) { + if ((start % TheISA::PageBytes) != 0 || + (length % TheISA::PageBytes) != 0) { warn("mmap failing: arguments not page-aligned: " "start 0x%x length 0x%x", start, length); diff --git a/src/sim/system.cc b/src/sim/system.cc index 9cd79cac0..ffab19c99 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -317,9 +317,9 @@ System::replaceThreadContext(ThreadContext *tc, int context_id) Addr System::allocPhysPages(int npages) { - Addr return_addr = pagePtr << LogVMPageSize; + Addr return_addr = pagePtr << PageShift; pagePtr += npages; - if ((pagePtr << LogVMPageSize) > physmem.totalSize()) + if ((pagePtr << PageShift) > physmem.totalSize()) fatal("Out of memory, please increase size of physical memory."); return return_addr; } @@ -333,7 +333,7 @@ System::memSize() const Addr System::freeMemSize() const { - return physmem.totalSize() - (pagePtr << LogVMPageSize); + return physmem.totalSize() - (pagePtr << PageShift); } bool -- cgit v1.2.3