Save/Restore the guest clock in XThreads
This commit is contained in:
@@ -84,6 +84,16 @@ uint32_t Clock::QueryGuestUptimeMillis() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Clock::SetGuestTickCount(uint64_t tick_count) {
|
||||
last_host_tick_count_ = Clock::QueryHostTickCount();
|
||||
guest_tick_count_ = tick_count;
|
||||
}
|
||||
|
||||
void Clock::SetGuestSystemTime(uint64_t system_time) {
|
||||
last_host_tick_count_ = Clock::QueryHostTickCount();
|
||||
guest_time_filetime_ = system_time - guest_system_time_base_;
|
||||
}
|
||||
|
||||
uint32_t Clock::ScaleGuestDurationMillis(uint32_t guest_ms) {
|
||||
if (guest_ms == UINT_MAX) {
|
||||
return UINT_MAX;
|
||||
|
||||
@@ -47,6 +47,11 @@ class Clock {
|
||||
// Queries the milliseconds since the guest began, accounting for scaling.
|
||||
static uint32_t QueryGuestUptimeMillis();
|
||||
|
||||
// Sets the guest tick count for the current thread.
|
||||
static void SetGuestTickCount(uint64_t tick_count);
|
||||
// Sets the system time for the current thread.
|
||||
static void SetGuestSystemTime(uint64_t system_time);
|
||||
|
||||
// Scales a time duration in milliseconds, from guest time.
|
||||
static uint32_t ScaleGuestDurationMillis(uint32_t guest_ms);
|
||||
// Scales a time duration in 100ns ticks like FILETIME, from guest time.
|
||||
|
||||
Reference in New Issue
Block a user