Tagged mbi
RFC 1/1 Tagged mbi
Hello. Currently mbi contains a lot of pointers and substructures. It's has various problems like:
-Unused fields occupy space if any subsequent fields is used. -Difficult to relocate since it may be spilled all over the memory -It's unstraightforward to e.g. specify 2 framebuffers
I propose to use tagged MBI. I attach proposed patch for multiboot and grub2. Patch for grub2 is based on my efiboot branch
The patched branches are available under people/phcoder/mbtag-spec and people/phcoder/taggedmbi.
The parts for which I haven't defined tagged equivalent yet:
-Symbols
-ROM information table
-Drives table
-APM table
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
=== modified file 'include/grub/i386/multiboot.h'
grub/i386/multiboot.h +3 -0
@@ -39,4 +39,7 @@void grub_multiboot_set_bootdev (void );void grub_multiboot_set_accepts_video (int val); +void grub_multiboot_set_tagged (int val); +int grub_multiboot_get_tagged (void ); +#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
=== modified file 'include/multiboot.h'
multiboot.h +115 -1
135 lines not on this page · raw message
=== modified file 'loader/i386/multiboot.c'
i386/multiboot.c +8 -1
@@ -62,7 +62,6 @@grub_err_t err;struct grub_relocator32_state state = { - .eax =MULTIBOOT_BOOTLOADER_MAGIC , .ecx =0 , .edx =0 , .eip = grub_multiboot_payload_eip,
@@ -71,6 +70,11 @@ .esp = 0x7ff00 }; +if (grub_multiboot_get_tagged ()) + state.eax =MULTIBOOT_BOOTLOADER_MAGIC_TAGGED ; +else + state.eax =MULTIBOOT_BOOTLOADER_MAGIC ; + mbi_size =grub_multiboot_get_mbi_size ();if (alloc_mbi < mbi_size) {
@@ -197,6 +201,9 @@/* Skip filename. */ grub_multiboot_init_mbi (argc -1 , argv +1 ); +if (header->flags &MULTIBOOT_TAGGED_MBI ) +grub_multiboot_set_tagged (1 ); +if (header->flags &MULTIBOOT_AOUT_KLUDGE ) { int offset = ((char *) header - buffer -
=== modified file 'loader/i386/multiboot_mbi.c'
i386/multiboot_mbi.c +304 -36
431 lines not on this page · raw message
=== modified file 'doc/boot.S'
boot.S +2 -2
@@ -30,9 +30,9 @@ /* The flags for the Multiboot header. */ #ifdef __ELF__ -# define MULTIBOOT_HEADER_FLAGS 0x00000007 +# define MULTIBOOT_HEADER_FLAGS 0x0000000f #else -# define MULTIBOOT_HEADER_FLAGS 0x00010007 +# define MULTIBOOT_HEADER_FLAGS 0x0001000f #endif .text
=== modified file 'doc/kernel.c'
kernel.c +153 -0
165 lines not on this page · raw message
=== modified file 'doc/multiboot.h'
multiboot.h +123 -1
143 lines not on this page · raw message
=== modified file 'doc/multiboot.texi'
multiboot.texi +174 -8
291 lines not on this page · raw message
Review
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Hello. Currently mbi contains a lot of pointers and substructures. It's has various problems like:
(quoted diff) +0
-3-Unused fields occupy space if any subsequent fields is used. -Difficult to relocate since it may be spilled all over the memory -It's unstraightforward to e.g. specify 2 framebuffers
Seems like there's a problem indeed.
Quoted 1 line
I propose to use tagged MBI.
Can you provide a short explanation on this proposed solution? You explained the problem, but not the solution.
Signature · 3 lines
Robert Millan "Be the change you want to see in the world" -- Gandhi
Multiboot 2 branch (Re: [RFC] Tagged mbi)
In reply to Vladimir 'φ-coder/phcoder' Serbinenkomultiboot.h line 35
Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko
multiboot.h +2
-0@@ -31,8 +31,11 @@/* This should be in %eax. */ #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 +/* This should be in %eax. */ +#define MULTIBOOT_BOOTLOADER_MAGIC_TAGGED 0x3BADB002
I created a branch for backward-incompatible changes, it's in /branches/multiboot2.
This does NOT mean that backward-incompatible changes are postponed. The draft in /branches/multiboot2 is already implemented in latest GRUB trunk. Further changes to this draft can be implemented in GRUB inmediately.
So the workflow is basically:
- Non-incompatible ammendments can go in /trunk/multiboot.
- Incompatible ammendments can go in /branches/multiboot2. This branch can (and should) be periodically resynced with /trunk/multiboot.
- In both cases, ammendments should be accompanied by changes to the example kernel (when this makes sense, of course).
- The master copies of multiboot.h and multiboot2.h are in those respective branches. GRUB shouldn't need to diverge from them, as all the GRUB-specific declarations are split in <grub/*> namespace already.
Signature · 3 lines
Robert Millan "Be the change you want to see in the world" -- Gandhi
Quoted 12 lines · Robert Millan
Review
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Hello. Currently mbi contains a lot of pointers and substructures. It's has various problems like:
(quoted diff) +0
-3-Unused fields occupy space if any subsequent fields is used. -Difficult to relocate since it may be spilled all over the memory -It's unstraightforward to e.g. specify 2 framebuffersSeems like there's a problem indeed.
Quoted 7 lines
Quoted 2 lines
I propose to use tagged MBI.
Can you provide a short explanation on this proposed solution? You explained the problem, but not the solution.
The solution is to have so called tags. Tag is a structure which begins with fields "size" and "type" and the rest of the content is determined by these 2 fields. Tags follow each other and the end of structure is a predefined tag. This way it's easy to skip unknown tags because of size field, easy to relocate because mbi is in a contiguous chunk of memory. Same type of tag may appear multiple times declaring e.g. 2 framebuffers. Details are in spec patch
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko