From: Steve Reinhardt Date: Sun, 12 Mar 2006 21:01:41 +0000 (-0500) Subject: Get rid of validInstAddr() & validDataAddr(). X-Git-Tag: m5_2.0_beta1~181 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37c860d3345b6fcc45dc609fd9bb7fe7e5136142;p=gem5.git Get rid of validInstAddr() & validDataAddr(). SE mode can now use page tables to determine which addresses are valid. sim/process.cc: sim/process.hh: Get rid of validInstAddr() & validDataAddr(). SE mode can now use page tables to determine which addresses are valid. Also get rid of some Process object fields that were only used by those functions. --HG-- extra : convert_revision : 74a25c0c2453bfc598eedacdbfccea1cf6493ba6 --- diff --git a/cpu/cpu_exec_context.hh b/cpu/cpu_exec_context.hh index 764c8fab3..509583d65 100644 --- a/cpu/cpu_exec_context.hh +++ b/cpu/cpu_exec_context.hh @@ -233,8 +233,6 @@ class CPUExecContext AlphaDTB *getDTBPtr() { return dtb; } - bool validInstAddr(Addr addr) { return true; } - bool validDataAddr(Addr addr) { return true; } int getInstAsid() { return regs.instAsid(); } int getDataAsid() { return regs.dataAsid(); } @@ -256,12 +254,6 @@ class CPUExecContext #else Process *getProcessPtr() { return process; } - bool validInstAddr(Addr addr) - { return process->validInstAddr(addr); } - - bool validDataAddr(Addr addr) - { return process->validDataAddr(addr); } - int getInstAsid() { return asid; } int getDataAsid() { return asid; } diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 3c57ad907..d102757e6 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -143,8 +143,6 @@ class ExecContext virtual int getThreadNum() = 0; - virtual bool validInstAddr(Addr addr) = 0; - virtual bool validDataAddr(Addr addr) = 0; virtual int getInstAsid() = 0; virtual int getDataAsid() = 0; @@ -309,8 +307,6 @@ class ProxyExecContext : public ExecContext int getThreadNum() { return actualXC->getThreadNum(); } - bool validInstAddr(Addr addr) { return actualXC->validInstAddr(addr); } - bool validDataAddr(Addr addr) { return actualXC->validDataAddr(addr); } int getInstAsid() { return actualXC->getInstAsid(); } int getDataAsid() { return actualXC->getDataAsid(); } diff --git a/sim/process.cc b/sim/process.cc index d5f97ee5f..c8c4d0ba6 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -37,11 +37,7 @@ #include "base/loader/symtab.hh" #include "base/statistics.hh" #include "config/full_system.hh" -#include "cpu/cpu_exec_context.hh" #include "cpu/exec_context.hh" -#include "cpu/smt.hh" -#include "encumbered/cpu/full/thread.hh" -#include "encumbered/eio/eio.hh" #include "mem/page_table.hh" #include "mem/memory.hh" #include "mem/translating_port.hh" @@ -269,16 +265,12 @@ LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile, { prog_fname = argv[0]; - prog_entry = objFile->entryPoint(); - text_base = objFile->textBase(); - text_size = objFile->textSize(); - data_base = objFile->dataBase(); - data_size = objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(data_base + data_size, VMPageSize); + brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); + brk_point = roundUp(brk_point, VMPageSize); // Set up stack. On Alpha, stack goes below text section. This // code should get moved to some architecture-specific spot. - stack_base = text_base - (409600+4096); + stack_base = objFile->textBase() - (409600+4096); // Set up region for mmaps. Tru64 seems to start just above 0 and // grow up from there. @@ -353,6 +345,8 @@ LiveProcess::startup() execContexts[0]->setIntReg(ArgumentReg1, argv_array_base); execContexts[0]->setIntReg(StackPointerReg, stack_min); execContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer()); + + Addr prog_entry = objFile->entryPoint(); execContexts[0]->setPC(prog_entry); execContexts[0]->setNextPC(prog_entry + sizeof(MachInst)); diff --git a/sim/process.hh b/sim/process.hh index 476cb8ecf..ffdca819e 100644 --- a/sim/process.hh +++ b/sim/process.hh @@ -92,12 +92,6 @@ class Process : public SimObject // list of all blocked contexts std::list waitList; - Addr text_base; // text (code) segment base - unsigned text_size; // text (code) size in bytes - - Addr data_base; // initialized data segment base - unsigned data_size; // initialized data + bss size in bytes - Addr brk_point; // top of the data segment Addr stack_base; // stack segment base (highest address) @@ -116,7 +110,6 @@ class Process : public SimObject Addr nxm_end; std::string prog_fname; // file name - Addr prog_entry; // entry point (initial PC) Stats::Scalar<> num_syscalls; // number of syscalls executed @@ -171,26 +164,6 @@ class Process : public SimObject // look up simulator fd for given target fd int sim_fd(int tgt_fd); - // is this a valid instruction fetch address? - bool validInstAddr(Addr addr) - { - return (text_base <= addr && - addr < text_base + text_size && - !(addr & (sizeof(MachInst)-1))); - } - - // is this a valid address? (used to filter data fetches) - // note that we just assume stack size <= 16MB - // this may be alpha-specific - bool validDataAddr(Addr addr) - { - return ((data_base <= addr && addr < brk_point) || - (next_thread_stack_base <= addr && addr < stack_base) || - (text_base <= addr && addr < (text_base + text_size)) || - (mmap_start <= addr && addr < mmap_end) || - (nxm_start <= addr && addr < nxm_end)); - } - virtual void syscall(ExecContext *xc) = 0; };