Fixes so m5 compiles on gcc 3.4, which has much stricter syntax. Most changes come...
authorKevin Lim <ktlim@umich.edu>
Fri, 14 Jan 2005 23:34:56 +0000 (18:34 -0500)
committerKevin Lim <ktlim@umich.edu>
Fri, 14 Jan 2005 23:34:56 +0000 (18:34 -0500)
which is evaluated slightly differently than in previous versions of gcc.

arch/alpha/alpha_linux_process.cc:
    Alphabetize includes.
arch/alpha/vptr.hh:
    Change the constants that are being used for alpha pagebytes to come from the ISA.
base/random.hh:
cpu/static_inst.cc:
sim/param.cc:
    Fix up template syntax.
base/range.hh:
    Include iostream for << operator.
base/res_list.hh:
base/statistics.hh:
cpu/simple_cpu/simple_cpu.hh:
cpu/static_inst.hh:
sim/eventq.hh:
sim/param.hh:
    Fixup for templated code to resolve different scope lookup in gcc 3.4.  This defers the lookup of the
    function/variable until actual instantiation time by making it dependent on the templated class/function.
base/trace.cc:
    Fix call to new.
base/trace.hh:
    Fix up #define to have full path.
cpu/base_cpu.cc:
    Fix up call to new.
dev/etherlink.hh:
dev/ns_gige.hh:
dev/sinic.hh:
    Fixup for friend class/function declaration.  g++ 3.4 no longer allows typedefs to be declared as
    a friend class.
dev/pcidev.hh:
    Fix up re-definition of access level to params.
kern/linux/linux_syscalls.hh:
kern/tru64/tru64_syscalls.hh:
    Fix up header.  Fix up template syntax.
sim/serialize.cc:
    Include errno.h.
sim/startup.cc:
    Change startupq.  queue was getting destructed before all things had called ~StartupCallback(), which lead
    to a segfault.  This puts startupq in global space, and we allocate it ourselves.  Other code may be similar
    to this and may need changing in the future.
sim/syscall_emul.hh:
    Include cpu/exec_context.hh and sim/process.hh, as forward declarations are no longer sufficient.
sim/universe.cc:
    Include errno.h

--HG--
extra : convert_revision : e49d08ee89eb06a28351f02bafc028ca6652d5af

25 files changed:
arch/alpha/alpha_linux_process.cc
arch/alpha/vptr.hh
base/random.hh
base/range.hh
base/res_list.hh
base/statistics.hh
base/trace.cc
base/trace.hh
cpu/base_cpu.cc
cpu/simple_cpu/simple_cpu.hh
cpu/static_inst.cc
cpu/static_inst.hh
dev/etherlink.hh
dev/ns_gige.hh
dev/pcidev.hh
dev/sinic.hh
kern/linux/linux_syscalls.hh
kern/tru64/tru64_syscalls.hh
sim/eventq.hh
sim/param.cc
sim/param.hh
sim/serialize.cc
sim/startup.cc
sim/syscall_emul.hh
sim/universe.cc

index 67bb0ab3b47e4686e70582b639565786826b8421..ba4b1d07e774453ac09daa35581f26edde29c3d4 100644 (file)
  * 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"
index cd4bc547b36ce7a3454607e7d188b21685c3f699..e955c67cf40d7ae9b8184b1da398203deac995c9 100644 (file)
@@ -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__
index 0bfed100c3d36653395b31cf45a39fe97c0e42e0..fe93a98a6f01d0423e9da71c892aff35c632d3ed 100644 (file)
@@ -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(); }
index 9289792ea69588fedb49c6061a15371458795c0f..57b6e6a77502eee599fbeac7eea2a5acd7d2af37 100644 (file)
@@ -30,6 +30,7 @@
 #define __BASE_RANGE_HH__
 
 #include <cassert>
+#include <iostream>
 #include <string>
 
 /**
index 7080a3ba79e6d3b8db8cfe4bf9c53d1f33aaec44..5dc798fed05bb45aaa0b31117ad9ee0e4d38835e 100644 (file)
@@ -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())
index f3b8a3922b93c8fa1243cd35d0f7eeec1559fce2..9ec26eb4d41eb5ed06f1d7e1eabb4c9cb6beb5c3 100644 (file)
@@ -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;
     }
index bc6c9aa7a4b3690879f463e00fb466a27af22af4..aa4e7b2af45a7427f3d43bd787cb9b747ebc7f0d 100644 (file)
@@ -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;
index 5e05d6e5e6ec23c5564e4875972dc2623de6b5a5..054b145461617d625f23eefe9336c0d7c44cdcaa 100644 (file)
@@ -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__
index 7605ff3c3fd05b26b025b02563609ab58ffe1b7f..c4bb97ff87b5f375927cec66ff89489df9d74ecc 100644 (file)
@@ -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");
 
index 341a0da2369c5c9a461e2290dd9e87ee1b81a3e0..9b6e2423b50cfe11f4d1a6dd14d867b74810323b 100644 (file)
  * 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__
index 4cb45a8181e374528587e0144b464a1d060dfe07..7069d89ec6a78fd35a3f3f170f0fe57148b74768 100644 (file)
@@ -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>;
index 46b2e4b19f660622f949cd2c8425a3f58a1de5e8..c442ada35ba03ce7955ccd00bc8708c1a2457ca2 100644 (file)
@@ -456,7 +456,7 @@ class StaticInstPtr : public RefCountingPtr<StaticInst<ISA> >
     /// Convert to pointer to StaticInstBase class.
     operator const StaticInstBasePtr()
     {
-        return get();
+        return this->get();
     }
 };
 
index e998a006fca038949078b2280d6810a576f74b92..d5cd7d7c823a459e4496857dfab6c99615ba5a22 100644 (file)
  * 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;
index 8d601612659e7395a62f19a4657ce0a30ea24976..697c39caccfccbda7c667a066b10823a30f4c127 100644 (file)
@@ -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;
 
index 4b947b56053a39f7e0cacd8d2281c0496b62c53c..14f183e2891fe3bd2e3b4158450fcf04bfd9adb7 100644 (file)
@@ -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:
index ef515ffad8e3099df544de2987ab3fb5c3add4fb..9f265b3f6a8ac4572b5150907dd6563deeebd74a 100644 (file)
@@ -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;
index dee7c5fcd4ff91b7a1b9606992f6ef8d13868cf0..44a038def5702459ce0b72f7f7d1960cc52e724e 100644 (file)
  * 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__
index 7ddc699b1d4f646b3fe29b71c7ef7db8deca26af..44e5de250df60a67004459d727a58386d35095a3 100644 (file)
  * 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__
index 304e4b16a5cc79c3324ef5839bfec528ab964e25..d62e7df10a7954ab561dbbf0aab797bf2dffe65c 100644 (file)
@@ -30,8 +30,8 @@
  * EventQueue interfaces
  */
 
-#ifndef __EVENTQ_HH__
-#define __EVENTQ_HH__
+#ifndef __SIM_EVENTQ_HH__
+#define __SIM_EVENTQ_HH__
 
 #include <assert.h>
 
 #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__
index d20be8d3358bf215108fc2978714e29ce47b0da6..e25daac305dd302783b1b38dfacc1563dc4ebe4c 100644 (file)
  */
 
 #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>;
 
 ////////////////////////////////////////////////////////////////////////
 //
index ac57afa311208e07373c53e2482d95d900c2c649..f4b9d3450a7b2ad39aff74d0cbc1d390f98976e9 100644 (file)
  * 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_
index 2a5e3d398b45d53ad09a8194ae07819e8497a78a..3a073f68d2be8ff9f1ba9e16357a8d3c247e0d8b 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <errno.h>
 
 #include <fstream>
 #include <list>
index ebb4c0bc02bffd14359eba703b12b482a7886b6a..7cc0ac8fbb836fcc4371a61588d289a689f474f9 100644 (file)
 #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();
index 77d1044492c1a87ea2cd51d2ddc331778e8dc0cb..768bc3700cbddbf596d882d38c265b3cb5200f0a 100644 (file)
@@ -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
 /// 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__
index 824b985fa8642acc4c4bcacf56f210f13e7f1394..8311b06180b4797bafdb844164b8ebcd43e7b5b3 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <errno.h>
 
 #include <cstring>
 #include <fstream>