summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-09-03 07:42:21 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-09-03 07:42:21 -0400
commite1ac9629398027186ef4c2a66772aeff2b4c6792 (patch)
tree69a2591a576690aeafca28eef2374b20b76d7c3c /src/sim
parent23c85407562c3e2e2f3e1ca8b8dcbdc38fac82df (diff)
downloadgem5-e1ac9629398027186ef4c2a66772aeff2b4c6792.tar.xz
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.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc4
-rw-r--r--src/sim/syscall_emul.cc12
-rw-r--r--src/sim/syscall_emul.hh10
-rw-r--r--src/sim/system.cc6
4 files changed, 16 insertions, 16 deletions
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