[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] Make multiboot-related code more readable.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID 1c15f97a220d2f526bbd21b165e464229fee5337 # Parent 44319e9dc0c527fea544ca1c9b55027de7e26ecd [XEN] Make multiboot-related code more readable. Tested on i386 and x86_64 with GRUB and PXELINUX bootmanagers. From: Christoph Egger <Christoph.Egger@xxxxxxx> Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/arch/x86/boot/x86_32.S | 9 ++++++--- xen/arch/x86/boot/x86_64.S | 9 ++++++--- xen/include/xen/multiboot.h | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 9 deletions(-) diff -r 44319e9dc0c5 -r 1c15f97a220d xen/arch/x86/boot/x86_32.S --- a/xen/arch/x86/boot/x86_32.S Thu Dec 07 11:18:38 2006 +0000 +++ b/xen/arch/x86/boot/x86_32.S Thu Dec 07 11:22:26 2006 +0000 @@ -1,4 +1,5 @@ #include <xen/config.h> +#include <xen/multiboot.h> #include <public/xen.h> #include <asm/asm_defns.h> #include <asm/desc.h> @@ -17,12 +18,14 @@ ENTRY(_stext) .align 4 /*** MULTIBOOT HEADER ****/ +#define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ + MULTIBOOT_HEADER_WANT_MEMORY) /* Magic number indicating a Multiboot header. */ - .long 0x1BADB002 + .long MULTIBOOT_HEADER_MAGIC /* Flags to bootloader (see Multiboot spec). */ - .long 0x00000003 + .long MULTIBOOT_HEADER_FLAGS /* Checksum: must be the negated sum of the first two fields. */ - .long -0x1BADB005 + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) not_multiboot_msg: .asciz "ERR: Not a Multiboot bootloader!" diff -r 44319e9dc0c5 -r 1c15f97a220d xen/arch/x86/boot/x86_64.S --- a/xen/arch/x86/boot/x86_64.S Thu Dec 07 11:18:38 2006 +0000 +++ b/xen/arch/x86/boot/x86_64.S Thu Dec 07 11:22:26 2006 +0000 @@ -1,4 +1,5 @@ #include <xen/config.h> +#include <xen/multiboot.h> #include <public/xen.h> #include <asm/asm_defns.h> #include <asm/desc.h> @@ -19,12 +20,14 @@ ENTRY(_stext) .org 0x004 /*** MULTIBOOT HEADER ****/ +#define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ + MULTIBOOT_HEADER_WANT_MEMORY) /* Magic number indicating a Multiboot header. */ - .long 0x1BADB002 + .long MULTIBOOT_HEADER_MAGIC /* Flags to bootloader (see Multiboot spec). */ - .long 0x00000003 + .long MULTIBOOT_HEADER_FLAGS /* Checksum: must be the negated sum of the first two fields. */ - .long -0x1BADB005 + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!" .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!" diff -r 44319e9dc0c5 -r 1c15f97a220d xen/include/xen/multiboot.h --- a/xen/include/xen/multiboot.h Thu Dec 07 11:18:38 2006 +0000 +++ b/xen/include/xen/multiboot.h Thu Dec 07 11:22:26 2006 +0000 @@ -18,15 +18,29 @@ #ifndef __MULTIBOOT_H__ #define __MULTIBOOT_H__ + +/* + * Multiboot header structure. + */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 +#define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001 +#define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002 +#define MULTIBOOT_HEADER_HAS_VBE 0x00000004 +#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000 + /* The magic number passed by a Multiboot-compliant boot loader. */ -#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 #define MBI_MEMLIMITS (1<<0) #define MBI_DRIVES (1<<1) #define MBI_CMDLINE (1<<2) #define MBI_MODULES (1<<3) +#define MBI_AOUT_SYMS (1<<4) +#define MBI_ELF_SYMS (1<<5) #define MBI_MEMMAP (1<<6) #define MBI_LOADERNAME (1<<9) + +#ifndef __ASSEMBLY__ /* The symbol table for a.out. */ typedef struct { @@ -47,16 +61,28 @@ typedef struct { /* The Multiboot information. */ typedef struct { u32 flags; + + /* Valid if flags sets MBI_MEMLIMITS */ u32 mem_lower; u32 mem_upper; + + /* Valid if flags sets MBI_DRIVES */ u32 boot_device; + + /* Valid if flags sets MBI_CMDLINE */ u32 cmdline; + + /* Valid if flags sets MBI_MODULES */ u32 mods_count; u32 mods_addr; + + /* Valid if flags sets ... */ union { - aout_symbol_table_t aout_sym; - elf_section_header_table_t elf_sec; + aout_symbol_table_t aout_sym; /* ... MBI_AOUT_SYMS */ + elf_section_header_table_t elf_sec; /* ... MBI_ELF_SYMS */ } u; + + /* Valid if flags sets MBI_MEMMAP */ u32 mmap_length; u32 mmap_addr; } multiboot_info_t; @@ -80,4 +106,7 @@ typedef struct { u32 type; } memory_map_t; + +#endif /* __ASSEMBLY__ */ + #endif /* __MULTIBOOT_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |