Re: [off-topic] Fully virtualisable CPUs

Alan Cox (alan@lxorguk.ukuu.org.uk)
Sun, 8 Sep 1996 13:00:20 +0100 (BST)


> Yeah it would run slow the first few times a process ran, but it would
> leave a long trail of compiled piecelets, and without too much
> difficulty that could be cached on disk along with the executable so
> that next time the executable was run the loader would load the
> cache'd interpreted reassembled progress. In this way, one could even
> boot a new version of Linux in a Linux window, or FreeBSD, or NT, or
> Windows '95, or ... CP/M :) or Solaris 'x86 ... Heck I can do this
> myself. Anybody have references on:
>
> * x86 instruction set

Intels Pentium and PPro manuals are on their web site. They seem to be
complete enough for your task.

What you are describing by the way is how things like the Executor Mac
emulator do to get fast Mac emulation on a Linux box. Before you leap boldly
into action remember some little 'catches'

1. You have to play with mmap and mprotect as well since there are
side effects you have to emulate (page table dirty bits for example), and
some memory writes eg to the page tables affect the emulator however they
are done by the process you are running.

2. Self modifying code

3. Even worse, code that looks at itself to see if it needs to self
modify this time.

It is doable Im sure but it is also a big job.

Alan