mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-11 04:29:37 +00:00
Fix RTC units
Fixed an issue where get-msecs-601 and get-msecs-60x were not returning the same value. RTC was being calculated using timebase frequency instead of nanosecond frequency. 601 uses RTC. 60x uses TBR. On a real Mac, a G3 CPU won't have a RTC and accessing RTC would cause an exception. This is not the case for dingusppc but I don't think that's a problem.
This commit is contained in:
parent
ed424ad544
commit
b665f2cb4e
|
@ -858,9 +858,7 @@ void dppc_interpreter::ppc_mtmsr() {
|
|||
static inline void calc_rtcl_value()
|
||||
{
|
||||
uint64_t new_ts = get_virt_time_ns();
|
||||
uint64_t diff = new_ts - rtc_timestamp;
|
||||
uint64_t rtc_inc = diff * tbr_freq_hz / NS_PER_SEC;
|
||||
uint64_t rtc_l = rtc_lo + (rtc_inc << 7);
|
||||
uint64_t rtc_l = new_ts - rtc_timestamp + rtc_lo;
|
||||
if (rtc_l >= ONE_BILLION_NS) { // check RTCL overflow
|
||||
rtc_hi += rtc_l / ONE_BILLION_NS;
|
||||
rtc_lo = rtc_l % ONE_BILLION_NS;
|
||||
|
|
Loading…
Reference in New Issue
Block a user