diff options
author | Luca Dariz <luca.dariz@gmail.com> | 2022-02-05 18:51:25 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-27 20:32:01 +0200 |
commit | 6c3c3c7a2e633e4dedd1701e6e2134f223b38574 (patch) | |
tree | 26096c259ae6de6c6bdd2b003cd7f97f67f8104b /i386 | |
parent | c442d1a656e16d12cefe2d3e9b57f764ca4bc755 (diff) | |
download | gnumach-6c3c3c7a2e633e4dedd1701e6e2134f223b38574.tar.gz gnumach-6c3c3c7a2e633e4dedd1701e6e2134f223b38574.tar.bz2 gnumach-6c3c3c7a2e633e4dedd1701e6e2134f223b38574.zip |
cleanup multiboot
* use _raw_ structs where we refer to the bootloader-provided data
* remove unused structures
* fix 64 bit boot
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-3-luca@orpolo.org>
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386at/model_dep.c | 23 | ||||
-rw-r--r-- | i386/include/mach/i386/multiboot.h | 110 |
2 files changed, 14 insertions, 119 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index e3a56dba..105aedb2 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -122,7 +122,7 @@ unsigned long *pfn_list = (void*) PFN_LIST; unsigned long la_shift = VM_MIN_KERNEL_ADDRESS; #endif #else /* MACH_XEN */ -struct multiboot_info boot_info; +struct multiboot_raw_info boot_info; #endif /* MACH_XEN */ /* Command line supplied to kernel. */ @@ -403,7 +403,7 @@ i386at_init(void) } if (boot_info.flags & MULTIBOOT_MODS && boot_info.mods_count) { - struct multiboot_module *m; + struct multiboot_raw_module *m; int i; if (! init_alloc_aligned( @@ -591,13 +591,14 @@ void c_boot_entry(vm_offset_t bi) * so that the symbol table's memory won't be stomped on. */ if ((boot_info.flags & MULTIBOOT_AOUT_SYMS) - && boot_info.syms.a.addr) + && boot_info.shdr_addr) { vm_size_t symtab_size, strtab_size; - kern_sym_start = (vm_offset_t)phystokv(boot_info.syms.a.addr); - symtab_size = (vm_offset_t)phystokv(boot_info.syms.a.tabsize); - strtab_size = (vm_offset_t)phystokv(boot_info.syms.a.strsize); + /* For simplicity we just use a simple boot_info_raw structure for elf */ + kern_sym_start = (vm_offset_t)phystokv(boot_info.shdr_addr); + symtab_size = (vm_offset_t)phystokv(boot_info.shdr_num); + strtab_size = (vm_offset_t)phystokv(boot_info.shdr_size); kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size; printf("kernel symbol table at %08lx-%08lx (%ld,%ld)\n", @@ -606,12 +607,12 @@ void c_boot_entry(vm_offset_t bi) } if ((boot_info.flags & MULTIBOOT_ELF_SHDR) - && boot_info.syms.e.num) + && boot_info.shdr_num) { - elf_shdr_num = boot_info.syms.e.num; - elf_shdr_size = boot_info.syms.e.size; - elf_shdr_addr = (vm_offset_t)phystokv(boot_info.syms.e.addr); - elf_shdr_shndx = boot_info.syms.e.shndx; + elf_shdr_num = boot_info.shdr_num; + elf_shdr_size = boot_info.shdr_size; + elf_shdr_addr = (vm_offset_t)phystokv(boot_info.shdr_addr); + elf_shdr_shndx = boot_info.shdr_strndx; printf("ELF section header table at %08lx\n", elf_shdr_addr); } diff --git a/i386/include/mach/i386/multiboot.h b/i386/include/mach/i386/multiboot.h index 5a532576..c3538c1f 100644 --- a/i386/include/mach/i386/multiboot.h +++ b/i386/include/mach/i386/multiboot.h @@ -25,31 +25,6 @@ #include <mach/machine/vm_types.h> -/* For a.out kernel boot images, the following header must appear - somewhere in the first 8192 bytes of the kernel image file. */ -struct multiboot_header -{ - /* Must be MULTIBOOT_MAGIC */ - unsigned magic; - - /* Feature flags - see below. */ - unsigned flags; - - /* - * Checksum - * - * The above fields plus this one must equal 0 mod 2^32. - */ - unsigned checksum; - - /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */ - vm_offset_t header_addr; - vm_offset_t load_addr; - vm_offset_t load_end_addr; - vm_offset_t bss_end_addr; - vm_offset_t entry; -}; - /* The entire multiboot_header must be contained within the first MULTIBOOT_SEARCH bytes of the kernel image. */ #define MULTIBOOT_SEARCH 8192 @@ -65,7 +40,7 @@ struct multiboot_header /* Align all boot modules on page (4KB) boundaries. */ #define MULTIBOOT_PAGE_ALIGN 0x00000001 -/* Must be provided memory information in multiboot_info structure */ +/* Must be provided memory information in multiboot_raw_info structure */ #define MULTIBOOT_MEMORY_INFO 0x00000002 /* Use the load address fields above instead of the ones in the a.out header @@ -78,61 +53,7 @@ struct multiboot_header that the multiboot method is being used */ #define MULTIBOOT_VALID 0x2badb002 -/* The boot loader passes this data structure to the kernel in - register EBX on entry. */ -struct multiboot_info -{ - /* These flags indicate which parts of the multiboot_info are valid; - see below for the actual flag bit definitions. */ - unsigned flags; - - /* Lower/Upper memory installed in the machine. - Valid only if MULTIBOOT_MEMORY is set in flags word above. */ - vm_size_t mem_lower; - vm_size_t mem_upper; - - /* BIOS disk device the kernel was loaded from. - Valid only if MULTIBOOT_BOOT_DEVICE is set in flags word above. */ - unsigned char boot_device[4]; - - /* Command-line for the OS kernel: a null-terminated ASCII string. - Valid only if MULTIBOOT_CMDLINE is set in flags word above. */ - vm_offset_t cmdline; - - /* List of boot modules loaded with the kernel. - Valid only if MULTIBOOT_MODS is set in flags word above. */ - unsigned mods_count; - vm_offset_t mods_addr; - - /* Symbol information for a.out or ELF executables. */ - union - { - struct - { - /* a.out symbol information valid only if MULTIBOOT_AOUT_SYMS - is set in flags word above. */ - vm_size_t tabsize; - vm_size_t strsize; - vm_offset_t addr; - unsigned reserved; - } a; - - struct - { - /* ELF section header information valid only if - MULTIBOOT_ELF_SHDR is set in flags word above. */ - unsigned num; - vm_size_t size; - vm_offset_t addr; - unsigned shndx; - } e; - } syms; - - /* Memory map buffer. - Valid only if MULTIBOOT_MEM_MAP is set in flags word above. */ - vm_size_t mmap_count; - vm_offset_t mmap_addr; -}; + #define MULTIBOOT_MEMORY 0x00000001 #define MULTIBOOT_BOOT_DEVICE 0x00000002 @@ -175,33 +96,6 @@ struct multiboot32_module }; #endif - -/* The mmap_addr field above contains the physical address of the first - of the AddrRangeDesc structure. "size" represents the size of the - rest of the structure and optional padding. The offset to the beginning - of the next structure is therefore "size + 4". */ -struct AddrRangeDesc -{ - unsigned long size; - unsigned long BaseAddrLow; - unsigned long BaseAddrHigh; - unsigned long LengthLow; - unsigned long LengthHigh; - unsigned long Type; - - /* unspecified optional padding... */ -}; - -struct multiboot_mmap -{ - unsigned long size; - unsigned long long BaseAddr; - unsigned long long Length; - unsigned long Type; - - /* unspecified optional padding... */ -}; - /* usable memory "Type", all others are reserved. */ #define MB_ARD_MEMORY 1 |