* contradiction in boot/i386/pc/boot.S
@ 2008-01-08 10:50 Robert Millan
2008-01-08 18:13 ` Pavel Roskin
2008-01-08 18:24 ` Pavel Roskin
0 siblings, 2 replies; 10+ messages in thread
From: Robert Millan @ 2008-01-08 10:50 UTC (permalink / raw)
To: grub-devel
boot/i386/pc/boot.S reads:
/*
* This is a workaround for buggy BIOSes which don't pass boot
* drive correctly. If GRUB is installed into a HDD, check if
* DL is masked correctly. If not, assume that the BIOS passed
* a bogus value and set DL to 0x80, since this is the only
* possible boot drive. If GRUB is installed into a floppy,
* this does nothing (only jump).
*/
boot_drive_check:
jmp 1f /* grub-setup may overwrite this jump */
testb $0x80, %dl
jnz 1f
movb $0x80, %dl
1:
However, if 0x80 is really "the only possible boot drive", that means the
test is pointless and can be replaced with:
boot_drive_check:
jmp 1f /* grub-setup may overwrite this jump */
movb $0x80, %dl
1:
So AFAICT either the comment or the code needs adjusting.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 10:50 contradiction in boot/i386/pc/boot.S Robert Millan
@ 2008-01-08 18:13 ` Pavel Roskin
2008-01-08 18:24 ` Pavel Roskin
1 sibling, 0 replies; 10+ messages in thread
From: Pavel Roskin @ 2008-01-08 18:13 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-01-08 at 11:50 +0100, Robert Millan wrote:
> However, if 0x80 is really "the only possible boot drive", that means the
> test is pointless and can be replaced with:
>
> boot_drive_check:
> jmp 1f /* grub-setup may overwrite this jump */
> movb $0x80, %dl
> 1:
>
> So AFAICT either the comment or the code needs adjusting.
I think the code allows simplification regardless of what the comment
says.
Actually, the shortest solution (and we really want to be short in the
bootsector) would be to only have NOPs there without any jumps, and have
grub-setup overwrite the NOPs with "movb $0x80, %dl" for hard drive
installations.
Or the other way around - have "movb $0x80, %dl" in the code and have
grub-setup overwrite it with NOPs if installing not on a hard drive.
And by the way, I would remove the "boot_drive_check" label where it is
now and rename "real_start" to it, moving that "movb" there. That would
save a us label, making the code easier to read.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 10:50 contradiction in boot/i386/pc/boot.S Robert Millan
2008-01-08 18:13 ` Pavel Roskin
@ 2008-01-08 18:24 ` Pavel Roskin
2008-01-08 20:24 ` Robert Millan
1 sibling, 1 reply; 10+ messages in thread
From: Pavel Roskin @ 2008-01-08 18:24 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-01-08 at 11:50 +0100, Robert Millan wrote:
> boot_drive_check:
> jmp 1f /* grub-setup may overwrite this jump */
> testb $0x80, %dl
> jnz 1f
> movb $0x80, %dl
> 1:
>
> However, if 0x80 is really "the only possible boot drive", that means the
> test is pointless and can be replaced with:
No, I was wrong, I misread "testb" as "cmpb". Values such as 0x81 are
valid and should be preserved.
Please ignore my previous message.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 18:24 ` Pavel Roskin
@ 2008-01-08 20:24 ` Robert Millan
2008-01-08 22:57 ` Pavel Roskin
0 siblings, 1 reply; 10+ messages in thread
From: Robert Millan @ 2008-01-08 20:24 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 01:24:25PM -0500, Pavel Roskin wrote:
> On Tue, 2008-01-08 at 11:50 +0100, Robert Millan wrote:
> > boot_drive_check:
> > jmp 1f /* grub-setup may overwrite this jump */
> > testb $0x80, %dl
> > jnz 1f
> > movb $0x80, %dl
> > 1:
> >
> > However, if 0x80 is really "the only possible boot drive", that means the
> > test is pointless and can be replaced with:
>
> No, I was wrong, I misread "testb" as "cmpb". Values such as 0x81 are
> valid and should be preserved.
Yeah I was going to point that..
> Please ignore my previous message.
All of it, or just partly ?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 20:24 ` Robert Millan
@ 2008-01-08 22:57 ` Pavel Roskin
2008-01-08 23:37 ` Robert Millan
0 siblings, 1 reply; 10+ messages in thread
From: Pavel Roskin @ 2008-01-08 22:57 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-01-08 at 21:24 +0100, Robert Millan wrote:
> On Tue, Jan 08, 2008 at 01:24:25PM -0500, Pavel Roskin wrote:
> > On Tue, 2008-01-08 at 11:50 +0100, Robert Millan wrote:
> > > boot_drive_check:
> > > jmp 1f /* grub-setup may overwrite this jump */
> > > testb $0x80, %dl
> > > jnz 1f
> > > movb $0x80, %dl
> > > 1:
> > >
> > > However, if 0x80 is really "the only possible boot drive", that means the
> > > test is pointless and can be replaced with:
> >
> > No, I was wrong, I misread "testb" as "cmpb". Values such as 0x81 are
> > valid and should be preserved.
>
> Yeah I was going to point that..
>
> > Please ignore my previous message.
>
> All of it, or just partly ?
All of it, I'm afraid.
However, it's possible to save 2 bytes if we get rid of the first short
jump and overwrite the whole section (testb, jnz, movb) with NOPs for
the floppies.
We can save 4 more bytes if we do "orb $0x80, %dl" unconditionally for
the hard drives. However, I'm not sure if there are BIOSes that pass 1
in %dl and how critical it would be if it becomes 0x81. That's
something I'll rather not do without seeing the original bug reports.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 22:57 ` Pavel Roskin
@ 2008-01-08 23:37 ` Robert Millan
2008-01-08 23:48 ` Vincent Pelletier
2008-01-08 23:52 ` Pavel Roskin
0 siblings, 2 replies; 10+ messages in thread
From: Robert Millan @ 2008-01-08 23:37 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 05:57:16PM -0500, Pavel Roskin wrote:
>
> We can save 4 more bytes if we do "orb $0x80, %dl" unconditionally for
> the hard drives. However, I'm not sure if there are BIOSes that pass 1
> in %dl and how critical it would be if it becomes 0x81.
I think the assumption is that if the BIOS passes 0x01, etc, it's
garbage and should be ignored completely.
> That's
> something I'll rather not do without seeing the original bug reports.
Same here. Maybe Okuji will know..
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 23:37 ` Robert Millan
@ 2008-01-08 23:48 ` Vincent Pelletier
2008-01-08 23:51 ` Vincent Pelletier
2008-01-08 23:52 ` Pavel Roskin
1 sibling, 1 reply; 10+ messages in thread
From: Vincent Pelletier @ 2008-01-08 23:48 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 9, 2008 12:37 AM, Robert Millan <rmh@aybabtu.com> wrote:
> On Tue, Jan 08, 2008 at 05:57:16PM -0500, Pavel Roskin wrote:
> > That's
> > something I'll rather not do without seeing the original bug reports.
>
> Same here. Maybe Okuji will know..
I have a box with this bug - sadly, I will not be able to reach it
within the next 2 months - so I can test various proposals if provided
with patches :) .
IIRC originaly this fix was dropped from gub to grub2, and I re-raised
the issue. But that's all, I don't think I touched the code.
Vincent Pelletier
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 23:48 ` Vincent Pelletier
@ 2008-01-08 23:51 ` Vincent Pelletier
0 siblings, 0 replies; 10+ messages in thread
From: Vincent Pelletier @ 2008-01-08 23:51 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 9, 2008 12:48 AM, Vincent Pelletier <plr.vincent@gmail.com> wrote:
> within the next 2 months
Gah. "next 2 weeks".
Vincent Pelletier
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 23:37 ` Robert Millan
2008-01-08 23:48 ` Vincent Pelletier
@ 2008-01-08 23:52 ` Pavel Roskin
2008-01-08 23:57 ` Robert Millan
1 sibling, 1 reply; 10+ messages in thread
From: Pavel Roskin @ 2008-01-08 23:52 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, 2008-01-09 at 00:37 +0100, Robert Millan wrote:
> On Tue, Jan 08, 2008 at 05:57:16PM -0500, Pavel Roskin wrote:
> >
> > We can save 4 more bytes if we do "orb $0x80, %dl" unconditionally for
> > the hard drives. However, I'm not sure if there are BIOSes that pass 1
> > in %dl and how critical it would be if it becomes 0x81.
>
> I think the assumption is that if the BIOS passes 0x01, etc, it's
> garbage and should be ignored completely.
I understand the assumption.
> > That's
> > something I'll rather not do without seeing the original bug reports.
>
> Same here. Maybe Okuji will know..
When I tried to actually change the code, it turned out that
grub-mkimage doesn't change the boot sector, so grub-mkimage needs to be
adjusted, and maybe some other tools.
Alternatively, the logic should not be reverted, i.e. the adjustments
should be done for the hard drive installs. This means that grub-setup
should write valid x86 code over NOPs. It gets too complicated to
bother without having a very good incentive to save those 2 bytes.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: contradiction in boot/i386/pc/boot.S
2008-01-08 23:52 ` Pavel Roskin
@ 2008-01-08 23:57 ` Robert Millan
0 siblings, 0 replies; 10+ messages in thread
From: Robert Millan @ 2008-01-08 23:57 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 06:52:36PM -0500, Pavel Roskin wrote:
> [...]. It gets too complicated to
> bother without having a very good incentive to save those 2 bytes.
Heh, you have a point here.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-01-08 23:58 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 10:50 contradiction in boot/i386/pc/boot.S Robert Millan
2008-01-08 18:13 ` Pavel Roskin
2008-01-08 18:24 ` Pavel Roskin
2008-01-08 20:24 ` Robert Millan
2008-01-08 22:57 ` Pavel Roskin
2008-01-08 23:37 ` Robert Millan
2008-01-08 23:48 ` Vincent Pelletier
2008-01-08 23:51 ` Vincent Pelletier
2008-01-08 23:52 ` Pavel Roskin
2008-01-08 23:57 ` Robert Millan
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.