vaseboot/include/VasEBoot/multiboot.h

122 lines
3.9 KiB
C

/* multiboot.h - multiboot header file with VasEBoot definitions. */
/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2003,2007,2008,2010 Free Software Foundation, Inc.
*
* VasEBoot 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 3 of the License, or
* (at your option) any later version.
*
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VasEBoot_MULTIBOOT_HEADER
#define VasEBoot_MULTIBOOT_HEADER 1
#include <VasEBoot/file.h>
#ifdef VasEBoot_USE_MULTIBOOT2
#include <multiboot2.h>
/* Same thing as far as our loader is concerned. */
#define MULTIBOOT_BOOTLOADER_MAGIC MULTIBOOT2_BOOTLOADER_MAGIC
#define MULTIBOOT_HEADER_MAGIC MULTIBOOT2_HEADER_MAGIC
#else
#include <multiboot.h>
#endif
#include <VasEBoot/types.h>
#include <VasEBoot/err.h>
#ifndef VasEBoot_USE_MULTIBOOT2
typedef enum
{
VasEBoot_MULTIBOOT_QUIRKS_NONE = 0,
VasEBoot_MULTIBOOT_QUIRK_BAD_KLUDGE = 1,
VasEBoot_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL = 2
} VasEBoot_multiboot_quirks_t;
extern VasEBoot_multiboot_quirks_t VasEBoot_multiboot_quirks;
#endif
extern struct VasEBoot_relocator *VasEBoot_multiboot_relocator;
void VasEBoot_multiboot (int argc, char *argv[]);
void VasEBoot_module (int argc, char *argv[]);
void VasEBoot_multiboot_set_accepts_video (int val);
VasEBoot_err_t VasEBoot_multiboot_make_mbi (VasEBoot_uint32_t *target);
void VasEBoot_multiboot_free_mbi (void);
VasEBoot_err_t VasEBoot_multiboot_init_mbi (int argc, char *argv[]);
VasEBoot_err_t VasEBoot_multiboot_add_module (VasEBoot_addr_t start, VasEBoot_size_t size,
int argc, char *argv[]);
void VasEBoot_multiboot_set_bootdev (void);
void
VasEBoot_multiboot_add_elfsyms (VasEBoot_size_t num, VasEBoot_size_t entsize,
unsigned shndx, void *data);
VasEBoot_uint32_t VasEBoot_get_multiboot_mmap_count (void);
VasEBoot_err_t VasEBoot_multiboot_set_video_mode (void);
/* FIXME: support coreboot as well. */
#if defined (VasEBoot_MACHINE_PCBIOS)
#define VasEBoot_MACHINE_HAS_VBE 1
#else
#define VasEBoot_MACHINE_HAS_VBE 0
#endif
#if defined (VasEBoot_MACHINE_PCBIOS) || defined (VasEBoot_MACHINE_COREBOOT) || defined (VasEBoot_MACHINE_MULTIBOOT) || defined (VasEBoot_MACHINE_QEMU)
#define VasEBoot_MACHINE_HAS_VGA_TEXT 1
#else
#define VasEBoot_MACHINE_HAS_VGA_TEXT 0
#endif
#if defined (VasEBoot_MACHINE_EFI) || defined (VasEBoot_MACHINE_PCBIOS) || defined (VasEBoot_MACHINE_COREBOOT) || defined (VasEBoot_MACHINE_MULTIBOOT)
#define VasEBoot_MACHINE_HAS_ACPI 1
#else
#define VasEBoot_MACHINE_HAS_ACPI 0
#endif
#define VasEBoot_MULTIBOOT_CONSOLE_EGA_TEXT 1
#define VasEBoot_MULTIBOOT_CONSOLE_FRAMEBUFFER 2
VasEBoot_err_t
VasEBoot_multiboot_set_console (int console_type, int accepted_consoles,
int width, int height, int depth,
int console_required);
VasEBoot_err_t
VasEBoot_multiboot_load (VasEBoot_file_t file, const char *filename);
struct mbi_load_data
{
VasEBoot_file_t file;
const char *filename;
void *buffer;
unsigned int mbi_ver;
int relocatable;
VasEBoot_uint32_t min_addr;
VasEBoot_uint32_t max_addr;
VasEBoot_size_t align;
VasEBoot_uint32_t preference;
VasEBoot_uint32_t link_base_addr;
VasEBoot_uint32_t load_base_addr;
int avoid_efi_boot_services;
};
typedef struct mbi_load_data mbi_load_data_t;
/* Load ELF32 or ELF64. */
VasEBoot_err_t
VasEBoot_multiboot_load_elf (mbi_load_data_t *mld);
extern VasEBoot_size_t VasEBoot_multiboot_pure_size;
extern VasEBoot_size_t VasEBoot_multiboot_alloc_mbi;
extern VasEBoot_uint32_t VasEBoot_multiboot_payload_eip;
#endif /* ! VasEBoot_MULTIBOOT_HEADER */