Re: BOOT_CS

From: H. Peter Anvin
Date: Wed Feb 25 2004 - 11:27:32 EST


Followup to: <20040225103043.44010.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
By author: =?iso-8859-1?q?Etienne=20Lorrain?= <etienne_lorrain@xxxxxxxx>
In newsgroup: linux.dev.kernel
>
> What I did is simply load and uncompress Linux to a legally allocated
> HIMEM block (so that is a 100 % compatible DOS software, you can use
> a network disk or a disk cache for that) and check everything is right
> before disabling interruption, switch back to real mode with
> 4 Gb segments of non paged memory, copy the block at the right place,
> and start Linux in protected mode.
> You have to remember keeping the code short in between the back switch
> to real mode and the start of Linux because the data (Linux kernel)
> is at a clear physical address, but your code itself is in a 4 Kbyte
> page which is available - but the page after it may not be loaded
> so no more code...
>

[...]

There is a hook in the kernel immediately after enteing protected mode
for *exactly* this reason -- it was added to support LOADLIN. The
whole point is that your boot loader obtains control at that point so
you can put things back where they need to go (such as 0x100000 for
the main part of the kernel, which you will *never* get from an
HMA-enabled DOS.) The algorithm for that is pretty straightforward;
you can even deal with the case where you have scattered pages all
over memory.

-hpa

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/