Merge changes to make m5 g++ 3.4 compatible.
sim/param.cc: Merge changes. --HG-- extra : convert_revision : b5044e1f7c48ae2d74d5233dd4fabfb7a801d7c8
This commit is contained in:
commit
aed3e6780a
26 changed files with 231 additions and 205 deletions
|
@ -26,24 +26,24 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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 <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 "cpu/base_cpu.hh"
|
||||||
#include "mem/functional_mem/functional_memory.hh"
|
|
||||||
#include "sim/process.hh"
|
|
||||||
#include "cpu/exec_context.hh"
|
#include "cpu/exec_context.hh"
|
||||||
|
#include "mem/functional_mem/functional_memory.hh"
|
||||||
#include "sim/fake_syscall.hh"
|
#include "sim/fake_syscall.hh"
|
||||||
|
#include "sim/host.hh"
|
||||||
|
#include "sim/process.hh"
|
||||||
#include "sim/sim_events.hh"
|
#include "sim/sim_events.hh"
|
||||||
|
|
||||||
#include "sim/syscall_emul.hh"
|
|
||||||
#include "arch/alpha/alpha_common_syscall_emul.hh"
|
#include "arch/alpha/alpha_common_syscall_emul.hh"
|
||||||
|
#include "sim/syscall_emul.hh"
|
||||||
#include "sim/universe.hh" // for curTick & ticksPerSecond
|
#include "sim/universe.hh" // for curTick & ticksPerSecond
|
||||||
|
|
||||||
#include "arch/alpha/alpha_linux_process.hh"
|
#include "arch/alpha/alpha_linux_process.hh"
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __VPTR_HH__
|
#ifndef __ARCH_ALPHA_VPTR_HH__
|
||||||
#define __VPTR_HH__
|
#define __ARCH_ALPHA_VPTR_HH__
|
||||||
|
|
||||||
#include "arch/alpha/vtophys.hh"
|
#include "arch/alpha/vtophys.hh"
|
||||||
|
|
||||||
|
@ -69,14 +69,15 @@ class VPtr
|
||||||
const VPtr<T> &operator+=(int offset)
|
const VPtr<T> &operator+=(int offset)
|
||||||
{
|
{
|
||||||
ptr += offset;
|
ptr += offset;
|
||||||
assert((ptr & (ALPHA_PGBYTES - 1)) + sizeof(T) < ALPHA_PGBYTES);
|
assert((ptr & (AlphaISA::PageBytes - 1)) + sizeof(T)
|
||||||
|
< AlphaISA::PageBytes);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VPtr<T> &operator=(Addr p)
|
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;
|
ptr = p;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -110,4 +111,4 @@ class VPtr
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __VPTR_HH__
|
#endif // __ARCH_ALPHA_VPTR_HH__
|
||||||
|
|
|
@ -37,61 +37,61 @@ double getDouble();
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Random;
|
struct Random;
|
||||||
|
|
||||||
struct Random<int8_t>
|
template<> struct Random<int8_t>
|
||||||
{
|
{
|
||||||
static int8_t get()
|
static int8_t get()
|
||||||
{ return getLong() & (int8_t)-1; }
|
{ return getLong() & (int8_t)-1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<uint8_t>
|
template<> struct Random<uint8_t>
|
||||||
{
|
{
|
||||||
static uint8_t get()
|
static uint8_t get()
|
||||||
{ return getLong() & (uint8_t)-1; }
|
{ return getLong() & (uint8_t)-1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<int16_t>
|
template<> struct Random<int16_t>
|
||||||
{
|
{
|
||||||
static int16_t get()
|
static int16_t get()
|
||||||
{ return getLong() & (int16_t)-1; }
|
{ return getLong() & (int16_t)-1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<uint16_t>
|
template<> struct Random<uint16_t>
|
||||||
{
|
{
|
||||||
static uint16_t get()
|
static uint16_t get()
|
||||||
{ return getLong() & (uint16_t)-1; }
|
{ return getLong() & (uint16_t)-1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<int32_t>
|
template<> struct Random<int32_t>
|
||||||
{
|
{
|
||||||
static int32_t get()
|
static int32_t get()
|
||||||
{ return (int32_t)getLong(); }
|
{ return (int32_t)getLong(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<uint32_t>
|
template<> struct Random<uint32_t>
|
||||||
{
|
{
|
||||||
static uint32_t get()
|
static uint32_t get()
|
||||||
{ return (uint32_t)getLong(); }
|
{ return (uint32_t)getLong(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<int64_t>
|
template<> struct Random<int64_t>
|
||||||
{
|
{
|
||||||
static int64_t get()
|
static int64_t get()
|
||||||
{ return (int64_t)getLong() << 32 || (uint64_t)getLong(); }
|
{ return (int64_t)getLong() << 32 || (uint64_t)getLong(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<uint64_t>
|
template<> struct Random<uint64_t>
|
||||||
{
|
{
|
||||||
static uint64_t get()
|
static uint64_t get()
|
||||||
{ return (uint64_t)getLong() << 32 || (uint64_t)getLong(); }
|
{ return (uint64_t)getLong() << 32 || (uint64_t)getLong(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<float>
|
template<> struct Random<float>
|
||||||
{
|
{
|
||||||
static float get()
|
static float get()
|
||||||
{ return getDouble(); }
|
{ return getDouble(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Random<double>
|
template<> struct Random<double>
|
||||||
{
|
{
|
||||||
static double get()
|
static double get()
|
||||||
{ return getDouble(); }
|
{ return getDouble(); }
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define __BASE_RANGE_HH__
|
#define __BASE_RANGE_HH__
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -352,7 +352,7 @@ res_list<T>::insert_after(iterator prev, T *d)
|
||||||
iterator p;
|
iterator p;
|
||||||
|
|
||||||
if (!allocate_storage)
|
if (!allocate_storage)
|
||||||
panic("Can't copy data... not allocating storage");
|
this->panic("Can't copy data... not allocating storage");
|
||||||
|
|
||||||
p = insert_after(prev);
|
p = insert_after(prev);
|
||||||
if (p.notnull())
|
if (p.notnull())
|
||||||
|
|
|
@ -417,10 +417,10 @@ class Wrap : public Child
|
||||||
*/
|
*/
|
||||||
Parent &name(const std::string &_name)
|
Parent &name(const std::string &_name)
|
||||||
{
|
{
|
||||||
Data<Child> *data = statData();
|
Data<Child> *data = this->statData();
|
||||||
data->name = _name;
|
data->name = _name;
|
||||||
setPrint();
|
this->setPrint();
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -431,8 +431,8 @@ class Wrap : public Child
|
||||||
*/
|
*/
|
||||||
Parent &desc(const std::string &_desc)
|
Parent &desc(const std::string &_desc)
|
||||||
{
|
{
|
||||||
statData()->desc = _desc;
|
this->statData()->desc = _desc;
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -442,8 +442,8 @@ class Wrap : public Child
|
||||||
*/
|
*/
|
||||||
Parent &precision(int _precision)
|
Parent &precision(int _precision)
|
||||||
{
|
{
|
||||||
statData()->precision = _precision;
|
this->statData()->precision = _precision;
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -453,8 +453,8 @@ class Wrap : public Child
|
||||||
*/
|
*/
|
||||||
Parent &flags(StatFlags _flags)
|
Parent &flags(StatFlags _flags)
|
||||||
{
|
{
|
||||||
statData()->flags |= _flags;
|
this->statData()->flags |= _flags;
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -466,8 +466,8 @@ class Wrap : public Child
|
||||||
template <class Stat>
|
template <class Stat>
|
||||||
Parent &prereq(const Stat &prereq)
|
Parent &prereq(const Stat &prereq)
|
||||||
{
|
{
|
||||||
statData()->prereq = prereq.statData();
|
this->statData()->prereq = prereq.statData();
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -487,11 +487,11 @@ class WrapVec : public Wrap<Parent, Child, Data>
|
||||||
*/
|
*/
|
||||||
Parent &subname(int index, const std::string &name)
|
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)
|
if (subn.size() <= index)
|
||||||
subn.resize(index + 1);
|
subn.resize(index + 1);
|
||||||
subn[index] = name;
|
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)
|
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)
|
if (subd.size() <= index)
|
||||||
subd.resize(index + 1);
|
subd.resize(index + 1);
|
||||||
subd[index] = desc;
|
subd[index] = desc;
|
||||||
|
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -523,19 +523,19 @@ class WrapVec2d : public WrapVec<Parent, Child, Data>
|
||||||
*/
|
*/
|
||||||
Parent &ysubnames(const char **names)
|
Parent &ysubnames(const char **names)
|
||||||
{
|
{
|
||||||
Data<Child> *data = statData();
|
Data<Child> *data = this->statData();
|
||||||
data->y_subnames.resize(y);
|
data->y_subnames.resize(this->y);
|
||||||
for (int i = 0; i < y; ++i)
|
for (int i = 0; i < this->y; ++i)
|
||||||
data->y_subnames[i] = names[i];
|
data->y_subnames[i] = names[i];
|
||||||
return self();
|
return this->self();
|
||||||
}
|
}
|
||||||
Parent &ysubname(int index, const std::string subname)
|
Parent &ysubname(int index, const std::string subname)
|
||||||
{
|
{
|
||||||
Data<Child> *data = statData();
|
Data<Child> *data = this->statData();
|
||||||
assert(index < y);
|
assert(index < this->y);
|
||||||
data->y_subnames.resize(y);
|
data->y_subnames.resize(this->y);
|
||||||
data->y_subnames[index] = subname.c_str();
|
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. */
|
/** Define the params of the storage class. */
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
/** Define the bin type. */
|
/** Define the bin type. */
|
||||||
typedef typename Bin::Bin<Storage> bin_t;
|
typedef typename Bin::template Bin<Storage> bin_t;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The bin of this stat. */
|
/** The bin of this stat. */
|
||||||
|
@ -914,7 +914,7 @@ class VectorBase : public DataAccess
|
||||||
/** Define the params of the storage class. */
|
/** Define the params of the storage class. */
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
/** Define the bin type. */
|
/** Define the bin type. */
|
||||||
typedef typename Bin::VectorBin<Storage> bin_t;
|
typedef typename Bin::template VectorBin<Storage> bin_t;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The bin of this stat. */
|
/** The bin of this stat. */
|
||||||
|
@ -1022,7 +1022,7 @@ class ScalarProxy
|
||||||
/** Define the params of the storage class. */
|
/** Define the params of the storage class. */
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
/** Define the bin type. */
|
/** Define the bin type. */
|
||||||
typedef typename Bin::VectorBin<Storage> bin_t;
|
typedef typename Bin::template VectorBin<Storage> bin_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Pointer to the bin in the parent VectorBase. */
|
/** Pointer to the bin in the parent VectorBase. */
|
||||||
|
@ -1155,7 +1155,7 @@ class ScalarProxy
|
||||||
const StatData *statData() const { return getStatData(stat); }
|
const StatData *statData() const { return getStatData(stat); }
|
||||||
std::string str() const
|
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:
|
public:
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
typedef typename Bin::VectorBin<Storage> bin_t;
|
typedef typename Bin::template VectorBin<Storage> bin_t;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
size_t x;
|
size_t x;
|
||||||
|
@ -1204,7 +1204,7 @@ class Vector2dBase : public DataAccess
|
||||||
data->cvec[i] = this->data(i)->value(params);
|
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>;
|
friend class VectorProxy<Storage, Bin>;
|
||||||
VectorProxy<Storage, Bin> operator[](int index);
|
VectorProxy<Storage, Bin> operator[](int index);
|
||||||
|
@ -1225,7 +1225,7 @@ class VectorProxy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
typedef typename Bin::VectorBin<Storage> bin_t;
|
typedef typename Bin::template VectorBin<Storage> bin_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bin_t *bin;
|
bin_t *bin;
|
||||||
|
@ -1622,7 +1622,7 @@ class DistBase : public DataAccess
|
||||||
/** Define the params of the storage class. */
|
/** Define the params of the storage class. */
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
/** Define the bin type. */
|
/** Define the bin type. */
|
||||||
typedef typename Bin::Bin<Storage> bin_t;
|
typedef typename Bin::template Bin<Storage> bin_t;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The bin of this stat. */
|
/** The bin of this stat. */
|
||||||
|
@ -1698,7 +1698,7 @@ class VectorDistBase : public DataAccess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Storage::Params params_t;
|
typedef typename Storage::Params params_t;
|
||||||
typedef typename Bin::VectorBin<Storage> bin_t;
|
typedef typename Bin::template VectorBin<Storage> bin_t;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bin_t bin;
|
bin_t bin;
|
||||||
|
@ -1749,7 +1749,7 @@ class DistProxy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Storage::Params params_t;
|
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;
|
typedef VectorDistBase<Storage, Bin> base_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -2206,7 +2206,7 @@ class Scalar
|
||||||
|
|
||||||
Scalar()
|
Scalar()
|
||||||
{
|
{
|
||||||
setInit();
|
this->setInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2258,7 +2258,7 @@ class Average
|
||||||
|
|
||||||
Average()
|
Average()
|
||||||
{
|
{
|
||||||
setInit();
|
this->setInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2290,8 +2290,8 @@ class Vector
|
||||||
* @return A reference to this stat.
|
* @return A reference to this stat.
|
||||||
*/
|
*/
|
||||||
Vector &init(size_t size) {
|
Vector &init(size_t size) {
|
||||||
bin.init(size, params);
|
this->bin.init(size, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2314,8 +2314,8 @@ class AverageVector
|
||||||
* @return A reference to this stat.
|
* @return A reference to this stat.
|
||||||
*/
|
*/
|
||||||
AverageVector &init(size_t size) {
|
AverageVector &init(size_t size) {
|
||||||
bin.init(size, params);
|
this->bin.init(size, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2333,10 +2333,10 @@ class Vector2d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Vector2d &init(size_t _x, size_t _y) {
|
Vector2d &init(size_t _x, size_t _y) {
|
||||||
statData()->x = x = _x;
|
this->statData()->x = this->x = _x;
|
||||||
statData()->y = y = _y;
|
this->statData()->y = this->y = _y;
|
||||||
bin.init(x * y, params);
|
this->bin.init(this->x * this->y, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2367,12 +2367,12 @@ class Distribution
|
||||||
* @return A reference to this distribution.
|
* @return A reference to this distribution.
|
||||||
*/
|
*/
|
||||||
Distribution &init(Counter min, Counter max, Counter bkt) {
|
Distribution &init(Counter min, Counter max, Counter bkt) {
|
||||||
params.min = min;
|
this->params.min = min;
|
||||||
params.max = max;
|
this->params.max = max;
|
||||||
params.bucket_size = bkt;
|
this->params.bucket_size = bkt;
|
||||||
params.size = (int)rint((max - min) / bkt + 1.0);
|
this->params.size = (int)rint((max - min) / bkt + 1.0);
|
||||||
bin.init(params);
|
this->bin.init(this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2399,8 +2399,8 @@ class StandardDeviation
|
||||||
* Construct and initialize this distribution.
|
* Construct and initialize this distribution.
|
||||||
*/
|
*/
|
||||||
StandardDeviation() {
|
StandardDeviation() {
|
||||||
bin.init(params);
|
this->bin.init(this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2426,8 +2426,8 @@ class AverageDeviation
|
||||||
*/
|
*/
|
||||||
AverageDeviation()
|
AverageDeviation()
|
||||||
{
|
{
|
||||||
bin.init(params);
|
this->bin.init(this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2457,12 +2457,12 @@ class VectorDistribution
|
||||||
* @return A reference to this distribution.
|
* @return A reference to this distribution.
|
||||||
*/
|
*/
|
||||||
VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) {
|
VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) {
|
||||||
params.min = min;
|
this->params.min = min;
|
||||||
params.max = max;
|
this->params.max = max;
|
||||||
params.bucket_size = bkt;
|
this->params.bucket_size = bkt;
|
||||||
params.size = (int)rint((max - min) / bkt + 1.0);
|
this->params.size = (int)rint((max - min) / bkt + 1.0);
|
||||||
bin.init(size, params);
|
this->bin.init(size, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2491,8 +2491,8 @@ class VectorStandardDeviation
|
||||||
* @return A reference to this distribution.
|
* @return A reference to this distribution.
|
||||||
*/
|
*/
|
||||||
VectorStandardDeviation &init(int size) {
|
VectorStandardDeviation &init(int size) {
|
||||||
bin.init(size, params);
|
this->bin.init(size, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2521,8 +2521,8 @@ class VectorAverageDeviation
|
||||||
* @return A reference to this distribution.
|
* @return A reference to this distribution.
|
||||||
*/
|
*/
|
||||||
VectorAverageDeviation &init(int size) {
|
VectorAverageDeviation &init(int size) {
|
||||||
bin.init(size, params);
|
this->bin.init(size, this->params);
|
||||||
setInit();
|
this->setInit();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ Log::init(int _size)
|
||||||
|
|
||||||
size = _size;
|
size = _size;
|
||||||
|
|
||||||
buffer = new (Record *)[size];
|
buffer = new Record *[size];
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
buffer[i] = NULL;
|
buffer[i] = NULL;
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TRACE_HH__
|
#ifndef __BASE_TRACE_HH__
|
||||||
#define __TRACE_HH__
|
#define __BASE_TRACE_HH__
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -228,4 +228,4 @@ do { \
|
||||||
|
|
||||||
#endif // TRACING_ON
|
#endif // TRACING_ON
|
||||||
|
|
||||||
#endif // __TRACE_HH__
|
#endif // __BASE_TRACE_HH__
|
||||||
|
|
|
@ -76,7 +76,7 @@ BaseCPU::BaseCPU(const string &_name, int _number_of_threads, bool _def_reg,
|
||||||
maxThreadsPerCPU = number_of_threads;
|
maxThreadsPerCPU = number_of_threads;
|
||||||
|
|
||||||
// allocate per-thread instruction-based event queues
|
// 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)
|
for (int i = 0; i < number_of_threads; ++i)
|
||||||
comInstEventQueue[i] = new EventQueue("instruction-based event queue");
|
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
|
// 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)
|
for (int i = 0; i < number_of_threads; ++i)
|
||||||
comLoadEventQueue[i] = new EventQueue("load-based event queue");
|
comLoadEventQueue[i] = new EventQueue("load-based event queue");
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,15 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void
|
||||||
|
SimpleCPU::trace_data(T data) {
|
||||||
|
if (traceData) {
|
||||||
|
traceData->setData(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SimpleCPU::TickEvent::TickEvent(SimpleCPU *c)
|
SimpleCPU::TickEvent::TickEvent(SimpleCPU *c)
|
||||||
: Event(&mainEventQueue, CPU_Tick_Pri), cpu(c), multiplier(1)
|
: Event(&mainEventQueue, CPU_Tick_Pri), cpu(c), multiplier(1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,15 +26,15 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SIMPLE_CPU_HH__
|
#ifndef __CPU_SIMPLE_CPU_SIMPLE_CPU_HH__
|
||||||
#define __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 "base/statistics.hh"
|
||||||
|
#include "cpu/base_cpu.hh"
|
||||||
#include "cpu/exec_context.hh"
|
#include "cpu/exec_context.hh"
|
||||||
|
#include "cpu/pc_event.hh"
|
||||||
#include "cpu/static_inst.hh"
|
#include "cpu/static_inst.hh"
|
||||||
|
#include "sim/eventq.hh"
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
#ifdef FULL_SYSTEM
|
#ifdef FULL_SYSTEM
|
||||||
|
@ -103,12 +103,7 @@ class SimpleCPU : public BaseCPU
|
||||||
private:
|
private:
|
||||||
Trace::InstRecord *traceData;
|
Trace::InstRecord *traceData;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void trace_data(T data) {
|
void trace_data(T data);
|
||||||
if (traceData) {
|
|
||||||
traceData->setData(data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
enum Status {
|
enum Status {
|
||||||
|
@ -346,4 +341,4 @@ class SimpleCPU : public BaseCPU
|
||||||
ExecContext *xcBase() { return xc; }
|
ExecContext *xcBase() { return xc; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SIMPLE_CPU_HH__
|
#endif // __CPU_SIMPLE_CPU_SIMPLE_CPU_HH__
|
||||||
|
|
|
@ -85,4 +85,4 @@ StaticInst<ISA>::hasBranchTarget(Addr pc, ExecContext *xc, Addr &tgt)
|
||||||
|
|
||||||
|
|
||||||
// force instantiation of template function(s) above
|
// force instantiation of template function(s) above
|
||||||
template StaticInst<AlphaISA>;
|
template class StaticInst<AlphaISA>;
|
||||||
|
|
|
@ -456,7 +456,7 @@ class StaticInstPtr : public RefCountingPtr<StaticInst<ISA> >
|
||||||
/// Convert to pointer to StaticInstBase class.
|
/// Convert to pointer to StaticInstBase class.
|
||||||
operator const StaticInstBasePtr()
|
operator const StaticInstBasePtr()
|
||||||
{
|
{
|
||||||
return get();
|
return this->get();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
* Device module for modelling a fixed bandwidth full duplex ethernet link
|
* Device module for modelling a fixed bandwidth full duplex ethernet link
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ETHERLINK_HH__
|
#ifndef __DEV_ETHERLINK_HH__
|
||||||
#define __ETHERLINK_HH__
|
#define __DEV_ETHERLINK_HH__
|
||||||
|
|
||||||
#include "sim/host.hh"
|
|
||||||
#include "sim/eventq.hh"
|
|
||||||
#include "dev/etherint.hh"
|
#include "dev/etherint.hh"
|
||||||
#include "dev/etherpkt.hh"
|
#include "dev/etherpkt.hh"
|
||||||
|
#include "sim/eventq.hh"
|
||||||
|
#include "sim/host.hh"
|
||||||
#include "sim/sim_object.hh"
|
#include "sim/sim_object.hh"
|
||||||
|
|
||||||
class EtherDump;
|
class EtherDump;
|
||||||
|
@ -71,7 +71,7 @@ class EtherLink : public SimObject
|
||||||
PacketPtr packet;
|
PacketPtr packet;
|
||||||
void txDone();
|
void txDone();
|
||||||
typedef EventWrapper<Link, &Link::txDone> DoneEvent;
|
typedef EventWrapper<Link, &Link::txDone> DoneEvent;
|
||||||
friend class DoneEvent;
|
friend void DoneEvent::process();
|
||||||
DoneEvent doneEvent;
|
DoneEvent doneEvent;
|
||||||
|
|
||||||
friend class LinkDelayEvent;
|
friend class LinkDelayEvent;
|
||||||
|
|
|
@ -261,12 +261,12 @@ class NSGigE : public PciDev
|
||||||
void rxKick();
|
void rxKick();
|
||||||
Tick rxKickTick;
|
Tick rxKickTick;
|
||||||
typedef EventWrapper<NSGigE, &NSGigE::rxKick> RxKickEvent;
|
typedef EventWrapper<NSGigE, &NSGigE::rxKick> RxKickEvent;
|
||||||
friend class RxKickEvent;
|
friend void RxKickEvent::process();
|
||||||
|
|
||||||
void txKick();
|
void txKick();
|
||||||
Tick txKickTick;
|
Tick txKickTick;
|
||||||
typedef EventWrapper<NSGigE, &NSGigE::txKick> TxKickEvent;
|
typedef EventWrapper<NSGigE, &NSGigE::txKick> TxKickEvent;
|
||||||
friend class TxKickEvent;
|
friend void TxKickEvent::process();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retransmit event
|
* Retransmit event
|
||||||
|
@ -279,7 +279,7 @@ class NSGigE : public PciDev
|
||||||
txKick();
|
txKick();
|
||||||
}
|
}
|
||||||
typedef EventWrapper<NSGigE, &NSGigE::txEventTransmit> TxEvent;
|
typedef EventWrapper<NSGigE, &NSGigE::txEventTransmit> TxEvent;
|
||||||
friend class TxEvent;
|
friend void TxEvent::process();
|
||||||
TxEvent txEvent;
|
TxEvent txEvent;
|
||||||
|
|
||||||
void txDump() const;
|
void txDump() const;
|
||||||
|
@ -313,7 +313,7 @@ class NSGigE : public PciDev
|
||||||
void cpuIntrClear();
|
void cpuIntrClear();
|
||||||
|
|
||||||
typedef EventWrapper<NSGigE, &NSGigE::cpuInterrupt> IntrEvent;
|
typedef EventWrapper<NSGigE, &NSGigE::cpuInterrupt> IntrEvent;
|
||||||
friend class IntrEvent;
|
friend void IntrEvent::process();
|
||||||
IntrEvent *intrEvent;
|
IntrEvent *intrEvent;
|
||||||
NSGigEInt *interface;
|
NSGigEInt *interface;
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,6 @@ class PciConfigData : public SimObject
|
||||||
*/
|
*/
|
||||||
class PciDev : public DmaDevice
|
class PciDev : public DmaDevice
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
struct Params;
|
|
||||||
Params *_params;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Params
|
struct Params
|
||||||
{
|
{
|
||||||
|
@ -110,6 +106,11 @@ class PciDev : public DmaDevice
|
||||||
/** The function number */
|
/** The function number */
|
||||||
uint32_t functionNum;
|
uint32_t functionNum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Params *_params;
|
||||||
|
|
||||||
|
public:
|
||||||
const Params *params() const { return _params; }
|
const Params *params() const { return _params; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Base : public PciDev
|
||||||
void cpuIntrClear();
|
void cpuIntrClear();
|
||||||
|
|
||||||
typedef EventWrapper<Base, &Base::cpuInterrupt> IntrEvent;
|
typedef EventWrapper<Base, &Base::cpuInterrupt> IntrEvent;
|
||||||
friend class IntrEvent;
|
friend void IntrEvent::process();
|
||||||
IntrEvent *intrEvent;
|
IntrEvent *intrEvent;
|
||||||
Interface *interface;
|
Interface *interface;
|
||||||
|
|
||||||
|
@ -155,12 +155,12 @@ class Device : public Base
|
||||||
void rxKick();
|
void rxKick();
|
||||||
Tick rxKickTick;
|
Tick rxKickTick;
|
||||||
typedef EventWrapper<Device, &Device::rxKick> RxKickEvent;
|
typedef EventWrapper<Device, &Device::rxKick> RxKickEvent;
|
||||||
friend class RxKickEvent;
|
friend void RxKickEvent::process();
|
||||||
|
|
||||||
void txKick();
|
void txKick();
|
||||||
Tick txKickTick;
|
Tick txKickTick;
|
||||||
typedef EventWrapper<Device, &Device::txKick> TxKickEvent;
|
typedef EventWrapper<Device, &Device::txKick> TxKickEvent;
|
||||||
friend class TxKickEvent;
|
friend void TxKickEvent::process();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retransmit event
|
* Retransmit event
|
||||||
|
@ -173,7 +173,7 @@ class Device : public Base
|
||||||
txKick();
|
txKick();
|
||||||
}
|
}
|
||||||
typedef EventWrapper<Device, &Device::txEventTransmit> TxEvent;
|
typedef EventWrapper<Device, &Device::txEventTransmit> TxEvent;
|
||||||
friend class TxEvent;
|
friend void TxEvent::process();
|
||||||
TxEvent txEvent;
|
TxEvent txEvent;
|
||||||
|
|
||||||
void txDump() const;
|
void txDump() const;
|
||||||
|
|
|
@ -26,14 +26,15 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LINUX_SYSCALLS_HH__
|
#ifndef __KERN_LINUX_LINUX_SYSCALLS_HH__
|
||||||
#define __LINUX_SYSCALLS_HH__
|
#define __KERN_LINUX_LINUX_SYSCALLS_HH__
|
||||||
|
|
||||||
#include "kern/linux/linux.hh"
|
#include "kern/linux/linux.hh"
|
||||||
|
|
||||||
template <class OS>
|
template <class OS>
|
||||||
class SystemCalls;
|
class SystemCalls;
|
||||||
|
|
||||||
|
template <>
|
||||||
class SystemCalls<Linux>
|
class SystemCalls<Linux>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -322,4 +323,4 @@ class SystemCalls<Linux>
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __LINUX_SYSCALLS_HH__
|
#endif // __KERN_LINUX_LINUX_SYSCALLS_HH__
|
||||||
|
|
|
@ -26,14 +26,15 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TRU64_SYSCALLS_HH__
|
#ifndef __KERN_TRU64_TRU64_SYSCALLS_HH__
|
||||||
#define __TRU64_SYSCALLS_HH__
|
#define __KERN_TRU64_TRU64_SYSCALLS_HH__
|
||||||
|
|
||||||
#include "kern/tru64/tru64.hh"
|
#include "kern/tru64/tru64.hh"
|
||||||
|
|
||||||
template <class OS>
|
template <class OS>
|
||||||
class SystemCalls;
|
class SystemCalls;
|
||||||
|
|
||||||
|
template <>
|
||||||
class SystemCalls<Tru64>
|
class SystemCalls<Tru64>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -355,4 +356,4 @@ class SystemCalls<Tru64>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __TRU64_SYSCALLS_HH__
|
#endif // __KERN_TRU64_TRU64_SYSCALLS_HH__
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
* EventQueue interfaces
|
* EventQueue interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EVENTQ_HH__
|
#ifndef __SIM_EVENTQ_HH__
|
||||||
#define __EVENTQ_HH__
|
#define __SIM_EVENTQ_HH__
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -43,11 +43,24 @@
|
||||||
#include "sim/host.hh" // for Tick
|
#include "sim/host.hh" // for Tick
|
||||||
|
|
||||||
#include "base/fast_alloc.hh"
|
#include "base/fast_alloc.hh"
|
||||||
#include "sim/serialize.hh"
|
|
||||||
#include "base/trace.hh"
|
#include "base/trace.hh"
|
||||||
|
#include "sim/serialize.hh"
|
||||||
|
|
||||||
class EventQueue; // forward declaration
|
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
|
* An item on an event queue. The action caused by a given
|
||||||
* event is specified by deriving a subclass and overriding the
|
* event is specified by deriving a subclass and overriding the
|
||||||
|
@ -228,7 +241,7 @@ DelayFunction(Tick when, T *object)
|
||||||
public:
|
public:
|
||||||
DelayEvent(Tick when, T *o)
|
DelayEvent(Tick when, T *o)
|
||||||
: Event(&mainEventQueue), object(o)
|
: Event(&mainEventQueue), object(o)
|
||||||
{ setFlags(AutoDestroy); schedule(when); }
|
{ setFlags(this->AutoDestroy); schedule(when); }
|
||||||
void process() { (object->*F)(); }
|
void process() { (object->*F)(); }
|
||||||
const char *description() { return "delay"; }
|
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__
|
||||||
|
|
|
@ -493,11 +493,11 @@ EnumVectorParam<Map>::showType(ostream &os) const
|
||||||
showEnumType(os, map, num_values);
|
showEnumType(os, map, num_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
template EnumParam<const char *>;
|
template class EnumParam<const char *>;
|
||||||
template EnumVectorParam<const char *>;
|
template class EnumVectorParam<const char *>;
|
||||||
|
|
||||||
template EnumParam<EnumParamMap>;
|
template class EnumParam<EnumParamMap>;
|
||||||
template EnumVectorParam<EnumParamMap>;
|
template class EnumVectorParam<EnumParamMap>;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,9 +26,10 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PARAM_HH__
|
#ifndef __SIM_PARAM_HH__
|
||||||
#define __PARAM_HH__
|
#define __SIM_PARAM_HH__
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -524,7 +525,7 @@ class MappedEnumParam : public EnumParam<EnumParamMap>
|
||||||
{
|
{
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
die("not found");
|
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> bool parseParam(const std::string &str, T &data);
|
||||||
template <class T> void showParam(std::ostream &os, const T &data);
|
template <class T> void showParam(std::ostream &os, const T &data);
|
||||||
|
|
||||||
#endif // _PARAM_HH
|
#endif // _SIM_PARAM_HH_
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
|
@ -29,20 +29,32 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "base/misc.hh"
|
#include "base/misc.hh"
|
||||||
#include "sim/startup.hh"
|
|
||||||
#include "sim/debug.hh"
|
#include "sim/debug.hh"
|
||||||
|
#include "sim/startup.hh"
|
||||||
|
|
||||||
typedef std::list<StartupCallback *> startupq_t;
|
typedef std::list<StartupCallback *> startupq_t;
|
||||||
startupq_t &startupq() { static startupq_t queue; return queue; }
|
|
||||||
StartupCallback::StartupCallback() { startupq().push_back(this); }
|
startupq_t *startupq = NULL;
|
||||||
StartupCallback::~StartupCallback() { startupq().remove(this); }
|
|
||||||
|
StartupCallback::StartupCallback()
|
||||||
|
{
|
||||||
|
if (startupq == NULL)
|
||||||
|
startupq = new startupq_t;
|
||||||
|
startupq->push_back(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
StartupCallback::~StartupCallback()
|
||||||
|
{
|
||||||
|
startupq->remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
void StartupCallback::startup() { }
|
void StartupCallback::startup() { }
|
||||||
|
|
||||||
void
|
void
|
||||||
SimStartup()
|
SimStartup()
|
||||||
{
|
{
|
||||||
startupq_t::iterator i = startupq().begin();
|
startupq_t::iterator i = startupq->begin();
|
||||||
startupq_t::iterator end = startupq().end();
|
startupq_t::iterator end = startupq->end();
|
||||||
|
|
||||||
while (i != end) {
|
while (i != end) {
|
||||||
(*i)->startup();
|
(*i)->startup();
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SYSCALL_EMUL_HH__
|
#ifndef __SIM_SYSCALL_EMUL_HH__
|
||||||
#define __SYSCALL_EMUL_HH__
|
#define __SIM_SYSCALL_EMUL_HH__
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @file syscall_emul.hh
|
/// @file syscall_emul.hh
|
||||||
|
@ -35,14 +35,16 @@
|
||||||
/// This file defines objects used to emulate syscalls from the target
|
/// This file defines objects used to emulate syscalls from the target
|
||||||
/// application on the host machine.
|
/// application on the host machine.
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/intmath.hh" // for RoundUp
|
#include "base/intmath.hh" // for RoundUp
|
||||||
#include "targetarch/isa_traits.hh" // for Addr
|
|
||||||
#include "mem/functional_mem/functional_memory.hh"
|
#include "mem/functional_mem/functional_memory.hh"
|
||||||
|
#include "targetarch/isa_traits.hh" // for Addr
|
||||||
|
|
||||||
class Process;
|
#include "base/trace.hh"
|
||||||
class ExecContext;
|
#include "cpu/exec_context.hh"
|
||||||
|
#include "sim/process.hh"
|
||||||
|
|
||||||
///
|
///
|
||||||
/// System call descriptor.
|
/// System call descriptor.
|
||||||
|
@ -197,6 +199,36 @@ int unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
|
||||||
/// Target rename() handler.
|
/// Target rename() handler.
|
||||||
int renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
|
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
|
// 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.
|
/// Target open() handler.
|
||||||
template <class OS>
|
template <class OS>
|
||||||
int
|
int
|
||||||
|
@ -260,7 +284,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
if (path == "/dev/sysdev0") {
|
if (path == "/dev/sysdev0") {
|
||||||
// This is a memory-mapped high-resolution timer device on Alpha.
|
// This is a memory-mapped high-resolution timer device on Alpha.
|
||||||
// We don't support it, so just punt.
|
// We don't support it, so just punt.
|
||||||
DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << endl;
|
DCOUT(SyscallWarnings) << "Ignoring open(" << path << ", ...)" << std::endl;
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +302,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
|
|
||||||
// any target flags left?
|
// any target flags left?
|
||||||
if (tgtFlags != 0)
|
if (tgtFlags != 0)
|
||||||
cerr << "Syscall: open: cannot decode flags: " << tgtFlags << endl;
|
std::cerr << "Syscall: open: cannot decode flags: " << tgtFlags << std::endl;
|
||||||
|
|
||||||
#ifdef __CYGWIN32__
|
#ifdef __CYGWIN32__
|
||||||
hostFlags |= O_BINARY;
|
hostFlags |= O_BINARY;
|
||||||
|
@ -414,7 +438,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cerr << "getrlimitFunc: unimplemented resource " << resource << endl;
|
std::cerr << "getrlimitFunc: unimplemented resource " << resource << std::endl;
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -423,28 +447,6 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
return 0;
|
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.
|
/// Target gettimeofday() handler.
|
||||||
template <class OS>
|
template <class OS>
|
||||||
int
|
int
|
||||||
|
@ -476,7 +478,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
// plow ahead
|
// plow ahead
|
||||||
DCOUT(SyscallWarnings)
|
DCOUT(SyscallWarnings)
|
||||||
<< "Warning: getrusage() only supports RUSAGE_SELF."
|
<< "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);
|
getElapsedTime(rup->ru_utime.tv_sec, rup->ru_utime.tv_usec);
|
||||||
|
@ -502,6 +504,4 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __SIM_SYSCALL_EMUL_HH__
|
||||||
|
|
||||||
#endif // __SYSCALL_EMUL_HH__
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
Loading…
Reference in a new issue