/* The following value must be present in the EAX register. */
#define	MULTIBOOT_VALID	0x2BADB002

typedef unsigned short	uint16_t;
typedef unsigned long	uint32_t;

/* This structure must appear within the first 8K of the kernel file,
on a 4-byte boundary */
struct multiboot_header {
	uint32_t magic;		/* magic = MULTIBOOT_MAGIC = 0x1BADB002 */
	uint32_t flags;
	uint32_t checksum;	/* magic+flags+checksum = 0 */
/* a.out kludge ("address fields")
these are valid only if (magic & 0x10000)	(MULTIBOOT_AOUT_KLUDGE) */
	uint32_t header_addr;	/* phys adr of Multiboot header */
	uint32_t load_addr;	/* phys adr of .text */
	uint32_t load_end_addr;	/* phys adr of .bss */
	uint32_t bss_end_addr;	/* phys adr of end */
	uint32_t entry_addr;	/* phys adr of entry point */
/* these are valid only if (magic & 0x00004)	(MULTIBOOT_VIDEO_MODE) */
	uint32_t mode_type;
	uint32_t width;
	uint32_t height;
	uint32_t depth;
};

file sections for a.out kludge
section:	text-and-data			BSS
phys adr:	.load_addr			.load_end_addr
size:		.load_end_addr - .load_addr	.bss_end_addr - .load_end_addr
file offset:	N + .load_addr - .header_addr	n/a
(where N=file offset of multiboot_header)


struct multiboot_info {
	uint32_t flags;
/* conventional and extended memory sizes, in K
valid only if (flags & 0x0001)	(MB_INFO_MEMORY) */
	uint32_t mem_lower;
	uint32_t mem_upper;
/* valid only if (flags & 0x0002)	(MB_INFO_BOOTDEV) */
	uint32_t boot_device;
/* valid only if (flags & 0x0004)	(MB_INFO_CMDLINE) */
	uint32_t cmdline;
/* boot modules
valid only if (flags & 0x0008)		(MB_INFO_MODS) */
	uint32_t mods_count;
	uint32_t mods_addr;
	union {
		struct {
/* a.out symbol table
valid only if (flags & 0x0010)		(MB_INFO_AOUT_SYMS)*/
			uint32_t tabsize;
			uint32_t strsize;
			uint32_t addr;
			uint32_t pad;
		} a;
		struct {
/* ELF section header table
valid only if (flags & 0x0020)		(MB_INFO_ELF_SHDR) */
			uint32_t num;
			uint32_t size;
			uint32_t addr;
			uint32_t shndx;
		} e;
	} syms;
/* detailed map of memory ranges
valid only if (flags & 0x0040)		(MB_INFO_MEM_MAP) */
	uint32_t mmap_length;
	uint32_t mmap_addr;
/* drive Info
valid only if (flags & 0x0080)		(MB_INFO_DRIVE_INFO) */
	uint32_t drives_length;
	uint32_t drives_addr;
/* ROM configuration table
valid only if (flags & 0x0100)		(MB_INFO_CONFIG_TABLE) */
	uint32_t config_table;
/* Boot Loader Name
valid only if (flags & 0x0200)		(MB_INFO_BOOT_LOADER_NAME) */
	uint32_t boot_loader_name;
/* APM table
valid only if (flags & 0x0400)		(MB_INFO_APM_TABLE) */
	uint32_t apm_table;
/* Video
valid only if (flags & 0x0800)		(MB_INFO_VIDEO_INFO) */
	uint32_t vbe_control_info;
	uint32_t vbe_mode_info;
	uint16_t vbe_mode;
	uint16_t vbe_interface_seg;
	uint16_t vbe_interface_off;
	uint16_t vbe_interface_len;
};
