summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/alpha_tru64_process.cc53
-rw-r--r--base/hostinfo.cc2
-rw-r--r--base/inifile.cc5
-rw-r--r--base/stats/events.cc11
-rw-r--r--cpu/beta_cpu/btb.cc5
-rw-r--r--cpu/beta_cpu/comm.hh2
-rw-r--r--cpu/beta_cpu/inst_queue.hh2
-rw-r--r--cpu/beta_cpu/sat_counter.hh2
-rw-r--r--python/SConscript4
-rw-r--r--python/m5/objects/AlphaConsole.py2
-rw-r--r--python/m5/objects/BaseCPU.py2
-rw-r--r--python/m5/objects/System.py (renamed from python/m5/objects/BaseSystem.py)3
-rw-r--r--python/m5/objects/Tsunami.py2
-rw-r--r--sim/system.cc68
-rwxr-xr-xutil/pbs/job.py2
15 files changed, 120 insertions, 45 deletions
diff --git a/arch/alpha/alpha_tru64_process.cc b/arch/alpha/alpha_tru64_process.cc
index 6fe4290e8..4d73e711f 100644
--- a/arch/alpha/alpha_tru64_process.cc
+++ b/arch/alpha/alpha_tru64_process.cc
@@ -26,32 +26,39 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h> // for host open() flags
#include <sys/types.h>
#include <sys/stat.h>
+#if defined(__OpenBSD__)
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
#include <sys/statfs.h>
-#include <string.h> // for memset()
+#endif
+
#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h> // for host open() flags
+#include <string.h> // for memset()
+#include <unistd.h>
-#include "sim/host.hh"
+#include "arch/alpha/alpha_common_syscall_emul.hh"
+#include "arch/alpha/alpha_tru64_process.hh"
+#include "base/trace.hh"
#include "cpu/base_cpu.hh"
-#include "mem/functional_mem/functional_memory.hh"
-#include "sim/process.hh"
#include "cpu/exec_context.hh"
+#include "mem/functional_mem/functional_memory.hh"
#include "sim/fake_syscall.hh"
-
-#include "arch/alpha/alpha_common_syscall_emul.hh"
-#include "arch/alpha/alpha_tru64_process.hh"
-
+#include "sim/host.hh"
+#include "sim/process.hh"
+#include "sim/root.hh"
#include "sim/syscall_emul.hh"
-#include "sim/root.hh" // for curTick & ticksPerSecond
-
-#include "base/trace.hh"
using namespace std;
+typedef struct stat global_stat;
+typedef struct statfs global_statfs;
+typedef struct dirent global_dirent;
+
///
/// This class encapsulates the types, structures, constants,
/// functions, and syscall-number mappings specific to the Alpha Tru64
@@ -530,7 +537,7 @@ class Tru64 {
/// memory space. Used by stat(), fstat(), and lstat().
template <class T>
static void
- copyOutStatBuf(FunctionalMemory *mem, Addr addr, struct ::stat *host)
+ copyOutStatBuf(FunctionalMemory *mem, Addr addr, global_stat *host)
{
TypedBufferArg<T> tgt(addr);
@@ -556,11 +563,15 @@ class Tru64 {
/// memory space. Used by statfs() and fstatfs().
template <class T>
static void
- copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, struct ::statfs *host)
+ copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, global_statfs *host)
{
TypedBufferArg<T> tgt(addr);
+#if defined(__OpenBSD__)
+ tgt->f_type = 0;
+#else
tgt->f_type = host->f_type;
+#endif
tgt->f_bsize = host->f_bsize;
tgt->f_blocks = host->f_blocks;
tgt->f_bfree = host->f_bfree;
@@ -575,13 +586,13 @@ class Tru64 {
class F64 {
public:
static void copyOutStatBuf(FunctionalMemory *mem, Addr addr,
- struct ::stat *host)
+ global_stat *host)
{
Tru64::copyOutStatBuf<Tru64::F64_stat>(mem, addr, host);
}
static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr,
- struct ::statfs *host)
+ global_statfs *host)
{
Tru64::copyOutStatfsBuf<Tru64::F64_statfs>(mem, addr, host);
}
@@ -590,13 +601,13 @@ class Tru64 {
class PreF64 {
public:
static void copyOutStatBuf(FunctionalMemory *mem, Addr addr,
- struct ::stat *host)
+ global_stat *host)
{
Tru64::copyOutStatBuf<Tru64::pre_F64_stat>(mem, addr, host);
}
static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr,
- struct ::statfs *host)
+ global_statfs *host)
{
Tru64::copyOutStatfsBuf<Tru64::pre_F64_statfs>(mem, addr, host);
}
@@ -826,7 +837,7 @@ class Tru64 {
char *host_buf_ptr = host_buf;
char *host_buf_end = host_buf + host_result;
while (host_buf_ptr < host_buf_end) {
- struct ::dirent *host_dp = (struct ::dirent *)host_buf_ptr;
+ global_dirent *host_dp = (global_dirent *)host_buf_ptr;
int namelen = strlen(host_dp->d_name);
// Actual size includes padded string rounded up for alignment.
diff --git a/base/hostinfo.cc b/base/hostinfo.cc
index cb5c04efc..6d07c957e 100644
--- a/base/hostinfo.cc
+++ b/base/hostinfo.cc
@@ -70,7 +70,7 @@ procInfo(char *filename, char *target)
while (fp && !feof(fp) && !done) {
if (fgets(line, 80, fp)) {
if (strncmp(line, target, strlen(target)) == 0) {
- sprintf(format, "%s %%lld", target);
+ snprintf(format, sizeof(format), "%s %%lld", target);
sscanf(line, format, &usage);
fclose(fp);
diff --git a/base/inifile.cc b/base/inifile.cc
index 862e4082f..cbb506c8b 100644
--- a/base/inifile.cc
+++ b/base/inifile.cc
@@ -79,7 +79,8 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
tmpf.close();
- char *cfile = strcpy(new char[file.size() + 1], file.c_str());
+ char *cfile = strncpy(new char[file.size() + 1], file.c_str(),
+ file.size());
char *dir = dirname(cfile);
char *dir_arg = NULL;
if (*dir != '.') {
@@ -87,7 +88,7 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
arg += dir;
dir_arg = new char[arg.size() + 1];
- strcpy(dir_arg, arg.c_str());
+ strncpy(dir_arg, arg.c_str(), arg.size());
}
delete [] cfile;
diff --git a/base/stats/events.cc b/base/stats/events.cc
index dd7ec2ccf..e083cf0da 100644
--- a/base/stats/events.cc
+++ b/base/stats/events.cc
@@ -140,6 +140,10 @@ InsertEvent::insert(const string &stat)
void
InsertEvent::flush()
{
+ static const char query_header[] = "INSERT INTO "
+ "events(ev_event, ev_run, ev_tick)"
+ "values";
+
if (size) {
MySQL::Connection &mysql = MySqlDB.conn();
assert(mysql.connected());
@@ -147,12 +151,9 @@ InsertEvent::flush()
}
query[0] = '\0';
- size = 0;
+ size = sizeof(query_header);
first = true;
- strcpy(query, "INSERT INTO "
- "events(ev_event, ev_run, ev_tick)"
- "values");
- size = strlen(query);
+ memcpy(query, query_header, size);
}
void
diff --git a/cpu/beta_cpu/btb.cc b/cpu/beta_cpu/btb.cc
index 65b7fffa4..92864dbaa 100644
--- a/cpu/beta_cpu/btb.cc
+++ b/cpu/beta_cpu/btb.cc
@@ -26,8 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <math.h>
-
+#include "base/intmath.hh"
#include "base/trace.hh"
#include "cpu/beta_cpu/btb.hh"
@@ -53,7 +52,7 @@ DefaultBTB::DefaultBTB(unsigned _numEntries,
tagMask = (1 << tagBits) - 1;
- tagShiftAmt = instShiftAmt + (int)log2(numEntries);
+ tagShiftAmt = instShiftAmt + FloorLog2(numEntries);
}
inline
diff --git a/cpu/beta_cpu/comm.hh b/cpu/beta_cpu/comm.hh
index 61660d39f..475ab8df8 100644
--- a/cpu/beta_cpu/comm.hh
+++ b/cpu/beta_cpu/comm.hh
@@ -29,11 +29,11 @@
#ifndef __CPU_BETA_CPU_COMM_HH__
#define __CPU_BETA_CPU_COMM_HH__
-#include <stdint.h>
#include <vector>
#include "arch/alpha/isa_traits.hh"
#include "cpu/inst_seq.hh"
+#include "sim/host.hh"
// Find better place to put this typedef.
// The impl might be the best place for this.
diff --git a/cpu/beta_cpu/inst_queue.hh b/cpu/beta_cpu/inst_queue.hh
index 7d726c27f..02dc1222d 100644
--- a/cpu/beta_cpu/inst_queue.hh
+++ b/cpu/beta_cpu/inst_queue.hh
@@ -32,12 +32,12 @@
#include <list>
#include <map>
#include <queue>
-#include <stdint.h>
#include <vector>
#include "base/statistics.hh"
#include "base/timebuf.hh"
#include "cpu/inst_seq.hh"
+#include "sim/host.hh"
/**
* A standard instruction queue class. It holds ready instructions, in
diff --git a/cpu/beta_cpu/sat_counter.hh b/cpu/beta_cpu/sat_counter.hh
index 5b32774cc..5455ca56a 100644
--- a/cpu/beta_cpu/sat_counter.hh
+++ b/cpu/beta_cpu/sat_counter.hh
@@ -29,7 +29,7 @@
#ifndef __CPU_BETA_CPU_SAT_COUNTER_HH__
#define __CPU_BETA_CPU_SAT_COUNTER_HH__
-#include <stdint.h>
+#include "sim/host.hh"
/**
* Private counter class for the internal saturating counters.
diff --git a/python/SConscript b/python/SConscript
index 9c15c6d50..7042a58e6 100644
--- a/python/SConscript
+++ b/python/SConscript
@@ -182,7 +182,7 @@ EmbedMap %(name)s("%(fname)s",
# base list of .py files to embed
embedded_py_files = [ '../util/pbs/jobfile.py' ]
-# add all .py and .mpy files in python/m5
+# add all .py files in python/m5
objpath = os.path.join(env['SRCDIR'], 'python', 'm5')
for root, dirs, files in os.walk(objpath, topdown=True):
for i,dir in enumerate(dirs):
@@ -192,7 +192,7 @@ for root, dirs, files in os.walk(objpath, topdown=True):
assert(root.startswith(objpath))
for f in files:
- if f.endswith('.mpy') or f.endswith('.py'):
+ if f.endswith('.py'):
embedded_py_files.append(os.path.join(root, f))
embedfile_hh = os.path.join(env['SRCDIR'], 'base/embedfile.hh')
diff --git a/python/m5/objects/AlphaConsole.py b/python/m5/objects/AlphaConsole.py
index 9fe31b009..32a137bec 100644
--- a/python/m5/objects/AlphaConsole.py
+++ b/python/m5/objects/AlphaConsole.py
@@ -7,4 +7,4 @@ class AlphaConsole(PioDevice):
disk = Param.SimpleDisk("Simple Disk")
num_cpus = Param.Int(1, "Number of CPUs")
sim_console = Param.SimConsole(Parent.any, "The Simulator Console")
- system = Param.BaseSystem(Parent.any, "system object")
+ system = Param.System(Parent.any, "system object")
diff --git a/python/m5/objects/BaseCPU.py b/python/m5/objects/BaseCPU.py
index 0dc436434..452b97c84 100644
--- a/python/m5/objects/BaseCPU.py
+++ b/python/m5/objects/BaseCPU.py
@@ -9,7 +9,7 @@ class BaseCPU(SimObject):
dtb = Param.AlphaDTB("Data TLB")
itb = Param.AlphaITB("Instruction TLB")
mem = Param.FunctionalMemory("memory")
- system = Param.BaseSystem(Parent.any, "system object")
+ system = Param.System(Parent.any, "system object")
else:
workload = VectorParam.Process("processes to run")
diff --git a/python/m5/objects/BaseSystem.py b/python/m5/objects/System.py
index 457eadb36..c247983c5 100644
--- a/python/m5/objects/BaseSystem.py
+++ b/python/m5/objects/System.py
@@ -1,7 +1,6 @@
from m5 import *
-class BaseSystem(SimObject):
+class System(SimObject):
type = 'BaseSystem'
- abstract = True
boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
"boot processor frequency")
memctrl = Param.MemoryController(Parent.any, "memory controller")
diff --git a/python/m5/objects/Tsunami.py b/python/m5/objects/Tsunami.py
index fa3c18127..c8fd94e2c 100644
--- a/python/m5/objects/Tsunami.py
+++ b/python/m5/objects/Tsunami.py
@@ -5,7 +5,7 @@ from Platform import Platform
class Tsunami(Platform):
type = 'Tsunami'
pciconfig = Param.PciConfigAll("PCI configuration")
- system = Param.BaseSystem(Parent.any, "system")
+ system = Param.System(Parent.any, "system")
class TsunamiCChip(FooPioDevice):
type = 'TsunamiCChip'
diff --git a/sim/system.cc b/sim/system.cc
index c6a65f9d9..8844f13de 100644
--- a/sim/system.cc
+++ b/sim/system.cc
@@ -34,7 +34,7 @@
#include "mem/functional_mem/memory_control.hh"
#include "mem/functional_mem/physical_memory.hh"
#include "targetarch/vtophys.hh"
-#include "sim/param.hh"
+#include "sim/builder.hh"
#include "sim/system.hh"
#include "base/trace.hh"
@@ -269,5 +269,69 @@ printSystems()
System::printSystems();
}
-DEFINE_SIM_OBJECT_CLASS_NAME("System", System)
+BEGIN_DECLARE_SIM_OBJECT_PARAMS(System)
+
+ Param<Tick> boot_cpu_frequency;
+ SimObjectParam<MemoryController *> memctrl;
+ SimObjectParam<PhysicalMemory *> physmem;
+
+ Param<string> kernel;
+ Param<string> console;
+ Param<string> pal;
+
+ Param<string> boot_osflags;
+ Param<string> readfile;
+ Param<unsigned int> init_param;
+
+ Param<uint64_t> system_type;
+ Param<uint64_t> system_rev;
+
+ Param<bool> bin;
+ VectorParam<string> binned_fns;
+ Param<bool> bin_int;
+
+END_DECLARE_SIM_OBJECT_PARAMS(System)
+
+BEGIN_INIT_SIM_OBJECT_PARAMS(System)
+
+ INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
+ INIT_PARAM(memctrl, "memory controller"),
+ INIT_PARAM(physmem, "phsyical memory"),
+ INIT_PARAM(kernel, "file that contains the kernel code"),
+ INIT_PARAM(console, "file that contains the console code"),
+ INIT_PARAM(pal, "file that contains palcode"),
+ INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
+ "a"),
+ INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
+ INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
+ INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
+ INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
+ INIT_PARAM_DFLT(bin, "is this system to be binned", false),
+ INIT_PARAM(binned_fns, "functions to be broken down and binned"),
+ INIT_PARAM_DFLT(bin_int, "is interrupt code binned seperately?", true)
+
+END_INIT_SIM_OBJECT_PARAMS(System)
+
+CREATE_SIM_OBJECT(System)
+{
+ System::Params *p = new System::Params;
+ p->name = getInstanceName();
+ p->boot_cpu_frequency = boot_cpu_frequency;
+ p->memctrl = memctrl;
+ p->physmem = physmem;
+ p->kernel_path = kernel;
+ p->console_path = console;
+ p->palcode = pal;
+ p->boot_osflags = boot_osflags;
+ p->init_param = init_param;
+ p->readfile = readfile;
+ p->system_type = system_type;
+ p->system_rev = system_rev;
+ p->bin = bin;
+ p->binned_fns = binned_fns;
+ p->bin_int = bin_int;
+ return new System(p);
+}
+
+REGISTER_SIM_OBJECT("System", System)
diff --git a/util/pbs/job.py b/util/pbs/job.py
index 5eed0cd75..4ead50de9 100755
--- a/util/pbs/job.py
+++ b/util/pbs/job.py
@@ -134,7 +134,7 @@ if __name__ == '__main__':
os.symlink(joinpath(jobdir, 'output'), 'status.out')
- args = [ joinpath(basedir, 'm5'), joinpath(basedir, 'run.mpy') ]
+ args = [ joinpath(basedir, 'm5'), joinpath(basedir, 'run.py') ]
if not len(args):
sys.exit("no arguments")