grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/7] RFC: Use correct addresses, eliminate manual relocation


From: Pavel Roskin
Subject: Re: [PATCH 7/7] RFC: Use correct addresses, eliminate manual relocations
Date: Wed, 15 Jul 2009 19:40:14 -0400

On Thu, 2009-07-16 at 00:41 +0200, Vladimir 'phcoder' Serbinenko wrote:

> AFAIR during compilation process relocation entries are preserved and
> resolved only in the last step. Now thinking it should work even
> without .bss. Anyway don't care much about compiling bootsectors under
> darwin. Apple's CC generates longer opcodes which breaks bootsectors.
> Untill someone finds a fix darwin users will have to use bootsectors
> compiled under linux. It's not a huge problem since very few
> developpers need to modify boot sector

OK, good to know.  I'll try to preserve Darwin compatibility though.  At
least I can test it now.

> > So patches 5 and 7 are dropped for now.

I meant patches 4 (removal of kernel_address) and 7 (elimination of
manual relocations).

>   Patches 1-4 and 6 have been
> > applied.  Installation on FAT32 is safe now.  The "Hard Disk" message
> > has been preserved, so it can be shortened later if the real need
> > arises.
> >
> > That said, using direct jump to 0x8000 would save 3 bytes
> Unfortunately BIOSes loading at 7c0:0 exist

I mean we can remove kernel_address (minus 2 bytes) and use "jmp 0x8000"
instead of "jmp *(kernel_address)" (3 bytes instead of 4).  We are in
the correct segment already at that point.

> > and then we
> > can save 2 bytes by taking an unconditional jump from the "disk check"
> > code and reverting the logic.
> I don't understand what part of code you mean but as long if it's just
> revertion of a logic to do the same then it's fine with me

Well, we cannot "revert the logic", as we don't use grub-setup in
grub-mkrescue (perhaps it should be fixed).  As it stands now, the
bootsector should default to "no drive check".

I have a solution for that, but it turns out that grub-setup is buggy,
specifically this code:

if (dest_dev->disk->id & 0x80)

dest_dev->disk->id is just a position of the entry in device.map.
Moreover, util/hostdisk.c sets disk->has_partitions to 1
indiscriminately, even for floppies, so we cannot rely on it.  I suspect
that installation on floppies is broken, as copying the partition table
would overwrite the floppy code in the bootsector.

Before this is fixed, it's better to keep the drive check as is.

> > And maybe we could save 1 byte by yanking
> > "cli" as writing to %ss disables interrupts until the next instruction.
> I pefer to keep cli because alternative i386 implementations may have
> bug with it

OK.

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]