[Info-vax] Pointless Nostalgia: System Service Dispatching
lawrencedo99 at gmail.com
lawrencedo99 at gmail.com
Wed Jun 29 05:53:50 EDT 2016
This is all water under the bridge now, but I remember something peculiar about the way system services were dispatched on the VAX using the CHMK instruction, particularly.
As I recall from reading the “Internals & Data Structures” manual, each system service was invoked using the “CHMK #<code>” instruction, with a code identifying the system service.
This instruction had to be 4 bytes long. To ensure this (and prevent optimization to short literals by the assembler), the codes were forward-defined in MACRO. This seemed an unnecessarily roundabout way to do things, when you could have just written “CHMK I^#<code>” to force immediate-mode literals.
The other thing was, the CHMx instructions caused traps, not faults. Thus, restartable services (e.g. $HIBER) required the caller’s PC to be backed up by 4 before putting the process on a suitable wait queue. When it was woken up, the CHMK instruction would be automatically re-executed.
This allowed, for example, ASTs to temporarily interrupt a hibernating process, after which the process would return to hibernation, unless a $WAKE had been done in the meantime (perhaps in the AST itself), whereupon the $HIBER call would simply fall through and the process would resume normal execution.
Again, this could have been done a little simpler: why could the CHMx instructions not have triggered a fault (saved PC left pointing at start of instruction) rather than a trap (saved PC pointing at next instruction)? And the saved PSL would have had the FPD bit set. When one of these instructions was executed with FPD set, it would simply fall through as a no-op. Thus, restarting the system service would be as simple as clearing FPD in the saved PSL. The REI would do the rest.
So much more elegant, do you think?
I think the original VAX engineers missed a trick there...
More information about the Info-vax
mailing list