-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Joe Ciccone wrote:
> Grub legacy sets up protected mode.

...Well never mind that then.  Apparently the part of boot/setup.S in
the kernel that I was reading isn't actually executed.  Figures.  :-P

So it starts in protected mode, but (presumably) not long mode?

>> But for two, isn't 4G of virtual address space way more than enough
>> for grub to do whatever it needs to do?  I mean, all it has to do
>> is load up a file or two off the host FS and jump to an address
>> inside the memory image of one of the files.  That's not nearly
>> complicated enough to require more than 4G of memory.
> 
> Without setting up protected mode you can't access more then 1mb of 
> physical memory, without pulling your hair out.

Right.  (Actually I'm not sure you can access more than 1MB of memory
even if you *do* pull your hair out.  The memory model is 16-bit
segments and 16-bit offsets, but the physical address mapping is "shift
the segment number by 4 bits and add the offset" -- so the maximum
physical memory is 20 bits' worth, or 1MB.  Although I'm not exactly
sure what happens when you try to access FFFF:0010.  Physical address
zero?  Overflow bit turned on in EFLAGS?  Hard lockup?  :-P)

In any case, you need the segment descriptor bits that say "native
32-bit data segment" to be turned on, which means you need segmentation
on, which means you need protected mode.

But you don't need more than 4G of memory, so protected mode is enough.
Long mode is massive overkill for a bootloader, IMO.  (That is, as long
as CPUs still natively support 32-bit protected mode.  If that ever
changes, then the bootloaders will have to change.  But I doubt it will
ever be able to change -- modern processors still come up in the "good"
old 16:16-virtual/20-bit-physical real mode at boot time.)

> The problem with grub legacy is that stage2 gets linked into the grub
> shell.

... Oh.  That explains that problem.  :-)

If stage2 gets linked into the grub shell, they must be the same bit
size.  So the only way to get a 64-bit grub shell would be to have a
64-bit stage2.  Which is extreme overkill (especially if the kernel
already expects to be able to switch into long mode), which is likely
why they don't do it.

> Grub2 should be able to work. I just compiled 1.95 with 64bit
> binaries and 32bit modules. Now all I would like to do is compile a
> pure64 system and try this.

I'm working in that direction today still...  :-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGoincS5vET1Wea5wRAxVWAKCtPGyMGdiuCHsw65zcYi0psJp0wgCgqbMh
QBBjSBXj93//2bKtpXd2DRw=
=Llkv
-----END PGP SIGNATURE-----
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to