Subject: Re: SIMH runs NetBSD/vax
To: None <port-vax@NetBSD.ORG>
From: John Wilson <wilson@dbit.com>
List: port-vax
Date: 03/12/2002 09:21:57
>From: Olaf Seibert <rhialto@polderland.nl>

>> Might as well just document the sequence of instructions NetBSD uses for
>> the busy wait.  Assuming it's short and simple, SIMH can easily be
>> modified to detect it and DTRT.
>
>That's one thing that IBM's VM/370 did (VM/370 is the operating system
>that virtualises IBM 370-family computers on 370's. In very great
>detail). It detected for instance a common busy-wait loop on a TIO (Test
>IO) instruction.

TSS/8 did the same kind of thing on the PDP-8, to detect a spin-loop waiting
for TTY input and put the process to sleep (in KEY state) until someone
types something.  Cute technique...  And it's nice when you can use a code
sequence to do something more efficiently on new systems, that would still
work OK on old systems (like string copies on the 68010).

This kind of thing could definitely work.  I do the same 68010 trick for
detecting string-copy operations in E11 (although for this particular case
I have it easy, the PDP-11 *does* have a WAIT instruction, which I turn
into a Linux sched_yield() call when appropriate).

>One thing SIMH maybe could do is change the meaning of an uncommon sort
>of instruction that's effectively a No OPeration, which could be
>inserted in the busy-wait. SIMH could treat it like a WAIT instruction.

You could even do it to an instruction which *isn't* a no op, if it's used
rarely enough that detecting some strange case (in SIMH) wouldn't cost
anything measurable.  If NetBSD is just going to twiddle its thumbs anyway,
it might as well do some complicated math or string thing that usually
never happens.  Real VAXes wouldn't care...

John Wilson
D Bit