Re: contradiction in boot/i386/pc/boot.S
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 I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
On Jan 9, 2008 12:48 AM, Vincent Pelletier <[EMAIL PROTECTED]> wrote: > within the next 2 months Gah. "next 2 weeks". Vincent Pelletier ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
On Jan 9, 2008 12:37 AM, Robert Millan <[EMAIL PROTECTED]> 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 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: contradiction in boot/i386/pc/boot.S
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 ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
contradiction in boot/i386/pc/boot.S
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 I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel