Re: [GIT PULL] x86 setup: correct booting on 486 (revised)

Eric W. Biederman
2007-11-05T21:16:05Z

"H. Peter Anvin" <hpa@zytor.com> writes:

> Eric W. Biederman wrote:
>>>
>>>> However, that being said, doing so is trivial, and it might help some
>>>> debugging hack; anything that makes debugging easier is a Good Thing[TM].
>>> Yeah. Even if it was just re-using the boot-time stack area temporarily, just
>>> to give code the choice to use a common set of instructions.
>>
>> If I had to do it from scratch today I would make the 32-bit entry
>> point require a stack, segments and use C calling conventions to pass
>> struct boot_params *.
>>
>> Besides %esi I'm not really fond of requiring anything in the 32bit
>> entrypoint. At the same time I totally agree that it is always nice
>> to provide way more then you need.
>>
>
> Nailing down the interface as hard as possible is a good idea, to avoid tying
> your hands for the future.
>
> -hpa

I'm just saying be liberal in what you accept and conservative in what
you send.

Making the entire process well defined is useful so things don't break
unnecessarily, and the maintainers of the pieces of software that use
the interface know what they can reliably get away with and what is
just luck.

Currently using the 32-bit entry point reliably requires:
%cs to be set.
%esi to be set.
%ebx be set to 0.
%gdt to be set and have:
0x10 a 32bit 4G code segment with base of 0
0x18 a 32bit 4G data segment with base of 0

With the latest generation of the boot protocol if KEEP_SEGMENTS
is set then it is only required that the data segments %ds, %es, %fs,
%gs and %ss be initialized to a valid value.

I have no problem with code providing more then what is required
above, and in fact I think it is likely a good thing.

For future expansion of the protocol things will go easiest if
we don't add additional requirements to the list above, as that
is all that I think all current boot loaders provide.

Anyway this is getting off topic. So far the changes to pmjump.S
look to be going well.

Eric