Review Board 2.0.15


x86: Add checkpointing capability to devices

Review Request #387 - Created Jan. 6, 2011 and submitted

Information
Brad Beckmann
gem5
Reviewers
Default
ali, gblack, nate, stever
x86: Add checkpointing capability to devices

Add checkpointing capability to the Intel 8254 timer, CMOS, I8042,
PS2 Keyboard and Mouse, I82094AA, I8237, I8254, I8259, and speaker
devices

   
Posted (Jan. 6, 2011, 9:11 p.m.)



  
src/dev/intel_8254_timer.cc (Diff revision 1)
 
 
This seems to be a bit different since you're fixing existing serialization code instead of adding new code, but it's small enough that it's not a huge deal to slip it in there. Ideally you'd separate it out, though.
src/dev/x86/i8042.cc (Diff revision 1)
 
 
__data is a top secret internal component of the bit union mechanism, hence it's double leading underscores. I think if you use the macro bare gcc won't cooperate, and if you cast it the name gets messed up. You'll have to declare a temporary variable and serialize/unserialize that. It's a pain, but it doesn't break encapsulation.
src/dev/x86/i8042.cc (Diff revision 1)
 
 
Why aren't you using the SERIALIZE_SCALAR, etc., macros for these? Granted macros are gross generally, but using them would be consistent with all the other code and fit with what most or all of these lines are doing perfectly.
src/dev/x86/i8042.cc (Diff revision 1)
 
 
This stuff that goes with the base PS2Device class should go in serialize functions declared there. Then you won't have two copies of it, and it makes the code more modular.
src/dev/x86/i8042.cc (Diff revision 1)
 
 
Use new and delete.
src/dev/x86/i82094aa.cc (Diff revision 1)
 
 
Hmm. Apparently you can cast inside a SERIALIZE_*? If that works that's what you should do with the bituions. Cast them to their underlying type (the type of __data) and it may all magically work. Or maybe not if it's using a reference or something.
src/dev/x86/speaker.cc (Diff revision 1)
 
 
See above about bit unions.