- Timestamp:
- Nov 25, 2019 9:50:56 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r82201 r82202 454 454 } 455 455 456 static intkbd_write_data(PPDMDEVINS pDevIns, PKBDSTATE s, uint32_t val)457 { 458 intrc = VINF_SUCCESS;456 static VBOXSTRICTRC kbd_write_data(PPDMDEVINS pDevIns, PKBDSTATE s, uint32_t val) 457 { 458 VBOXSTRICTRC rc = VINF_SUCCESS; 459 459 460 460 #ifdef DEBUG_KBD … … 488 488 # else /* IN_RING3 */ 489 489 PDMDevHlpA20Set(s->CTX_SUFF(pDevIns), !!(val & 2)); 490 # endif /* !IN_RING3 */490 # endif /* IN_RING3 */ 491 491 #endif 492 492 if (!(val & 1)) { … … 643 643 /* -=-=-=-=-=- wrappers -=-=-=-=-=- */ 644 644 645 /** Fluff bits indexed by size (1,2,4). */ 646 static uint32_t const g_afFluff[5] = 647 { 648 /* [0] = */ 0, 649 /* [1] = */ 0, 650 /* [2] = */ UINT32_C(0xff00), 651 /* [3] = */ 0, 652 /* [4] = */ UINT32_C(0xffffff00) /* Crazy Apple (Darwin 6.0.2 and earlier). */ 653 }; 654 645 655 /** 646 656 * @callback_method_impl{FNIOMIOPORTNEWIN, … … 652 662 RT_NOREF(pvUser, offPort); 653 663 Assert(offPort == 0); 654 655 switch (cb) 656 { 657 case 1: 658 *pu32 = kbd_read_data(pDevIns, pThis); 659 Log2(("kbdIOPortDataRead: *pu32=%#x\n", *pu32)); 660 return VINF_SUCCESS; 661 662 case 4: 663 case 2: 664 { 665 uint32_t const uFluff = cb == 2 ? UINT32_C(0x0000ff00) 666 : UINT32_C(0xffffff00) /* Crazy Apple (Darwin 6.0.2 and earlier). */; 667 *pu32 = uFluff | kbd_read_data(pDevIns, pThis); 668 Log2(("kbdIOPortDataRead: cb=%u *pu32=%#x\n", cb, *pu32)); 669 return VINF_SUCCESS; 670 } 671 672 default: 673 ASSERT_GUEST_MSG_FAILED(("Port=0x60+%x cb=%d\n", offPort, cb)); 674 return VERR_IOM_IOPORT_UNUSED; 675 } 664 Assert(cb == 1 || cb == 2 || cb == 4); 665 666 *pu32 = kbd_read_data(pDevIns, pThis) | g_afFluff[cb]; 667 Log2(("kbdIOPortDataRead: cb=%u *pu32=%#x\n", cb, *pu32)); 668 return VINF_SUCCESS; 676 669 } 677 670 … … 682 675 static DECLCALLBACK(VBOXSTRICTRC) kbdIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 683 676 { 684 VBOXSTRICTRC rc = VINF_SUCCESS;685 677 RT_NOREF(offPort, pvUser); 686 678 Assert(offPort == 0); … … 689 681 { 690 682 PKBDSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PKBDSTATE); 691 rc = kbd_write_data(pDevIns, pThis, (uint8_t)u32); 692 Log2(("kbdIOPortDataWrite: Port=0x60+%x cb=%d u32=%#x\n", offPort, cb, u32)); 693 } 694 else 695 ASSERT_GUEST_MSG_FAILED(("Port=0x60+%x cb=%d\n", offPort, cb)); 696 return rc; 683 VBOXSTRICTRC rc = kbd_write_data(pDevIns, pThis, (uint8_t)u32); 684 Log2(("kbdIOPortDataWrite: Port=0x60+%x cb=%d u32=%#x rc=%Rrc\n", offPort, cb, u32, VBOXSTRICTRC_VAL(rc))); 685 return rc; 686 } 687 Assert(cb == 4); 688 ASSERT_GUEST_MSG_FAILED(("Port=0x60+%x cb=%d\n", offPort, cb)); 689 return VINF_SUCCESS; 697 690 } 698 691 … … 706 699 RT_NOREF(offPort, pvUser); 707 700 Assert(offPort == 0); 708 709 switch (cb) 710 { 711 case 1: 712 *pu32 = pThis->status; 713 Log2(("kbdIOPortStatusRead: -> *pu32=%#x\n", *pu32)); 714 return VINF_SUCCESS; 715 716 case 2: 717 case 4: 718 { 719 uint32_t const uFluff = cb == 2 ? UINT32_C(0x0000ff00) 720 : UINT32_C(0xffffff00) /* Crazy Apple (Darwin 6.0.2 and earlier). */; 721 *pu32 = uFluff | pThis->status; 722 Log2(("kbdIOPortStatusRead: cb=%u -> *pu32=%#x\n", cb, *pu32)); 723 return VINF_SUCCESS; 724 } 725 726 default: 727 ASSERT_GUEST_MSG_FAILED(("Port=0x64+%x cb=%d\n", offPort, cb)); 728 return VERR_IOM_IOPORT_UNUSED; 729 } 701 Assert(cb == 1 || cb == 2 || cb == 4); 702 703 *pu32 = pThis->status | g_afFluff[cb]; 704 Log2(("kbdIOPortStatusRead: cb=%u -> *pu32=%#x\n", cb, *pu32)); 705 return VINF_SUCCESS; 730 706 } 731 707 … … 746 722 return rc; 747 723 } 724 Assert(cb == 4); 748 725 ASSERT_GUEST_MSG_FAILED(("offPort=0x64+%x cb=%d\n", offPort, cb)); 749 726 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.