diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/alpha/isa_traits.hh --- a/src/arch/alpha/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/alpha/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -109,19 +109,7 @@ mode_number // number of modes }; -// Constants Related to the number of registers - -enum { - LogVMPageSize = 13, // 8K bytes - VMPageSize = (1 << LogVMPageSize), - - BranchPredAddrShiftAmt = 2, // instructions are 4-byte aligned - - MachineBytes = 8, - WordBytes = 4, - HalfwordBytes = 2, - ByteBytes = 1 -}; +const int MachineBytes = 8; // return a no-op instruction... used for instruction fetch faults // Alpha UNOP (ldq_u r31,0(r0)) diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/alpha/process.cc --- a/src/arch/alpha/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/alpha/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -49,7 +49,7 @@ : LiveProcess(params, objFile) { brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set up stack. On Alpha, stack goes below text section. This // code should get moved to some architecture-specific spot. @@ -83,7 +83,7 @@ // seem to be a problem. // check out _dl_aux_init() in glibc/elf/dl-support.c for details // --Lisa - auxv.push_back(auxv_t(M5_AT_PAGESZ, AlphaISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, AlphaISA::PageBytes)); auxv.push_back(auxv_t(M5_AT_CLKTCK, 100)); auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable())); DPRINTF(Loader, "auxv at PHDR %08p\n", elfObject->programHeaderTable()); @@ -193,7 +193,7 @@ LiveProcess::initState(); - argsInit(MachineBytes, VMPageSize); + argsInit(MachineBytes, PageBytes); ThreadContext *tc = system->getThreadContext(contextIds[0]); tc->setIntReg(GlobalPointerReg, objFile->globalPointer()); diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/arm/isa_traits.hh --- a/src/arch/arm/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/arm/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -51,8 +51,6 @@ namespace LittleEndianGuest {} -#define TARGET_ARM - namespace ArmISA { using namespace LittleEndianGuest; @@ -101,16 +99,7 @@ // return a no-op instruction... used for instruction fetch faults const ExtMachInst NoopMachInst = 0x01E320F000ULL; - const int LogVMPageSize = 12; // 4K bytes - const int VMPageSize = (1 << LogVMPageSize); - - // Shouldn't this be 1 because of Thumb?! Dynamic? --Ali - const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned - const int MachineBytes = 4; - const int WordBytes = 4; - const int HalfwordBytes = 2; - const int ByteBytes = 1; const uint32_t HighVecs = 0xFFFF0000; diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/arm/process.cc --- a/src/arch/arm/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/arm/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -74,7 +74,7 @@ // Set up break point (Top of Heap) brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set up region for mmaps. For now, start at bottom of kuseg space. mmap_start = mmap_end = 0x40000000L; @@ -91,7 +91,7 @@ // Set up break point (Top of Heap) brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set up region for mmaps. For now, start at bottom of kuseg space. mmap_start = mmap_end = 0x4000000000L; @@ -101,7 +101,7 @@ ArmLiveProcess32::initState() { LiveProcess::initState(); - argsInit(VMPageSize, INTREG_SP); + argsInit(PageBytes, INTREG_SP); for (int i = 0; i < contextIds.size(); i++) { ThreadContext * tc = system->getThreadContext(contextIds[i]); CPACR cpacr = tc->readMiscReg(MISCREG_CPACR); @@ -120,7 +120,7 @@ ArmLiveProcess64::initState() { LiveProcess::initState(); - argsInit(VMPageSize, INTREG_SP0); + argsInit(PageBytes, INTREG_SP0); for (int i = 0; i < contextIds.size(); i++) { ThreadContext * tc = system->getThreadContext(contextIds[i]); CPSR cpsr = tc->readMiscReg(MISCREG_CPSR); @@ -203,7 +203,7 @@ //XXX Figure out what these should be auxv.push_back(auxv_t(M5_AT_HWCAP, features)); //The system page size - auxv.push_back(auxv_t(M5_AT_PAGESZ, ArmISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, ArmISA::PageBytes)); //Frequency at which times() increments auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); // For statically linked executables, this is the virtual address of the diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/arm/utility.cc --- a/src/arch/arm/utility.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/arm/utility.cc Thu Aug 28 17:52:32 2014 +0100 @@ -85,6 +85,7 @@ } } else { if (size == (uint16_t)(-1)) + // todo: should this not be sizeof(uint32_t) rather? size = ArmISA::MachineBytes; if (number < NumArgumentRegs) { diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/mips/isa_traits.hh --- a/src/arch/mips/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/mips/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -145,16 +145,6 @@ // return a no-op instruction... used for instruction fetch faults const ExtMachInst NoopMachInst = 0x00000000; -const int LogVMPageSize = 13; // 8K bytes -const int VMPageSize = (1 << LogVMPageSize); - -const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned - -const int MachineBytes = 4; -const int WordBytes = 4; -const int HalfwordBytes = 2; -const int ByteBytes = 1; - const int ANNOTE_NONE = 0; const uint32_t ITOUCH_ANNOTE = 0xffffffff; diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/mips/process.cc --- a/src/arch/mips/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/mips/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -58,7 +58,7 @@ // Set up break point (Top of Heap) brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set up region for mmaps. Start it 1GB above the top of the heap. mmap_start = mmap_end = brk_point + 0x40000000L; @@ -69,7 +69,7 @@ { LiveProcess::initState(); - argsInit(VMPageSize); + argsInit(PageBytes); } template @@ -88,7 +88,7 @@ if (elfObject) { // Set the system page size - auxv.push_back(auxv_t(M5_AT_PAGESZ, MipsISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, MipsISA::PageBytes)); // Set the frequency at which time() increments auxv.push_back(auxv_t(M5_AT_CLKTCK, 100)); // For statically linked executables, this is the virtual diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/null/isa_traits.hh --- a/src/arch/null/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/null/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -51,9 +51,6 @@ const Addr PageShift = 12; const Addr PageBytes = ULL(1) << PageShift; - const int LogVMPageSize = 12; // 4K bytes - const int VMPageSize = (1 << LogVMPageSize); - } #endif //__ARCH_NULL_ISA_TRAITS_HH__ diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/power/isa_traits.hh --- a/src/arch/power/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/power/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -61,9 +61,6 @@ const Addr NPtePage = ULL(1) << NPtePageShift; const Addr PteMask = NPtePage - 1; -const int LogVMPageSize = 12; // 4K bytes -const int VMPageSize = (1 << LogVMPageSize); - const int MachineBytes = 4; // This is ori 0, 0, 0 diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/power/process.cc --- a/src/arch/power/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/power/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -56,7 +56,7 @@ // Set up break point (Top of Heap) brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set up region for mmaps. For now, start at bottom of kuseg space. mmap_start = mmap_end = 0x70000000L; @@ -67,7 +67,7 @@ { Process::initState(); - argsInit(MachineBytes, VMPageSize); + argsInit(MachineBytes, PageBytes); } void @@ -98,7 +98,7 @@ //XXX Figure out what these should be auxv.push_back(auxv_t(M5_AT_HWCAP, features)); //The system page size - auxv.push_back(auxv_t(M5_AT_PAGESZ, PowerISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, PowerISA::PageBytes)); //Frequency at which times() increments auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); // For statically linked executables, this is the virtual address of the diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/sparc/isa_traits.hh --- a/src/arch/sparc/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/sparc/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -41,8 +41,6 @@ namespace SparcISA { -const int MachineBytes = 8; - // This makes sure the big endian versions of certain functions are used. using namespace BigEndianGuest; @@ -52,21 +50,13 @@ // SPARC NOP (sethi %(hi(0), g0) const MachInst NoopMachInst = 0x01000000; -// 8K. This value is implmentation specific; and should probably -// be somewhere else. -const int LogVMPageSize = 13; -const int VMPageSize = (1 << LogVMPageSize); - // real address virtual mapping // sort of like alpha super page, but less frequently used const Addr SegKPMEnd = ULL(0xfffffffc00000000); const Addr SegKPMBase = ULL(0xfffffac000000000); -// Why does both the previous set of constants and this one exist? -const int PageShift = 13; -const int PageBytes = 1ULL << PageShift; - -const int BranchPredAddrShiftAmt = 2; +const Addr PageShift = 13; +const Addr PageBytes = ULL(1) << PageShift; StaticInstPtr decodeInst(ExtMachInst); diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/sparc/process.cc --- a/src/arch/sparc/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/sparc/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -57,7 +57,7 @@ // XXX all the below need to be updated for SPARC - Ali brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); // Set pointer for next thread stack. Reserve 8M for main stack. next_thread_stack_base = stack_base - (8 * 1024 * 1024); @@ -166,7 +166,7 @@ pstate.am = 1; tc->setMiscReg(MISCREG_PSTATE, pstate); - argsInit(32 / 8, VMPageSize); + argsInit(32 / 8, PageBytes); } void @@ -180,7 +180,7 @@ pstate.ie = 1; tc->setMiscReg(MISCREG_PSTATE, pstate); - argsInit(sizeof(IntReg), VMPageSize); + argsInit(sizeof(IntReg), PageBytes); } template @@ -234,7 +234,7 @@ // Bits which describe the system hardware capabilities auxv.push_back(auxv_t(M5_AT_HWCAP, hwcap)); // The system page size - auxv.push_back(auxv_t(M5_AT_PAGESZ, SparcISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, SparcISA::PageBytes)); // Defined to be 100 in the kernel source. // Frequency at which times() increments auxv.push_back(auxv_t(M5_AT_CLKTCK, 100)); diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/x86/isa_traits.hh --- a/src/arch/x86/isa_traits.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/x86/isa_traits.hh Thu Aug 28 17:52:32 2014 +0100 @@ -59,14 +59,8 @@ //XXX This needs to be set to an intermediate instruction struct //which encodes this instruction - //4k. This value is not constant on x86. - const int LogVMPageSize = 12; - const int VMPageSize = (1 << LogVMPageSize); - - const int PageShift = 12; - const int PageBytes = 1ULL << PageShift; - - const int BranchPredAddrShiftAmt = 0; + const Addr PageShift = 12; + const Addr PageBytes = ULL(1) << PageShift; // Memory accesses can be unaligned const bool HasUnalignedMemAcc = true; diff -r 1e963c0e3020 -r b7ac68974f7c src/arch/x86/process.cc --- a/src/arch/x86/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/arch/x86/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -86,7 +86,7 @@ numSyscallDescs(_numSyscallDescs) { brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, VMPageSize); + brk_point = roundUp(brk_point, PageBytes); } X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params, @@ -96,7 +96,7 @@ { vsyscallPage.base = 0xffffffffff600000ULL; - vsyscallPage.size = VMPageSize; + vsyscallPage.size = PageBytes; vsyscallPage.vtimeOffset = 0x400; vsyscallPage.vgettimeofdayOffset = 0x0; @@ -133,10 +133,10 @@ X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs) { _gdtStart = ULL(0xffffd000); - _gdtSize = VMPageSize; + _gdtSize = PageBytes; vsyscallPage.base = 0xffffe000ULL; - vsyscallPage.size = VMPageSize; + vsyscallPage.size = PageBytes; vsyscallPage.vsyscallOffset = 0x400; vsyscallPage.vsysexitOffset = 0x410; @@ -163,7 +163,7 @@ { X86LiveProcess::initState(); - argsInit(sizeof(uint64_t), VMPageSize); + argsInit(sizeof(uint64_t), PageBytes); // Set up the vsyscall page for this process. allocateMem(vsyscallPage.base, vsyscallPage.size); @@ -258,7 +258,7 @@ { X86LiveProcess::initState(); - argsInit(sizeof(uint32_t), VMPageSize); + argsInit(sizeof(uint32_t), PageBytes); /* * Set up a GDT for this process. The whole GDT wouldn't really be for @@ -474,7 +474,7 @@ //XXX Figure out what these should be auxv.push_back(auxv_t(M5_AT_HWCAP, features)); //The system page size - auxv.push_back(auxv_t(M5_AT_PAGESZ, X86ISA::VMPageSize)); + auxv.push_back(auxv_t(M5_AT_PAGESZ, X86ISA::PageBytes)); //Frequency at which times() increments //Defined to be 100 in the kernel source. auxv.push_back(auxv_t(M5_AT_CLKTCK, 100)); diff -r 1e963c0e3020 -r b7ac68974f7c src/kern/tru64/tru64.hh --- a/src/kern/tru64/tru64.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/kern/tru64/tru64.hh Thu Aug 28 17:52:32 2014 +0100 @@ -548,8 +548,8 @@ process->next_thread_stack_base -= stack_size; } - Addr rounded_stack_base = roundDown(stack_base, VMPageSize); - Addr rounded_stack_size = roundUp(stack_size, VMPageSize); + Addr rounded_stack_base = roundDown(stack_base, PageBytes); + Addr rounded_stack_size = roundUp(stack_size, PageBytes); DPRINTF(SyscallVerbose, "stack_create: allocating stack @ %#x size %#x " @@ -675,9 +675,9 @@ *configptr_ptr = htog(config_addr); // Register this as a valid address range with the process - base_addr = roundDown(base_addr, VMPageSize); + base_addr = roundDown(base_addr, PageBytes); int size = cur_addr - base_addr; - process->allocateMem(base_addr, roundUp(size, VMPageSize)); + process->allocateMem(base_addr, roundUp(size, PageBytes)); config.copyOut(tc->getMemProxy()); slot_state.copyOut(tc->getMemProxy()); diff -r 1e963c0e3020 -r b7ac68974f7c src/mem/cache/prefetch/base.cc --- a/src/mem/cache/prefetch/base.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/mem/cache/prefetch/base.cc Thu Aug 28 17:52:32 2014 +0100 @@ -312,7 +312,7 @@ bool BasePrefetcher::samePage(Addr a, Addr b) { - return roundDown(a, TheISA::VMPageSize) == roundDown(b, TheISA::VMPageSize); + return roundDown(a, TheISA::PageBytes) == roundDown(b, TheISA::PageBytes); } diff -r 1e963c0e3020 -r b7ac68974f7c src/mem/multi_level_page_table_impl.hh --- a/src/mem/multi_level_page_table_impl.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/mem/multi_level_page_table_impl.hh Thu Aug 28 17:52:32 2014 +0100 @@ -74,13 +74,13 @@ /* setting first level of the page table */ uint64_t log_req_size = floorLog2(sizeof(PageTableEntry)) + logLevelSize[numLevels-1]; - assert(log_req_size >= LogVMPageSize); - uint64_t npages = 1 << (log_req_size - LogVMPageSize); + assert(log_req_size >= PageShift); + uint64_t npages = 1 << (log_req_size - PageShift); Addr paddr = system->allocPhysPages(npages); PortProxy &p = system->physProxy; - p.memsetBlob(paddr, 0, npages << LogVMPageSize); + p.memsetBlob(paddr, 0, npages << PageShift); } @@ -93,7 +93,7 @@ Addr level_base = basePtr; for (int i = numLevels - 1; i > 0; i--) { - Addr entry_addr = (level_base<physProxy; @@ -106,16 +106,16 @@ uint64_t log_req_size = floorLog2(sizeof(PageTableEntry)) + logLevelSize[i-1]; - assert(log_req_size >= LogVMPageSize); - uint64_t npages = 1 << (log_req_size - LogVMPageSize); + assert(log_req_size >= PageShift); + uint64_t npages = 1 << (log_req_size - PageShift); DPRINTF(MMU, "Allocating %d pages needed for entry in level %d\n", npages, i-1); /* allocate new entry */ Addr next_entry_paddr = system->allocPhysPages(npages); - p.memsetBlob(next_entry_paddr, 0, npages << LogVMPageSize); + p.memsetBlob(next_entry_paddr, 0, npages << PageShift); - next_entry_pnum = next_entry_paddr >> LogVMPageSize; + next_entry_pnum = next_entry_paddr >> PageShift; pTableISAOps.setPnum(entry, next_entry_pnum); pTableISAOps.setPTEFields(entry); p.write(entry_addr, entry); @@ -125,7 +125,7 @@ level_base = next_entry_pnum; } - PTE_addr = (level_base<(PTE_addr); Addr entry_paddr = pTableISAOps.getPnum(PTE); if (!clobber && entry_paddr == 0) { - pTableISAOps.setPnum(PTE, paddr >> LogVMPageSize); + pTableISAOps.setPnum(PTE, paddr >> PageShift); pTableISAOps.setPTEFields(PTE); p.write(PTE_addr, PTE); DPRINTF(MMU, "New mapping: %#x-%#x\n", vaddr, paddr); @@ -193,7 +193,7 @@ walk(new_vaddr, true, new_PTE_addr); PageTableEntry new_PTE = p.read(new_PTE_addr); - pTableISAOps.setPnum(new_PTE, paddr>>LogVMPageSize); + pTableISAOps.setPnum(new_PTE, paddr>>PageShift); pTableISAOps.setPTEFields(new_PTE); p.write(new_PTE_addr, new_PTE); DPRINTF(MMU, "Remapping: %#x-%#x\n", vaddr, new_PTE_addr); @@ -285,7 +285,7 @@ if (pnum == 0) return false; - entry = TlbEntry(pid, vaddr, pnum << LogVMPageSize); + entry = TlbEntry(pid, vaddr, pnum << PageShift); updateCache(page_addr, entry); } else { return false; diff -r 1e963c0e3020 -r b7ac68974f7c src/mem/page_table.hh --- a/src/mem/page_table.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/mem/page_table.hh Thu Aug 28 17:52:32 2014 +0100 @@ -73,7 +73,7 @@ public: PageTableBase(const std::string &__name, uint64_t _pid, - Addr _pageSize = TheISA::VMPageSize) + Addr _pageSize = TheISA::PageBytes) : pageSize(_pageSize), offsetMask(mask(floorLog2(_pageSize))), pid(_pid), _name(__name) { @@ -188,7 +188,7 @@ public: FuncPageTable(const std::string &__name, uint64_t _pid, - Addr _pageSize = TheISA::VMPageSize); + Addr _pageSize = TheISA::PageBytes); ~FuncPageTable(); @@ -229,7 +229,7 @@ { public: NoArchPageTable(const std::string &__name, uint64_t _pid, System *_sys, - Addr _pageSize = TheISA::VMPageSize) : FuncPageTable(__name, _pid) + Addr _pageSize = TheISA::PageBytes) : FuncPageTable(__name, _pid) { fatal("No architectural page table defined for this ISA.\n"); } diff -r 1e963c0e3020 -r b7ac68974f7c src/mem/ruby/common/Address.cc --- a/src/mem/ruby/common/Address.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/mem/ruby/common/Address.cc Thu Aug 28 17:52:32 2014 +0100 @@ -139,7 +139,7 @@ void Address::makePageAddress() { - m_address = maskLowOrderBits(TheISA::LogVMPageSize); + m_address = maskLowOrderBits(TheISA::PageShift); } Address diff -r 1e963c0e3020 -r b7ac68974f7c src/mem/se_translating_port_proxy.cc --- a/src/mem/se_translating_port_proxy.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/mem/se_translating_port_proxy.cc Thu Aug 28 17:52:32 2014 +0100 @@ -68,7 +68,7 @@ { int prevSize = 0; - for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) { + for (ChunkGenerator gen(addr, size, PageBytes); !gen.done(); gen.next()) { Addr paddr; if (!pTable->translate(gen.addr(),paddr)) @@ -94,13 +94,13 @@ { int prevSize = 0; - for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) { + for (ChunkGenerator gen(addr, size, PageBytes); !gen.done(); gen.next()) { Addr paddr; if (!pTable->translate(gen.addr(), paddr)) { if (allocating == Always) { - process->allocateMem(roundDown(gen.addr(), VMPageSize), - VMPageSize); + process->allocateMem(roundDown(gen.addr(), PageBytes), + PageBytes); } else if (allocating == NextPage) { // check if we've accessed the next page on the stack if (!process->fixupStackFault(gen.addr())) @@ -130,13 +130,13 @@ bool SETranslatingPortProxy::tryMemsetBlob(Addr addr, uint8_t val, int size) const { - for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) { + for (ChunkGenerator gen(addr, size, PageBytes); !gen.done(); gen.next()) { Addr paddr; if (!pTable->translate(gen.addr(), paddr)) { if (allocating == Always) { - process->allocateMem(roundDown(gen.addr(), VMPageSize), - VMPageSize); + process->allocateMem(roundDown(gen.addr(), PageBytes), + PageBytes); pTable->translate(gen.addr(), paddr); } else { return false; diff -r 1e963c0e3020 -r b7ac68974f7c src/sim/process.cc --- a/src/sim/process.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/sim/process.cc Thu Aug 28 17:52:32 2014 +0100 @@ -334,7 +334,7 @@ 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 @@ // 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 -r 1e963c0e3020 -r b7ac68974f7c src/sim/syscall_emul.hh --- a/src/sim/syscall_emul.hh Thu Aug 28 17:52:28 2014 +0100 +++ b/src/sim/syscall_emul.hh Thu Aug 28 17:52:32 2014 +0100 @@ -822,9 +822,9 @@ 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 @@ } } - 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 -r 1e963c0e3020 -r b7ac68974f7c src/sim/syscall_emul.cc --- a/src/sim/syscall_emul.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/sim/syscall_emul.cc Thu Aug 28 17:52:32 2014 +0100 @@ -148,7 +148,7 @@ SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) { - return (int)VMPageSize; + return (int)PageBytes; } @@ -167,9 +167,9 @@ 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 @@ 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 -r 1e963c0e3020 -r b7ac68974f7c src/sim/system.cc --- a/src/sim/system.cc Thu Aug 28 17:52:28 2014 +0100 +++ b/src/sim/system.cc Thu Aug 28 17:52:32 2014 +0100 @@ -317,9 +317,9 @@ 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 @@ Addr System::freeMemSize() const { - return physmem.totalSize() - (pagePtr << LogVMPageSize); + return physmem.totalSize() - (pagePtr << PageShift); } bool