From: Goswin von Brederlow <goswin-v-b@web.de>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Would a cleanup+extending of docs/multiboot.h be acceptable?
Date: Thu, 07 Apr 2011 14:09:50 +0200 [thread overview]
Message-ID: <87r59efek1.fsf@frosties.localnet> (raw)
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).
next reply other threads:[~2011-04-07 12:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 12:09 Goswin von Brederlow [this message]
2011-04-07 12:56 ` Would a cleanup+extending of docs/multiboot.h be acceptable? 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r59efek1.fsf@frosties.localnet \
--to=goswin-v-b@web.de \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.