Skip to contentSkip to conversation

unused constants in i386/boot.h

PATCH In review Yves Blusseau 4 participants 8 messages Jul 9, 2009 – Jul 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unused constants in i386/boot.h

Here's the patch to remove unused constants.
The real constants used are GRUB_BOOT_MACHINE_KERNEL_ADDR and GRUB_BOOT_MACHINE_KERNEL_SEG.

Best Regards,
Yves Blusseau

ChangeLog +5 -0
index 3fe273f..f8b098a 100644
@@ -1,3 +1,8 @@
+2009-07-09  Yves BLUSSEAU  <[email protected]>
+
+	* include/grub/i386/pc/boot.h: Remove unused contants
+	GRUB_BOOT_MACHINE_KERNEL_ADDRESS and GRUB_BOOT_MACHINE_KERNEL_SEGMENT
+
 2009-07-07  Pavel Roskin  <[email protected]>
 
 	* commands/search.c (search_file): Merge into ...
include/grub/i386/pc/boot.h +0 -6
index f35cb3a..3a5606a 100644
@@ -34,15 +34,9 @@
 /* The offset of BOOT_DRIVE.  */
 #define GRUB_BOOT_MACHINE_BOOT_DRIVE	0x4c
 
-/* The offset of KERNEL_ADDRESS.  */
-#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS	0x40
-
 /* The offset of KERNEL_SECTOR.  */
 #define GRUB_BOOT_MACHINE_KERNEL_SECTOR	0x44
 
-/* The offset of KERNEL_SEGMENT.  */
-#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT	0x42
-
 /* The offset of BOOT_DRIVE_CHECK.  */
 #define GRUB_BOOT_MACHINE_DRIVE_CHECK	0x4e
 
#1 lore raw
Quoted 10 lines · Yves Blusseau

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">Here's
the patch to remove unused constants.<br>
The real constants used are GRUB_BOOT_MACHINE_KERNEL_ADDR and GRUB_BOOT_MACHINE_KERNEL_SEG.<br>

Hi,

As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them.

Btw, please include a non-HTML version in your emails :-)

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 12 lines · Yves Blusseau
Quoted 10 lines

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">Here's the patch to remove unused constants.<br>
The real constants used are GRUB_BOOT_MACHINE_KERNEL_ADDR and GRUB_BOOT_MACHINE_KERNEL_SEG.<br>

Quoted 21 lines

Hi,

As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them.

Btw, please include a non-HTML version in your emails :-)

Signature · 13 lines
Robert Millan

 The DRM opt-in fallacy: "Your data belongs to us. We will decide  
when (and
 how) you may access your data; but nobody's threatening your  
freedom: we
 still allow you to remove your data and not access it at all."


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Hi

boot/i386/pc/boot.S DON'T use this macros.

They're only defined in i386/boot.h but they are not used anywhere. The new name of this constants are GRUB_BOOT_MACHINE_KERNEL_ADDR and GRUB_BOOT_MACHINE_KERNEL_SEG.
So the GRUB_BOOT_MACHINE_KERNEL_ADDRESS and GRUB_BOOT_MACHINE_KERNEL_SEGMENT (see the difference with the constants below) constants can be definitively removed, and it's better to remove them to avoid confusion.

Yves Blusseau

#3 lore raw

Quoting Yves Blusseau <[email protected]>:

Quoted 2 lines
Quoted 2 lines

As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them.

I'd rather not keep the macros that are not used outside boot.S. They give a wrong impression that somebody somewhere needs to know that offset.

As for the macros that are used, we should always have assembler statements ensuring that the described field is indeed there.

Quoted 9 lines

boot/i386/pc/boot.S DON'T use this macros.

They're only defined in i386/boot.h but they are not used anywhere. The new name of this constants are GRUB_BOOT_MACHINE_KERNEL_ADDR and GRUB_BOOT_MACHINE_KERNEL_SEG.
So the GRUB_BOOT_MACHINE_KERNEL_ADDRESS and GRUB_BOOT_MACHINE_KERNEL_SEGMENT (see the difference with the constants below) constants can be definitively removed, and it's better to remove them to avoid confusion.

I believe we should use every such removal to simplify the code. We can now use direct jump instead of an indirect. That would hopefully save us two bytes we need to implement fat32 support.

I think we should also remove the version from boot.S, as it's not being checked anywhere.

I realize that somebody might suggest adding such check, but I'd rather append those to bytes at the end of the bootsector. The extra bytes would be checked and stripped by grub-setup, so that they don't take space in the actual bootsector. Also, if we add such check, we need a very clear message in i386/boot.h requiring the version to be updated whenever any change to the offsets is made. The version number should be a plain integer, perhaps 16-bit, without distinction between major and minor versions, so that nobody needs to think where their change calls for a major version increase.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw
Quoted 8 lines · Pavel Roskin

Quoting Yves Blusseau <[email protected]>:

Quoted 2 lines
Quoted 2 lines

As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them.

I'd rather not keep the macros that are not used outside boot.S. They give a wrong impression that somebody somewhere needs to know that offset.

Ok, let's remove them. I don't feel strongly about it.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#5 lore raw
Quoted 11 lines · Robert Millan
Quoted 8 lines · Pavel Roskin

Quoting Yves Blusseau <[email protected]>:

Quoted 2 lines
Quoted 2 lines

As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them.

I'd rather not keep the macros that are not used outside boot.S. They give a wrong impression that somebody somewhere needs to know that offset.

Ok, let's remove them. I don't feel strongly about it.

I'm working on a patch series that would remove unnecessary stuff and widen the BPB.

Signature · 2 lines
Regards,
Pavel Roskin
#6 lore raw

Pavel Roskin a écrit : On Tue, 2009-07-14 at 19:37 +0200, Robert Millan wrote: On Sun, Jul 12, 2009 at 09:21:07AM -0400, Pavel Roskin wrote: Quoting Yves Blusseau <[email protected]>: As long as boot/i386/pc/boot.S has the variables whose offset these macros are describing, I think it's fine to keep them. I'd rather not keep the macros that are not used outside boot.S. They give a wrong impression that somebody somewhere needs to know that offset. Ok, let's remove them. I don't feel strongly about it.

#7 lore raw
Quoted 1 line · Yves Blusseau

Cool, i have planed to do it but if you do the job it'll be great !

It's committed. I'm looking at the sanity checks in grub-setup now.

By the way, please do something about your mailer. You messages come in HTML format, which makes it hard to quote them.

Signature · 2 lines
Regards,
Pavel Roskin