Changeset 23989 in vbox
- Timestamp:
- Oct 22, 2009 2:42:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Parallel/DevParallel.cpp
r22793 r23989 561 561 #ifdef IN_RING3 562 562 /** 563 * Saves a state of the serial port device. 564 * 565 * @returns VBox status code. 566 * @param pDevIns The device instance. 567 * @param pSSMHandle The handle to save the state to. 563 * @copydoc FNSSMDEVLIVEEXEC 564 */ 565 static DECLCALLBACK(int) parallelLiveExec(PPDMDEVINS pDevIns, 566 PSSMHANDLE pSSMHandle, 567 uint32_t uPass) 568 { 569 ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *); 570 571 SSMR3PutS32(pSSMHandle, pThis->irq); 572 SSMR3PutU32(pSSMHandle, pThis->base); 573 SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ 574 return VINF_SSM_DONT_CALL_AGAIN; 575 } 576 577 /** 578 * @copydoc FNSSMDEVSAVEEXEC 568 579 */ 569 580 static DECLCALLBACK(int) parallelSaveExec(PPDMDEVINS pDevIns, … … 575 586 SSMR3PutU8(pSSMHandle, pThis->reg_status); 576 587 SSMR3PutU8(pSSMHandle, pThis->reg_control); 577 SSMR3PutS32(pSSMHandle, pThis->irq); 578 SSMR3PutU32(pSSMHandle, pThis->base); 579 580 return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ 581 } 582 583 /** 584 * Loads a saved serial port device state. 585 * 586 * @returns VBox status code. 587 * @param pDevIns The device instance. 588 * @param pSSMHandle The handle to the saved state. 589 * @param uVersion The data unit version number. 590 * @param uPass The data pass. 588 589 parallelLiveExec(pDevIns, pSSMHandle, 0); 590 return VINF_SUCCESS; 591 } 592 593 /** 594 * @copydoc FNSSMDEVLOADEXEC 591 595 */ 592 596 static DECLCALLBACK(int) parallelLoadExec(PPDMDEVINS pDevIns, … … 599 603 AssertMsgReturn(uVersion == PARALLEL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 600 604 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 601 602 SSMR3GetU8(pSSMHandle, &pThis->reg_data); 603 SSMR3GetU8(pSSMHandle, &pThis->reg_status); 604 SSMR3GetU8(pSSMHandle, &pThis->reg_control); 605 SSMR3GetS32(pSSMHandle, &pThis->irq); 606 SSMR3GetU32(pSSMHandle, &pThis->base); 607 605 if (uPass == SSM_PASS_FINAL) 606 { 607 SSMR3GetU8(pSSMHandle, &pThis->reg_data); 608 SSMR3GetU8(pSSMHandle, &pThis->reg_status); 609 SSMR3GetU8(pSSMHandle, &pThis->reg_control); 610 } 611 612 /* the config */ 613 int32_t iIrq; 614 SSMR3GetS32(pSSMHandle, &iIrq); 615 uint32_t uIoBase; 616 SSMR3GetU32(pSSMHandle, &uIoBase); 608 617 uint32_t u32; 609 618 int rc = SSMR3GetU32(pSSMHandle, &u32); … … 611 620 return rc; 612 621 AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 622 623 if (pThis->irq != iIrq) 624 { 625 LogRel(("Parallel: IRQ changed: config=%#x state=%#x\n", pThis->irq, iIrq)); 626 return VERR_SSM_LOAD_CONFIG_MISMATCH; 627 } 628 629 if (pThis->base != uIoBase) 630 { 631 LogRel(("Parallel: IOBase changed: config=%#x state=%#x\n", pThis->base, uIoBase)); 632 return VERR_SSM_LOAD_CONFIG_MISMATCH; 633 } 613 634 614 635 /* not necessary... but it doesn't harm. */ … … 802 823 } 803 824 804 rc = PDMDevHlpSSMRegister(pDevIns, PARALLEL_SAVED_STATE_VERSION, sizeof(*pThis), parallelSaveExec, parallelLoadExec); 825 rc = PDMDevHlpSSMRegister3(pDevIns, PARALLEL_SAVED_STATE_VERSION, sizeof(*pThis), 826 parallelLiveExec, parallelSaveExec, parallelLoadExec); 805 827 if (RT_FAILURE(rc)) 806 828 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.