All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: bugs in loader/i386/pc/multiboot.c
@ 2009-02-22  0:52 Robert Millan
  2009-02-22  9:27 ` phcoder
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-02-22  0:52 UTC (permalink / raw)
  To: e_mc_h2; +Cc: Neal H. Walfield, grub-devel


Hi,

The problem with elf64 in our multiboot loader is that it duplicates a lot
of code from elf32 and this eventually leads to bitrot.

In fact, grub_multiboot_load_elf32 and grub_multiboot_load_elf64 are supposed
to be almost identical, and only differ in s/32/64/ references.

It'd be fairly simple to resincronize them, but I'd really like to find a
way to prevent this from happening again.

Does someone have any idea on what would be a good approach?

-- 
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."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bugs in loader/i386/pc/multiboot.c
  2009-02-22  0:52 bugs in loader/i386/pc/multiboot.c Robert Millan
@ 2009-02-22  9:27 ` phcoder
  2009-02-27 21:41   ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: phcoder @ 2009-02-22  9:27 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> Hi,
> 
> The problem with elf64 in our multiboot loader is that it duplicates a lot
> of code from elf32 and this eventually leads to bitrot.
> 
> In fact, grub_multiboot_load_elf32 and grub_multiboot_load_elf64 are supposed
> to be almost identical, and only differ in s/32/64/ references.
> 
> It'd be fairly simple to resincronize them, but I'd really like to find a
> way to prevent this from happening again.
> 
> Does someone have any idea on what would be a good approach?
> 
Move it to a separate file and instead of writing e.g. Elf32_Sym write 
Elf_Sym then in the top of the file:
#ifdef ELF64
#define Elf_Sym Elf64_Sym
...
#else
#define Elf_Sym Elf32_Sym
...
#endif
And then compile the same file twice, once with -DETLF32 and once with 
-DELF64. I was actually planning to do the same with my efiemu. If you 
agree I can do  this scheme in both places
Regard
Vladimir 'phcoder' Serbinenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bugs in loader/i386/pc/multiboot.c
  2009-02-22  9:27 ` phcoder
@ 2009-02-27 21:41   ` Robert Millan
  2009-02-27 22:01     ` Neal H. Walfield
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-02-27 21:41 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Feb 22, 2009 at 10:27:27AM +0100, phcoder wrote:
> Robert Millan wrote:
>> Hi,
>>
>> The problem with elf64 in our multiboot loader is that it duplicates a lot
>> of code from elf32 and this eventually leads to bitrot.
>>
>> In fact, grub_multiboot_load_elf32 and grub_multiboot_load_elf64 are supposed
>> to be almost identical, and only differ in s/32/64/ references.
>>
>> It'd be fairly simple to resincronize them, but I'd really like to find a
>> way to prevent this from happening again.
>>
>> Does someone have any idea on what would be a good approach?
>>
> Move it to a separate file and instead of writing e.g. Elf32_Sym write  
> Elf_Sym then in the top of the file:
> #ifdef ELF64
> #define Elf_Sym Elf64_Sym
> ...
> #else
> #define Elf_Sym Elf32_Sym
> ...
> #endif
> And then compile the same file twice, once with -DETLF32 and once with  
> -DELF64. I was actually planning to do the same with my efiemu. If you  
> agree I can do  this scheme in both places

I will try.  Does someone have a known-working Multiboot / ELF64 image I can
test with?

-- 
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."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bugs in loader/i386/pc/multiboot.c
  2009-02-27 21:41   ` Robert Millan
@ 2009-02-27 22:01     ` Neal H. Walfield
  2009-02-27 23:06       ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Neal H. Walfield @ 2009-02-27 22:01 UTC (permalink / raw)
  To: The development of GRUB 2

At Fri, 27 Feb 2009 22:41:47 +0100,
Robert Millan wrote:
> I will try.  Does someone have a known-working Multiboot / ELF64 image I can
> test with?

You can try Viengoos:

  http://plato.walfield.org/viengoos


Here is a grub.cfg menu entry:

  menuentry "Viengoos" {
      multiboot /viengoos -D 3 -o serial
      module /hieronymus
  }

(Output will be on the first serial console.)


Viengoos will print out the mmap as reported by Grub when it starts.
(Currently, it only uses the lower and upper memory values.)

Neal



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bugs in loader/i386/pc/multiboot.c
  2009-02-27 22:01     ` Neal H. Walfield
@ 2009-02-27 23:06       ` Robert Millan
  2009-03-01 21:41         ` Neal H. Walfield
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-02-27 23:06 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Feb 27, 2009 at 11:01:30PM +0100, Neal H. Walfield wrote:
> At Fri, 27 Feb 2009 22:41:47 +0100,
> Robert Millan wrote:
> > I will try.  Does someone have a known-working Multiboot / ELF64 image I can
> > test with?
> 
> You can try Viengoos:
> 
>   http://plato.walfield.org/viengoos
> 
> 
> Here is a grub.cfg menu entry:
> 
>   menuentry "Viengoos" {
>       multiboot /viengoos -D 3 -o serial
>       module /hieronymus
>   }
> 
> (Output will be on the first serial console.)
> 
> 
> Viengoos will print out the mmap as reported by Grub when it starts.
> (Currently, it only uses the lower and upper memory values.)

Thanks.  I just fixed it.

-- 
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."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bugs in loader/i386/pc/multiboot.c
  2009-02-27 23:06       ` Robert Millan
@ 2009-03-01 21:41         ` Neal H. Walfield
  0 siblings, 0 replies; 6+ messages in thread
From: Neal H. Walfield @ 2009-03-01 21:41 UTC (permalink / raw)
  To: The development of GRUB 2

At Sat, 28 Feb 2009 00:06:29 +0100,
Robert Millan wrote:
> Thanks.  I just fixed it.

I've tested it and it seems to work.

Thanks,
Neal



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-01 21:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-22  0:52 bugs in loader/i386/pc/multiboot.c Robert Millan
2009-02-22  9:27 ` phcoder
2009-02-27 21:41   ` Robert Millan
2009-02-27 22:01     ` Neal H. Walfield
2009-02-27 23:06       ` Robert Millan
2009-03-01 21:41         ` Neal H. Walfield

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.