[ipxe-devel] ipxe/seabios: segment register initialization

Kevin O'Connor kevin at koconnor.net
Mon Feb 15 14:29:26 GMT 2016


On Mon, Feb 15, 2016 at 08:43:18AM +0200, Michael S. Tsirkin wrote:
> On Mon, Feb 15, 2016 at 01:07:09AM +0000, Michael Brown wrote:
> > On 14/02/16 19:52, Michael S. Tsirkin wrote:
> > >On Sun, Feb 14, 2016 at 05:36:38PM +0000, Michael Brown wrote:
> > >>On 14/02/16 15:53, Michael S. Tsirkin wrote:
> > >>>do you think %DS should be zeroed when NBP is called then?
> > >>
> > >>Not according to the PXE spec.
> > >>
> > >>As far as I can tell, the initial value of %ds is undefined for both a PXE
> > >>NBP and a BIOS boot sector.
> > >
> > >Thanks,
> > 
> > Out of interest: did this question arise as a purely academic curiosity, or
> > is there some product in existence which creates a boot sector that relies
> > on %ds==0?
> > 
> > Michael
> 
> FWIW QEMU has a unit test with a boot sector that relies on %ds=0:
> https://git.kernel.org/cgit/virt/kvm/mst/qemu.git/tree/tests/bios-tables-test.c?h=pci
> (search for boot_sector in this file).
> 
> It's a test, not a product though, and would be easy to change not to
> rely on this.

FYI, I agree with Michael Brown - I know of no spec requiring %ds (nor
most of the other cpu registers) to be initialized when invoking the
boot sector.  SeaBIOS does currently zero most registers, but this was
done for general "data cleanliness" reasons.  I would recommend that
bootloaders not rely on any particular initial cpu state.

-Kevin


More information about the ipxe-devel mailing list