[SeaBIOS] Why drive_s is allocated from f-segment?

Kevin O'Connor kevin at koconnor.net
Thu Apr 12 02:34:13 CEST 2012


On Wed, Apr 11, 2012 at 04:27:57PM +0300, Gleb Natapov wrote:
> Hi Kevin,
> 
> Is there a reason why drive_s structures are allocated from f-segment?

The data is accessed from 16bit mode, so it must be in the first meg.
Only malloc_low() and malloc_fseg() provide data in this range.
Putting it in the f-segment has the advantage of not taking space away
from the OS (malloc_low uses the 9-segment) and the code generated
from f-segment accesses is slightly better (it can use %cs).

> The space for f-segment allocations are barely sufficient for bios
> tables.

There's plenty of space in the f-segment.  All the 32bit init code
that is relocated is given back to malloc_fseg - that's typically
about 20k.  Also, most of the bios tables are placed in high memory
(malloc_high).

-Kevin



More information about the SeaBIOS mailing list