summaryrefslogtreecommitdiff
path: root/src/dev/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev/sparc')
-rw-r--r--src/dev/sparc/dtod.cc35
-rw-r--r--src/dev/sparc/dtod.hh19
-rw-r--r--src/dev/sparc/mm_disk.cc5
-rw-r--r--src/dev/sparc/t1000.cc15
-rw-r--r--src/dev/sparc/t1000.hh13
5 files changed, 55 insertions, 32 deletions
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index 30c7baaf5..42275c60a 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -49,12 +49,24 @@ using namespace std;
using namespace TheISA;
DumbTOD::DumbTOD(Params *p)
- : BasicPioDevice(p), todTime(p->init_time)
+ : BasicPioDevice(p)
{
+ struct tm tm;
+ char *tz;
+
pioSize = 0x08;
- struct tm tm;
- gmtime_r((time_t*)&todTime, &tm);
+ parseTime(p->init_time, &tm);
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ todTime = mktime(&tm);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+
DPRINTFN("Real-time clock set to %s\n", asctime(&tm));
DPRINTFN("Real-time clock set to %d\n", todTime);
}
@@ -80,13 +92,26 @@ DumbTOD::write(PacketPtr pkt)
panic("Dumb tod device doesn't support writes\n");
}
+void
+DumbTOD::serialize(std::ostream &os)
+{
+ SERIALIZE_SCALAR(todTime);
+}
+
+void
+DumbTOD::unserialize(Checkpoint *cp, const std::string &section)
+{
+ UNSERIALIZE_SCALAR(todTime);
+}
+
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
Param<Addr> pio_addr;
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 +121,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..ddf9fcc96 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; }
@@ -62,6 +64,21 @@ class DumbTOD : public BasicPioDevice
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
+
+ /**
+ * Serialize this object to the given output stream.
+ * @param os The stream to serialize to.
+ */
+ virtual void serialize(std::ostream &os);
+
+ /**
+ * Reconstruct the state of this object from a checkpoint.
+ * @param cp The checkpoint use.
+ * @param section The section name of this object
+ */
+ virtual void unserialize(Checkpoint *cp, const std::string &section);
+
+
};
#endif // __DEV_BADDEV_HH__
diff --git a/src/dev/sparc/mm_disk.cc b/src/dev/sparc/mm_disk.cc
index 9057c28be..018415f6c 100644
--- a/src/dev/sparc/mm_disk.cc
+++ b/src/dev/sparc/mm_disk.cc
@@ -33,6 +33,8 @@
* in legion. Any access is translated to an offset in the disk image.
*/
+#include <cstring>
+
#include "base/trace.hh"
#include "dev/sparc/mm_disk.hh"
#include "dev/platform.hh"
@@ -45,7 +47,7 @@
MmDisk::MmDisk(Params *p)
: BasicPioDevice(p), image(p->image), curSector((uint64_t)-1), dirty(false)
{
- memset(&bytes, 0, SectorSize);
+ std::memset(&bytes, 0, SectorSize);
pioSize = image->size() * SectorSize;
}
@@ -99,6 +101,7 @@ Tick
MmDisk::write(PacketPtr pkt)
{
panic("need to implement\n");
+ M5_DUMMY_RETURN
}
diff --git a/src/dev/sparc/t1000.cc b/src/dev/sparc/t1000.cc
index 4a8de77a5..3a2f881f1 100644
--- a/src/dev/sparc/t1000.cc
+++ b/src/dev/sparc/t1000.cc
@@ -57,6 +57,7 @@ Tick
T1000::intrFrequency()
{
panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
void
@@ -89,6 +90,7 @@ Addr
T1000::pciToDma(Addr pciAddr) const
{
panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
@@ -96,18 +98,7 @@ Addr
T1000::calcConfigAddr(int bus, int dev, int func)
{
panic("Need implementation\n");
-}
-
-void
-T1000::serialize(std::ostream &os)
-{
- panic("Need implementation\n");
-}
-
-void
-T1000::unserialize(Checkpoint *cp, const std::string &section)
-{
- panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(T1000)
diff --git a/src/dev/sparc/t1000.hh b/src/dev/sparc/t1000.hh
index 2955763a9..8e28d90e5 100644
--- a/src/dev/sparc/t1000.hh
+++ b/src/dev/sparc/t1000.hh
@@ -90,19 +90,6 @@ class T1000 : public Platform
* Calculate the configuration address given a bus/dev/func.
*/
virtual Addr calcConfigAddr(int bus, int dev, int func);
-
- /**
- * Serialize this object to the given output stream.
- * @param os The stream to serialize to.
- */
- virtual void serialize(std::ostream &os);
-
- /**
- * Reconstruct the state of this object from a checkpoint.
- * @param cp The checkpoint use.
- * @param section The section name of this object
- */
- virtual void unserialize(Checkpoint *cp, const std::string &section);
};
#endif // __DEV_T1000_HH__