mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-14 23:31:39 +00:00
Whoever put together the grub multiboot.h header is insane.
This commit is contained in:
parent
c468c68661
commit
ddbc60b5ae
@ -1,136 +1,147 @@
|
||||
/* multiboot.h - the header for Multiboot */
|
||||
/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#ifndef _MULTIBOOT_H
|
||||
#define _MULTIBOOT_H
|
||||
|
||||
/* Macros. */
|
||||
|
||||
/* The magic number for the Multiboot header. */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
/* The flags for the Multiboot header. */
|
||||
#ifdef __ELF__
|
||||
# define MULTIBOOT_HEADER_FLAGS 0x00000003
|
||||
#else
|
||||
# define MULTIBOOT_HEADER_FLAGS 0x00010003
|
||||
#endif
|
||||
|
||||
/* The magic number passed by a Multiboot-compliant boot loader. */
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
|
||||
/* The size of our stack (16KB). */
|
||||
#define STACK_SIZE 0x4000
|
||||
|
||||
/* C symbol format. HAVE_ASM_USCORE is defined by configure. */
|
||||
#ifdef HAVE_ASM_USCORE
|
||||
# define EXT_C(sym) _ ## sym
|
||||
#else
|
||||
# define EXT_C(sym) sym
|
||||
#endif
|
||||
|
||||
#ifndef ASM
|
||||
/* Do not include here in boot.S. */
|
||||
|
||||
/* Types. */
|
||||
|
||||
/* The Multiboot header. */
|
||||
typedef struct multiboot_header
|
||||
{
|
||||
unsigned long magic;
|
||||
unsigned long flags;
|
||||
unsigned long checksum;
|
||||
unsigned long header_addr;
|
||||
unsigned long load_addr;
|
||||
unsigned long load_end_addr;
|
||||
unsigned long bss_end_addr;
|
||||
unsigned long entry_addr;
|
||||
} multiboot_header_t;
|
||||
|
||||
/* The symbol table for a.out. */
|
||||
typedef struct multiboot_aout_symbol_table
|
||||
{
|
||||
unsigned long tabsize;
|
||||
unsigned long strsize;
|
||||
unsigned long addr;
|
||||
unsigned long reserved;
|
||||
} multiboot_aout_symbol_table_t;
|
||||
|
||||
/* The section header table for ELF. */
|
||||
typedef struct multiboot_elf_section_header_table
|
||||
{
|
||||
unsigned long num;
|
||||
unsigned long size;
|
||||
unsigned long addr;
|
||||
unsigned long shndx;
|
||||
} multiboot_elf_section_header_table_t;
|
||||
|
||||
/* The Multiboot information. */
|
||||
typedef struct multiboot_info
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long mem_lower;
|
||||
unsigned long mem_upper;
|
||||
unsigned long boot_device;
|
||||
unsigned long cmdline;
|
||||
unsigned long mods_count;
|
||||
unsigned long mods_addr;
|
||||
union
|
||||
{
|
||||
multiboot_aout_symbol_table_t aout_sym;
|
||||
multiboot_elf_section_header_table_t elf_sec;
|
||||
} u;
|
||||
unsigned long mmap_length;
|
||||
unsigned long mmap_addr;
|
||||
unsigned long drives_length;
|
||||
unsigned long drives_addr;
|
||||
unsigned long config_table;
|
||||
unsigned long boot_loader_name;
|
||||
unsigned long apm_table;
|
||||
unsigned long vbe_control_info;
|
||||
unsigned long vbe_mode_info;
|
||||
unsigned short vbe_mode;
|
||||
unsigned short vbe_interface_seg;
|
||||
unsigned short vbe_interface_off;
|
||||
unsigned short vbe_interface_len;
|
||||
} multiboot_info_t;
|
||||
|
||||
/* The module structure. */
|
||||
typedef struct multiboot_module
|
||||
{
|
||||
unsigned long mod_start;
|
||||
unsigned long mod_end;
|
||||
unsigned long string;
|
||||
unsigned long reserved;
|
||||
} multiboot_module_t;
|
||||
|
||||
/* The memory map. Be careful that the offset 0 is base_addr_low
|
||||
but no size. */
|
||||
typedef struct multiboot_memory_map
|
||||
{
|
||||
unsigned long size;
|
||||
unsigned long base_addr_low;
|
||||
unsigned long base_addr_high;
|
||||
unsigned long length_low;
|
||||
unsigned long length_high;
|
||||
unsigned long type;
|
||||
} multiboot_memory_map_t;
|
||||
|
||||
#endif /* ! ASM */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-basic-offset: 2
|
||||
* End:
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Multiboot operating systems
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** The magic number for the Multiboot header */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
/** Boot modules must be page aligned */
|
||||
#define MB_FLAG_PGALIGN 0x00000001
|
||||
|
||||
/** Memory map must be provided */
|
||||
#define MB_FLAG_MEMMAP 0x00000002
|
||||
|
||||
/** Video mode information must be provided */
|
||||
#define MB_FLAG_VIDMODE 0x00000004
|
||||
|
||||
/** Image is a raw multiboot image (not ELF) */
|
||||
#define MB_FLAG_RAW 0x00010000
|
||||
|
||||
/**
|
||||
* The magic number passed by a Multiboot-compliant boot loader
|
||||
*
|
||||
* Must be passed in register %eax when jumping to the Multiboot OS
|
||||
* image.
|
||||
*/
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
|
||||
/** Multiboot information structure mem_* fields are valid */
|
||||
#define MBI_FLAG_MEM 0x00000001
|
||||
|
||||
/** Multiboot information structure boot_device field is valid */
|
||||
#define MBI_FLAG_BOOTDEV 0x00000002
|
||||
|
||||
/** Multiboot information structure cmdline field is valid */
|
||||
#define MBI_FLAG_CMDLINE 0x00000004
|
||||
|
||||
/** Multiboot information structure module fields are valid */
|
||||
#define MBI_FLAG_MODS 0x00000008
|
||||
|
||||
/** Multiboot information structure a.out symbol table is valid */
|
||||
#define MBI_FLAG_AOUT 0x00000010
|
||||
|
||||
/** Multiboot information struture ELF section header table is valid */
|
||||
#define MBI_FLAG_ELF 0x00000020
|
||||
|
||||
/** Multiboot information structure memory map is valid */
|
||||
#define MBI_FLAG_MMAP 0x00000040
|
||||
|
||||
/** Multiboot information structure drive list is valid */
|
||||
#define MBI_FLAG_DRIVES 0x00000080
|
||||
|
||||
/** Multiboot information structure ROM configuration field is valid */
|
||||
#define MBI_FLAG_CFGTBL 0x00000100
|
||||
|
||||
/** Multiboot information structure boot loader name field is valid */
|
||||
#define MBI_FLAG_LOADER 0x00000200
|
||||
|
||||
/** Multiboot information structure APM table is valid */
|
||||
#define MBI_FLAG_APM 0x00000400
|
||||
|
||||
/** Multiboot information structure video information is valid */
|
||||
#define MBI_FLAG_VBE 0x00000800
|
||||
|
||||
/** A multiboot header */
|
||||
struct multiboot_header {
|
||||
uint32_t magic;
|
||||
uint32_t flags;
|
||||
uint32_t checksum;
|
||||
uint32_t header_addr;
|
||||
uint32_t load_addr;
|
||||
uint32_t load_end_addr;
|
||||
uint32_t bss_end_addr;
|
||||
uint32_t entry_addr;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** A multiboot a.out symbol table */
|
||||
struct multiboot_aout_symbol_table {
|
||||
uint32_t tabsize;
|
||||
uint32_t strsize;
|
||||
uint32_t addr;
|
||||
uint32_t reserved;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** A multiboot ELF section header table */
|
||||
struct multiboot_elf_section_header_table {
|
||||
uint32_t num;
|
||||
uint32_t size;
|
||||
uint32_t addr;
|
||||
uint32_t shndx;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** A multiboot information structure */
|
||||
struct multiboot_info {
|
||||
uint32_t flags;
|
||||
uint32_t mem_lower;
|
||||
uint32_t mem_upper;
|
||||
uint32_t boot_device;
|
||||
uint32_t cmdline;
|
||||
uint32_t mods_count;
|
||||
uint32_t mods_addr;
|
||||
union {
|
||||
struct multiboot_aout_symbol_table aout_syms;
|
||||
struct multiboot_elf_section_header_table elf_sections;
|
||||
} syms;
|
||||
uint32_t mmap_length;
|
||||
uint32_t mmap_addr;
|
||||
uint32_t drives_length;
|
||||
uint32_t drives_addr;
|
||||
uint32_t config_table;
|
||||
uint32_t boot_loader_name;
|
||||
uint32_t apm_table;
|
||||
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;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** A multiboot module structure */
|
||||
struct multiboot_module {
|
||||
uint32_t mod_start;
|
||||
uint32_t mod_end;
|
||||
uint32_t string;
|
||||
uint32_t reserved;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** A multiboot memory map entry */
|
||||
struct multiboot_memory_map {
|
||||
uint32_t size;
|
||||
uint64_t base_addr;
|
||||
uint64_t length;
|
||||
uint32_t type;
|
||||
} __attribute__ (( packed, may_alias ));
|
||||
|
||||
/** Usable RAM */
|
||||
#define MBMEM_RAM 1
|
||||
|
||||
#endif /* _MULTIBOOT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user