summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/alpha_linux_process.cc16
-rw-r--r--arch/alpha/vptr.hh11
-rw-r--r--base/random.hh20
-rw-r--r--base/range.hh1
-rw-r--r--base/res_list.hh2
-rw-r--r--base/statistics.hh128
-rw-r--r--base/trace.cc2
-rw-r--r--base/trace.hh6
-rw-r--r--cpu/base_cpu.cc4
-rw-r--r--cpu/simple_cpu/simple_cpu.hh19
-rw-r--r--cpu/static_inst.cc2
-rw-r--r--cpu/static_inst.hh2
-rw-r--r--dev/etherlink.hh10
-rw-r--r--dev/ns_gige.hh8
-rw-r--r--dev/pcidev.hh9
-rw-r--r--dev/sinic.hh8
-rw-r--r--kern/linux/linux_syscalls.hh7
-rw-r--r--kern/tru64/tru64_syscalls.hh7
-rw-r--r--sim/eventq.hh34
-rw-r--r--sim/param.cc18
-rw-r--r--sim/param.hh9
-rw-r--r--sim/serialize.cc1
-rw-r--r--sim/startup.cc24
-rw-r--r--sim/syscall_emul.hh84
-rw-r--r--sim/universe.cc1
25 files changed, 225 insertions, 208 deletions
diff --git a/arch/alpha/alpha_linux_process.cc b/arch/alpha/alpha_linux_process.cc
index 67bb0ab3b..ba4b1d07e 100644
--- a/arch/alpha/alpha_linux_process.cc
+++ b/arch/alpha/alpha_linux_process.cc
@@ -26,24 +26,24 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <dirent.h>
#include <errno.h>
-#include <unistd.h>
#include <fcntl.h> // for host open() flags
-#include <sys/types.h>
-#include <sys/stat.h>
#include <string.h> // for memset()
-#include <dirent.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-#include "sim/host.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 "sim/host.hh"
+#include "sim/process.hh"
#include "sim/sim_events.hh"
-#include "sim/syscall_emul.hh"
#include "arch/alpha/alpha_common_syscall_emul.hh"
+#include "sim/syscall_emul.hh"
#include "sim/universe.hh" // for curTick & ticksPerSecond
#include "arch/alpha/alpha_linux_process.hh"
diff --git a/arch/alpha/vptr.hh b/arch/alpha/vptr.hh
index cd4bc547b..e955c67cf 100644
--- a/arch/alpha/vptr.hh
+++ b/arch/alpha/vptr.hh
@@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __VPTR_HH__
-#define __VPTR_HH__
+#ifndef __ARCH_ALPHA_VPTR_HH__
+#define __ARCH_ALPHA_VPTR_HH__
#include "arch/alpha/vtophys.hh"
@@ -69,14 +69,15 @@ class VPtr
const VPtr<T> &operator+=(int offset)
{
ptr += offset;
- assert((ptr & (ALPHA_PGBYTES - 1)) + sizeof(T) < ALPHA_PGBYTES);
+ assert((ptr & (AlphaISA::PageBytes - 1)) + sizeof(T)
+ < AlphaISA::PageBytes);
return *this;
}
const VPtr<T> &operator=(Addr p)
{
- assert((p & (ALPHA_PGBYTES - 1)) + sizeof(T) < ALPHA_PGBYTES);
+ assert((p & (AlphaISA::PageBytes)) + sizeof(T) < AlphaISA::PageBytes);
ptr = p;
return *this;
@@ -110,4 +111,4 @@ class VPtr
}
};
-#endif // __VPTR_HH__
+#endif // __ARCH_ALPHA_VPTR_HH__
diff --git a/base/random.hh b/base/random.hh
index 0bfed100c..fe93a98a6 100644
--- a/base/random.hh
+++ b/base/random.hh
@@ -37,61 +37,61 @@ double getDouble();
template <typename T>
struct Random;
-struct Random<int8_t>
+template<> struct Random<int8_t>
{
static int8_t get()
{ return getLong() & (int8_t)-1; }
};
-struct Random<uint8_t>
+template<> struct Random<uint8_t>
{
static uint8_t get()
{ return getLong() & (uint8_t)-1; }
};
-struct Random<int16_t>
+template<> struct Random<int16_t>
{
static int16_t get()
{ return getLong() & (int16_t)-1; }
};
-struct Random<uint16_t>
+template<> struct Random<uint16_t>
{
static uint16_t get()
{ return getLong() & (uint16_t)-1; }
};
-struct Random<int32_t>
+template<> struct Random<int32_t>
{
static int32_t get()
{ return (int32_t)getLong(); }
};
-struct Random<uint32_t>
+template<> struct Random<uint32_t>
{
static uint32_t get()
{ return (uint32_t)getLong(); }
};
-struct Random<int64_t>
+template<> struct Random<int64_t>
{
static int64_t get()
{ return (int64_t)getLong() << 32 || (uint64_t)getLong(); }
};
-struct Random<uint64_t>
+template<> struct Random<uint64_t>
{
static uint64_t get()
{ return (uint64_t)getLong() << 32 || (uint64_t)getLong(); }
};
-struct Random<float>
+template<> struct Random<float>
{
static float get()
{ return getDouble(); }
};
-struct Random<double>
+template<> struct Random<double>
{
static double get()
{ return getDouble(); }
diff --git a/base/range.hh b/base/range.hh
index 9289792ea..57b6e6a77 100644
--- a/base/range.hh
+++ b/base/range.hh
@@ -30,6 +30,7 @@
#define __BASE_RANGE_HH__
#include <cassert>
+#include <iostream>
#include <string>
/**
diff --git a/base/res_list.hh b/base/res_list.hh
index 7080a3ba7..5dc798fed 100644
--- a/base/res_list.hh
+++ b/base/res_list.hh
@@ -352,7 +352,7 @@ res_list<T>::insert_after(iterator prev, T *d)
iterator p;
if (!allocate_storage)
- panic("Can't copy data... not allocating storage");
+ this->panic("Can't copy data... not allocating storage");
p = insert_after(prev);
if (p.notnull())
diff --git a/base/statistics.hh b/base/statistics.hh
index f3b8a3922..9ec26eb4d 100644
--- a/base/statistics.hh
+++ b/base/statistics.hh
@@ -407,7 +407,7 @@ class Wrap : public Child
public:
Wrap()
{
- map(new Data<Child>(*this));
+ map(new Data<Child>(*this));
}
/**
@@ -417,10 +417,10 @@ class Wrap : public Child
*/
Parent &name(const std::string &_name)
{
- Data<Child> *data = statData();
+ Data<Child> *data = this->statData();
data->name = _name;
- setPrint();
- return self();
+ this->setPrint();
+ return this->self();
}
/**
@@ -431,8 +431,8 @@ class Wrap : public Child
*/
Parent &desc(const std::string &_desc)
{
- statData()->desc = _desc;
- return self();
+ this->statData()->desc = _desc;
+ return this->self();
}
/**
@@ -442,8 +442,8 @@ class Wrap : public Child
*/
Parent &precision(int _precision)
{
- statData()->precision = _precision;
- return self();
+ this->statData()->precision = _precision;
+ return this->self();
}
/**
@@ -453,8 +453,8 @@ class Wrap : public Child
*/
Parent &flags(StatFlags _flags)
{
- statData()->flags |= _flags;
- return self();
+ this->statData()->flags |= _flags;
+ return this->self();
}
/**
@@ -466,8 +466,8 @@ class Wrap : public Child
template <class Stat>
Parent &prereq(const Stat &prereq)
{
- statData()->prereq = prereq.statData();
- return self();
+ this->statData()->prereq = prereq.statData();
+ return this->self();
}
};
@@ -487,11 +487,11 @@ class WrapVec : public Wrap<Parent, Child, Data>
*/
Parent &subname(int index, const std::string &name)
{
- std::vector<std::string> &subn = statData()->subnames;
+ std::vector<std::string> &subn = this->statData()->subnames;
if (subn.size() <= index)
subn.resize(index + 1);
subn[index] = name;
- return self();
+ return this->self();
}
/**
@@ -503,12 +503,12 @@ class WrapVec : public Wrap<Parent, Child, Data>
*/
Parent &subdesc(int index, const std::string &desc)
{
- std::vector<std::string> &subd = statData()->subdescs;
+ std::vector<std::string> &subd = this->statData()->subdescs;
if (subd.size() <= index)
subd.resize(index + 1);
subd[index] = desc;
- return self();
+ return this->self();
}
};
@@ -523,19 +523,19 @@ class WrapVec2d : public WrapVec<Parent, Child, Data>
*/
Parent &ysubnames(const char **names)
{
- Data<Child> *data = statData();
- data->y_subnames.resize(y);
- for (int i = 0; i < y; ++i)
+ Data<Child> *data = this->statData();
+ data->y_subnames.resize(this->y);
+ for (int i = 0; i < this->y; ++i)
data->y_subnames[i] = names[i];
- return self();
+ return this->self();
}
Parent &ysubname(int index, const std::string subname)
{
- Data<Child> *data = statData();
- assert(index < y);
- data->y_subnames.resize(y);
+ Data<Child> *data = this->statData();
+ assert(index < this->y);
+ data->y_subnames.resize(this->y);
data->y_subnames[index] = subname.c_str();
- return self();
+ return this->self();
}
};
@@ -711,7 +711,7 @@ class ScalarBase : public DataAccess
/** Define the params of the storage class. */
typedef typename Storage::Params params_t;
/** Define the bin type. */
- typedef typename Bin::Bin<Storage> bin_t;
+ typedef typename Bin::template Bin<Storage> bin_t;
protected:
/** The bin of this stat. */
@@ -914,7 +914,7 @@ class VectorBase : public DataAccess
/** Define the params of the storage class. */
typedef typename Storage::Params params_t;
/** Define the bin type. */
- typedef typename Bin::VectorBin<Storage> bin_t;
+ typedef typename Bin::template VectorBin<Storage> bin_t;
protected:
/** The bin of this stat. */
@@ -1022,7 +1022,7 @@ class ScalarProxy
/** Define the params of the storage class. */
typedef typename Storage::Params params_t;
/** Define the bin type. */
- typedef typename Bin::VectorBin<Storage> bin_t;
+ typedef typename Bin::template VectorBin<Storage> bin_t;
private:
/** Pointer to the bin in the parent VectorBase. */
@@ -1155,7 +1155,7 @@ class ScalarProxy
const StatData *statData() const { return getStatData(stat); }
std::string str() const
{
- return csprintf("%s[%d]", statData()->name, index);
+ return csprintf("%s[%d]", this->statData()->name, index);
}
};
@@ -1176,7 +1176,7 @@ class Vector2dBase : public DataAccess
{
public:
typedef typename Storage::Params params_t;
- typedef typename Bin::VectorBin<Storage> bin_t;
+ typedef typename Bin::template VectorBin<Storage> bin_t;
protected:
size_t x;
@@ -1204,7 +1204,7 @@ class Vector2dBase : public DataAccess
data->cvec[i] = this->data(i)->value(params);
}
- std::string ysubname(int i) const { return (*y_subnames)[i]; }
+ std::string ysubname(int i) const { return (*this->y_subnames)[i]; }
friend class VectorProxy<Storage, Bin>;
VectorProxy<Storage, Bin> operator[](int index);
@@ -1225,7 +1225,7 @@ class VectorProxy
{
public:
typedef typename Storage::Params params_t;
- typedef typename Bin::VectorBin<Storage> bin_t;
+ typedef typename Bin::template VectorBin<Storage> bin_t;
private:
bin_t *bin;
@@ -1622,7 +1622,7 @@ class DistBase : public DataAccess
/** Define the params of the storage class. */
typedef typename Storage::Params params_t;
/** Define the bin type. */
- typedef typename Bin::Bin<Storage> bin_t;
+ typedef typename Bin::template Bin<Storage> bin_t;
protected:
/** The bin of this stat. */
@@ -1698,7 +1698,7 @@ class VectorDistBase : public DataAccess
{
public:
typedef typename Storage::Params params_t;
- typedef typename Bin::VectorBin<Storage> bin_t;
+ typedef typename Bin::template VectorBin<Storage> bin_t;
protected:
bin_t bin;
@@ -1749,7 +1749,7 @@ class DistProxy
{
public:
typedef typename Storage::Params params_t;
- typedef typename Bin::Bin<Storage> bin_t;
+ typedef typename Bin::template Bin<Storage> bin_t;
typedef VectorDistBase<Storage, Bin> base_t;
private:
@@ -2206,7 +2206,7 @@ class Scalar
Scalar()
{
- setInit();
+ this->setInit();
}
/**
@@ -2258,7 +2258,7 @@ class Average
Average()
{
- setInit();
+ this->setInit();
}
/**
@@ -2290,8 +2290,8 @@ class Vector
* @return A reference to this stat.
*/
Vector &init(size_t size) {
- bin.init(size, params);
- setInit();
+ this->bin.init(size, this->params);
+ this->setInit();
return *this;
}
@@ -2314,8 +2314,8 @@ class AverageVector
* @return A reference to this stat.
*/
AverageVector &init(size_t size) {
- bin.init(size, params);
- setInit();
+ this->bin.init(size, this->params);
+ this->setInit();
return *this;
}
@@ -2333,10 +2333,10 @@ class Vector2d
{
public:
Vector2d &init(size_t _x, size_t _y) {
- statData()->x = x = _x;
- statData()->y = y = _y;
- bin.init(x * y, params);
- setInit();
+ this->statData()->x = this->x = _x;
+ this->statData()->y = this->y = _y;
+ this->bin.init(this->x * this->y, this->params);
+ this->setInit();
return *this;
}
@@ -2367,12 +2367,12 @@ class Distribution
* @return A reference to this distribution.
*/
Distribution &init(Counter min, Counter max, Counter bkt) {
- params.min = min;
- params.max = max;
- params.bucket_size = bkt;
- params.size = (int)rint((max - min) / bkt + 1.0);
- bin.init(params);
- setInit();
+ this->params.min = min;
+ this->params.max = max;
+ this->params.bucket_size = bkt;
+ this->params.size = (int)rint((max - min) / bkt + 1.0);
+ this->bin.init(this->params);
+ this->setInit();
return *this;
}
@@ -2399,8 +2399,8 @@ class StandardDeviation
* Construct and initialize this distribution.
*/
StandardDeviation() {
- bin.init(params);
- setInit();
+ this->bin.init(this->params);
+ this->setInit();
}
};
@@ -2426,8 +2426,8 @@ class AverageDeviation
*/
AverageDeviation()
{
- bin.init(params);
- setInit();
+ this->bin.init(this->params);
+ this->setInit();
}
};
@@ -2457,12 +2457,12 @@ class VectorDistribution
* @return A reference to this distribution.
*/
VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) {
- params.min = min;
- params.max = max;
- params.bucket_size = bkt;
- params.size = (int)rint((max - min) / bkt + 1.0);
- bin.init(size, params);
- setInit();
+ this->params.min = min;
+ this->params.max = max;
+ this->params.bucket_size = bkt;
+ this->params.size = (int)rint((max - min) / bkt + 1.0);
+ this->bin.init(size, this->params);
+ this->setInit();
return *this;
}
@@ -2491,8 +2491,8 @@ class VectorStandardDeviation
* @return A reference to this distribution.
*/
VectorStandardDeviation &init(int size) {
- bin.init(size, params);
- setInit();
+ this->bin.init(size, this->params);
+ this->setInit();
return *this;
}
@@ -2521,8 +2521,8 @@ class VectorAverageDeviation
* @return A reference to this distribution.
*/
VectorAverageDeviation &init(int size) {
- bin.init(size, params);
- setInit();
+ this->bin.init(size, this->params);
+ this->setInit();
return *this;
}
diff --git a/base/trace.cc b/base/trace.cc
index bc6c9aa7a..aa4e7b2af 100644
--- a/base/trace.cc
+++ b/base/trace.cc
@@ -71,7 +71,7 @@ Log::init(int _size)
size = _size;
- buffer = new (Record *)[size];
+ buffer = new Record *[size];
for (int i = 0; i < size; ++i) {
buffer[i] = NULL;
diff --git a/base/trace.hh b/base/trace.hh
index 5e05d6e5e..054b14546 100644
--- a/base/trace.hh
+++ b/base/trace.hh
@@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __TRACE_HH__
-#define __TRACE_HH__
+#ifndef __BASE_TRACE_HH__
+#define __BASE_TRACE_HH__
#include <vector>
@@ -228,4 +228,4 @@ do { \
#endif // TRACING_ON
-#endif // __TRACE_HH__
+#endif // __BASE_TRACE_HH__
diff --git a/cpu/base_cpu.cc b/cpu/base_cpu.cc
index 7605ff3c3..c4bb97ff8 100644
--- a/cpu/base_cpu.cc
+++ b/cpu/base_cpu.cc
@@ -76,7 +76,7 @@ BaseCPU::BaseCPU(const string &_name, int _number_of_threads, bool _def_reg,
maxThreadsPerCPU = number_of_threads;
// allocate per-thread instruction-based event queues
- comInstEventQueue = new (EventQueue *)[number_of_threads];
+ comInstEventQueue = new EventQueue *[number_of_threads];
for (int i = 0; i < number_of_threads; ++i)
comInstEventQueue[i] = new EventQueue("instruction-based event queue");
@@ -101,7 +101,7 @@ BaseCPU::BaseCPU(const string &_name, int _number_of_threads, bool _def_reg,
}
// allocate per-thread load-based event queues
- comLoadEventQueue = new (EventQueue *)[number_of_threads];
+ comLoadEventQueue = new EventQueue *[number_of_threads];
for (int i = 0; i < number_of_threads; ++i)
comLoadEventQueue[i] = new EventQueue("load-based event queue");
diff --git a/cpu/simple_cpu/simple_cpu.hh b/cpu/simple_cpu/simple_cpu.hh
index 341a0da23..9b6e2423b 100644
--- a/cpu/simple_cpu/simple_cpu.hh
+++ b/cpu/simple_cpu/simple_cpu.hh
@@ -26,15 +26,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __SIMPLE_CPU_HH__
-#define __SIMPLE_CPU_HH__
+#ifndef __CPU_SIMPLE_CPU_SIMPLE_CPU_HH__
+#define __CPU_SIMPLE_CPU_SIMPLE_CPU_HH__
-#include "cpu/base_cpu.hh"
-#include "sim/eventq.hh"
-#include "cpu/pc_event.hh"
#include "base/statistics.hh"
+#include "cpu/base_cpu.hh"
#include "cpu/exec_context.hh"
+#include "cpu/pc_event.hh"
#include "cpu/static_inst.hh"
+#include "sim/eventq.hh"
// forward declarations
#ifdef FULL_SYSTEM
@@ -103,12 +103,7 @@ class SimpleCPU : public BaseCPU
private:
Trace::InstRecord *traceData;
template<typename T>
- void trace_data(T data) {
- if (traceData) {
- traceData->setData(data);
- }
- };
-
+ void trace_data(T data);
public:
//
enum Status {
@@ -346,4 +341,4 @@ class SimpleCPU : public BaseCPU
ExecContext *xcBase() { return xc; }
};
-#endif // __SIMPLE_CPU_HH__
+#endif // __CPU_SIMPLE_CPU_SIMPLE_CPU_HH__
diff --git a/cpu/static_inst.cc b/cpu/static_inst.cc
index 4cb45a818..7069d89ec 100644
--- a/cpu/static_inst.cc
+++ b/cpu/static_inst.cc
@@ -85,4 +85,4 @@ StaticInst<ISA>::hasBranchTarget(Addr pc, ExecContext *xc, Addr &tgt)
// force instantiation of template function(s) above
-template StaticInst<AlphaISA>;
+template class StaticInst<AlphaISA>;
diff --git a/cpu/static_inst.hh b/cpu/static_inst.hh
index 46b2e4b19..c442ada35 100644
--- a/cpu/static_inst.hh
+++ b/cpu/static_inst.hh
@@ -456,7 +456,7 @@ class StaticInstPtr : public RefCountingPtr<StaticInst<ISA> >
/// Convert to pointer to StaticInstBase class.
operator const StaticInstBasePtr()
{
- return get();
+ return this->get();
}
};
diff --git a/dev/etherlink.hh b/dev/etherlink.hh
index e998a006f..d5cd7d7c8 100644
--- a/dev/etherlink.hh
+++ b/dev/etherlink.hh
@@ -30,13 +30,13 @@
* Device module for modelling a fixed bandwidth full duplex ethernet link
*/
-#ifndef __ETHERLINK_HH__
-#define __ETHERLINK_HH__
+#ifndef __DEV_ETHERLINK_HH__
+#define __DEV_ETHERLINK_HH__
-#include "sim/host.hh"
-#include "sim/eventq.hh"
#include "dev/etherint.hh"
#include "dev/etherpkt.hh"
+#include "sim/eventq.hh"
+#include "sim/host.hh"
#include "sim/sim_object.hh"
class EtherDump;
@@ -71,7 +71,7 @@ class EtherLink : public SimObject
PacketPtr packet;
void txDone();
typedef EventWrapper<Link, &Link::txDone> DoneEvent;
- friend class DoneEvent;
+ friend void DoneEvent::process();
DoneEvent doneEvent;
friend class LinkDelayEvent;
diff --git a/dev/ns_gige.hh b/dev/ns_gige.hh
index 8d6016126..697c39cac 100644
--- a/dev/ns_gige.hh
+++ b/dev/ns_gige.hh
@@ -262,12 +262,12 @@ class NSGigE : public PciDev
void rxKick();
Tick rxKickTick;
typedef EventWrapper<NSGigE, &NSGigE::rxKick> RxKickEvent;
- friend class RxKickEvent;
+ friend void RxKickEvent::process();
void txKick();
Tick txKickTick;
typedef EventWrapper<NSGigE, &NSGigE::txKick> TxKickEvent;
- friend class TxKickEvent;
+ friend void TxKickEvent::process();
/**
* Retransmit event
@@ -280,7 +280,7 @@ class NSGigE : public PciDev
txKick();
}
typedef EventWrapper<NSGigE, &NSGigE::txEventTransmit> TxEvent;
- friend class TxEvent;
+ friend void TxEvent::process();
TxEvent txEvent;
void txDump() const;
@@ -315,7 +315,7 @@ class NSGigE : public PciDev
void cpuIntrClear();
typedef EventWrapper<NSGigE, &NSGigE::cpuInterrupt> IntrEvent;
- friend class IntrEvent;
+ friend void IntrEvent::process();
IntrEvent *intrEvent;
NSGigEInt *interface;
diff --git a/dev/pcidev.hh b/dev/pcidev.hh
index 4b947b560..14f183e28 100644
--- a/dev/pcidev.hh
+++ b/dev/pcidev.hh
@@ -78,10 +78,6 @@ class PciConfigData : public SimObject
*/
class PciDev : public DmaDevice
{
- protected:
- struct Params;
- Params *_params;
-
public:
struct Params
{
@@ -110,6 +106,11 @@ class PciDev : public DmaDevice
/** The function number */
uint32_t functionNum;
};
+
+ protected:
+ Params *_params;
+
+ public:
const Params *params() const { return _params; }
protected:
diff --git a/dev/sinic.hh b/dev/sinic.hh
index ef515ffad..9f265b3f6 100644
--- a/dev/sinic.hh
+++ b/dev/sinic.hh
@@ -59,7 +59,7 @@ class Base : public PciDev
void cpuIntrClear();
typedef EventWrapper<Base, &Base::cpuInterrupt> IntrEvent;
- friend class IntrEvent;
+ friend void IntrEvent::process();
IntrEvent *intrEvent;
Interface *interface;
@@ -155,12 +155,12 @@ class Device : public Base
void rxKick();
Tick rxKickTick;
typedef EventWrapper<Device, &Device::rxKick> RxKickEvent;
- friend class RxKickEvent;
+ friend void RxKickEvent::process();
void txKick();
Tick txKickTick;
typedef EventWrapper<Device, &Device::txKick> TxKickEvent;
- friend class TxKickEvent;
+ friend void TxKickEvent::process();
/**
* Retransmit event
@@ -173,7 +173,7 @@ class Device : public Base
txKick();
}
typedef EventWrapper<Device, &Device::txEventTransmit> TxEvent;
- friend class TxEvent;
+ friend void TxEvent::process();
TxEvent txEvent;
void txDump() const;
diff --git a/kern/linux/linux_syscalls.hh b/kern/linux/linux_syscalls.hh
index dee7c5fcd..44a038def 100644
--- a/kern/linux/linux_syscalls.hh
+++ b/kern/linux/linux_syscalls.hh
@@ -26,14 +26,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __LINUX_SYSCALLS_HH__
-#define __LINUX_SYSCALLS_HH__
+#ifndef __KERN_LINUX_LINUX_SYSCALLS_HH__
+#define __KERN_LINUX_LINUX_SYSCALLS_HH__
#include "kern/linux/linux.hh"
template <class OS>
class SystemCalls;
+template <>
class SystemCalls<Linux>
{
public:
@@ -322,4 +323,4 @@ class SystemCalls<Linux>
};
-#endif // __LINUX_SYSCALLS_HH__
+#endif // __KERN_LINUX_LINUX_SYSCALLS_HH__
diff --git a/kern/tru64/tru64_syscalls.hh b/kern/tru64/tru64_syscalls.hh
index 7ddc699b1..44e5de250 100644
--- a/kern/tru64/tru64_syscalls.hh
+++ b/kern/tru64/tru64_syscalls.hh
@@ -26,14 +26,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __TRU64_SYSCALLS_HH__
-#define __TRU64_SYSCALLS_HH__
+#ifndef __KERN_TRU64_TRU64_SYSCALLS_HH__
+#define __KERN_TRU64_TRU64_SYSCALLS_HH__
#include "kern/tru64/tru64.hh"
template <class OS>
class SystemCalls;
+template <>
class SystemCalls<Tru64>
{
public:
@@ -355,4 +356,4 @@ class SystemCalls<Tru64>
}
};
-#endif // __TRU64_SYSCALLS_HH__
+#endif // __KERN_TRU64_TRU64_SYSCALLS_HH__
diff --git a/sim/eventq.hh b/sim/eventq.hh
index 304e4b16a..d62e7df10 100644
--- a/sim/eventq.hh
+++ b/sim/eventq.hh
@@ -30,8 +30,8 @@
* EventQueue interfaces
*/
-#ifndef __EVENTQ_HH__
-#define __EVENTQ_HH__
+#ifndef __SIM_EVENTQ_HH__
+#define __SIM_EVENTQ_HH__
#include <assert.h>
@@ -43,11 +43,24 @@
#include "sim/host.hh" // for Tick
#include "base/fast_alloc.hh"
-#include "sim/serialize.hh"
#include "base/trace.hh"
+#include "sim/serialize.hh"
class EventQueue; // forward declaration
+//////////////////////
+//
+// Main Event Queue
+//
+// Events on this queue are processed at the *beginning* of each
+// cycle, before the pipeline simulation is performed.
+//
+// defined in eventq.cc
+//
+//////////////////////
+extern EventQueue mainEventQueue;
+
+
/*
* An item on an event queue. The action caused by a given
* event is specified by deriving a subclass and overriding the
@@ -228,7 +241,7 @@ DelayFunction(Tick when, T *object)
public:
DelayEvent(Tick when, T *o)
: Event(&mainEventQueue), object(o)
- { setFlags(AutoDestroy); schedule(when); }
+ { setFlags(this->AutoDestroy); schedule(when); }
void process() { (object->*F)(); }
const char *description() { return "delay"; }
};
@@ -386,16 +399,5 @@ EventQueue::reschedule(Event *event)
}
-//////////////////////
-//
-// Main Event Queue
-//
-// Events on this queue are processed at the *beginning* of each
-// cycle, before the pipeline simulation is performed.
-//
-// defined in eventq.cc
-//
-//////////////////////
-extern EventQueue mainEventQueue;
-#endif // __EVENTQ_HH__
+#endif // __SIM_EVENTQ_HH__
diff --git a/sim/param.cc b/sim/param.cc
index d20be8d33..e25daac30 100644
--- a/sim/param.cc
+++ b/sim/param.cc
@@ -27,21 +27,21 @@
*/
#include <algorithm>
+#include <cstdio> // for sscanf()
#include <list>
#include <string>
#include <vector>
-#include <stdio.h> // for sscanf()
#include <assert.h>
-#include "sim/param.hh"
-#include "sim/sim_object.hh"
#include "base/inifile.hh"
-#include "sim/configfile.hh"
-#include "sim/config_node.hh"
#include "base/misc.hh"
#include "base/str.hh"
#include "base/trace.hh"
+#include "sim/config_node.hh"
+#include "sim/configfile.hh"
+#include "sim/param.hh"
+#include "sim/sim_object.hh"
using namespace std;
@@ -474,11 +474,11 @@ EnumVectorParam<Map>::showType(ostream &os) const
showEnumType(os, map, num_values);
}
-template EnumParam<const char *>;
-template EnumVectorParam<const char *>;
+template class EnumParam<const char *>;
+template class EnumVectorParam<const char *>;
-template EnumParam<EnumParamMap>;
-template EnumVectorParam<EnumParamMap>;
+template class EnumParam<EnumParamMap>;
+template class EnumVectorParam<EnumParamMap>;
////////////////////////////////////////////////////////////////////////
//
diff --git a/sim/param.hh b/sim/param.hh
index ac57afa31..f4b9d3450 100644
--- a/sim/param.hh
+++ b/sim/param.hh
@@ -26,9 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __PARAM_HH__
-#define __PARAM_HH__
+#ifndef __SIM_PARAM_HH__
+#define __SIM_PARAM_HH__
+#include <iostream>
#include <list>
#include <string>
#include <vector>
@@ -524,7 +525,7 @@ class MappedEnumParam : public EnumParam<EnumParamMap>
{
if (!isValid())
die("not found");
- return (ENUM)value[n];
+ return (ENUM)value[this->n];
}
};
@@ -782,4 +783,4 @@ SimObjectVectorParam<OBJ_CLASS *>::showType(std::ostream &os) const \
template <class T> bool parseParam(const std::string &str, T &data);
template <class T> void showParam(std::ostream &os, const T &data);
-#endif // _PARAM_HH
+#endif // _SIM_PARAM_HH_
diff --git a/sim/serialize.cc b/sim/serialize.cc
index 2a5e3d398..3a073f68d 100644
--- a/sim/serialize.cc
+++ b/sim/serialize.cc
@@ -29,6 +29,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <fstream>
#include <list>
diff --git a/sim/startup.cc b/sim/startup.cc
index ebb4c0bc0..7cc0ac8fb 100644
--- a/sim/startup.cc
+++ b/sim/startup.cc
@@ -29,20 +29,32 @@
#include <list>
#include "base/misc.hh"
-#include "sim/startup.hh"
#include "sim/debug.hh"
+#include "sim/startup.hh"
typedef std::list<StartupCallback *> startupq_t;
-startupq_t &startupq() { static startupq_t queue; return queue; }
-StartupCallback::StartupCallback() { startupq().push_back(this); }
-StartupCallback::~StartupCallback() { startupq().remove(this); }
+
+startupq_t *startupq = NULL;
+
+StartupCallback::StartupCallback()
+{
+ if (startupq == NULL)
+ startupq = new startupq_t;
+ startupq->push_back(this);
+}
+
+StartupCallback::~StartupCallback()
+{
+ startupq->remove(this);
+}
+
void StartupCallback::startup() { }
void
SimStartup()
{
- startupq_t::iterator i = startupq().begin();
- startupq_t::iterator end = startupq().end();
+ startupq_t::iterator i = startupq->begin();
+ startupq_t::iterator end = startupq->end();
while (i != end) {
(*i)->startup();
diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh
index 77d104449..768bc3700 100644
--- a/sim/syscall_emul.hh
+++ b/sim/syscall_emul.hh
@@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __SYSCALL_EMUL_HH__
-#define __SYSCALL_EMUL_HH__
+#ifndef __SIM_SYSCALL_EMUL_HH__
+#define __SIM_SYSCALL_EMUL_HH__
///
/// @file syscall_emul.hh
@@ -35,14 +35,16 @@
/// This file defines objects used to emulate syscalls from the target
/// application on the host machine.
+#include <errno.h>
#include <string>
#include "base/intmath.hh" // for RoundUp
-#include "targetarch/isa_traits.hh" // for Addr
#include "mem/functional_mem/functional_memory.hh"
+#include "targetarch/isa_traits.hh" // for Addr
-class Process;
-class ExecContext;
+#include "base/trace.hh"
+#include "cpu/exec_context.hh"
+#include "sim/process.hh"
///
/// System call descriptor.
@@ -197,6 +199,36 @@ int unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
/// Target rename() handler.
int renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
+/// This struct is used to build an target-OS-dependent table that
+/// maps the target's open() flags to the host open() flags.
+struct OpenFlagTransTable {
+ int tgtFlag; //!< Target system flag value.
+ int hostFlag; //!< Corresponding host system flag value.
+};
+
+
+
+/// A readable name for 1,000,000, for converting microseconds to seconds.
+const int one_million = 1000000;
+
+/// Approximate seconds since the epoch (1/1/1970). About a billion,
+/// by my reckoning. We want to keep this a constant (not use the
+/// real-world time) to keep simulations repeatable.
+const unsigned seconds_since_epoch = 1000000000;
+
+/// Helper function to convert current elapsed time to seconds and
+/// microseconds.
+template <class T1, class T2>
+void
+getElapsedTime(T1 &sec, T2 &usec)
+{
+ int cycles_per_usec = ticksPerSecond / one_million;
+
+ int elapsed_usecs = curTick / cycles_per_usec;
+ sec = elapsed_usecs / one_million;
+ usec = elapsed_usecs % one_million;
+}
+
//////////////////////////////////////////////////////////////////////
//
// The following emulation functions are generic, but need to be
@@ -238,14 +270,6 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
}
}
-/// This struct is used to build an target-OS-dependent table that
-/// maps the target's open() flags to the host open() flags.
-struct OpenFlagTransTable {
- int tgtFlag; //!< Target system flag value.
- int hostFlag; //!< Corresponding host system flag value.
-};
-
-
/// Target open() handler.
template <class OS>
int
@@ -260,7 +284,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
if (path == "/dev/sysdev0") {
// This is a memory-mapped high-resolution timer device on Alpha.
// We don't support it, so just punt.
- DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << endl;
+ DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << std::endl;
return -ENOENT;
}
@@ -278,7 +302,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
// any target flags left?
if (tgtFlags != 0)
- cerr << "Syscall: open: cannot decode flags: " << tgtFlags << endl;
+ std::cerr << "Syscall: open: cannot decode flags: " << tgtFlags << std::endl;
#ifdef __CYGWIN32__
hostFlags |= O_BINARY;
@@ -414,7 +438,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
break;
default:
- cerr << "getrlimitFunc: unimplemented resource " << resource << endl;
+ std::cerr << "getrlimitFunc: unimplemented resource " << resource << std::endl;
abort();
break;
}
@@ -423,28 +447,6 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
return 0;
}
-/// A readable name for 1,000,000, for converting microseconds to seconds.
-const int one_million = 1000000;
-
-/// Approximate seconds since the epoch (1/1/1970). About a billion,
-/// by my reckoning. We want to keep this a constant (not use the
-/// real-world time) to keep simulations repeatable.
-const unsigned seconds_since_epoch = 1000000000;
-
-/// Helper function to convert current elapsed time to seconds and
-/// microseconds.
-template <class T1, class T2>
-void
-getElapsedTime(T1 &sec, T2 &usec)
-{
- int cycles_per_usec = ticksPerSecond / one_million;
-
- int elapsed_usecs = curTick / cycles_per_usec;
- sec = elapsed_usecs / one_million;
- usec = elapsed_usecs % one_million;
-}
-
-
/// Target gettimeofday() handler.
template <class OS>
int
@@ -476,7 +478,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
// plow ahead
DCOUT(SyscallWarnings)
<< "Warning: getrusage() only supports RUSAGE_SELF."
- << " Parameter " << who << " ignored." << endl;
+ << " Parameter " << who << " ignored." << std::endl;
}
getElapsedTime(rup->ru_utime.tv_sec, rup->ru_utime.tv_usec);
@@ -502,6 +504,4 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
return 0;
}
-
-
-#endif // __SYSCALL_EMUL_HH__
+#endif // __SIM_SYSCALL_EMUL_HH__
diff --git a/sim/universe.cc b/sim/universe.cc
index 824b985fa..8311b0618 100644
--- a/sim/universe.cc
+++ b/sim/universe.cc
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <cstring>
#include <fstream>