i8042.cc (9808:13ffc0066b76) | i8042.cc (10905:a6ca6831e775) |
---|---|
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 | 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::serialize(std::ostream &os) | 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); | 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", os); 478 keyboard.serialize("keyboard", os); | 477 mouse.serialize("mouse", cp); 478 keyboard.serialize("keyboard", cp); |
479} 480 481void | 479} 480 481void |
482X86ISA::I8042::unserialize(Checkpoint *cp, const std::string §ion) | 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); | 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, section); 494 keyboard.unserialize("keyboard", cp, section); | 493 mouse.unserialize("mouse", cp); 494 keyboard.unserialize("keyboard", cp); |
495 496 statusReg.__data = statusRegData; 497 commandByte.__data = commandByteData; 498} 499 500void | 495 496 statusReg.__data = statusRegData; 497 commandByte.__data = commandByteData; 498} 499 500void |
501X86ISA::PS2Keyboard::serialize(const std::string &base, std::ostream &os) | 501X86ISA::PS2Keyboard::serialize(const std::string &base, CheckpointOut &cp) |
502{ | 502{ |
503 paramOut(os, base + ".lastCommand", lastCommand); | 503 paramOut(cp, base + ".lastCommand", lastCommand); |
504 int bufferSize = outBuffer.size(); | 504 int bufferSize = outBuffer.size(); |
505 paramOut(os, base + ".outBuffer.size", bufferSize); | 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 } | 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(os, base + ".outBuffer.elts", buffer, | 511 arrayParamOut(cp, base + ".outBuffer.elts", buffer, |
512 bufferSize*sizeof(uint8_t)); 513 delete[] buffer; 514} 515 516void | 512 bufferSize*sizeof(uint8_t)); 513 delete[] buffer; 514} 515 516void |
517X86ISA::PS2Keyboard::unserialize(const std::string &base, Checkpoint *cp, 518 const std::string §ion) | 517X86ISA::PS2Keyboard::unserialize(const std::string &base, CheckpointIn &cp) |
519{ | 518{ |
520 paramIn(cp, section, base + ".lastCommand", lastCommand); | 519 paramIn(cp, base + ".lastCommand", lastCommand); |
521 int bufferSize; | 520 int bufferSize; |
522 paramIn(cp, section, base + ".outBuffer.size", bufferSize); | 521 paramIn(cp, base + ".outBuffer.size", bufferSize); |
523 uint8_t *buffer = new uint8_t[bufferSize]; | 522 uint8_t *buffer = new uint8_t[bufferSize]; |
524 arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, | 523 arrayParamIn(cp, base + ".outBuffer.elts", buffer, |
525 bufferSize*sizeof(uint8_t)); 526 for (int i = 0; i < bufferSize; ++i) { 527 outBuffer.push(buffer[i]); 528 } 529 delete[] buffer; 530} 531 532void | 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 |
533X86ISA::PS2Mouse::serialize(const std::string &base, std::ostream &os) | 532X86ISA::PS2Mouse::serialize(const std::string &base, CheckpointOut &cp) |
534{ 535 uint8_t statusData = status.__data; | 533{ 534 uint8_t statusData = status.__data; |
536 paramOut(os, base + ".lastCommand", lastCommand); | 535 paramOut(cp, base + ".lastCommand", lastCommand); |
537 int bufferSize = outBuffer.size(); | 536 int bufferSize = outBuffer.size(); |
538 paramOut(os, base + ".outBuffer.size", bufferSize); | 537 paramOut(cp, base + ".outBuffer.size", bufferSize); |
539 uint8_t *buffer = new uint8_t[bufferSize]; 540 for (int i = 0; i < bufferSize; ++i) { 541 buffer[i] = outBuffer.front(); 542 outBuffer.pop(); 543 } | 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 } |
544 arrayParamOut(os, base + ".outBuffer.elts", buffer, | 543 arrayParamOut(cp, base + ".outBuffer.elts", buffer, |
545 bufferSize*sizeof(uint8_t)); 546 delete[] buffer; | 544 bufferSize*sizeof(uint8_t)); 545 delete[] buffer; |
547 paramOut(os, base + ".status", statusData); 548 paramOut(os, base + ".resolution", resolution); 549 paramOut(os, base + ".sampleRate", sampleRate); | 546 paramOut(cp, base + ".status", statusData); 547 paramOut(cp, base + ".resolution", resolution); 548 paramOut(cp, base + ".sampleRate", sampleRate); |
550} 551 552void | 549} 550 551void |
553X86ISA::PS2Mouse::unserialize(const std::string &base, Checkpoint *cp, 554 const std::string §ion) | 552X86ISA::PS2Mouse::unserialize(const std::string &base, CheckpointIn &cp) |
555{ 556 uint8_t statusData; | 553{ 554 uint8_t statusData; |
557 paramIn(cp, section, base + ".lastCommand", lastCommand); | 555 paramIn(cp, base + ".lastCommand", lastCommand); |
558 int bufferSize; | 556 int bufferSize; |
559 paramIn(cp, section, base + ".outBuffer.size", bufferSize); | 557 paramIn(cp, base + ".outBuffer.size", bufferSize); |
560 uint8_t *buffer = new uint8_t[bufferSize]; | 558 uint8_t *buffer = new uint8_t[bufferSize]; |
561 arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, | 559 arrayParamIn(cp, base + ".outBuffer.elts", buffer, |
562 bufferSize*sizeof(uint8_t)); 563 for (int i = 0; i < bufferSize; ++i) { 564 outBuffer.push(buffer[i]); 565 } 566 delete[] buffer; | 560 bufferSize*sizeof(uint8_t)); 561 for (int i = 0; i < bufferSize; ++i) { 562 outBuffer.push(buffer[i]); 563 } 564 delete[] buffer; |
567 paramIn(cp, section, base + ".status", statusData); 568 paramIn(cp, section, base + ".resolution", resolution); 569 paramIn(cp, section, base + ".sampleRate", sampleRate); | 565 paramIn(cp, base + ".status", statusData); 566 paramIn(cp, base + ".resolution", resolution); 567 paramIn(cp, base + ".sampleRate", sampleRate); |
570 571 status.__data = statusData; 572} 573 574X86ISA::I8042 * 575I8042Params::create() 576{ 577 return new X86ISA::I8042(this); 578} | 568 569 status.__data = statusData; 570} 571 572X86ISA::I8042 * 573I8042Params::create() 574{ 575 return new X86ISA::I8042(this); 576} |