vmware: add GETTIME backdoor command (23)#1590
Open
felixrieseberg wants to merge 1 commit into
Open
Conversation
Returns the host's wall-clock time: EAX = seconds since the Unix epoch (UTC), EBX = remaining microseconds, ECX = maximum time lag in microseconds, EDX = host offset from UTC in minutes (east positive). Guests only read the RTC at boot, so a VM resumed from a saved state keeps running with the clock it was saved with. With this command a small guest agent can periodically compare its clock against the host and correct it without a reboot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just like the other VMWare-related PRs, no hard feelings if you don't want them - I just want to upstream stuff I've done for Windows. This one implements implements VMware backdoor command 23 (
GETTIME) on port 0x5658.Return values in registers after the
IN EAX, DX:Guests read the RTC only at boot. A VM resumed from a saved state continues running with whatever clock it was saved with, and the guest has no way to learn the correct time without rebooting.
With GETTIME, a small guest agent can issue a single backdoor call on a timer and compare its own
time()against the host — no kernel driver, no full VMware Tools stack. The protocol is simple enough for a hand-rolled 16/32-bit DOS or Win9x TSR.Notes on GETTIMEFULL
VMware deprecated GETTIME in favour of command 35 (
GETTIMEFULL) because EAX wraps as a signed value in 2038. Read as unsigned (which is what>>> 0gives JS, and what 32-bit C gives withunsigned long), EAX is valid until 2106. GETTIME is simpler for the guest to consume and is still the first thing open-vm-tools'Backdoor_GetTimewrapper tries. I think for our purposes her eis is probably fine :)