Re: So near but....

Linus Torvalds (Linus.Torvalds@cs.helsinki.fi)
Wed, 16 Aug 1995 07:24:47 +0300


"Matti E. Aarnio [OH1MQK]": "Re: So near but...." (Aug 15, 19:55):
> >
> > Does a 386 need to be emulated, or will an 8088 suffice? Not that I can
> > produce either, but I am interested in the size of the task.
>
> The BIOS-code is supposedly 8086/8088, but some code-writers
> try to be clever.. PCI-bus BIOSes are likely to be 80386
> capable, though likely to be executed in 8086 mode. PCI-bus
> is used only with 486 and Pentium, as far as Intel documents
> and existing machines show any example -- well, of PCs..

Even some ISA cards can be 386-specific: I know my ATI Graphics Ultra
Pro (ISA) card manual at least stated that you need a 386-class machine
to use it (it _may_ be that this was due to external drivers, but I
wouldn't be surprised if they use 32-bit operations even in the BIOS).

Still, just emulating a real-mode i386 is trivial, at least compared to
emulating protected mode and paging.. There are various x86-emulators
around (although the one I remember off-hand had some restrictions on
use), and extending them accept 32-bit data extensions might not be too
bad.

It wouldn't need to be very fast, so a stupid and straightforward
approach is pretty ok. You'll be shocked to hear that some of this is
actually done in the linux i387-emulator already (it does all the memory
access emulation already - looking up the mod/rm stuff and handling
different segments for v86 mode, for example).

The i387-emulator obviously won't do any of the actual integer
instructions, but it _could_ be used as a starting point. After all,
what it does is essentially emulate a subset of a ix86 already..
(although you may not actually want to have all the baggage that the
math-emulator has: it needs to be much more advanced than your average
BIOS emulator in some respects).

Linus