ia64/xen-unstable
changeset 12833:1c15f97a220d
[XEN] Make multiboot-related code more readable.
Tested on i386 and x86_64 with GRUB and PXELINUX bootmanagers.
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Tested on i386 and x86_64 with GRUB and PXELINUX bootmanagers.
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Thu Dec 07 11:22:26 2006 +0000 (2006-12-07) |
parents | 44319e9dc0c5 |
children | 2dd4569e0640 |
files | xen/arch/x86/boot/x86_32.S xen/arch/x86/boot/x86_64.S xen/include/xen/multiboot.h |
line diff
1.1 --- a/xen/arch/x86/boot/x86_32.S Thu Dec 07 11:18:38 2006 +0000 1.2 +++ b/xen/arch/x86/boot/x86_32.S Thu Dec 07 11:22:26 2006 +0000 1.3 @@ -1,4 +1,5 @@ 1.4 #include <xen/config.h> 1.5 +#include <xen/multiboot.h> 1.6 #include <public/xen.h> 1.7 #include <asm/asm_defns.h> 1.8 #include <asm/desc.h> 1.9 @@ -17,12 +18,14 @@ ENTRY(_stext) 1.10 .align 4 1.11 1.12 /*** MULTIBOOT HEADER ****/ 1.13 +#define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ 1.14 + MULTIBOOT_HEADER_WANT_MEMORY) 1.15 /* Magic number indicating a Multiboot header. */ 1.16 - .long 0x1BADB002 1.17 + .long MULTIBOOT_HEADER_MAGIC 1.18 /* Flags to bootloader (see Multiboot spec). */ 1.19 - .long 0x00000003 1.20 + .long MULTIBOOT_HEADER_FLAGS 1.21 /* Checksum: must be the negated sum of the first two fields. */ 1.22 - .long -0x1BADB005 1.23 + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) 1.24 1.25 not_multiboot_msg: 1.26 .asciz "ERR: Not a Multiboot bootloader!"
2.1 --- a/xen/arch/x86/boot/x86_64.S Thu Dec 07 11:18:38 2006 +0000 2.2 +++ b/xen/arch/x86/boot/x86_64.S Thu Dec 07 11:22:26 2006 +0000 2.3 @@ -1,4 +1,5 @@ 2.4 #include <xen/config.h> 2.5 +#include <xen/multiboot.h> 2.6 #include <public/xen.h> 2.7 #include <asm/asm_defns.h> 2.8 #include <asm/desc.h> 2.9 @@ -19,12 +20,14 @@ ENTRY(_stext) 2.10 2.11 .org 0x004 2.12 /*** MULTIBOOT HEADER ****/ 2.13 +#define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ 2.14 + MULTIBOOT_HEADER_WANT_MEMORY) 2.15 /* Magic number indicating a Multiboot header. */ 2.16 - .long 0x1BADB002 2.17 + .long MULTIBOOT_HEADER_MAGIC 2.18 /* Flags to bootloader (see Multiboot spec). */ 2.19 - .long 0x00000003 2.20 + .long MULTIBOOT_HEADER_FLAGS 2.21 /* Checksum: must be the negated sum of the first two fields. */ 2.22 - .long -0x1BADB005 2.23 + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) 2.24 2.25 .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!" 2.26 .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!"
3.1 --- a/xen/include/xen/multiboot.h Thu Dec 07 11:18:38 2006 +0000 3.2 +++ b/xen/include/xen/multiboot.h Thu Dec 07 11:22:26 2006 +0000 3.3 @@ -18,16 +18,30 @@ 3.4 #ifndef __MULTIBOOT_H__ 3.5 #define __MULTIBOOT_H__ 3.6 3.7 + 3.8 +/* 3.9 + * Multiboot header structure. 3.10 + */ 3.11 +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 3.12 +#define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001 3.13 +#define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002 3.14 +#define MULTIBOOT_HEADER_HAS_VBE 0x00000004 3.15 +#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000 3.16 + 3.17 /* The magic number passed by a Multiboot-compliant boot loader. */ 3.18 -#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 3.19 +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 3.20 3.21 #define MBI_MEMLIMITS (1<<0) 3.22 #define MBI_DRIVES (1<<1) 3.23 #define MBI_CMDLINE (1<<2) 3.24 #define MBI_MODULES (1<<3) 3.25 +#define MBI_AOUT_SYMS (1<<4) 3.26 +#define MBI_ELF_SYMS (1<<5) 3.27 #define MBI_MEMMAP (1<<6) 3.28 #define MBI_LOADERNAME (1<<9) 3.29 3.30 +#ifndef __ASSEMBLY__ 3.31 + 3.32 /* The symbol table for a.out. */ 3.33 typedef struct { 3.34 u32 tabsize; 3.35 @@ -47,16 +61,28 @@ typedef struct { 3.36 /* The Multiboot information. */ 3.37 typedef struct { 3.38 u32 flags; 3.39 + 3.40 + /* Valid if flags sets MBI_MEMLIMITS */ 3.41 u32 mem_lower; 3.42 u32 mem_upper; 3.43 + 3.44 + /* Valid if flags sets MBI_DRIVES */ 3.45 u32 boot_device; 3.46 + 3.47 + /* Valid if flags sets MBI_CMDLINE */ 3.48 u32 cmdline; 3.49 + 3.50 + /* Valid if flags sets MBI_MODULES */ 3.51 u32 mods_count; 3.52 u32 mods_addr; 3.53 + 3.54 + /* Valid if flags sets ... */ 3.55 union { 3.56 - aout_symbol_table_t aout_sym; 3.57 - elf_section_header_table_t elf_sec; 3.58 + aout_symbol_table_t aout_sym; /* ... MBI_AOUT_SYMS */ 3.59 + elf_section_header_table_t elf_sec; /* ... MBI_ELF_SYMS */ 3.60 } u; 3.61 + 3.62 + /* Valid if flags sets MBI_MEMMAP */ 3.63 u32 mmap_length; 3.64 u32 mmap_addr; 3.65 } multiboot_info_t; 3.66 @@ -80,4 +106,7 @@ typedef struct { 3.67 u32 type; 3.68 } memory_map_t; 3.69 3.70 + 3.71 +#endif /* __ASSEMBLY__ */ 3.72 + 3.73 #endif /* __MULTIBOOT_H__ */