Tagged mbi
Here is tagged mbi proposal rebased for multiboot2. I defined begining of tag buffer as starting with total mbi size to make relocation and memory mapping trivial.
Current problems:
- I haven't migrated the a.out (as oppose to multiboot kludge) symbols, drives table and ROM configuration table. I'm not familiar with these fields. What are they used for?
-Memory usage. Additionally to the space occupied by payload multiboot specification uses memory for mbi, ELF sections and modules. Moving all this information around without overwriting may be a difficult task. Possible alternatives:
- Put modules and sections in mbi. But then one-chunk mbi may not find
enough available space in the memory
- Add a map of memory used by multiboot separately from memory map. I
don't think it's worth it since this information is easily available by
traversing mbi anyway.
- Add requirements on position of modules. It actually just moves
complexity from payload to bootloader. (for grub I wrote newreloc layer for such requirements present in different protocols, it's currently in late alpha, available at people/phcoder/newreloc)
- Leave it as is and propose some code to do moving mbi around sanely
under non-copyleft license.
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
=== added file 'ChangeLog.tag'
ChangeLog.tag +40 -0
@@ -0,0 +1,40 @@ +2010-01-16 Vladimir Serbinenko <[email protected]> + + Multiboot2 tag support + + * conf/i386.rmk (multiboot2_mod_SOURCES): Replace + loader/i386/multiboot_mbi.c with loader/i386/multiboot_mbi2.c. + * include/grub/i386/multiboot.h (grub_multiboot_real_boot): Removed. + (grub_multiboot2_real_boot): Likewise. + * include/grub/multiboot.h (grub_multiboot_set_accepts_video): Removed. + (grub_get_multiboot_mmap_len): New proto. + (grub_fill_multiboot_mmap): Likewise. + (grub_multiboot_set_video_mode): Likewise. + (grub_multiboot_fill_vbe_info_real): Likewise. + * include/multiboot2.h: Resynced with specification. + * loader/i386/multiboot_mbi.c (DEFAULT_VIDEO_MODE): Moved from here... + * loader/i386/multiboot.c (DEFAULT_VIDEO_MODE): ... here. + * loader/i386/multiboot_mbi.c (HAS_VGA_TEXT): Moved from here .. + * include/grub/multiboot.h (GRUB_MACHINE_HAS_VGA_TEXT): ... here. All + users updated. + * loader/i386/multiboot_mbi.c (HAS_VBE): Moved from here .. + * include/grub/multiboot.h (GRUB_MACHINE_HAS_VBE): ... here. All + users updated. + * loader/i386/multiboot_mbi.c (accepts_video): Moved from here... + * loader/i386/multiboot.c (accepts_video): ... here. All users updated. + * loader/i386/multiboot_mbi.c (grub_multiboot_set_accepts_video): + Removed. + * loader/i386/multiboot_mbi.c (grub_get_multiboot_mmap_len): + Moved from here... + * loader/i386/multiboot.c (grub_get_multiboot_mmap_len): ... here. + * loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap): + Moved from here... + * loader/i386/multiboot.c (grub_fill_multiboot_mmap): ... here. + * loader/i386/multiboot_mbi.c (set_video_mode): Moved from here... + * loader/i386/multiboot.c (grub_multiboot_set_video_mode): ... here. + All users updated. + * loader/i386/multiboot_mbi.c (fill_vbe_info): Moved generic parts + from here... + * loader/i386/multiboot.c (grub_multiboot_fill_vbe_info_real): ... here. + All users updated. + * loader/i386/multiboot_mbi2.c: New file.
=== modified file 'conf/i386.rmk'
i386.rmk +1 -1
@@ -36,7 +36,7 @@ pkglib_MODULES += multiboot2.mod multiboot2_mod_SOURCES = loader/i386/multiboot.c \ - loader/i386/multiboot_mbi.c \ + loader/i386/multiboot_mbi2.c \ loader/multiboot_loader.c multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2 multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
=== modified file 'include/grub/i386/multiboot.h'
grub/i386/multiboot.h +0 -8
@@ -19,14 +19,6 @@#ifndef GRUB_MULTIBOOT_CPU_HEADER #define GRUB_MULTIBOOT_CPU_HEADER 1 -/* The asm part of the multiboot loader. */ -void grub_multiboot_real_boot (grub_addr_t entry, -struct multiboot_info *mbi) - __attribute__ ((noreturn)); -void grub_multiboot2_real_boot (grub_addr_t entry, -struct multiboot_info *mbi) - __attribute__ ((noreturn)); -extern grub_uint32_t grub_multiboot_payload_eip;extern char *grub_multiboot_payload_orig;extern grub_addr_t grub_multiboot_payload_dest;
=== modified file 'include/grub/multiboot.h'
grub/multiboot.h +19 -2
@@ -35,8 +35,6 @@void grub_multiboot (int argc,char *argv[]);void grub_module (int argc,char *argv[]); -void grub_multiboot_set_accepts_video (int val); -grub_size_t grub_multiboot_get_mbi_size (void );grub_err_t grub_multiboot_make_mbi (void *orig,grub_uint32_t dest,grub_off_t buf_off,grub_size_t bufsize);
@@ -46,5 +44,24 @@ int argc, char *argv[]);void grub_multiboot_set_bootdev (void ); +grub_uint32_t grub_get_multiboot_mmap_len (void ); +void grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry); +grub_err_t grub_multiboot_set_video_mode (void ); + +#if defined (GRUB_MACHINE_PCBIOS ) || defined (GRUB_MACHINE_COREBOOT ) || defined (GRUB_MACHINE_QEMU ) +#include <grub/i386/pc/vbe.h> +grub_err_t +grub_multiboot_fill_vbe_info_real (struct grub_vbe_info_block *vbe_control_info, +struct grub_vbe_mode_info_block *vbe_mode_info, +multiboot_uint16_t *vbe_mode, +multiboot_uint16_t *vbe_interface_seg, +multiboot_uint16_t *vbe_interface_off, +multiboot_uint16_t *vbe_interface_len); +#define GRUB_MACHINE_HAS_VBE 1 +#define GRUB_MACHINE_HAS_VGA_TEXT 1 +#else +#define GRUB_MACHINE_HAS_VBE 0 +#define GRUB_MACHINE_HAS_VGA_TEXT 0 +#endif #endif /* ! GRUB_MULTIBOOT_HEADER */
=== modified file 'include/multiboot2.h'
multiboot2.h +102 -133
271 lines not on this page · raw message
=== modified file 'loader/i386/multiboot.c'
i386/multiboot.c +137 -1
161 lines not on this page · raw message
=== modified file 'loader/i386/multiboot_mbi.c'
i386/multiboot_mbi.c +53 -162
284 lines not on this page · raw message
=== added file 'loader/i386/multiboot_mbi2.c'
i386/multiboot_mbi2.c +476 -0
476 lines not on this page · raw message
=== modified file 'doc/kernel.c'
kernel.c +146 -170
341 lines not on this page · raw message
=== modified file 'doc/multiboot.texi'
multiboot.texi +210 -271
590 lines not on this page · raw message
=== modified file 'doc/multiboot2.h'
multiboot2.h +124 -131
299 lines not on this page · raw message