- Timestamp:
- Feb 1, 2013 1:24:40 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83547
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevRTC.cpp
r43241 r44510 897 897 static void rtcCalcCRC(RTCState *pThis) 898 898 { 899 uint16_t u16; 900 unsigned i; 901 902 for (i = RTC_CRC_START, u16 = 0; i <= RTC_CRC_LAST; i++) 899 uint16_t u16 = 0; 900 for (unsigned i = RTC_CRC_START; i <= RTC_CRC_LAST; i++) 903 901 u16 += pThis->cmos_data[i]; 902 904 903 pThis->cmos_data[RTC_CRC_LOW] = u16 & 0xff; 905 904 pThis->cmos_data[RTC_CRC_HIGH] = (u16 >> 8) & 0xff; … … 908 907 909 908 /** 910 * Write to a CMOS register and update the checksum if necessary. 911 * 912 * @returns VBox status code. 913 * @param pDevIns Device instance of the RTC. 914 * @param iReg The CMOS register index; bit 8 determines bank. 915 * @param u8Value The CMOS register value. 909 * @interface_method_impl{PDMRTCREG,pfnWrite} 916 910 */ 917 911 static DECLCALLBACK(int) rtcCMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value) 918 912 { 919 913 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 914 Assert(PDMCritSectIsOwner(pDevIns->pCritSectRoR3)); 920 915 if (iReg < RT_ELEMENTS(pThis->cmos_data)) 921 916 { 922 PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);923 924 917 pThis->cmos_data[iReg] = u8Value; 925 918 … … 929 922 rtcCalcCRC(pThis); 930 923 931 PDMCritSectLeave(pDevIns->pCritSectRoR3);932 924 return VINF_SUCCESS; 933 925 } … … 939 931 940 932 /** 941 * Read a CMOS register. 942 * 943 * @returns VBox status code. 944 * @param pDevIns Device instance of the RTC. 945 * @param iReg The CMOS register index; bit 8 determines bank. 946 * @param pu8Value Where to store the CMOS register value. 933 * @interface_method_impl{PDMRTCREG,pfnRead} 947 934 */ 948 935 static DECLCALLBACK(int) rtcCMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value) 949 936 { 950 937 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 938 Assert(PDMCritSectIsOwner(pDevIns->pCritSectRoR3)); 939 951 940 if (iReg < RT_ELEMENTS(pThis->cmos_data)) 952 941 { 953 PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);954 955 942 *pu8Value = pThis->cmos_data[iReg]; 956 957 PDMCritSectLeave(pDevIns->pCritSectRoR3);958 943 return VINF_SUCCESS; 959 944 } -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r44508 r44510 1984 1984 int rc; 1985 1985 if (pVM->pdm.s.pRtc) 1986 rc = pVM->pdm.s.pRtc->Reg.pfnWrite(pVM->pdm.s.pRtc->pDevIns, iReg, u8Value); 1986 { 1987 PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns; 1988 rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED); 1989 if (RT_SUCCESS(rc)) 1990 { 1991 rc = pVM->pdm.s.pRtc->Reg.pfnWrite(pDevInsRtc, iReg, u8Value); 1992 PDMCritSectLeave(pDevInsRtc->pCritSectRoR3); 1993 } 1994 } 1987 1995 else 1988 1996 rc = VERR_PDM_NO_RTC_INSTANCE; … … 2005 2013 int rc; 2006 2014 if (pVM->pdm.s.pRtc) 2007 rc = pVM->pdm.s.pRtc->Reg.pfnRead(pVM->pdm.s.pRtc->pDevIns, iReg, pu8Value); 2015 { 2016 PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns; 2017 rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED); 2018 if (RT_SUCCESS(rc)) 2019 { 2020 rc = pVM->pdm.s.pRtc->Reg.pfnRead(pDevInsRtc, iReg, pu8Value); 2021 PDMCritSectLeave(pDevInsRtc->pCritSectRoR3); 2022 } 2023 } 2008 2024 else 2009 2025 rc = VERR_PDM_NO_RTC_INSTANCE;
Note:
See TracChangeset
for help on using the changeset viewer.