Merge from trunk

This commit is contained in:
Robert Millan 2009-12-25 22:29:47 +00:00
commit d94000ed13
210 changed files with 4949 additions and 2557 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,8 @@
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)

View file

@ -19,10 +19,11 @@
#define GRUB_AUTH_HEADER 1
#include <grub/err.h>
#include <grub/i18n.h>
/* Macros for indistinguishibility. */
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get ("Enter password: ", \
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "access denied")
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
string, len, \
'*', 0, 0)

View file

@ -26,8 +26,10 @@
# include <grub/efi/efi.h>
# define grub_autoefi_get_memory_map grub_efi_get_memory_map
# define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
# define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
# define grub_autoefi_system_table grub_efi_system_table
# define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
# define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
static inline grub_err_t grub_autoefi_prepare (void)
{
return GRUB_ERR_NONE;
@ -53,9 +55,11 @@ static inline grub_err_t grub_autoefi_prepare (void)
# include <grub/efiemu/efiemu.h>
# define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
# define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
# define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
# define grub_autoefi_system_table grub_efiemu_system_table
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
# define grub_autoefi_prepare grub_efiemu_prepare
# define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI

112
include/grub/charset.h Normal file
View file

@ -0,0 +1,112 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CHARSET_HEADER
#define GRUB_CHARSET_HEADER 1
#include <grub/types.h>
#define GRUB_UINT8_1_LEADINGBIT 0x80
#define GRUB_UINT8_2_LEADINGBITS 0xc0
#define GRUB_UINT8_3_LEADINGBITS 0xe0
#define GRUB_UINT8_4_LEADINGBITS 0xf0
#define GRUB_UINT8_5_LEADINGBITS 0xf8
#define GRUB_UINT8_6_LEADINGBITS 0xfc
#define GRUB_UINT8_7_LEADINGBITS 0xfe
#define GRUB_UINT8_1_TRAILINGBIT 0x01
#define GRUB_UINT8_2_TRAILINGBITS 0x03
#define GRUB_UINT8_3_TRAILINGBITS 0x07
#define GRUB_UINT8_4_TRAILINGBITS 0x0f
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
#define GRUB_UCS2_LIMIT 0x10000
#define GRUB_UTF16_UPPER_SURROGATE(code) \
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
#define GRUB_UTF16_LOWER_SURROGATE(code) \
(0xDC00 + (((code) - GRUB_UCS2_LIMIT) & 0xfff))
grub_ssize_t
grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
const grub_uint8_t *src, grub_size_t srcsize,
const grub_uint8_t **srcend);
/* Convert UTF-16 to UTF-8. */
static inline grub_uint8_t *
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
grub_size_t size)
{
grub_uint32_t code_high = 0;
while (size--)
{
grub_uint32_t code = *src++;
if (code_high)
{
if (code >= 0xDC00 && code <= 0xDFFF)
{
/* Surrogate pair. */
code = ((code_high - 0xD800) << 12) + (code - 0xDC00) + 0x10000;
*dest++ = (code >> 18) | 0xF0;
*dest++ = ((code >> 12) & 0x3F) | 0x80;
*dest++ = ((code >> 6) & 0x3F) | 0x80;
*dest++ = (code & 0x3F) | 0x80;
}
else
{
/* Error... */
*dest++ = '?';
}
code_high = 0;
}
else
{
if (code <= 0x007F)
*dest++ = code;
else if (code <= 0x07FF)
{
*dest++ = (code >> 6) | 0xC0;
*dest++ = (code & 0x3F) | 0x80;
}
else if (code >= 0xD800 && code <= 0xDBFF)
{
code_high = code;
continue;
}
else if (code >= 0xDC00 && code <= 0xDFFF)
{
/* Error... */
*dest++ = '?';
}
else
{
*dest++ = (code >> 12) | 0xE0;
*dest++ = ((code >> 6) & 0x3F) | 0x80;
*dest++ = (code & 0x3F) | 0x80;
}
}
}
return dest;
}
#endif

View file

@ -21,6 +21,7 @@
#define GRUB_EFI_API_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
/* For consistency and safety, we name the EFI-defined types differently.
All names are transformed into lower case, _t appended, and

View file

@ -55,6 +55,10 @@ grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version,
grub_efi_memory_descriptor_t *virtual_map);
void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);

View file

@ -24,7 +24,7 @@
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum
typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,

View file

@ -268,9 +268,19 @@ void grub_efiemu_free_syms (void);
grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
int plus_handle,
int minus_handle, int ptv_needed, int size);
grub_err_t grub_efiemu_write_sym_markers (void);
grub_err_t grub_efiemu_pnvram (void);
grub_err_t grub_efiemu_prepare (void);
char *grub_efiemu_get_default_core_name (void);
void grub_efiemu_pnvram_cmd_unregister (void);
grub_err_t grub_efiemu_autocore (void);
grub_err_t grub_efiemu_crc32 (void);
grub_err_t grub_efiemu_crc64 (void);
grub_err_t
grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version
__attribute__ ((unused)),
grub_efi_memory_descriptor_t *virtual_map);
#endif /* ! GRUB_EFI_EMU_HEADER */

View file

@ -48,7 +48,8 @@ struct grub_hfs_sblock
/* A pascal style string that holds the volumename. */
grub_uint8_t volname[28];
grub_uint8_t unused5[60];
grub_uint8_t unused5[52];
grub_uint64_t num_serial;
grub_uint16_t embed_sig;
struct grub_hfs_extent embed_extent;
grub_uint8_t unused6[4];

View file

@ -1,3 +1,26 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CPU_MACHO_H
#define GRUB_CPU_MACHO_H 1
#include <grub/macho.h>
#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x)==0x00000007)
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
@ -9,3 +32,15 @@ struct grub_macho_thread32
grub_uint32_t entry_point;
grub_uint8_t unknown2[20];
} __attribute__ ((packed));
struct grub_macho_thread64
{
grub_uint32_t cmd;
grub_uint32_t cmdsize;
grub_uint8_t unknown1[0x88];
grub_uint64_t entry_point;
grub_uint8_t unknown2[0x20];
} __attribute__ ((packed));
#endif

View file

@ -85,7 +85,7 @@
struct grub_machine_bios_data_area
{
grub_uint8_t unused1[0x17];
grub_uint8_t keyboard_flag_lower; /* 0x17 */
grub_uint8_t keyboard_flag_lower; /* 0x17 */
grub_uint8_t unused2[0xf0 - 0x18];
};

View file

@ -201,7 +201,7 @@ struct grub_pxenv_get_cached_info
#define GRUB_PXE_MAC_ADDR_LEN 16
typedef grub_uint8_t grub_pxe_mac_addr[GRUB_PXE_MAC_ADDR_LEN];
typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
struct grub_pxenv_boot_player
{
@ -216,7 +216,7 @@ struct grub_pxenv_boot_player
grub_uint32_t your_ip;
grub_uint32_t server_ip;
grub_uint32_t gateway_ip;
grub_pxe_mac_addr mac_addr;
grub_pxe_mac_addr_t mac_addr;
grub_uint8_t server_name[64];
grub_uint8_t boot_file[128];
union
@ -306,10 +306,6 @@ struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
extern struct grub_pxenv *grub_pxe_pxenv;
extern grub_uint32_t grub_pxe_your_ip;
extern grub_uint32_t grub_pxe_server_ip;
extern grub_uint32_t grub_pxe_gateway_ip;
extern int grub_pxe_blksize;
void grub_pxe_unload (void);

View file

@ -20,6 +20,7 @@
#define GRUB_CPU_XNU_H 1
#include <grub/err.h>
#include <grub/efi/api.h>
#include <grub/cpu/relocator.h>
#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
@ -67,15 +68,54 @@ struct grub_xnu_boot_params
/* Size of grub_efi_uintn_t in bits. */
grub_uint8_t efi_uintnbits;
} __attribute__ ((packed));
#define GRUB_XNU_BOOTARGS_VERMINOR 4
#define GRUB_XNU_BOOTARGS_VERMINOR 5
#define GRUB_XNU_BOOTARGS_VERMAJOR 1
struct grub_xnu_devprop_header
{
grub_uint32_t length;
/* Always set to 1. Version? */
grub_uint32_t alwaysone;
grub_uint32_t num_devices;
};
struct grub_xnu_devprop_device_header
{
grub_uint32_t length;
grub_uint32_t num_values;
};
void grub_cpu_xnu_unload (void);
struct grub_xnu_devprop_device_descriptor;
struct grub_xnu_devprop_device_descriptor *
grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
grub_err_t
grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
grub_err_t
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
char *name);
grub_err_t
grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
char *name, void *data, int datalen);
grub_err_t
grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
grub_uint16_t *name, int namelen,
void *data, int datalen);
grub_err_t
grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
char *name);
void grub_cpu_xnu_init (void);
void grub_cpu_xnu_fini (void);
extern grub_uint32_t grub_xnu_entry_point;
extern grub_uint32_t grub_xnu_stack;
extern grub_uint32_t grub_xnu_arg1;
extern char grub_xnu_cmdline[1024];
grub_err_t grub_xnu_boot (void);
grub_err_t grub_cpu_xnu_fill_devicetree (void);
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
grub_err_t
grub_cpu_xnu_fill_devicetree (void);
extern grub_uint32_t grub_xnu_heap_will_be_at;
#endif

View file

@ -102,6 +102,23 @@ struct grub_macho_segment32
grub_uint32_t flags;
} __attribute__ ((packed));
/* 64-bit segment command. */
struct grub_macho_segment64
{
#define GRUB_MACHO_CMD_SEGMENT64 0x19
grub_uint32_t cmd;
grub_uint32_t cmdsize;
grub_uint8_t segname[16];
grub_uint64_t vmaddr;
grub_uint64_t vmsize;
grub_uint64_t fileoff;
grub_uint64_t filesize;
grub_macho_vmprot_t maxprot;
grub_macho_vmprot_t initprot;
grub_uint32_t nsects;
grub_uint32_t flags;
} __attribute__ ((packed));
#define GRUB_MACHO_CMD_THREAD 5
#endif

View file

@ -46,17 +46,28 @@ grub_macho_t grub_macho_file (grub_file_t);
grub_err_t grub_macho_close (grub_macho_t);
int grub_macho_contains_macho32 (grub_macho_t);
grub_err_t grub_macho32_size (grub_macho_t macho, grub_addr_t *segments_start,
grub_addr_t *segments_end, int flags);
grub_uint32_t grub_macho32_get_entry_point (grub_macho_t macho);
grub_err_t grub_macho_size32 (grub_macho_t macho, grub_uint32_t *segments_start,
grub_uint32_t *segments_end, int flags);
grub_uint32_t grub_macho_get_entry_point32 (grub_macho_t macho);
int grub_macho_contains_macho64 (grub_macho_t);
grub_err_t grub_macho_size64 (grub_macho_t macho, grub_uint64_t *segments_start,
grub_uint64_t *segments_end, int flags);
grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho);
/* Ignore BSS segments when loading. */
#define GRUB_MACHO_NOBSS 0x1
grub_err_t grub_macho32_load (grub_macho_t macho, char *offset, int flags);
grub_err_t grub_macho_load32 (grub_macho_t macho, char *offset, int flags);
grub_err_t grub_macho_load64 (grub_macho_t macho, char *offset, int flags);
/* Like filesize and file_read but take only 32-bit part
for current architecture. */
grub_size_t grub_macho32_filesize (grub_macho_t macho);
grub_err_t grub_macho32_readfile (grub_macho_t macho, void *dest);
grub_size_t grub_macho_filesize32 (grub_macho_t macho);
grub_err_t grub_macho_readfile32 (grub_macho_t macho, void *dest);
grub_size_t grub_macho_filesize64 (grub_macho_t macho);
grub_err_t grub_macho_readfile64 (grub_macho_t macho, void *dest);
void grub_macho_parse32 (grub_macho_t macho);
void grub_macho_parse64 (grub_macho_t macho);
#endif /* ! GRUB_MACHOLOAD_HEADER */

View file

@ -172,6 +172,8 @@ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_puts) (const char *s);
int EXPORT_FUNC(grub_puts_) (const char *s);
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,
@ -181,9 +183,6 @@ int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
grub_uint16_t *src,
grub_size_t size);
grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
grub_size_t destsize,
const grub_uint8_t *src,

View file

@ -30,6 +30,9 @@
/* The maximum size of a command-line. */
#define GRUB_MAX_CMDLINE 1600
/* The standard left and right margin for some messages. */
#define STANDARD_MARGIN 6
/* The type of a completion item. */
enum grub_completion_type
{
@ -73,6 +76,14 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
/* Defined in `menu_text.c'. */
void grub_wait_after_message (void);
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
void grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position);
void grub_print_message_indented (const char *msg, int margin_left,
int margin_right);
/* Defined in `handler.c'. */
void read_handler_list (void);

View file

@ -22,8 +22,6 @@
#include <config.h>
#include <grub/cpu/types.h>
#define UNUSED __attribute__ ((unused))
#ifdef GRUB_UTIL
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG

View file

@ -64,9 +64,6 @@ grub_usb_err_t grub_usb_clear_halt (grub_usb_device_t dev, int endpoint);
grub_usb_err_t grub_usb_set_configuration (grub_usb_device_t dev,
int configuration);
grub_usb_err_t grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index,
int langid, char **string);
void grub_usb_controller_dev_register (grub_usb_controller_dev_t usb);
void grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb);

View file

@ -76,6 +76,8 @@ struct grub_xnu_extheader
grub_uint32_t infoplistsize;
grub_uint32_t binaryaddr;
grub_uint32_t binarysize;
grub_uint32_t nameaddr;
grub_uint32_t namesize;
} __attribute__ ((packed));
struct grub_xnu_devtree_key *grub_xnu_create_key (struct grub_xnu_devtree_key **parent,
@ -101,7 +103,10 @@ grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,
grub_err_t grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
int maxrecursion);
void *grub_xnu_heap_malloc (int size);
grub_err_t grub_xnu_fill_devicetree (void);
extern grub_uint32_t grub_xnu_heap_real_start;
extern grub_size_t grub_xnu_heap_size;
extern void *grub_xnu_heap_start;
extern struct grub_video_bitmap *grub_xnu_bitmap;
extern int grub_xnu_is_64bit;
#endif

View file

@ -1,6 +1,5 @@
/*
* multiboot.h - Multiboot header file.
* Copyright (C) 2003,2007,2008,2009 Free Software Foundation, Inc.
/* multiboot.h - Multiboot header file. */
/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -24,70 +23,66 @@
#define MULTIBOOT_HEADER 1
/* How many bytes from the start of the file we search for the header. */
#define MULTIBOOT_SEARCH 8192
#define MULTIBOOT_SEARCH 8192
/* The magic field should contain this. */
#define MULTIBOOT_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
/* This should be in %eax. */
#define MULTIBOOT_MAGIC2 0x2BADB002
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
/* The bits in the required part of flags field we don't support. */
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
/* Alignment of multiboot modules. */
#define MULTIBOOT_MOD_ALIGN 0x00001000
#define MULTIBOOT_MOD_ALIGN 0x00001000
/* Alignment of the multiboot info structure. */
#define MULTIBOOT_INFO_ALIGN 0x00000004
#define MULTIBOOT_INFO_ALIGN 0x00000004
/*
* Flags set in the 'flags' member of the multiboot header.
*/
/* Flags set in the 'flags' member of the multiboot header. */
/* Align all boot modules on i386 page (4KB) boundaries. */
#define MULTIBOOT_PAGE_ALIGN 0x00000001
#define MULTIBOOT_PAGE_ALIGN 0x00000001
/* Must pass memory information to OS. */
#define MULTIBOOT_MEMORY_INFO 0x00000002
#define MULTIBOOT_MEMORY_INFO 0x00000002
/* Must pass video information to OS. */
#define MULTIBOOT_VIDEO_MODE 0x00000004
#define MULTIBOOT_VIDEO_MODE 0x00000004
/* This flag indicates the use of the address fields in the header. */
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
/*
* Flags to be set in the 'flags' member of the multiboot info structure.
*/
/* Flags to be set in the 'flags' member of the multiboot info structure. */
/* is there basic lower/upper memory information? */
#define MULTIBOOT_INFO_MEMORY 0x00000001
#define MULTIBOOT_INFO_MEMORY 0x00000001
/* is there a boot device set? */
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
/* is the command-line defined? */
#define MULTIBOOT_INFO_CMDLINE 0x00000004
#define MULTIBOOT_INFO_CMDLINE 0x00000004
/* are there modules to do something with? */
#define MULTIBOOT_INFO_MODS 0x00000008
#define MULTIBOOT_INFO_MODS 0x00000008
/* These next two are mutually exclusive */
/* is there a symbol table loaded? */
#define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
/* is there an ELF section header table? */
#define MULTIBOOT_INFO_ELF_SHDR 0x00000020
#define MULTIBOOT_INFO_ELF_SHDR 0X00000020
/* is there a full memory map? */
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
/* Is there drive info? */
#define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
/* Is there a config table? */
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
/* Is there a boot loader name? */
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
/* Is there a APM table? */
#define MULTIBOOT_INFO_APM_TABLE 0x00000400
@ -97,102 +92,131 @@
#ifndef ASM_FILE
#include <grub/types.h>
typedef unsigned short multiboot_uint16_t;
typedef unsigned int multiboot_uint32_t;
typedef unsigned long long multiboot_uint64_t;
struct multiboot_header
{
/* Must be MULTIBOOT_MAGIC - see above. */
grub_uint32_t magic;
multiboot_uint32_t magic;
/* Feature flags. */
grub_uint32_t flags;
multiboot_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
grub_uint32_t checksum;
multiboot_uint32_t checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
multiboot_uint32_t header_addr;
multiboot_uint32_t load_addr;
multiboot_uint32_t load_end_addr;
multiboot_uint32_t bss_end_addr;
multiboot_uint32_t entry_addr;
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
multiboot_uint32_t mode_type;
multiboot_uint32_t width;
multiboot_uint32_t height;
multiboot_uint32_t depth;
};
/* The symbol table for a.out. */
struct multiboot_aout_symbol_table
{
multiboot_uint32_t tabsize;
multiboot_uint32_t strsize;
multiboot_uint32_t addr;
multiboot_uint32_t reserved;
};
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
/* The section header table for ELF. */
struct multiboot_elf_section_header_table
{
multiboot_uint32_t num;
multiboot_uint32_t size;
multiboot_uint32_t addr;
multiboot_uint32_t shndx;
};
typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
struct multiboot_info
{
/* Multiboot info version number */
grub_uint32_t flags;
multiboot_uint32_t flags;
/* Available memory from BIOS */
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
multiboot_uint32_t mem_lower;
multiboot_uint32_t mem_upper;
/* "root" partition */
grub_uint32_t boot_device;
multiboot_uint32_t boot_device;
/* Kernel command line */
grub_uint32_t cmdline;
multiboot_uint32_t cmdline;
/* Boot-Module list */
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
multiboot_uint32_t mods_count;
multiboot_uint32_t mods_addr;
grub_uint32_t syms[4];
union
{
multiboot_aout_symbol_table_t aout_sym;
multiboot_elf_section_header_table_t elf_sec;
} u;
/* Memory Mapping buffer */
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
multiboot_uint32_t mmap_length;
multiboot_uint32_t mmap_addr;
/* Drive Info buffer */
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
multiboot_uint32_t drives_length;
multiboot_uint32_t drives_addr;
/* ROM configuration table */
grub_uint32_t config_table;
multiboot_uint32_t config_table;
/* Boot Loader Name */
grub_uint32_t boot_loader_name;
multiboot_uint32_t boot_loader_name;
/* APM table */
grub_uint32_t apm_table;
multiboot_uint32_t apm_table;
/* Video */
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
multiboot_uint32_t vbe_control_info;
multiboot_uint32_t vbe_mode_info;
multiboot_uint16_t vbe_mode;
multiboot_uint16_t vbe_interface_seg;
multiboot_uint16_t vbe_interface_off;
multiboot_uint16_t vbe_interface_len;
};
typedef struct multiboot_info multiboot_info_t;
struct multiboot_mmap_entry
{
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
multiboot_uint32_t size;
multiboot_uint64_t addr;
multiboot_uint64_t len;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
grub_uint32_t type;
multiboot_uint32_t type;
} __attribute__((packed));
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
struct multiboot_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
grub_uint32_t mod_start;
grub_uint32_t mod_end;
multiboot_uint32_t mod_start;
multiboot_uint32_t mod_end;
/* Module command line */
grub_uint32_t cmdline;
multiboot_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
grub_uint32_t pad;
multiboot_uint32_t pad;
};
typedef struct multiboot_mod_list multiboot_module_t;
#endif /* ! ASM_FILE */