[Info-vax] clock problems with OpenVMS x86 on VirtualBox

gah4 gah4 at u.washington.edu
Mon May 15 07:34:56 EDT 2023


On Monday, May 15, 2023 at 3:06:16 AM UTC-7, Johnny Billquist wrote:

(snip, I wrote)

> > But S/370 adds a TOD clock, which keeps track of time, and a separate 
> > system for non TOD related timing. One complication with the TOD clock 
> > in Y2K days, is that access is not privileged, such that it can't be emulated 
> > by VM. So, VM/370 and successor guests read the hardware TOD clock. 
> > But other timing uses a different timer which is emulated.

> Most systems do have a TOD clock as well, in hardware. But it is not 
> used for actually reporting current wall clock time, but is read out at 
> boot time and the OS time is set from it, and occasionally it is also 
> written to, to correct small drifts that happen over time. 
 
The S/370 TOD clock is 64 bits, and increments such that bit 51 
(counting from the MSB as bit 0) increments at 1MHz.  
Actual implementations might have more or less resolution.

It is accessed with the STCK instruction, which stores its value
in memory.  It is defined such that you never see the same value
in successive execution.  That is easy on slow CPUs, otherwise
they increment low bits.  As well as I know it, processors in the
1970's really did increment it at 1MHz.  You would not want to do
that with interrupts.  

Then there is the CPU timer, again 64 bits, which decrements such that
but 51 decrements at 1MHz.  Again, actual implementations might
have or or less resolution.  It generates an interrupt when it is negative.

So, no high speed interrupt is needed, but you still get high resolution.
There are reasons why it might not always be decremented, such that
it isn't good for time-of-day use.  

In the case of virtual machines, each one will have its own CPU timer,
but only one TOD clock.  STCK is not a privileged instruction, so programs
(or OS) see the host clock.




More information about the Info-vax mailing list