summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-01-28 14:46:56 -0500
committerGabe Black <gblack@eecs.umich.edu>2007-01-28 14:46:56 -0500
commit91ca1b48e29dc8a5edcd57bf03ed9737b5de0661 (patch)
tree9a2db053cba40110ae69a2444b061c3d5ea8bdef /src
parent0358ccee23072eef0b6448e3170457037682a452 (diff)
parent37795b104d93a48b319074fbef770d88820d554a (diff)
downloadgem5-91ca1b48e29dc8a5edcd57bf03ed9737b5de0661.tar.xz
Merge zizzer:/bk/newmem
into zower.eecs.umich.edu:/eecshome/m5/newmem --HG-- extra : convert_revision : 2398e48722dd71ddf270e93bd7b387078fb30e6b
Diffstat (limited to 'src')
-rw-r--r--src/SConscript5
-rw-r--r--src/base/compiler.hh3
-rw-r--r--src/base/cprintf_formats.hh22
-rw-r--r--src/base/statistics.hh2
-rw-r--r--src/cpu/static_inst.hh2
-rw-r--r--src/dev/alpha/tsunami_io.cc73
-rw-r--r--src/dev/alpha/tsunami_io.hh3
-rw-r--r--src/dev/sparc/dtod.cc10
-rw-r--r--src/dev/sparc/dtod.hh4
-rw-r--r--src/mem/packet.hh4
-rw-r--r--src/sim/host.hh4
-rw-r--r--src/sim/param.cc24
-rw-r--r--src/sim/param.hh1
13 files changed, 79 insertions, 78 deletions
diff --git a/src/SConscript b/src/SConscript
index 6c179f861..2a61100c1 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -325,6 +325,11 @@ elif env['SUNCC']:
ccflags['opt'] = '-g -O'
ccflags['fast'] = '-fast'
ccflags['prof'] = '-fast -g -pg'
+elif env['ICC']:
+ ccflags['debug'] = '-g -O0'
+ ccflags['opt'] = '-g -O'
+ ccflags['fast'] = '-fast'
+ ccflags['prof'] = '-fast -g -pg'
else:
print 'Unknown compiler, please fix compiler options'
Exit(1)
diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index 5f2e9d7af..dc23ed7b3 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -44,7 +44,8 @@
// this doesn't do anything with sun cc, but why not
#define M5_ATTR_NORETURN __sun_attr__((__noreturn__))
#define M5_DUMMY_RETURN return (0);
-#define M5_PRAGMA_NORETURN(x) _Pragma("does_not_return(x)")
+#define DO_PRAGMA(x) _Pragma(#x)
+#define M5_PRAGMA_NORETURN(x) DO_PRAGMA(does_not_return(x))
#else
#error "Need to define compiler options in base/compiler.hh"
#endif
diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh
index 3ea20446d..0af493217 100644
--- a/src/base/cprintf_formats.hh
+++ b/src/base/cprintf_formats.hh
@@ -84,21 +84,21 @@ _format_integer(std::ostream &out, const T &data, Format &fmt)
switch (fmt.base) {
case Format::hex:
- out.setf(ios::hex, ios::basefield);
+ out.setf(std::ios::hex, std::ios::basefield);
break;
case Format::oct:
- out.setf(ios::oct, ios::basefield);
+ out.setf(std::ios::oct, std::ios::basefield);
break;
case Format::dec:
- out.setf(ios::dec, ios::basefield);
+ out.setf(std::ios::dec, std::ios::basefield);
break;
}
if (fmt.alternate_form) {
if (!fmt.fill_zero)
- out.setf(ios::showbase);
+ out.setf(std::ios::showbase);
else {
switch (fmt.base) {
case Format::hex:
@@ -122,13 +122,13 @@ _format_integer(std::ostream &out, const T &data, Format &fmt)
out.width(fmt.width);
if (fmt.flush_left && !fmt.fill_zero)
- out.setf(ios::left);
+ out.setf(std::ios::left);
if (fmt.print_sign)
- out.setf(ios::showpos);
+ out.setf(std::ios::showpos);
if (fmt.uppercase)
- out.setf(ios::uppercase);
+ out.setf(std::ios::uppercase);
out << data;
}
@@ -148,7 +148,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
if (fmt.precision == 0)
fmt.precision = 1;
else
- out.setf(ios::scientific);
+ out.setf(std::ios::scientific);
out.precision(fmt.precision);
} else
@@ -156,7 +156,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
out.width(fmt.width);
if (fmt.uppercase)
- out.setf(ios::uppercase);
+ out.setf(std::ios::uppercase);
break;
case Format::fixed:
@@ -164,7 +164,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
if (fmt.width > 0)
out.width(fmt.width);
- out.setf(ios::fixed);
+ out.setf(std::ios::fixed);
out.precision(fmt.precision);
} else
if (fmt.width > 0)
@@ -216,7 +216,7 @@ _format_string(std::ostream &out, const T &data, Format &fmt)
if (fmt.width > 0)
out.width(fmt.width);
if (fmt.flush_left)
- out.setf(ios::left);
+ out.setf(std::ios::left);
out << data;
#endif
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index d8e8b4c15..2b1b327e5 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -398,7 +398,7 @@ class Wrap : public Child
public:
Wrap()
{
- map(new Data<Child>(*this));
+ this->map(new Data<Child>(*this));
}
/**
diff --git a/src/cpu/static_inst.hh b/src/cpu/static_inst.hh
index 5928eea76..416c8ab56 100644
--- a/src/cpu/static_inst.hh
+++ b/src/cpu/static_inst.hh
@@ -379,6 +379,7 @@ class StaticInst : public StaticInstBase
{
panic("StaticInst::branchTarget() called on instruction "
"that is not a PC-relative branch.");
+ M5_DUMMY_RETURN
}
/**
@@ -393,6 +394,7 @@ class StaticInst : public StaticInstBase
panic("StaticInst::branchTarget() called on instruction "
"that is not an indirect branch.");
}
+ M5_DUMMY_RETURN
/**
* Return true if the instruction is a control transfer, and if so,
diff --git a/src/dev/alpha/tsunami_io.cc b/src/dev/alpha/tsunami_io.cc
index d701dc98f..58933428c 100644
--- a/src/dev/alpha/tsunami_io.cc
+++ b/src/dev/alpha/tsunami_io.cc
@@ -65,69 +65,32 @@ TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami, const vector<int> &t,
stat_regA = RTCA_32768HZ | RTCA_1024HZ;
stat_regB = RTCB_PRDC_IE |RTCB_BIN | RTCB_24HR;
- if (year_is_bcd) {
- // The RTC uses BCD for the last two digits in the year.
- // They python year is a full year.
- int _year = t[0] % 100;
- int tens = _year / 10;
- int ones = _year % 10;
-
- year = (tens << 4) + ones;
- } else {
- // Even though the datasheet says that the year field should be
- // interpreted as BCD, we just enter the number of years since
- // 1900 since linux seems to be happy with that (and I believe
- // that Tru64 was as well)
- year = t[0] - 1900;
- }
-
- mon = t[1];
- mday = t[2];
- hour = t[3];
- min = t[4];
- sec = t[5];
-
- // wday is defined to be in the range from 1 - 7 with 1 being Sunday.
- // the value coming from python is in the range from 0 - 6 with 0 being
- // Monday. Fix that here.
- wday = t[6] + 2;
- if (wday > 7)
- wday -= 7;
-
- DPRINTFN("Real-time clock set to %s", getDateString());
-}
-
-std::string
-TsunamiIO::RTC::getDateString()
-{
struct tm tm;
+ parseTime(t, &tm);
- memset(&tm, 0, sizeof(tm));
+ year = tm.tm_year;
if (year_is_bcd) {
- // undo the BCD and conver to years since 1900 guessing that
- // anything before 1970 is actually after 2000
- int _year = (year >> 4) * 10 + (year & 0xf);
- if (_year < 70)
- _year += 100;
-
- tm.tm_year = _year;
- } else {
- // number of years since 1900
- tm.tm_year = year;
+ // The datasheet says that the year field can be either BCD or
+ // years since 1900. Linux seems to be happy with years since
+ // 1900.
+ year = year % 100;
+ int tens = year / 10;
+ int ones = year % 10;
+ year = (tens << 4) + ones;
}
- // unix is 0-11 for month
- tm.tm_mon = mon - 1;
- tm.tm_mday = mday;
- tm.tm_hour = hour;
- tm.tm_min = min;
- tm.tm_sec = sec;
+ // Unix is 0-11 for month, data seet says start at 1
+ mon = tm.tm_mon + 1;
+ mday = tm.tm_mday;
+ hour = tm.tm_hour;
+ min = tm.tm_min;
+ sec = tm.tm_sec;
- // to add more annoyance unix is 0 - 6 with 0 as sunday
- tm.tm_wday = wday - 1;
+ // Datasheet says 1 is sunday
+ wday = tm.tm_wday + 1;
- return asctime(&tm);
+ DPRINTFN("Real-time clock set to %s", asctime(&tm));
}
void
diff --git a/src/dev/alpha/tsunami_io.hh b/src/dev/alpha/tsunami_io.hh
index f42af4197..f4fa62a68 100644
--- a/src/dev/alpha/tsunami_io.hh
+++ b/src/dev/alpha/tsunami_io.hh
@@ -125,9 +125,6 @@ class TsunamiIO : public BasicPioDevice
/** RTC read data */
uint8_t readData();
- /** RTC get the date */
- std::string getDateString();
-
/**
* Serialize this object to the given output stream.
* @param base The base name of the counter object.
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index 30c7baaf5..50e158c12 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -49,12 +49,14 @@ using namespace std;
using namespace TheISA;
DumbTOD::DumbTOD(Params *p)
- : BasicPioDevice(p), todTime(p->init_time)
+ : BasicPioDevice(p)
{
pioSize = 0x08;
struct tm tm;
- gmtime_r((time_t*)&todTime, &tm);
+ parseTime(p->init_time, &tm);
+ todTime = timegm(&tm);
+
DPRINTFN("Real-time clock set to %s\n", asctime(&tm));
DPRINTFN("Real-time clock set to %d\n", todTime);
}
@@ -86,7 +88,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
Param<Tick> pio_latency;
SimObjectParam<Platform *> platform;
SimObjectParam<System *> system;
- Param<time_t> time;
+ VectorParam<int> time;
END_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
@@ -96,7 +98,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(DumbTOD)
INIT_PARAM(pio_latency, "Programmed IO latency"),
INIT_PARAM(platform, "platform"),
INIT_PARAM(system, "system object"),
- INIT_PARAM(time, "System time to use (0 for actual time")
+ INIT_PARAM(time, "")
END_INIT_SIM_OBJECT_PARAMS(DumbTOD)
diff --git a/src/dev/sparc/dtod.hh b/src/dev/sparc/dtod.hh
index 7d3a9f628..26d4ecc08 100644
--- a/src/dev/sparc/dtod.hh
+++ b/src/dev/sparc/dtod.hh
@@ -36,6 +36,8 @@
#ifndef __DEV_SPARC_DTOD_HH__
#define __DEV_SPARC_DTOD_HH__
+#include <vector>
+
#include "base/range.hh"
#include "dev/io_device.hh"
@@ -52,7 +54,7 @@ class DumbTOD : public BasicPioDevice
public:
struct Params : public BasicPioDevice::Params
{
- time_t init_time;
+ std::vector<int> init_time;
};
protected:
const Params *params() const { return (const Params *)_params; }
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 19251941f..15f605ca7 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -41,10 +41,12 @@
#include <cassert>
#include <list>
+#include "base/misc.hh"
#include "mem/request.hh"
#include "sim/host.hh"
#include "sim/root.hh"
+
struct Packet;
typedef Packet *PacketPtr;
typedef uint8_t* PacketDataPtr;
@@ -238,7 +240,7 @@ class Packet
bool isNoAllocate() const { return (flags & NO_ALLOCATE) != 0; }
bool isCompressed() const { return (flags & COMPRESSED) != 0; }
- bool nic_pkt() { assert("Unimplemented\n" && 0); return false; }
+ bool nic_pkt() { panic("Unimplemented"); M5_DUMMY_RETURN }
/** Possible results of a packet's request. */
enum Result
diff --git a/src/sim/host.hh b/src/sim/host.hh
index 8b1ddbfe7..93a5fe7f2 100644
--- a/src/sim/host.hh
+++ b/src/sim/host.hh
@@ -38,6 +38,8 @@
#define __HOST_HH__
#include <inttypes.h>
+#include <limits>
+
/** uint64_t constant */
#define ULL(N) ((uint64_t)N##ULL)
@@ -56,7 +58,7 @@ typedef int64_t Counter;
*/
typedef int64_t Tick;
-const Tick MaxTick = (1LL << 63) - 1;
+const Tick MaxTick = std::numeric_limits<Tick>::max();
/**
* Address type
diff --git a/src/sim/param.cc b/src/sim/param.cc
index b1c50946b..5cc69b161 100644
--- a/src/sim/param.cc
+++ b/src/sim/param.cc
@@ -777,3 +777,27 @@ ParamContext::describeAllContexts(ostream &os)
os << endl;
}
}
+
+void
+parseTime(const std::vector<int> &time, struct tm *tm)
+{
+ memset(tm, 0, sizeof(struct tm));
+
+ // UNIX is years since 1900
+ tm->tm_year = time[0] - 1900;
+
+ // Python starts at 1, UNIX starts at 0
+ tm->tm_mon = time[1] - 1;
+ tm->tm_mday = time[2];
+ tm->tm_hour = time[3];
+ tm->tm_min = time[4];
+ tm->tm_sec = time[5];
+
+ // Python has 0 as Monday, UNIX is 0 as sunday
+ tm->tm_wday = time[6] + 1;
+ if (tm->tm_wday > 6)
+ tm->tm_wday -= 7;
+
+ // Python starts at 1, Unix starts at 0
+ tm->tm_yday = time[7] - 1;
+}
diff --git a/src/sim/param.hh b/src/sim/param.hh
index 2aa0456da..8a4670e27 100644
--- a/src/sim/param.hh
+++ b/src/sim/param.hh
@@ -781,4 +781,5 @@ 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);
+void parseTime(const std::vector<int> &time, struct tm *tm);
#endif // _SIM_PARAM_HH_