diff -r e2a76f792897 -r 523c3adda92d src/dev/intel_8254_timer.cc --- a/src/dev/intel_8254_timer.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/intel_8254_timer.cc Thu Jan 06 15:26:56 2011 -0800 @@ -247,7 +247,9 @@ paramIn(cp, section, base + ".read_byte", read_byte); paramIn(cp, section, base + ".write_byte", write_byte); - Tick event_tick; + Tick event_tick = 0; + if (event.scheduled()) + parent->deschedule(event); paramIn(cp, section, base + ".event_tick", event_tick); if (event_tick) parent->schedule(event, event_tick); diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/cmos.hh --- a/src/dev/x86/cmos.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/cmos.hh Thu Jan 06 15:26:56 2011 -0800 @@ -82,6 +82,10 @@ Tick read(PacketPtr pkt); Tick write(PacketPtr pkt); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); + }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/cmos.cc --- a/src/dev/x86/cmos.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/cmos.cc Thu Jan 06 15:26:56 2011 -0800 @@ -111,6 +111,26 @@ } } +void +X86ISA::Cmos::serialize(std::ostream &os) +{ + SERIALIZE_SCALAR(address); + SERIALIZE_ARRAY(regs, numRegs); + + // Serialize the timer + rtc.serialize("rtc", os); +} + +void +X86ISA::Cmos::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(address); + UNSERIALIZE_ARRAY(regs, numRegs); + + // Serialize the timer + rtc.unserialize("rtc", cp, section); +} + X86ISA::Cmos * CmosParams::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8042.hh --- a/src/dev/x86/i8042.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8042.hh Thu Jan 06 15:26:56 2011 -0800 @@ -116,6 +116,10 @@ {} bool processData(uint8_t data); + + void serialize(const std::string &base, std::ostream &os); + void unserialize(const std::string &base, Checkpoint *cp, + const std::string §ion); }; class PS2Keyboard : public PS2Device @@ -146,6 +150,10 @@ public: bool processData(uint8_t data); + + void serialize(const std::string &base, std::ostream &os); + void unserialize(const std::string &base, Checkpoint *cp, + const std::string §ion); }; class I8042 : public BasicPioDevice @@ -252,6 +260,9 @@ Tick read(PacketPtr pkt); Tick write(PacketPtr pkt); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8042.cc --- a/src/dev/x86/i8042.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8042.cc Thu Jan 06 15:26:56 2011 -0800 @@ -439,6 +439,102 @@ return latency; } +void +X86ISA::I8042::serialize(std::ostream &os) +{ + SERIALIZE_SCALAR(dataPort); + SERIALIZE_SCALAR(commandPort); + SERIALIZE_SCALAR(statusReg.__data); + SERIALIZE_SCALAR(commandByte.__data); + SERIALIZE_SCALAR(dataReg); + SERIALIZE_SCALAR(lastCommand); + mouse.serialize("mouse", os); + keyboard.serialize("keyboard", os); +} + +void +X86ISA::I8042::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(dataPort); + UNSERIALIZE_SCALAR(commandPort); + UNSERIALIZE_SCALAR(statusReg.__data); + UNSERIALIZE_SCALAR(commandByte.__data); + UNSERIALIZE_SCALAR(dataReg); + UNSERIALIZE_SCALAR(lastCommand); + mouse.unserialize("mouse", cp, section); + keyboard.unserialize("keyboard", cp, section); +} + +void +X86ISA::PS2Keyboard::serialize(const std::string &base, std::ostream &os) +{ + paramOut(os, base + ".lastCommand", lastCommand); + int bufferSize = outBuffer.size(); + paramOut(os, base + ".outBuffer.size", bufferSize); + uint8_t *buffer = (uint8_t*)malloc(bufferSize*sizeof(uint8_t)); + for (int i = 0; i < bufferSize; ++i) { + buffer[i] = outBuffer.front(); + outBuffer.pop(); + } + arrayParamOut(os, base + ".outBuffer.elts", buffer, + bufferSize*sizeof(uint8_t)); + free(buffer); +} + +void +X86ISA::PS2Keyboard::unserialize(const std::string &base, Checkpoint *cp, + const std::string §ion) +{ + paramIn(cp, section, base + ".lastCommand", lastCommand); + int bufferSize; + paramIn(cp, section, base + ".outBuffer.size", bufferSize); + uint8_t *buffer = (uint8_t*)malloc(bufferSize*sizeof(uint8_t)); + arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, + bufferSize*sizeof(uint8_t)); + for (int i = 0; i < bufferSize; ++i) { + outBuffer.push(buffer[i]); + } + free(buffer); +} + +void +X86ISA::PS2Mouse::serialize(const std::string &base, std::ostream &os) +{ + paramOut(os, base + ".lastCommand", lastCommand); + int bufferSize = outBuffer.size(); + paramOut(os, base + ".outBuffer.size", bufferSize); + uint8_t *buffer = (uint8_t*)malloc(bufferSize*sizeof(uint8_t)); + for (int i = 0; i < bufferSize; ++i) { + buffer[i] = outBuffer.front(); + outBuffer.pop(); + } + arrayParamOut(os, base + ".outBuffer.elts", buffer, + bufferSize*sizeof(uint8_t)); + free(buffer); + paramOut(os, base + ".status", status.__data); + paramOut(os, base + ".resolution", resolution); + paramOut(os, base + ".sampleRate", sampleRate); +} + +void +X86ISA::PS2Mouse::unserialize(const std::string &base, Checkpoint *cp, + const std::string §ion) +{ + paramIn(cp, section, base + ".lastCommand", lastCommand); + int bufferSize; + paramIn(cp, section, base + ".outBuffer.size", bufferSize); + uint8_t *buffer = (uint8_t*)malloc(bufferSize*sizeof(uint8_t)); + arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, + bufferSize*sizeof(uint8_t)); + for (int i = 0; i < bufferSize; ++i) { + outBuffer.push(buffer[i]); + } + free(buffer); + paramIn(cp, section, base + ".status", status.__data); + paramIn(cp, section, base + ".resolution", resolution); + paramIn(cp, section, base + ".sampleRate", sampleRate); +} + X86ISA::I8042 * I8042Params::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i82094aa.hh --- a/src/dev/x86/i82094aa.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i82094aa.hh Thu Jan 06 15:26:56 2011 -0800 @@ -130,6 +130,9 @@ void raiseInterruptPin(int number); void lowerInterruptPin(int number); void registerLocalApic(int id, Interrupts *localApic); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i82094aa.cc --- a/src/dev/x86/i82094aa.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i82094aa.cc Thu Jan 06 15:26:56 2011 -0800 @@ -236,6 +236,30 @@ localApics[initialId] = localApic; } +void +X86ISA::I82094AA::serialize(std::ostream &os) +{ + SERIALIZE_SCALAR(regSel); + SERIALIZE_SCALAR(initialApicId); + SERIALIZE_SCALAR(id); + SERIALIZE_SCALAR(arbId); + SERIALIZE_SCALAR(lowestPriorityOffset); + SERIALIZE_ARRAY((uint64_t*)redirTable, TableSize); + SERIALIZE_ARRAY(pinStates, TableSize); +} + +void +X86ISA::I82094AA::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(regSel); + UNSERIALIZE_SCALAR(initialApicId); + UNSERIALIZE_SCALAR(id); + UNSERIALIZE_SCALAR(arbId); + UNSERIALIZE_SCALAR(lowestPriorityOffset); + UNSERIALIZE_ARRAY((uint64_t*)redirTable, TableSize); + UNSERIALIZE_ARRAY(pinStates, TableSize); +} + X86ISA::I82094AA * I82094AAParams::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8237.hh --- a/src/dev/x86/i8237.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8237.hh Thu Jan 06 15:26:56 2011 -0800 @@ -59,6 +59,9 @@ Tick read(PacketPtr pkt); Tick write(PacketPtr pkt); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8237.cc --- a/src/dev/x86/i8237.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8237.cc Thu Jan 06 15:26:56 2011 -0800 @@ -119,12 +119,24 @@ case 0xf: panic("Write to i8237 write all mask register bits unimplemented.\n"); default: - panic("Write to undefined i8254 register.\n"); + panic("Write to undefined i8237 register.\n"); } pkt->makeAtomicResponse(); return latency; } +void +X86ISA::I8237::serialize(std::ostream &os) +{ + SERIALIZE_SCALAR(maskReg); +} + +void +X86ISA::I8237::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(maskReg); +} + X86ISA::I8237 * I8237Params::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8254.hh --- a/src/dev/x86/i8254.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8254.hh Thu Jan 06 15:26:56 2011 -0800 @@ -109,6 +109,10 @@ { pit.writeControl(val); } + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); + }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8254.cc --- a/src/dev/x86/i8254.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8254.cc Thu Jan 06 15:26:56 2011 -0800 @@ -76,6 +76,18 @@ return latency; } +void +X86ISA::I8254::serialize(std::ostream &os) +{ + pit.serialize("pit", os); +} + +void +X86ISA::I8254::unserialize(Checkpoint *cp, const std::string §ion) +{ + pit.unserialize("pit", cp, section); +} + X86ISA::I8254 * I8254Params::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8259.hh --- a/src/dev/x86/i8259.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8259.hh Thu Jan 06 15:26:56 2011 -0800 @@ -108,6 +108,9 @@ void raiseInterruptPin(int number); void lowerInterruptPin(int number); int getVector(); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/i8259.cc --- a/src/dev/x86/i8259.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/i8259.cc Thu Jan 06 15:26:56 2011 -0800 @@ -303,6 +303,42 @@ return line | vectorOffset; } +void +X86ISA::I8259::serialize(std::ostream &os) +{ + SERIALIZE_ARRAY(pinStates, NumLines); + SERIALIZE_ENUM(mode); + SERIALIZE_SCALAR(IRR); + SERIALIZE_SCALAR(ISR); + SERIALIZE_SCALAR(IMR); + SERIALIZE_SCALAR(vectorOffset); + SERIALIZE_SCALAR(cascadeMode); + SERIALIZE_SCALAR(cascadeBits); + SERIALIZE_SCALAR(edgeTriggered); + SERIALIZE_SCALAR(readIRR); + SERIALIZE_SCALAR(expectICW4); + SERIALIZE_SCALAR(initControlWord); + SERIALIZE_SCALAR(autoEOI); +} + +void +X86ISA::I8259::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_ARRAY(pinStates, NumLines); + UNSERIALIZE_ENUM(mode); + UNSERIALIZE_SCALAR(IRR); + UNSERIALIZE_SCALAR(ISR); + UNSERIALIZE_SCALAR(IMR); + UNSERIALIZE_SCALAR(vectorOffset); + UNSERIALIZE_SCALAR(cascadeMode); + UNSERIALIZE_SCALAR(cascadeBits); + UNSERIALIZE_SCALAR(edgeTriggered); + UNSERIALIZE_SCALAR(readIRR); + UNSERIALIZE_SCALAR(expectICW4); + UNSERIALIZE_SCALAR(initControlWord); + UNSERIALIZE_SCALAR(autoEOI); +} + X86ISA::I8259 * I8259Params::create() { diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/speaker.hh --- a/src/dev/x86/speaker.hh Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/speaker.hh Thu Jan 06 15:26:56 2011 -0800 @@ -72,6 +72,10 @@ Tick read(PacketPtr pkt); Tick write(PacketPtr pkt); + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); + }; } // namespace X86ISA diff -r e2a76f792897 -r 523c3adda92d src/dev/x86/speaker.cc --- a/src/dev/x86/speaker.cc Thu Jan 06 15:26:35 2011 -0800 +++ b/src/dev/x86/speaker.cc Thu Jan 06 15:26:56 2011 -0800 @@ -72,6 +72,18 @@ return latency; } +void +X86ISA::Speaker::serialize(std::ostream &os) +{ + SERIALIZE_SCALAR(controlVal.__data); +} + +void +X86ISA::Speaker::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_SCALAR(controlVal.__data); +} + X86ISA::Speaker * PcSpeakerParams::create() {