Subject: Re: Boot ROM hacking
To: Andrew Gillham <gillhaa@ghost.whirlpool.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: port-i386
Date: 12/22/1999 17:21:28
gillhaa@ghost.whirlpool.com said:
> What cards do you typically use?

My production systems use 3com PCI cards. These are not the greatest
stuff under the sun, but easily available for me. I've also used
i82557 based cards, SMC Ultras and LANCE in the past.

> My only problem is that the 'quit' feature doesn't seem to allow the
> BIOS to continue with the normal boot path, so it won't boot a floppy
> now.

There is generally no way back once the boot has been started
by jumping to the INT19 vector. Blame these people who designed
the BIOS for it. Our ROM code tries some hack: it saves the
old contents of the INT19 vector to a supposedly save location,
and jumps to that on exit. There is no guarantee that the BIOS
has put a pointer to the disk boot function there before, so it
works with some BIOSes but fails with others.

> I figure that
> I will just temporarily add something like this to start_rom.S:
> ** Press <space> to BYPASS netboot. **

Yes, but it should go into the ROM's install function, ie
the INT19 handler just shouldn't be installed if the key is pressed.
At this point the processor is in real mode, so it becomes
nasty.
Would be good if you implemented it...

> A 64K ROM size is sort of ideal
> I guess, unless some sort of compression hack is used.

As the code works now, text, data, bss and stack must be within
one segment, ie <64k. (The heap is above, it can only be accessed
in protected mode.) Since the ROM contains text and data only,
you can't use up the 64k anyway. I'm typically using 32k ROMs
which usually work in all machines (have to leave out the
CREAD code though). The 64k limit could be overcome - it would
need a collection of stubs which all the BIOS calls go through,
some bounce buffers and a real mode stack below 64k, the rest
could be elsewhere. Then the compression would make more sense
than it does now. This is a task for a hardcore i386 assembler
programmer, not for me... Real-mode programming with a 32-bit
assembler is no fun, and the .use16 or so gas mode doesn't
always lead to the desired results, so one better uses the
standard 32-bit mode which is at least predictable.

> I'm not sure how much space
> is available for relocating code though. (e.g. 9000:0 is only 64K or
> can it overlap into a000:0?)

As I said, not only that the ROM contents must fit below a000:0,
there must also be space for the bss and the stack so that the
BIOS calls gets a return address and a stack pointer which fit
into 16 bits.

> Ultimately it might be possible
> to stick a flags byte into the CMOS somewhere. (though messy perhaps)

If you find a place for it... It might interfere badly with
BIOS variables.

> As far as the "cleanup on exit" for netboot, does the quit option
> work for you, or does it hang your machine also?

As said, it works sometimes. I pull the ROM normally:-)

best regards
Matthias