[comp.sys.m68k] 68020 virtual machine?

tim@ism780c.UUCP (Tim Smith) (04/18/87)

Suppose you are trying to do a virtual 68020 on the 68020.
How do you deal with attempts by the virtual 68020 to
return from a bus error?

There are a lot of things in the bus error stack frame that
are reserved and/or undefined.  If it has changed some of those,
it seems that it could really screw over the system when
you load them. 

Is there some way one can validate such a stack frame to make
sure that it won't do anything funny when used? 
-- 
Tim Smith			"Hojotoho! Hojotoho!
uucp: sdcrdcf!ism780c!tim	 Heiaha! Heiaha!
Delph or GEnie: Mnementh	 Hojotoho! Heiaha!"
Compuserve: 72257,3706

gnu@hoptoad.uucp (John Gilmore) (04/20/87)

> Suppose you are trying to do a virtual 68020 on the 68020.
> How do you deal with attempts by the virtual 68020 to
> return from a bus error?

This is a hole in the design.  You can kludge around in software,
e.g. by keeping a cache of recent bus error stack frames and making
sure that the one they are RTE-ing with is one actually generated
by the machine, but this fails when the cache is not large enough
It can potentially be infinite -- many bus errors cause program
termination, meaning no RTE is ever done on that stack frame.
Alternately, faulting in a page from over the net, from a server
which comes back to life an hour later, means you'd have to hold
that stack frame for an hour before the virtual system attempted to
RTE to it.

If you don't validate the bus error stack dump, the virtual machine
can quite easily hang the hardware or get into other messy trouble.
The microcode program counter is in that stack dump!  In fact, this is
how Motorola runs some microdiagnostics on the chips -- they are in
microcode that is only reachable via RTE from a long stack frame.

You can probably get close enough to do useful VM style work, but it
requires a small bit of trust of the code running in the virtual machines.
E.g. you could put a small hook in the virtual machine such that when
it takes a bus error it intends to RTE to later, it calls the VM supervisor
via an ILLEGAL instruction, to tell it to save the stack frame for later.
If it didn't do this, and didn't RTE soon, a future RTE to that frame
would produce an error.
-- 
Copyright 1987 John Gilmore; you can redistribute only if your recipients can.
(This is an effort to bend Stargate to work with Usenet, not against it.)
{sun,ptsfa,lll-crg,ihnp4,ucbvax}!hoptoad!gnu	       gnu@ingres.berkeley.edu