Fixes so m5 compiles on gcc 3.4, which has much stricter syntax. Most changes come from templated code,

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
This commit is contained in:
Kevin Lim 2005-01-14 18:34:56 -05:00
parent 3e5a3df24f
commit f58d85128d
25 changed files with 227 additions and 210 deletions

View file

@ -26,24 +26,24 @@
* 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>
#include <string.h> // for memset()
#include <dirent.h>
#include <errno.h>
#include <fcntl.h> // for host open() flags
#include <string.h> // for memset()
#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"

View 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__

View 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(); }

View file

@ -30,6 +30,7 @@
#define __BASE_RANGE_HH__
#include <cassert>
#include <iostream>
#include <string>
/**

View 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())

View 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;
}

View 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;

View 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__

View 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");

View file

@ -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__

View 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>;

View 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();
}
};

View file

@ -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;

View 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;

View 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:

View 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;

View file

@ -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__

View file

@ -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__

View file

@ -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__

View file

@ -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>;
////////////////////////////////////////////////////////////////////////
//

View file

@ -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_

View file

@ -29,6 +29,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fstream>
#include <list>

View file

@ -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();

View 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
@ -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__

View file

@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <cstring>
#include <fstream>