All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH 7/7] RFC: Use correct addresses, eliminate manual  relocations
Date: Wed, 15 Jul 2009 19:40:14 -0400	[thread overview]
Message-ID: <1247701214.1500.14.camel@mj> (raw)
In-Reply-To: <d7ead6de0907151541y29164a99g543ea5bba9c3dc1c@mail.gmail.com>

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	other threads:[~2009-07-15 23:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  1:00 [PATCH 1/7] Make boot/i386/pc/boot.S safer to modify Pavel Roskin
2009-07-15  1:00 ` [PATCH 2/7] Remove unused version information from boot/i386/pc/boot.S Pavel Roskin
2009-07-15  1:00 ` [PATCH 3/7] Eliminate kernel_segment Pavel Roskin
2009-07-16 15:45   ` Robert Millan
2009-07-15  1:00 ` [PATCH 4/7] Eliminate kernel_address Pavel Roskin
2009-07-16 15:52   ` Robert Millan
2009-07-15  1:00 ` [PATCH 5/7] Add newline after "Error" in bootsector Pavel Roskin
2009-07-15  1:00 ` [PATCH 6/7] Increase BPB size to accommodate FAT32 Pavel Roskin
2009-07-15  1:00 ` [PATCH 7/7] RFC: Use correct addresses, eliminate manual relocations Pavel Roskin
2009-07-15 15:33   ` Pavel Roskin
2009-07-15 22:41     ` Vladimir 'phcoder' Serbinenko
2009-07-15 23:40       ` Pavel Roskin [this message]
2009-07-16  3:44       ` Pavel Roskin
2009-07-16 15:36         ` Vladimir 'phcoder' Serbinenko
2009-07-16 15:43 ` [PATCH 1/7] Make boot/i386/pc/boot.S safer to modify Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247701214.1500.14.camel@mj \
    --to=proski@gnu.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.