[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Would a cleanup+extending of docs/multiboot.h be acceptable?
From: |
Goswin von Brederlow |
Subject: |
Would a cleanup+extending of docs/multiboot.h be acceptable? |
Date: |
Thu, 07 Apr 2011 14:09:50 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) |
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).
- Would a cleanup+extending of docs/multiboot.h be acceptable?,
Goswin von Brederlow <=
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Vladimir 'φ-coder/phcoder' Serbinenko, 2011/04/07
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Goswin von Brederlow, 2011/04/07
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Vladimir 'φ-coder/phcoder' Serbinenko, 2011/04/07
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Goswin von Brederlow, 2011/04/07
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Vladimir 'φ-coder/phcoder' Serbinenko, 2011/04/07
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Goswin von Brederlow, 2011/04/08
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Vladimir 'φ-coder/phcoder' Serbinenko, 2011/04/08
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Goswin von Brederlow, 2011/04/08
- Re: Would a cleanup+extending of docs/multiboot.h be acceptable?, Goswin von Brederlow, 2011/04/18