multiboot.c revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* Support for Multiboot */
#include <etherboot.h>
#include <lib.h>
#include <sys_info.h>
#define DEBUG_THIS DEBUG_MULTIBOOT
#include <debug.h>
/* Multiboot header, gives information to loader */
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_FLAGS 0x00000003
struct mbheader {
};
const struct mbheader multiboot_header
{
};
/* Multiboot information structure, provided by loader to us */
struct multiboot_mmap {
unsigned entry_size;
unsigned type;
};
struct multiboot_info {
unsigned flags;
#define MULTIBOOT_MEM_VALID 0x01
#define MULTIBOOT_BOOT_DEV_VALID 0x02
#define MULTIBOOT_CMDLINE_VALID 0x04
#define MULTIBOOT_MODS_VALID 0x08
#define MULTIBOOT_AOUT_SYMS_VALID 0x10
#define MULTIBOOT_ELF_SYMS_VALID 0x20
#define MULTIBOOT_MMAP_VALID 0x40
unsigned mem_lower;
unsigned mem_upper;
unsigned char boot_device[4];
unsigned command_line;
unsigned mods_count;
unsigned mods_addr;
unsigned syms_num;
unsigned syms_size;
unsigned syms_addr;
unsigned syms_shndx;
unsigned mmap_length;
unsigned mmap_addr;
};
{
struct multiboot_info *mbinfo;
struct multiboot_mmap *mbmem;
int i;
int mmap_count;
return;
/* convert mmap records */
mmap_count = 0;
for (i = 0; i < mbcount; i++) {
debug("%08x%08x %08x%08x (%d)\n",
mmap_count++;
}
break;
}
/* simple sanity check - there should be at least 2 RAM segments
* (base 640k and extended) */
if (mmap_count >= 2)
goto got_it;
printf("Multiboot mmap is broken\n");
}
/* use mem_lower and mem_upper */
mmap_count = 2;
goto got_it;
}
printf("Can't get memory information from Multiboot\n");
return;
return;
}