Deleted Added
sdiff udiff text old ( 9808:13ffc0066b76 ) new ( 10905:a6ca6831e775 )
full compact
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 449 unchanged lines hidden (view full) ---

458 } else {
459 panic("Write to unrecognized port %#x.\n", addr);
460 }
461 pkt->makeAtomicResponse();
462 return latency;
463}
464
465void
466X86ISA::I8042::serializeOld(CheckpointOut &cp)
467{
468 uint8_t statusRegData = statusReg.__data;
469 uint8_t commandByteData = commandByte.__data;
470
471 SERIALIZE_SCALAR(dataPort);
472 SERIALIZE_SCALAR(commandPort);
473 SERIALIZE_SCALAR(statusRegData);
474 SERIALIZE_SCALAR(commandByteData);
475 SERIALIZE_SCALAR(dataReg);
476 SERIALIZE_SCALAR(lastCommand);
477 mouse.serialize("mouse", cp);
478 keyboard.serialize("keyboard", cp);
479}
480
481void
482X86ISA::I8042::unserialize(CheckpointIn &cp)
483{
484 uint8_t statusRegData;
485 uint8_t commandByteData;
486
487 UNSERIALIZE_SCALAR(dataPort);
488 UNSERIALIZE_SCALAR(commandPort);
489 UNSERIALIZE_SCALAR(statusRegData);
490 UNSERIALIZE_SCALAR(commandByteData);
491 UNSERIALIZE_SCALAR(dataReg);
492 UNSERIALIZE_SCALAR(lastCommand);
493 mouse.unserialize("mouse", cp);
494 keyboard.unserialize("keyboard", cp);
495
496 statusReg.__data = statusRegData;
497 commandByte.__data = commandByteData;
498}
499
500void
501X86ISA::PS2Keyboard::serialize(const std::string &base, CheckpointOut &cp)
502{
503 paramOut(cp, base + ".lastCommand", lastCommand);
504 int bufferSize = outBuffer.size();
505 paramOut(cp, base + ".outBuffer.size", bufferSize);
506 uint8_t *buffer = new uint8_t[bufferSize];
507 for (int i = 0; i < bufferSize; ++i) {
508 buffer[i] = outBuffer.front();
509 outBuffer.pop();
510 }
511 arrayParamOut(cp, base + ".outBuffer.elts", buffer,
512 bufferSize*sizeof(uint8_t));
513 delete[] buffer;
514}
515
516void
517X86ISA::PS2Keyboard::unserialize(const std::string &base, CheckpointIn &cp)
518{
519 paramIn(cp, base + ".lastCommand", lastCommand);
520 int bufferSize;
521 paramIn(cp, base + ".outBuffer.size", bufferSize);
522 uint8_t *buffer = new uint8_t[bufferSize];
523 arrayParamIn(cp, base + ".outBuffer.elts", buffer,
524 bufferSize*sizeof(uint8_t));
525 for (int i = 0; i < bufferSize; ++i) {
526 outBuffer.push(buffer[i]);
527 }
528 delete[] buffer;
529}
530
531void
532X86ISA::PS2Mouse::serialize(const std::string &base, CheckpointOut &cp)
533{
534 uint8_t statusData = status.__data;
535 paramOut(cp, base + ".lastCommand", lastCommand);
536 int bufferSize = outBuffer.size();
537 paramOut(cp, base + ".outBuffer.size", bufferSize);
538 uint8_t *buffer = new uint8_t[bufferSize];
539 for (int i = 0; i < bufferSize; ++i) {
540 buffer[i] = outBuffer.front();
541 outBuffer.pop();
542 }
543 arrayParamOut(cp, base + ".outBuffer.elts", buffer,
544 bufferSize*sizeof(uint8_t));
545 delete[] buffer;
546 paramOut(cp, base + ".status", statusData);
547 paramOut(cp, base + ".resolution", resolution);
548 paramOut(cp, base + ".sampleRate", sampleRate);
549}
550
551void
552X86ISA::PS2Mouse::unserialize(const std::string &base, CheckpointIn &cp)
553{
554 uint8_t statusData;
555 paramIn(cp, base + ".lastCommand", lastCommand);
556 int bufferSize;
557 paramIn(cp, base + ".outBuffer.size", bufferSize);
558 uint8_t *buffer = new uint8_t[bufferSize];
559 arrayParamIn(cp, base + ".outBuffer.elts", buffer,
560 bufferSize*sizeof(uint8_t));
561 for (int i = 0; i < bufferSize; ++i) {
562 outBuffer.push(buffer[i]);
563 }
564 delete[] buffer;
565 paramIn(cp, base + ".status", statusData);
566 paramIn(cp, base + ".resolution", resolution);
567 paramIn(cp, base + ".sampleRate", sampleRate);
568
569 status.__data = statusData;
570}
571
572X86ISA::I8042 *
573I8042Params::create()
574{
575 return new X86ISA::I8042(this);
576}