All of lore.kernel.org
 help / color / mirror / Atom feed
* Would a cleanup+extending of docs/multiboot.h be acceptable?
@ 2011-04-07 12:09 Goswin von Brederlow
  2011-04-07 12:56 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 10+ messages in thread
From: Goswin von Brederlow @ 2011-04-07 12:09 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi,

I've been working on a 32bit->64bit trampoline based on the example
kernel that just switches to 64bit mode and executes a real kernel
passed as module. As real kernel I want to use grubs example kernel as
well to just verify the multiboot infos passed through the trampoline
are intact.

And there I hit a problem. The docs/multiboot.h does not use the types
set out in the multiboot specs:

typedef struct multiboot_header
{
  unsigned long magic;
  unsigned long flags;
  unsigned long checksum;
...

All of those should be u32. But long is 32bit on 32bit cpus and 64bit on
64bit cpus.

Since I want to reuse the multiboot specs for 64bit as much as possible
I would like to change the code like this:

typedef unsigned int   u32;

typedef struct multiboot_header
{
  u32 magic;
  u32 flags;
  u32 checksum;
...

I would also like to expand the multiboot.h file to cover the full specs
and #define all the bits and masks and not just those used in the
example. Basically join the stage2/mb_header.h and stage2/mb_info.h (and
replace 'unsigned *' types with 'u*'). That way the multiboot.h would be
better reusable for people implementing their own multiboot compliant
bootloader or kernel.

Would a change like that be acceptable? If so I could provide patches
for further review. Otherwise I won't bother and just make my own
multiboot.h file.


Also would you be interested in the 32->64bit trampoline and 64bit
example kernel for inclusion in grub?

The trampoline is based on the example kernel with a few lines added to
boot.S and kernel.c to jump to 64bit mode and call the 64bit entry
point. The 64bit kernel needs some changes to kernel.c (varargs for
printf), which I think can be made to work for 32bit and 64bit, and a
boot64.S similar to boot.S but rewritten for 64bit.

What I propose would be to have boot.S, boot64.S and kernel.c with some
#ifdef lines to switch between 32bit kernel, 32bit->64bit trampoline and
64bit kernel mode.

MfG
        Goswin

PS: It is still work-in-progress but I can already execute the 64bit
kernel and everything works but printf (varargs issue I believe).


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

end of thread, other threads:[~2011-04-18 19:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-07 12:09 Would a cleanup+extending of docs/multiboot.h be acceptable? Goswin von Brederlow
2011-04-07 12:56 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-07 14:50   ` Goswin von Brederlow
2011-04-07 14:57     ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-07 17:32       ` Goswin von Brederlow
2011-04-07 17:50         ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-08 14:43           ` Goswin von Brederlow
2011-04-08 14:53             ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-08 17:18               ` Goswin von Brederlow
2011-04-18 19:49               ` Goswin von Brederlow

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.