automake commit without merge history

This commit is contained in:
BVK Chaitanya 2010-05-06 11:34:04 +05:30
parent 265d68cd10
commit 8c41176882
810 changed files with 4980 additions and 2508 deletions

View file

@ -0,0 +1,53 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2005,2007 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_ACORN_FILECORE_HEADER
#define GRUB_ACORN_FILECORE_HEADER 1
#include <grub/types.h>
struct grub_filecore_disc_record
{
grub_uint8_t log2secsize;
grub_uint8_t secspertrack;
grub_uint8_t heads;
grub_uint8_t density;
grub_uint8_t idlen;
grub_uint8_t log2bpmb;
grub_uint8_t skew;
grub_uint8_t bootoption;
/* In bits 0-5, flags in bits 6 and 7. */
grub_uint8_t lowsector;
grub_uint8_t nzones;
grub_uint16_t zone_spare;
grub_uint32_t root_address;
/* Disc size in bytes. */
grub_uint32_t disc_size;
grub_uint16_t cycle_id;
char disc_name[10];
/* Yes, it is 32 bits! */
grub_uint32_t disctype;
/* Most significant part of the disc size. */
grub_uint32_t disc_size2;
grub_uint8_t share_size;
grub_uint8_t big_flag;
grub_uint8_t reserved[18];
};
#endif /* ! GRUB_ACORN_FILECORE_HEADER */

View file

@ -0,0 +1,75 @@
/*
* 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_ACPI_HEADER
#define GRUB_ACPI_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
struct grub_acpi_rsdp_v10
{
grub_uint8_t signature[8];
grub_uint8_t checksum;
grub_uint8_t oemid[6];
grub_uint8_t revision;
grub_uint32_t rsdt_addr;
} __attribute__ ((packed));
struct grub_acpi_rsdp_v20
{
struct grub_acpi_rsdp_v10 rsdpv1;
grub_uint32_t length;
grub_uint64_t xsdt_addr;
grub_uint8_t checksum;
grub_uint8_t reserved[3];
} __attribute__ ((packed));
struct grub_acpi_table_header
{
grub_uint8_t signature[4];
grub_uint32_t length;
grub_uint8_t revision;
grub_uint8_t checksum;
grub_uint8_t oemid[6];
grub_uint8_t oemtable[8];
grub_uint32_t oemrev;
grub_uint8_t creator_id[4];
grub_uint32_t creator_rev;
} __attribute__ ((packed));
struct grub_acpi_fadt
{
struct grub_acpi_table_header hdr;
grub_uint32_t facs_addr;
grub_uint32_t dsdt_addr;
grub_uint8_t somefields1[88];
grub_uint64_t facs_xaddr;
grub_uint64_t dsdt_xaddr;
grub_uint8_t somefields2[96];
} __attribute__ ((packed));
struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void);
struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void);
struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void);
struct grub_acpi_rsdp_v20 *grub_machine_acpi_get_rsdpv2 (void);
grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
grub_err_t grub_acpi_create_ebda (void);
#endif /* ! GRUB_ACPI_HEADER */

View file

@ -0,0 +1,128 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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/>.
*/
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)exec.h 8.1 (Berkeley) 6/11/93
* $FreeBSD$
*/
#ifndef GRUB_AOUT_HEADER
#define GRUB_AOUT_HEADER 1
#include <grub/types.h>
struct grub_aout32_header
{
grub_uint32_t a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
grub_uint32_t a_text; /* text segment size */
grub_uint32_t a_data; /* initialized data size */
grub_uint32_t a_bss; /* uninitialized data size */
grub_uint32_t a_syms; /* symbol table size */
grub_uint32_t a_entry; /* entry point */
grub_uint32_t a_trsize; /* text relocation size */
grub_uint32_t a_drsize; /* data relocation size */
};
struct grub_aout64_header
{
grub_uint32_t a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
grub_uint64_t a_text; /* text segment size */
grub_uint64_t a_data; /* initialized data size */
grub_uint64_t a_bss; /* uninitialized data size */
grub_uint64_t a_syms; /* symbol table size */
grub_uint64_t a_entry; /* entry point */
grub_uint64_t a_trsize; /* text relocation size */
grub_uint64_t a_drsize; /* data relocation size */
};
union grub_aout_header
{
struct grub_aout32_header aout32;
struct grub_aout64_header aout64;
};
#define AOUT_TYPE_NONE 0
#define AOUT_TYPE_AOUT32 1
#define AOUT_TYPE_AOUT64 6
#define AOUT32_OMAGIC 0x107 /* 0407 old impure format */
#define AOUT32_NMAGIC 0x108 /* 0410 read-only text */
#define AOUT32_ZMAGIC 0x10b /* 0413 demand load format */
#define AOUT32_QMAGIC 0xcc /* 0314 "compact" demand load format */
#define AOUT64_OMAGIC 0x1001
#define AOUT64_ZMAGIC 0x1002
#define AOUT64_NMAGIC 0x1003
#define AOUT_MID_ZERO 0 /* unknown - implementation dependent */
#define AOUT_MID_SUN010 1 /* sun 68010/68020 binary */
#define AOUT_MID_SUN020 2 /* sun 68020-only binary */
#define AOUT_MID_I386 134 /* i386 BSD binary */
#define AOUT_MID_SPARC 138 /* sparc */
#define AOUT_MID_HP200 200 /* hp200 (68010) BSD binary */
#define AOUT_MID_SUN 0x103
#define AOUT_MID_HP300 300 /* hp300 (68020+68881) BSD binary */
#define AOUT_MID_HPUX 0x20C /* hp200/300 HP-UX binary */
#define AOUT_MID_HPUX800 0x20B /* hp800 HP-UX binary */
#define AOUT_FLAG_PIC 0x10 /* contains position independent code */
#define AOUT_FLAG_DYNAMIC 0x20 /* contains run-time link-edit info */
#define AOUT_FLAG_DPMASK 0x30 /* mask for the above */
#define AOUT_GETMAGIC(header) ((header).a_midmag & 0xffff)
#define AOUT_GETMID(header) ((header).a_midmag >> 16) & 0x03ff)
#define AOUT_GETFLAG(header) ((header).a_midmag >> 26) & 0x3f)
#ifndef GRUB_UTIL
int EXPORT_FUNC(grub_aout_get_type) (union grub_aout_header *header);
grub_err_t EXPORT_FUNC(grub_aout_load) (grub_file_t file, int offset,
grub_addr_t load_addr, int load_size,
grub_addr_t bss_end_addr);
#endif
#endif /* ! GRUB_AOUT_HEADER */

View file

@ -0,0 +1,54 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* 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_AT_KEYBOARD_HEADER
#define GRUB_AT_KEYBOARD_HEADER 1
#define SHIFT_L 0x2a
#define SHIFT_R 0x36
#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)
#define KEYBOARD_COMMAND_READ 0x20
#define KEYBOARD_COMMAND_WRITE 0x60
#define KEYBOARD_COMMAND_REBOOT 0xfe
#define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275
#define OLPC_UP GRUB_TERM_UP
#define OLPC_DOWN GRUB_TERM_DOWN
#define OLPC_LEFT GRUB_TERM_LEFT
#define OLPC_RIGHT GRUB_TERM_RIGHT
#else
#define OLPC_UP '\0'
#define OLPC_DOWN '\0'
#define OLPC_LEFT '\0'
#define OLPC_RIGHT '\0'
#endif
#endif

View file

@ -0,0 +1,168 @@
/* ata.h - ATA disk access. */
/*
* GRUB -- GRand Unified Bootloader
* 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
* 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_ATA_HEADER
#define GRUB_ATA_HEADER 1
#include <grub/misc.h>
#include <grub/symbol.h>
/* XXX: For now this only works on i386. */
#include <grub/cpu/io.h>
typedef enum
{
GRUB_ATA_CHS,
GRUB_ATA_LBA,
GRUB_ATA_LBA48
} grub_ata_addressing_t;
#define GRUB_ATA_REG_DATA 0
#define GRUB_ATA_REG_ERROR 1
#define GRUB_ATA_REG_FEATURES 1
#define GRUB_ATA_REG_SECTORS 2
#define GRUB_ATAPI_REG_IREASON 2
#define GRUB_ATA_REG_SECTNUM 3
#define GRUB_ATA_REG_CYLLSB 4
#define GRUB_ATA_REG_CYLMSB 5
#define GRUB_ATA_REG_LBALOW 3
#define GRUB_ATA_REG_LBAMID 4
#define GRUB_ATAPI_REG_CNTLOW 4
#define GRUB_ATA_REG_LBAHIGH 5
#define GRUB_ATAPI_REG_CNTHIGH 5
#define GRUB_ATA_REG_DISK 6
#define GRUB_ATA_REG_CMD 7
#define GRUB_ATA_REG_STATUS 7
#define GRUB_ATA_REG2_CONTROL 0
#define GRUB_ATA_STATUS_ERR 0x01
#define GRUB_ATA_STATUS_INDEX 0x02
#define GRUB_ATA_STATUS_ECC 0x04
#define GRUB_ATA_STATUS_DRQ 0x08
#define GRUB_ATA_STATUS_SEEK 0x10
#define GRUB_ATA_STATUS_WRERR 0x20
#define GRUB_ATA_STATUS_READY 0x40
#define GRUB_ATA_STATUS_BUSY 0x80
/* ATAPI interrupt reason values (I/O, D/C bits). */
#define GRUB_ATAPI_IREASON_MASK 0x3
#define GRUB_ATAPI_IREASON_DATA_OUT 0x0
#define GRUB_ATAPI_IREASON_CMD_OUT 0x1
#define GRUB_ATAPI_IREASON_DATA_IN 0x2
#define GRUB_ATAPI_IREASON_ERROR 0x3
enum grub_ata_commands
{
GRUB_ATA_CMD_CHECK_POWER_MODE = 0xe5,
GRUB_ATA_CMD_IDENTIFY_DEVICE = 0xec,
GRUB_ATA_CMD_IDENTIFY_PACKET_DEVICE = 0xa1,
GRUB_ATA_CMD_IDLE = 0xe3,
GRUB_ATA_CMD_PACKET = 0xa0,
GRUB_ATA_CMD_READ_SECTORS = 0x20,
GRUB_ATA_CMD_READ_SECTORS_EXT = 0x24,
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK = 0xf5,
GRUB_ATA_CMD_SET_FEATURES = 0xef,
GRUB_ATA_CMD_SLEEP = 0xe6,
GRUB_ATA_CMD_SMART = 0xb0,
GRUB_ATA_CMD_STANDBY_IMMEDIATE = 0xe0,
GRUB_ATA_CMD_WRITE_SECTORS = 0x30,
GRUB_ATA_CMD_WRITE_SECTORS_EXT = 0x34,
};
enum grub_ata_timeout_milliseconds
{
GRUB_ATA_TOUT_STD = 1000, /* 1s standard timeout. */
GRUB_ATA_TOUT_DATA = 10000 /* 10s DATA I/O timeout. */
};
struct grub_ata_device
{
/* IDE port to use. */
int port;
/* IO addresses on which the registers for this device can be
found. */
grub_port_t ioaddress;
grub_port_t ioaddress2;
/* Two devices can be connected to a single cable. Use this field
to select device 0 (commonly known as "master") or device 1
(commonly known as "slave"). */
int device;
/* Addressing methods available for accessing this device. If CHS
is only available, use that. Otherwise use LBA, except for the
high sectors. In that case use LBA48. */
grub_ata_addressing_t addr;
/* Sector count. */
grub_uint64_t size;
/* CHS maximums. */
grub_uint16_t cylinders;
grub_uint16_t heads;
grub_uint16_t sectors_per_track;
/* Set to 0 for ATA, set to 1 for ATAPI. */
int atapi;
struct grub_ata_device *next;
};
grub_err_t EXPORT_FUNC(grub_ata_wait_not_busy) (struct grub_ata_device *dev,
int milliseconds);
grub_err_t EXPORT_FUNC(grub_ata_wait_drq) (struct grub_ata_device *dev,
int rw, int milliseconds);
void EXPORT_FUNC(grub_ata_pio_read) (struct grub_ata_device *dev,
char *buf, grub_size_t size);
static inline void
grub_ata_regset (struct grub_ata_device *dev, int reg, int val)
{
grub_outb (val, dev->ioaddress + reg);
}
static inline grub_uint8_t
grub_ata_regget (struct grub_ata_device *dev, int reg)
{
return grub_inb (dev->ioaddress + reg);
}
static inline void
grub_ata_regset2 (struct grub_ata_device *dev, int reg, int val)
{
grub_outb (val, dev->ioaddress2 + reg);
}
static inline grub_uint8_t
grub_ata_regget2 (struct grub_ata_device *dev, int reg)
{
return grub_inb (dev->ioaddress2 + reg);
}
static inline grub_err_t
grub_ata_check_ready (struct grub_ata_device *dev)
{
if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & GRUB_ATA_STATUS_BUSY)
return grub_ata_wait_not_busy (dev, GRUB_ATA_TOUT_STD);
return GRUB_ERR_NONE;
}
#endif /* ! GRUB_ATA_HEADER */

View file

@ -0,0 +1,37 @@
/*
* 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_AUTH_HEADER
#define GRUB_AUTH_HEADER 1
#include <grub/err.h>
#include <grub/crypto.h>
#define GRUB_AUTH_MAX_PASSLEN 1024
typedef grub_err_t (*grub_auth_callback_t) (const char *, const char *, void *);
grub_err_t grub_auth_register_authentication (const char *user,
grub_auth_callback_t callback,
void *arg);
grub_err_t grub_auth_unregister_authentication (const char *user);
grub_err_t grub_auth_authenticate (const char *user);
grub_err_t grub_auth_deauthenticate (const char *user);
grub_err_t grub_auth_check_authentication (const char *userlist);
#endif /* ! GRUB_AUTH_HEADER */

View file

@ -0,0 +1,78 @@
/*
* 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/>.
*/
/* This file provides some abstractions so that the same code compiles with
both efi and efiemu
*/
#ifndef GRUB_AUTOEFI_HEADER
#define GRUB_AUTOEFI_HEADER 1
#ifdef GRUB_MACHINE_EFI
# 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;
};
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_MACHINE_MEMORY_AVAILABLE
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_MACHINE_MEMORY_RESERVED
# ifdef GRUB_MACHINE_MEMORY_ACPI
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_MACHINE_MEMORY_ACPI
# endif
# ifdef GRUB_MACHINE_MEMORY_NVS
# define GRUB_AUTOEFI_MEMORY_NVS GRUB_MACHINE_MEMORY_NVS
# endif
# ifdef GRUB_MACHINE_MEMORY_CODE
# define GRUB_AUTOEFI_MEMORY_CODE GRUB_MACHINE_MEMORY_CODE
# endif
# define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
# define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
# define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
# define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
# define SYSTEM_TABLE(x) (grub_efi_system_table->x)
# define EFI_PRESENT 1
#else
# 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
# define GRUB_AUTOEFI_MEMORY_NVS GRUB_EFIEMU_MEMORY_NVS
# define GRUB_AUTOEFI_MEMORY_CODE GRUB_EFIEMU_MEMORY_CODE
# define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
# define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
# define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
# define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
# define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
# define grub_efi_allocate_pages(x,y) (x)
# define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
# define EFI_PRESENT 1
#endif
#endif

View file

@ -0,0 +1,70 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 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_BITMAP_HEADER
#define GRUB_BITMAP_HEADER 1
#include <grub/err.h>
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/video.h>
struct grub_video_bitmap
{
/* Bitmap format description. */
struct grub_video_mode_info mode_info;
/* Pointer to bitmap data formatted according to mode_info. */
void *data;
};
struct grub_video_bitmap_reader
{
/* File extension for this bitmap type (including dot). */
const char *extension;
/* Reader function to load bitmap. */
grub_err_t (*reader) (struct grub_video_bitmap **bitmap,
const char *filename);
/* Next reader. */
struct grub_video_bitmap_reader *next;
};
typedef struct grub_video_bitmap_reader *grub_video_bitmap_reader_t;
void EXPORT_FUNC (grub_video_bitmap_reader_register) (grub_video_bitmap_reader_t reader);
void EXPORT_FUNC (grub_video_bitmap_reader_unregister) (grub_video_bitmap_reader_t reader);
grub_err_t EXPORT_FUNC (grub_video_bitmap_create) (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format);
grub_err_t EXPORT_FUNC (grub_video_bitmap_destroy) (struct grub_video_bitmap *bitmap);
grub_err_t EXPORT_FUNC (grub_video_bitmap_load) (struct grub_video_bitmap **bitmap,
const char *filename);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_width) (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_height) (struct grub_video_bitmap *bitmap);
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);
void *EXPORT_FUNC (grub_video_bitmap_get_data) (struct grub_video_bitmap *bitmap);
#endif /* ! GRUB_BITMAP_HEADER */

View file

@ -0,0 +1,49 @@
/* bitmap_scale.h - Bitmap scaling functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_BITMAP_SCALE_HEADER
#define GRUB_BITMAP_SCALE_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/bitmap_scale.h>
enum grub_video_bitmap_scale_method
{
/* Choose the fastest interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_FASTEST,
/* Choose the highest quality interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST,
/* Specific algorithms: */
/* Nearest neighbor interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_NEAREST,
/* Bilinear interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BILINEAR
};
grub_err_t
EXPORT_FUNC (grub_video_bitmap_create_scaled) (struct grub_video_bitmap **dst,
int dst_width, int dst_height,
struct grub_video_bitmap *src,
enum
grub_video_bitmap_scale_method
scale_method);
#endif /* ! GRUB_BITMAP_SCALE_HEADER */

View file

@ -0,0 +1,27 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 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_BOOT_HEADER
#define GRUB_BOOT_HEADER 1
#define GRUB_BOOT_VERSION_MAJOR 4
#define GRUB_BOOT_VERSION_MINOR 0
#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \
| GRUB_BOOT_VERSION_MAJOR)
#endif /* ! GRUB_BOOT_HEADER */

View file

@ -0,0 +1,89 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2004,2007 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_BSDLABEL_PARTITION_HEADER
#define GRUB_BSDLABEL_PARTITION_HEADER 1
/* Constants for BSD disk label. */
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
/* BSD partition types. */
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
/* FreeBSD-specific types. */
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
/* NetBSD-specific types. */
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
/* OpenBSD-specific types. */
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
/* The BSD partition entry. */
struct grub_partition_bsd_entry
{
grub_uint32_t size;
grub_uint32_t offset;
grub_uint32_t fragment_size;
grub_uint8_t fs_type;
grub_uint8_t fs_fragments;
grub_uint16_t fs_cylinders;
} __attribute__ ((packed));
/* The BSD disk label. Only define members useful for GRUB. */
struct grub_partition_bsd_disk_label
{
grub_uint32_t magic;
grub_uint8_t padding[128];
grub_uint32_t magic2;
grub_uint16_t checksum;
grub_uint16_t num_partitions;
grub_uint32_t boot_size;
grub_uint32_t superblock_size;
} __attribute__ ((packed));
#endif /* ! GRUB_PC_PARTITION_HEADER */

View file

@ -0,0 +1,28 @@
/* bufio.h - prototypes for bufio */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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_BUFIO_H
#define GRUB_BUFIO_H 1
#include <grub/file.h>
grub_file_t EXPORT_FUNC (grub_bufio_open) (grub_file_t io, int size);
grub_file_t EXPORT_FUNC (grub_buffile_open) (const char *name, int size);
#endif /* ! GRUB_BUFIO_H */

View file

@ -0,0 +1,36 @@
/* cache.h - Flush the processor's cache. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007 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_CACHE_H
#define GRUB_CACHE_H 1
#include <grub/symbol.h>
#include <grub/types.h>
#if defined (__i386__) || defined (__x86_64__)
static inline void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
}
#else
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#endif
#endif /* ! GRUB_CACHE_HEADER */

View file

@ -0,0 +1,121 @@
/*
* 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;
}
/* Convert UCS-4 to UTF-8. */
char *grub_ucs4_to_utf8_alloc (grub_uint32_t *src, grub_size_t size);
int
grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
#endif

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_CMOS_H
#define GRUB_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#include <grub/cpu/cmos.h>
#define GRUB_CMOS_INDEX_SECOND 0
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
#define GRUB_CMOS_INDEX_MINUTE 2
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
#define GRUB_CMOS_INDEX_HOUR 4
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
#define GRUB_CMOS_INDEX_MONTH 8
#define GRUB_CMOS_INDEX_YEAR 9
#define GRUB_CMOS_INDEX_STATUS_A 0xA
#define GRUB_CMOS_INDEX_STATUS_B 0xB
#define GRUB_CMOS_INDEX_STATUS_C 0xC
#define GRUB_CMOS_INDEX_STATUS_D 0xD
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
#define GRUB_CMOS_STATUS_B_24HOUR 2
#define GRUB_CMOS_STATUS_B_BINARY 4
static inline grub_uint8_t
grub_bcd_to_num (grub_uint8_t a)
{
return ((a >> 4) * 10 + (a & 0xF));
}
static inline grub_uint8_t
grub_num_to_bcd (grub_uint8_t a)
{
return (((a / 10) << 4) + (a % 10));
}
static inline grub_uint8_t
grub_cmos_read (grub_uint8_t index)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
return grub_inb (GRUB_CMOS_DATA_REG);
}
static inline void
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
#endif /* GRUB_CMOS_H */

View file

@ -0,0 +1,127 @@
/*
* 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_COMMAND_HEADER
#define GRUB_COMMAND_HEADER 1
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/list.h>
/* Can be run in the command-line. */
#define GRUB_COMMAND_FLAG_CMDLINE 0x1
/* Can be run in the menu. */
#define GRUB_COMMAND_FLAG_MENU 0x2
/* Can be run in both interfaces. */
#define GRUB_COMMAND_FLAG_BOTH 0x3
/* Only for the command title. */
#define GRUB_COMMAND_FLAG_TITLE 0x4
/* Don't print the command on booting. */
#define GRUB_COMMAND_FLAG_NO_ECHO 0x8
/* This is an extended command. */
#define GRUB_COMMAND_FLAG_EXTCMD 0x10
/* This is an dynamic command. */
#define GRUB_COMMAND_FLAG_DYNCMD 0x20
struct grub_command;
typedef grub_err_t (*grub_command_func_t) (struct grub_command *cmd,
int argc, char **argv);
/* The command description. */
struct grub_command
{
/* The next element. */
struct grub_command *next;
/* The name. */
const char *name;
/* The priority. */
int prio;
/* The callback function. */
grub_command_func_t func;
/* The flags. */
unsigned flags;
/* The summary of the command usage. */
const char *summary;
/* The description of the command. */
const char *description;
/* Arbitrary data. */
void *data;
};
typedef struct grub_command *grub_command_t;
extern grub_command_t EXPORT_VAR(grub_command_list);
grub_command_t
EXPORT_FUNC(grub_register_command_prio) (const char *name,
grub_command_func_t func,
const char *summary,
const char *description,
int prio);
void EXPORT_FUNC(grub_unregister_command) (grub_command_t cmd);
static inline grub_command_t
grub_register_command (const char *name,
grub_command_func_t func,
const char *summary,
const char *description)
{
return grub_register_command_prio (name, func, summary, description, 0);
}
static inline grub_command_t
grub_register_command_p1 (const char *name,
grub_command_func_t func,
const char *summary,
const char *description)
{
return grub_register_command_prio (name, func, summary, description, 1);
}
static inline grub_command_t
grub_command_find (const char *name)
{
return grub_named_list_find (GRUB_AS_NAMED_LIST (grub_command_list), name);
}
static inline grub_err_t
grub_command_execute (const char *name, int argc, char **argv)
{
grub_command_t cmd;
cmd = grub_command_find (name);
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
}
static inline int
grub_command_iterate (int (*func) (grub_command_t))
{
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
(grub_list_hook_t) func);
}
void grub_register_core_commands (void);
#endif /* ! GRUB_COMMAND_HEADER */

View file

@ -0,0 +1,275 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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/>.
*/
/* Contains elements based on gcrypt-module.h and gcrypt.h.in.
If it's changed please update this file. */
#ifndef GRUB_CRYPTO_HEADER
#define GRUB_CRYPTO_HEADER 1
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
typedef enum
{
GPG_ERR_NO_ERROR,
GPG_ERR_BAD_MPI,
GPG_ERR_BAD_SECKEY,
GPG_ERR_BAD_SIGNATURE,
GPG_ERR_CIPHER_ALGO,
GPG_ERR_CONFLICT,
GPG_ERR_DECRYPT_FAILED,
GPG_ERR_DIGEST_ALGO,
GPG_ERR_GENERAL,
GPG_ERR_INTERNAL,
GPG_ERR_INV_ARG,
GPG_ERR_INV_CIPHER_MODE,
GPG_ERR_INV_FLAG,
GPG_ERR_INV_KEYLEN,
GPG_ERR_INV_OBJ,
GPG_ERR_INV_OP,
GPG_ERR_INV_SEXP,
GPG_ERR_INV_VALUE,
GPG_ERR_MISSING_VALUE,
GPG_ERR_NO_ENCRYPTION_SCHEME,
GPG_ERR_NO_OBJ,
GPG_ERR_NO_PRIME,
GPG_ERR_NO_SIGNATURE_SCHEME,
GPG_ERR_NOT_FOUND,
GPG_ERR_NOT_IMPLEMENTED,
GPG_ERR_NOT_SUPPORTED,
GPG_ERROR_CFLAGS,
GPG_ERR_PUBKEY_ALGO,
GPG_ERR_SELFTEST_FAILED,
GPG_ERR_TOO_SHORT,
GPG_ERR_UNSUPPORTED,
GPG_ERR_WEAK_KEY,
GPG_ERR_WRONG_KEY_USAGE,
GPG_ERR_WRONG_PUBKEY_ALGO,
GPG_ERR_OUT_OF_MEMORY
} gcry_err_code_t;
#define gpg_err_code_t gcry_err_code_t
#define gpg_error_t gcry_err_code_t
enum gcry_cipher_modes
{
GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */
GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */
GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */
GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */
GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */
GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */
GCRY_CIPHER_MODE_CTR = 6 /* Counter. */
};
/* Type for the cipher_setkey function. */
typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
const unsigned char *key,
unsigned keylen);
/* Type for the cipher_encrypt function. */
typedef void (*gcry_cipher_encrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf);
/* Type for the cipher_decrypt function. */
typedef void (*gcry_cipher_decrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf);
/* Type for the cipher_stencrypt function. */
typedef void (*gcry_cipher_stencrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf,
unsigned int n);
/* Type for the cipher_stdecrypt function. */
typedef void (*gcry_cipher_stdecrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf,
unsigned int n);
typedef struct gcry_cipher_oid_spec
{
const char *oid;
int mode;
} gcry_cipher_oid_spec_t;
/* Module specification structure for ciphers. */
typedef struct gcry_cipher_spec
{
const char *name;
const char **aliases;
gcry_cipher_oid_spec_t *oids;
grub_size_t blocksize;
grub_size_t keylen;
grub_size_t contextsize;
gcry_cipher_setkey_t setkey;
gcry_cipher_encrypt_t encrypt;
gcry_cipher_decrypt_t decrypt;
gcry_cipher_stencrypt_t stencrypt;
gcry_cipher_stdecrypt_t stdecrypt;
struct gcry_cipher_spec *next;
} gcry_cipher_spec_t;
/* Type for the md_init function. */
typedef void (*gcry_md_init_t) (void *c);
/* Type for the md_write function. */
typedef void (*gcry_md_write_t) (void *c, const void *buf, grub_size_t nbytes);
/* Type for the md_final function. */
typedef void (*gcry_md_final_t) (void *c);
/* Type for the md_read function. */
typedef unsigned char *(*gcry_md_read_t) (void *c);
typedef struct gcry_md_oid_spec
{
const char *oidstring;
} gcry_md_oid_spec_t;
/* Module specification structure for message digests. */
typedef struct gcry_md_spec
{
const char *name;
unsigned char *asnoid;
int asnlen;
gcry_md_oid_spec_t *oids;
grub_size_t mdlen;
gcry_md_init_t init;
gcry_md_write_t write;
gcry_md_final_t final;
gcry_md_read_t read;
grub_size_t contextsize; /* allocate this amount of context */
/* Block size, needed for HMAC. */
grub_size_t blocksize;
struct gcry_md_spec *next;
} gcry_md_spec_t;
struct grub_crypto_cipher_handle
{
const struct gcry_cipher_spec *cipher;
char ctx[0];
};
typedef struct grub_crypto_cipher_handle *grub_crypto_cipher_handle_t;
struct grub_crypto_hmac_handle;
const gcry_cipher_spec_t *
grub_crypto_lookup_cipher_by_name (const char *name);
grub_crypto_cipher_handle_t
grub_crypto_cipher_open (const struct gcry_cipher_spec *cipher);
gcry_err_code_t
grub_crypto_cipher_set_key (grub_crypto_cipher_handle_t cipher,
const unsigned char *key,
unsigned keylen);
void
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher);
void
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size);
gcry_err_code_t
grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size);
gcry_err_code_t
grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size);
gcry_err_code_t
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size,
void *iv_in);
gcry_err_code_t
grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size,
void *iv);
void
grub_cipher_register (gcry_cipher_spec_t *cipher);
void
grub_cipher_unregister (gcry_cipher_spec_t *cipher);
void
grub_md_register (gcry_md_spec_t *digest);
void
grub_md_unregister (gcry_md_spec_t *cipher);
void
grub_crypto_hash (const gcry_md_spec_t *hash, void *out, const void *in,
grub_size_t inlen);
const gcry_md_spec_t *
grub_crypto_lookup_md_by_name (const char *name);
grub_err_t
grub_crypto_gcry_error (gcry_err_code_t in);
void grub_burn_stack (grub_size_t size);
struct grub_crypto_hmac_handle *
grub_crypto_hmac_init (const struct gcry_md_spec *md,
const void *key, grub_size_t keylen);
void
grub_crypto_hmac_write (struct grub_crypto_hmac_handle *hnd, void *data,
grub_size_t datalen);
gcry_err_code_t
grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out);
gcry_err_code_t
grub_crypto_hmac_buffer (const struct gcry_md_spec *md,
const void *key, grub_size_t keylen,
void *data, grub_size_t datalen, void *out);
extern gcry_md_spec_t _gcry_digest_spec_md5;
extern gcry_md_spec_t _gcry_digest_spec_sha1;
extern gcry_md_spec_t _gcry_digest_spec_sha256;
extern gcry_md_spec_t _gcry_digest_spec_sha512;
#define GRUB_MD_MD5 ((const gcry_md_spec_t *) &_gcry_digest_spec_md5)
#define GRUB_MD_SHA1 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha1)
#define GRUB_MD_SHA256 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha256)
#define GRUB_MD_SHA512 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha512)
/* Implement PKCS#5 PBKDF2 as per RFC 2898. The PRF to use is HMAC variant
of digest supplied by MD. Inputs are the password P of length PLEN,
the salt S of length SLEN, the iteration counter C (> 0), and the
desired derived output length DKLEN. Output buffer is DK which
must have room for at least DKLEN octets. The output buffer will
be filled with the derived data. */
gcry_err_code_t
grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
const grub_uint8_t *P, grub_size_t Plen,
const grub_uint8_t *S, grub_size_t Slen,
unsigned int c,
grub_uint8_t *DK, grub_size_t dkLen);
int
grub_crypto_memcmp (const void *a, const void *b, grub_size_t n);
int
grub_password_get (char buf[], unsigned buf_size);
/* For indistinguishibility. */
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
extern void (*grub_crypto_autoload_hook) (const char *name);
#endif

View file

@ -0,0 +1,55 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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 KERNEL_DATETIME_HEADER
#define KERNEL_DATETIME_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
struct grub_datetime
{
grub_uint16_t year;
grub_uint8_t month;
grub_uint8_t day;
grub_uint8_t hour;
grub_uint8_t minute;
grub_uint8_t second;
};
/* Return date and time. */
#ifdef GRUB_MACHINE_EMU
grub_err_t EXPORT_FUNC(grub_get_datetime) (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t EXPORT_FUNC(grub_set_datetime) (struct grub_datetime *datetime);
#else
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
#endif
int grub_get_weekday (struct grub_datetime *datetime);
char *grub_get_weekday_name (struct grub_datetime *datetime);
void grub_unixtime2datetime (grub_int32_t nix,
struct grub_datetime *datetime);
#endif /* ! KERNEL_DATETIME_HEADER */

View file

@ -0,0 +1,41 @@
/* device.h - device manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007 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_DEVICE_HEADER
#define GRUB_DEVICE_HEADER 1
#include <grub/symbol.h>
#include <grub/err.h>
struct grub_disk;
struct grub_net;
struct grub_fs;
struct grub_device
{
struct grub_disk *disk;
struct grub_net *net;
};
typedef struct grub_device *grub_device_t;
grub_device_t EXPORT_FUNC(grub_device_open) (const char *name);
grub_err_t EXPORT_FUNC(grub_device_close) (grub_device_t device);
int EXPORT_FUNC(grub_device_iterate) (int (*hook) (const char *name));
#endif /* ! GRUB_DEVICE_HEADER */

View file

@ -0,0 +1,177 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_DISK_HEADER
#define GRUB_DISK_HEADER 1
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/device.h>
/* These are used to set a device id. When you add a new disk device,
you must define a new id for it here. */
enum grub_disk_dev_id
{
GRUB_DISK_DEVICE_BIOSDISK_ID,
GRUB_DISK_DEVICE_OFDISK_ID,
GRUB_DISK_DEVICE_LOOPBACK_ID,
GRUB_DISK_DEVICE_EFIDISK_ID,
GRUB_DISK_DEVICE_RAID_ID,
GRUB_DISK_DEVICE_LVM_ID,
GRUB_DISK_DEVICE_HOST_ID,
GRUB_DISK_DEVICE_ATA_ID,
GRUB_DISK_DEVICE_MEMDISK_ID,
GRUB_DISK_DEVICE_NAND_ID,
GRUB_DISK_DEVICE_UUID_ID,
GRUB_DISK_DEVICE_PXE_ID,
GRUB_DISK_DEVICE_SCSI_ID,
GRUB_DISK_DEVICE_FILE_ID,
GRUB_DISK_DEVICE_LUKS_ID
};
struct grub_disk;
#ifdef GRUB_UTIL
struct grub_disk_memberlist;
#endif
/* Disk device. */
struct grub_disk_dev
{
/* The device name. */
const char *name;
/* The device id used by the cache manager. */
enum grub_disk_dev_id id;
/* Call HOOK with each device name, until HOOK returns non-zero. */
int (*iterate) (int (*hook) (const char *name));
/* Open the device named NAME, and set up DISK. */
grub_err_t (*open) (const char *name, struct grub_disk *disk);
/* Close the disk DISK. */
void (*close) (struct grub_disk *disk);
/* Read SIZE sectors from the sector SECTOR of the disk DISK into BUF. */
grub_err_t (*read) (struct grub_disk *disk, grub_disk_addr_t sector,
grub_size_t size, char *buf);
/* Write SIZE sectors from BUF into the sector SECTOR of the disk DISK. */
grub_err_t (*write) (struct grub_disk *disk, grub_disk_addr_t sector,
grub_size_t size, const char *buf);
#ifdef GRUB_UTIL
struct grub_disk_memberlist *(*memberlist) (struct grub_disk *disk);
#endif
/* The next disk device. */
struct grub_disk_dev *next;
};
typedef struct grub_disk_dev *grub_disk_dev_t;
struct grub_partition;
/* Disk. */
struct grub_disk
{
/* The disk name. */
const char *name;
/* The underlying disk device. */
grub_disk_dev_t dev;
/* The total number of sectors. */
grub_uint64_t total_sectors;
/* If partitions can be stored. */
int has_partitions;
/* The id used by the disk cache manager. */
unsigned long id;
/* The partition information. This is machine-specific. */
struct grub_partition *partition;
/* Called when a sector was read. OFFSET is between 0 and
the sector size minus 1, and LENGTH is between 0 and the sector size. */
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length);
/* Device-specific data. */
void *data;
};
typedef struct grub_disk *grub_disk_t;
#ifdef GRUB_UTIL
struct grub_disk_memberlist
{
grub_disk_t disk;
struct grub_disk_memberlist *next;
};
typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
#endif
/* The sector size. */
#define GRUB_DISK_SECTOR_SIZE 0x200
#define GRUB_DISK_SECTOR_BITS 9
/* The maximum number of disk caches. */
#define GRUB_DISK_CACHE_NUM 1021
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
/* This is called from the memory manager. */
void grub_disk_cache_invalidate_all (void);
void EXPORT_FUNC(grub_disk_dev_register) (grub_disk_dev_t dev);
void EXPORT_FUNC(grub_disk_dev_unregister) (grub_disk_dev_t dev);
int EXPORT_FUNC(grub_disk_dev_iterate) (int (*hook) (const char *name));
grub_disk_t EXPORT_FUNC(grub_disk_open) (const char *name);
void EXPORT_FUNC(grub_disk_close) (grub_disk_t disk);
grub_err_t EXPORT_FUNC(grub_disk_read) (grub_disk_t disk,
grub_disk_addr_t sector,
grub_off_t offset,
grub_size_t size,
void *buf);
grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
grub_disk_addr_t sector,
grub_off_t offset,
grub_size_t size,
const void *buf);
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
/* ATA pass through parameters and function. */
struct grub_disk_ata_pass_through_parms
{
grub_uint8_t taskfile[8];
void * buffer;
int size;
};
extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
struct grub_disk_ata_pass_through_parms *);
#endif /* ! GRUB_DISK_HEADER */

119
grub-core/include/grub/dl.h Normal file
View file

@ -0,0 +1,119 @@
/* dl.h - types and prototypes for loadable module support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2005,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_DL_H
#define GRUB_DL_H 1
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/elf.h>
/*
* Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules
* to collect module names, so we define them only when they are not
* defined already.
*/
#ifndef GRUB_MOD_INIT
#define GRUB_MOD_INIT(name) \
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
void grub_##name##_init (void); \
void \
grub_##name##_init (void) { grub_mod_init (0); } \
static void \
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
#endif
#ifndef GRUB_MOD_FINI
#define GRUB_MOD_FINI(name) \
static void grub_mod_fini (void) __attribute__ ((used)); \
void grub_##name##_fini (void); \
void \
grub_##name##_fini (void) { grub_mod_fini (); } \
static void \
grub_mod_fini (void)
#endif
#ifdef APPLE_CC
#define GRUB_MOD_NAME(name) \
static char grub_modname[] __attribute__ ((section ("_modname, _modname"), used)) = #name;
#define GRUB_MOD_DEP(name) \
__asm__ (".section _moddeps, _moddeps\n.asciz \"" #name "\"\n")
#else
#define GRUB_MOD_NAME(name) \
__asm__ (".section .modname\n.asciz \"" #name "\"\n")
#define GRUB_MOD_DEP(name) \
__asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
#endif
struct grub_dl_segment
{
struct grub_dl_segment *next;
void *addr;
grub_size_t size;
unsigned section;
};
typedef struct grub_dl_segment *grub_dl_segment_t;
struct grub_dl;
struct grub_dl_dep
{
struct grub_dl_dep *next;
struct grub_dl *mod;
};
typedef struct grub_dl_dep *grub_dl_dep_t;
struct grub_dl
{
char *name;
int ref_count;
grub_dl_dep_t dep;
grub_dl_segment_t segment;
Elf_Sym *symtab;
void (*init) (struct grub_dl *mod);
void (*fini) (void);
};
typedef struct grub_dl *grub_dl_t;
grub_dl_t EXPORT_FUNC(grub_dl_load_file) (const char *filename);
grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
void grub_dl_unload_unneeded (void);
void grub_dl_unload_all (void);
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
grub_dl_t mod);
grub_err_t grub_arch_dl_check_header (void *ehdr);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#if defined (_mips)
#define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void);
#endif
#endif /* ! GRUB_DL_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2006,2007 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_EFI_CONSOLE_HEADER
#define GRUB_EFI_CONSOLE_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
/* Initialize the console system. */
void grub_console_init (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif /* ! GRUB_EFI_CONSOLE_HEADER */

View file

@ -0,0 +1,57 @@
/* console_control.h - definitions of the console control protocol */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 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/>.
*/
/* The console control protocol is not a part of the EFI spec,
but defined in Intel's Sample Implementation. */
#ifndef GRUB_EFI_CONSOLE_CONTROL_HEADER
#define GRUB_EFI_CONSOLE_CONTROL_HEADER 1
#define GRUB_EFI_CONSOLE_CONTROL_GUID \
{ 0xf42f7782, 0x12e, 0x4c12, \
{ 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } \
}
enum grub_efi_screen_mode
{
GRUB_EFI_SCREEN_TEXT,
GRUB_EFI_SCREEN_GRAPHICS,
GRUB_EFI_SCREEN_TEXT_MAX_VALUE
};
typedef enum grub_efi_screen_mode grub_efi_screen_mode_t;
struct grub_efi_console_control_protocol
{
grub_efi_status_t
(*get_mode) (struct grub_efi_console_control_protocol *this,
grub_efi_screen_mode_t *mode,
grub_efi_boolean_t *uga_exists,
grub_efi_boolean_t *std_in_locked);
grub_efi_status_t
(*set_mode) (struct grub_efi_console_control_protocol *this,
grub_efi_screen_mode_t mode);
grub_efi_status_t
(*lock_std_in) (struct grub_efi_console_control_protocol *this,
grub_efi_char16_t *password);
};
typedef struct grub_efi_console_control_protocol grub_efi_console_control_protocol_t;
#endif /* ! GRUB_EFI_CONSOLE_CONTROL_HEADER */

View file

@ -0,0 +1,33 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 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_EFI_DISK_HEADER
#define GRUB_EFI_DISK_HEADER 1
#include <grub/efi/api.h>
#include <grub/symbol.h>
#include <grub/disk.h>
grub_efi_handle_t
EXPORT_FUNC(grub_efidisk_get_device_handle) (grub_disk_t disk);
char *EXPORT_FUNC(grub_efidisk_get_device_name) (grub_efi_handle_t *handle);
void grub_efidisk_init (void);
void grub_efidisk_fini (void);
#endif /* ! GRUB_EFI_DISK_HEADER */

View file

@ -0,0 +1,73 @@
/* efi.h - declare variables and functions for EFI support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_EFI_EFI_HEADER
#define GRUB_EFI_EFI_HEADER 1
#include <grub/types.h>
#include <grub/dl.h>
#include <grub/efi/api.h>
/* Functions. */
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *registration);
grub_efi_handle_t *
EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type,
grub_efi_guid_t *protocol,
void *search_key,
grub_efi_uintn_t *num_handles);
void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
grub_efi_guid_t *protocol,
grub_efi_uint32_t attributes);
int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
void *
EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
int
EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
grub_efi_memory_descriptor_t *memory_map,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
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);
void grub_efi_init (void);
void grub_efi_fini (void);
void grub_efi_set_prefix (void);
/* Variables. */
extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
#endif /* ! GRUB_EFI_EFI_HEADER */

View file

@ -0,0 +1,96 @@
/*
* 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_EFI_GOP_HEADER
#define GRUB_EFI_GOP_HEADER 1
/* Based on UEFI specification. */
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,
GRUB_EFI_GOT_BITMASK
}
grub_efi_gop_pixel_format_t;
struct grub_efi_gop_pixel_bitmask
{
grub_uint32_t r;
grub_uint32_t g;
grub_uint32_t b;
grub_uint32_t a;
};
struct grub_efi_gop_mode_info
{
grub_efi_uint32_t version;
grub_efi_uint32_t width;
grub_efi_uint32_t height;
grub_efi_gop_pixel_format_t pixel_format;
struct grub_efi_gop_pixel_bitmask pixel_bitmask;
grub_efi_uint32_t pixels_per_scanline;
};
struct grub_efi_gop_mode
{
grub_efi_uint32_t max_mode;
grub_efi_uint32_t mode;
struct grub_efi_gop_mode_info *info;
grub_efi_uintn_t info_size;
grub_efi_physical_address_t fb_base;
grub_efi_uintn_t fb_size;
};
/* Forward declaration. */
struct grub_efi_gop;
typedef grub_efi_status_t
(*grub_efi_gop_query_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number,
grub_efi_uintn_t *size_of_info,
struct grub_efi_gop_mode_info **info);
typedef grub_efi_status_t
(*grub_efi_gop_set_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number);
typedef grub_efi_status_t
(*grub_efi_gop_blt_t) (struct grub_efi_gop *this,
void *buffer,
grub_efi_uintn_t operation,
grub_efi_uintn_t sx,
grub_efi_uintn_t sy,
grub_efi_uintn_t dx,
grub_efi_uintn_t dy,
grub_efi_uintn_t width,
grub_efi_uintn_t height,
grub_efi_uintn_t delta);
struct grub_efi_gop
{
grub_efi_gop_query_mode_t query_mode;
grub_efi_gop_set_mode_t set_mode;
grub_efi_gop_blt_t blt;
struct grub_efi_gop_mode *mode;
};
#endif

View file

@ -0,0 +1,48 @@
/*
* 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_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#define GRUB_MMAP_REGISTER_BY_FIRMWARE 1
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_RESERVED 2
#define GRUB_MACHINE_MEMORY_ACPI 3
#define GRUB_MACHINE_MEMORY_NVS 4
#define GRUB_MACHINE_MEMORY_CODE 5
#define GRUB_MACHINE_MEMORY_MAX_TYPE 5
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 6
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
int type, int handle);
grub_err_t grub_machine_mmap_unregister (int handle);
grub_uint64_t grub_mmap_get_post64 (void);
grub_uint64_t grub_mmap_get_upper (void);
grub_uint64_t grub_mmap_get_lower (void);
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */

View file

@ -0,0 +1,276 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_EFI_PE32_HEADER
#define GRUB_EFI_PE32_HEADER 1
#include <grub/types.h>
/* The MSDOS compatibility stub. This was copied from the output of
objcopy, and it is not necessary to care about what this means. */
#define GRUB_PE32_MSDOS_STUB \
{ \
0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, \
0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, \
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, \
0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, \
0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, \
0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, \
0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, \
0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, \
0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, \
0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, \
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \
}
#define GRUB_PE32_MSDOS_STUB_SIZE 0x80
/* According to the spec, the minimal alignment is 512 bytes...
But some examples (such as EFI drivers in the Intel
Sample Implementation) use 32 bytes (0x20) instead, and it seems
to be working. For now, GRUB uses 512 bytes for safety. */
#define GRUB_PE32_SECTION_ALIGNMENT 0x200
#define GRUB_PE32_FILE_ALIGNMENT GRUB_PE32_SECTION_ALIGNMENT
struct grub_pe32_coff_header
{
grub_uint16_t machine;
grub_uint16_t num_sections;
grub_uint32_t time;
grub_uint32_t symtab_offset;
grub_uint32_t num_symbols;
grub_uint16_t optional_header_size;
grub_uint16_t characteristics;
};
#define GRUB_PE32_MACHINE_I386 0x14c
#define GRUB_PE32_MACHINE_X86_64 0x8664
#define GRUB_PE32_RELOCS_STRIPPED 0x0001
#define GRUB_PE32_EXECUTABLE_IMAGE 0x0002
#define GRUB_PE32_LINE_NUMS_STRIPPED 0x0004
#define GRUB_PE32_LOCAL_SYMS_STRIPPED 0x0008
#define GRUB_PE32_AGGRESSIVE_WS_TRIM 0x0010
#define GRUB_PE32_LARGE_ADDRESS_AWARE 0x0020
#define GRUB_PE32_16BIT_MACHINE 0x0040
#define GRUB_PE32_BYTES_REVERSED_LO 0x0080
#define GRUB_PE32_32BIT_MACHINE 0x0100
#define GRUB_PE32_DEBUG_STRIPPED 0x0200
#define GRUB_PE32_REMOVABLE_RUN_FROM_SWAP 0x0400
#define GRUB_PE32_SYSTEM 0x1000
#define GRUB_PE32_DLL 0x2000
#define GRUB_PE32_UP_SYSTEM_ONLY 0x4000
#define GRUB_PE32_BYTES_REVERSED_HI 0x8000
struct grub_pe32_data_directory
{
grub_uint32_t rva;
grub_uint32_t size;
};
struct grub_pe32_optional_header
{
grub_uint16_t magic;
grub_uint8_t major_linker_version;
grub_uint8_t minor_linker_version;
grub_uint32_t code_size;
grub_uint32_t data_size;
grub_uint32_t bss_size;
grub_uint32_t entry_addr;
grub_uint32_t code_base;
#if GRUB_TARGET_SIZEOF_VOID_P == 4
grub_uint32_t data_base;
grub_uint32_t image_base;
#else
grub_uint64_t image_base;
#endif
grub_uint32_t section_alignment;
grub_uint32_t file_alignment;
grub_uint16_t major_os_version;
grub_uint16_t minor_os_version;
grub_uint16_t major_image_version;
grub_uint16_t minor_image_version;
grub_uint16_t major_subsystem_version;
grub_uint16_t minor_subsystem_version;
grub_uint32_t reserved;
grub_uint32_t image_size;
grub_uint32_t header_size;
grub_uint32_t checksum;
grub_uint16_t subsystem;
grub_uint16_t dll_characteristics;
#if GRUB_TARGET_SIZEOF_VOID_P == 4
grub_uint32_t stack_reserve_size;
grub_uint32_t stack_commit_size;
grub_uint32_t heap_reserve_size;
grub_uint32_t heap_commit_size;
#else
grub_uint64_t stack_reserve_size;
grub_uint64_t stack_commit_size;
grub_uint64_t heap_reserve_size;
grub_uint64_t heap_commit_size;
#endif
grub_uint32_t loader_flags;
grub_uint32_t num_data_directories;
/* Data directories. */
struct grub_pe32_data_directory export_table;
struct grub_pe32_data_directory import_table;
struct grub_pe32_data_directory resource_table;
struct grub_pe32_data_directory exception_table;
struct grub_pe32_data_directory certificate_table;
struct grub_pe32_data_directory base_relocation_table;
struct grub_pe32_data_directory debug;
struct grub_pe32_data_directory architecture;
struct grub_pe32_data_directory global_ptr;
struct grub_pe32_data_directory tls_table;
struct grub_pe32_data_directory load_config_table;
struct grub_pe32_data_directory bound_import;
struct grub_pe32_data_directory iat;
struct grub_pe32_data_directory delay_import_descriptor;
struct grub_pe32_data_directory com_runtime_header;
struct grub_pe32_data_directory reserved_entry;
};
#if GRUB_TARGET_SIZEOF_VOID_P == 4
#define GRUB_PE32_PE32_MAGIC 0x10b
#else
#define GRUB_PE32_PE32_MAGIC 0x20b
#endif
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
#define GRUB_PE32_NUM_DATA_DIRECTORIES 16
struct grub_pe32_section_table
{
char name[8];
grub_uint32_t virtual_size;
grub_uint32_t virtual_address;
grub_uint32_t raw_data_size;
grub_uint32_t raw_data_offset;
grub_uint32_t relocations_offset;
grub_uint32_t line_numbers_offset;
grub_uint16_t num_relocations;
grub_uint16_t num_line_numbers;
grub_uint32_t characteristics;
};
#define GRUB_PE32_SCN_CNT_CODE 0x00000020
#define GRUB_PE32_SCN_CNT_INITIALIZED_DATA 0x00000040
#define GRUB_PE32_SCN_MEM_DISCARDABLE 0x02000000
#define GRUB_PE32_SCN_MEM_EXECUTE 0x20000000
#define GRUB_PE32_SCN_MEM_READ 0x40000000
#define GRUB_PE32_SCN_MEM_WRITE 0x80000000
#define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000
#define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000
#define GRUB_PE32_SCN_ALIGN_4BYTES 0x00300000
#define GRUB_PE32_SCN_ALIGN_8BYTES 0x00400000
#define GRUB_PE32_SCN_ALIGN_16BYTES 0x00500000
#define GRUB_PE32_SCN_ALIGN_32BYTES 0x00600000
#define GRUB_PE32_SCN_ALIGN_64BYTES 0x00700000
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
#define GRUB_PE32_SCN_ALIGN_MASK 7
struct grub_pe32_header
{
/* This should be filled in with GRUB_PE32_MSDOS_STUB. */
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
/* This is always PE\0\0. */
char signature[4];
/* The COFF file header. */
struct grub_pe32_coff_header coff_header;
/* The Optional header. */
struct grub_pe32_optional_header optional_header;
};
struct grub_pe32_fixup_block
{
grub_uint32_t page_rva;
grub_uint32_t block_size;
grub_uint16_t entries[0];
};
#define GRUB_PE32_FIXUP_ENTRY(type, offset) (((type) << 12) | (offset))
#define GRUB_PE32_REL_BASED_ABSOLUTE 0
#define GRUB_PE32_REL_BASED_HIGH 1
#define GRUB_PE32_REL_BASED_LOW 2
#define GRUB_PE32_REL_BASED_HIGHLOW 3
#define GRUB_PE32_REL_BASED_HIGHADJ 4
#define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5
#define GRUB_PE32_REL_BASED_SECTION 6
#define GRUB_PE32_REL_BASED_REL 7
#define GRUB_PE32_REL_BASED_IA64_IMM64 9
#define GRUB_PE32_REL_BASED_DIR64 10
#define GRUB_PE32_REL_BASED_HIGH3ADJ 11
struct grub_pe32_symbol
{
union
{
char short_name[8];
grub_uint32_t long_name[2];
};
grub_uint32_t value;
grub_uint16_t section;
grub_uint16_t type;
grub_uint8_t storage_class;
grub_uint8_t num_aux;
} __attribute__ ((packed));
#define GRUB_PE32_SYM_CLASS_EXTERNAL 2
#define GRUB_PE32_SYM_CLASS_STATIC 3
#define GRUB_PE32_SYM_CLASS_FILE 0x67
#define GRUB_PE32_DT_FUNCTION 0x20
struct grub_pe32_reloc
{
grub_uint32_t offset;
grub_uint32_t symtab_index;
grub_uint16_t type;
} __attribute__ ((packed));
#define GRUB_PE32_REL_I386_DIR32 0x6
#define GRUB_PE32_REL_I386_REL32 0x14
#endif /* ! GRUB_EFI_PE32_HEADER */

View file

@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 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_EFI_TIME_HEADER
#define GRUB_EFI_TIME_HEADER 1
#include <grub/symbol.h>
/* This is destined to overflow when one hour passes by. */
#define GRUB_TICKS_PER_SECOND ((1UL << 31) / 60 / 60 * 2)
/* Return the real time in ticks. */
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
#endif /* ! GRUB_EFI_TIME_HEADER */

View file

@ -0,0 +1,76 @@
/* uga_draw.h - definitions of the uga draw protocol */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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/>.
*/
/* The console control protocol is not a part of the EFI spec,
but defined in Intel's Sample Implementation. */
#ifndef GRUB_EFI_UGA_DRAW_HEADER
#define GRUB_EFI_UGA_DRAW_HEADER 1
#define GRUB_EFI_UGA_DRAW_GUID \
{ 0x982c298b, 0xf4fa, 0x41cb, { 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 }}
enum grub_efi_uga_blt_operation
{
GRUB_EFI_UGA_VIDEO_FILL,
GRUB_EFI_UGA_VIDEO_TO_BLT,
GRUB_EFI_UGA_BLT_TO_VIDEO,
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
GRUB_EFI_UGA_GLT_MAX
};
struct grub_efi_uga_pixel
{
grub_uint8_t Blue;
grub_uint8_t Green;
grub_uint8_t Red;
grub_uint8_t Reserved;
};
struct grub_efi_uga_draw_protocol
{
grub_efi_status_t
(*get_mode) (struct grub_efi_uga_draw_protocol *this,
grub_uint32_t *width,
grub_uint32_t *height,
grub_uint32_t *depth,
grub_uint32_t *refresh_rate);
grub_efi_status_t
(*set_mode) (struct grub_efi_uga_draw_protocol *this,
grub_uint32_t width,
grub_uint32_t height,
grub_uint32_t depth,
grub_uint32_t refresh_rate);
grub_efi_status_t
(*blt) (struct grub_efi_uga_draw_protocol *this,
struct grub_efi_uga_pixel *blt_buffer,
enum grub_efi_uga_blt_operation blt_operation,
grub_efi_uintn_t src_x,
grub_efi_uintn_t src_y,
grub_efi_uintn_t dest_x,
grub_efi_uintn_t dest_y,
grub_efi_uintn_t width,
grub_efi_uintn_t height,
grub_efi_uintn_t delta);
};
typedef struct grub_efi_uga_draw_protocol grub_efi_uga_draw_protocol_t;
#endif /* ! GRUB_EFI_UGA_DRAW_HEADER */

View file

@ -0,0 +1,286 @@
/*
* 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_EFI_EMU_HEADER
#define GRUB_EFI_EMU_HEADER 1
#include <grub/efi/api.h>
#include <grub/file.h>
#define GRUB_EFIEMU_PAGESIZE 4096
/* EFI api defined in 32-bit and 64-bit version*/
struct grub_efi_system_table32
{
grub_efi_table_header_t hdr;
grub_efi_uint32_t firmware_vendor;
grub_efi_uint32_t firmware_revision;
grub_efi_uint32_t console_in_handler;
grub_efi_uint32_t con_in;
grub_efi_uint32_t console_out_handler;
grub_efi_uint32_t con_out;
grub_efi_uint32_t standard_error_handle;
grub_efi_uint32_t std_err;
grub_efi_uint32_t runtime_services;
grub_efi_uint32_t boot_services;
grub_efi_uint32_t num_table_entries;
grub_efi_uint32_t configuration_table;
} __attribute__ ((packed));
typedef struct grub_efi_system_table32 grub_efi_system_table32_t;
struct grub_efi_system_table64
{
grub_efi_table_header_t hdr;
grub_efi_uint64_t firmware_vendor;
grub_efi_uint32_t firmware_revision;
grub_efi_uint32_t pad;
grub_efi_uint64_t console_in_handler;
grub_efi_uint64_t con_in;
grub_efi_uint64_t console_out_handler;
grub_efi_uint64_t con_out;
grub_efi_uint64_t standard_error_handle;
grub_efi_uint64_t std_err;
grub_efi_uint64_t runtime_services;
grub_efi_uint64_t boot_services;
grub_efi_uint64_t num_table_entries;
grub_efi_uint64_t configuration_table;
} __attribute__ ((packed));
typedef struct grub_efi_system_table64 grub_efi_system_table64_t;
struct grub_efiemu_runtime_services32
{
grub_efi_table_header_t hdr;
grub_efi_uint32_t get_time;
grub_efi_uint32_t set_time;
grub_efi_uint32_t get_wakeup_time;
grub_efi_uint32_t set_wakeup_time;
grub_efi_uint32_t set_virtual_address_map;
grub_efi_uint32_t convert_pointer;
grub_efi_uint32_t get_variable;
grub_efi_uint32_t get_next_variable_name;
grub_efi_uint32_t set_variable;
grub_efi_uint32_t get_next_high_monotonic_count;
grub_efi_uint32_t reset_system;
} __attribute__ ((packed));
typedef struct grub_efiemu_runtime_services32 grub_efiemu_runtime_services32_t;
struct grub_efiemu_runtime_services64
{
grub_efi_table_header_t hdr;
grub_efi_uint64_t get_time;
grub_efi_uint64_t set_time;
grub_efi_uint64_t get_wakeup_time;
grub_efi_uint64_t set_wakeup_time;
grub_efi_uint64_t set_virtual_address_map;
grub_efi_uint64_t convert_pointer;
grub_efi_uint64_t get_variable;
grub_efi_uint64_t get_next_variable_name;
grub_efi_uint64_t set_variable;
grub_efi_uint64_t get_next_high_monotonic_count;
grub_efi_uint64_t reset_system;
} __attribute__ ((packed));
typedef struct grub_efiemu_runtime_services64 grub_efiemu_runtime_services64_t;
extern grub_efi_system_table32_t *grub_efiemu_system_table32;
extern grub_efi_system_table64_t *grub_efiemu_system_table64;
/* Convenience macros to access currently loaded efiemu */
#define grub_efiemu_system_table ((grub_efiemu_sizeof_uintn_t () == 8) \
? (void *) grub_efiemu_system_table64 \
: (void *) grub_efiemu_system_table32)
#define GRUB_EFIEMU_SIZEOF_OF_UINTN (grub_efiemu_sizeof_uintn_t ())
#define GRUB_EFIEMU_SYSTEM_TABLE(x) ((grub_efiemu_sizeof_uintn_t () == 8) \
? grub_efiemu_system_table64->x \
: grub_efiemu_system_table32->x)
#define GRUB_EFIEMU_SYSTEM_TABLE_SET(x,y) ((grub_efiemu_sizeof_uintn_t () == 8)\
? (grub_efiemu_system_table64->x \
= (y)) \
: (grub_efiemu_system_table32->x \
= (y)))
#define GRUB_EFIEMU_SYSTEM_TABLE_PTR(x) ((grub_efiemu_sizeof_uintn_t () == 8)\
? UINT_TO_PTR \
(grub_efiemu_system_table64->x) \
: UINT_TO_PTR \
(grub_efiemu_system_table32->x))
#define GRUB_EFIEMU_SYSTEM_TABLE_VAR(x) ((grub_efiemu_sizeof_uintn_t () == 8) \
? (void *) \
&(grub_efiemu_system_table64->x) \
: (void *) \
&(grub_efiemu_system_table32->x))
#define GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF(x) \
((grub_efiemu_sizeof_uintn_t () == 8) \
? sizeof(grub_efiemu_system_table64->x)\
: sizeof(grub_efiemu_system_table32->x))
#define GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF_TOTAL ((grub_efiemu_sizeof_uintn_t () == 8) ? sizeof(*grub_efiemu_system_table64):sizeof(*grub_efiemu_system_table32))
/* ELF management definitions and functions */
struct grub_efiemu_segment
{
struct grub_efiemu_segment *next;
grub_size_t size;
unsigned section;
int handle;
int ptv_rel_needed;
grub_off_t off;
void *srcptr;
};
typedef struct grub_efiemu_segment *grub_efiemu_segment_t;
struct grub_efiemu_elf_sym
{
int handle;
grub_off_t off;
unsigned section;
};
int grub_efiemu_check_header32 (void *ehdr, grub_size_t size);
int grub_efiemu_check_header64 (void *ehdr, grub_size_t size);
grub_err_t grub_efiemu_loadcore_init32 (void *core, grub_size_t core_size,
grub_efiemu_segment_t *segments);
grub_err_t grub_efiemu_loadcore_init64 (void *core, grub_size_t core_size,
grub_efiemu_segment_t *segments);
grub_err_t grub_efiemu_loadcore_load32 (void *core,
grub_size_t core_size,
grub_efiemu_segment_t segments);
grub_err_t grub_efiemu_loadcore_load64 (void *core,
grub_size_t core_size,
grub_efiemu_segment_t segments);
grub_err_t grub_efiemu_loadcore_unload32 (void);
grub_err_t grub_efiemu_loadcore_unload64 (void);
grub_err_t grub_efiemu_loadcore_unload(void);
grub_err_t grub_efiemu_loadcore_init (grub_file_t file);
grub_err_t grub_efiemu_loadcore_load (void);
/* Configuration tables manipulation. Definitions and functions */
struct grub_efiemu_configuration_table
{
struct grub_efiemu_configuration_table *next;
grub_efi_guid_t guid;
void * (*get_table) (void *data);
void (*unload) (void *data);
void *data;
};
struct grub_efiemu_configuration_table32
{
grub_efi_guid_t vendor_guid;
grub_efi_uint32_t vendor_table;
} __attribute__ ((packed));
typedef struct grub_efiemu_configuration_table32 grub_efiemu_configuration_table32_t;
struct grub_efiemu_configuration_table64
{
grub_efi_guid_t vendor_guid;
grub_efi_uint64_t vendor_table;
} __attribute__ ((packed));
typedef struct grub_efiemu_configuration_table64 grub_efiemu_configuration_table64_t;
grub_err_t grub_efiemu_unregister_configuration_table (grub_efi_guid_t guid);
grub_err_t
grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
void * (*get_table) (void *data),
void (*unload) (void *data),
void *data);
/* Memory management functions */
int grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
grub_efi_memory_type_t type);
void *grub_efiemu_mm_obtain_request (int handle);
int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
grub_efi_memory_descriptor_t *memory_map,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t grub_efiemu_mm_unload (void);
grub_err_t grub_efiemu_mm_do_alloc (void);
grub_err_t grub_efiemu_mm_init (void);
void *grub_efiemu_mm_obtain_request (int handle);
void grub_efiemu_mm_return_request (int handle);
grub_efi_memory_type_t grub_efiemu_mm_get_type (int handle);
/* Drop-in replacements for grub_efi_* and grub_machine_* */
int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
grub_efi_memory_descriptor_t *memory_map,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t
grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
int grub_efiemu_sizeof_uintn_t (void);
int grub_efiemu_exit_boot_services (grub_efi_uintn_t map_key);
int grub_efiemu_finish_boot_services (void);
grub_err_t
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);
#define GRUB_EFIEMU_MEMORY_AVAILABLE 1
#define GRUB_EFIEMU_MEMORY_RESERVED 2
#define GRUB_EFIEMU_MEMORY_ACPI 3
#define GRUB_EFIEMU_MEMORY_NVS 4
#define GRUB_EFIEMU_MEMORY_CODE 5
/* efiemu main control definitions and functions*/
typedef enum {GRUB_EFIEMU_NOTLOADED,
GRUB_EFIEMU32, GRUB_EFIEMU64} grub_efiemu_mode_t;
struct grub_efiemu_prepare_hook
{
struct grub_efiemu_prepare_hook *next;
grub_err_t (*hook) (void *data);
void (*unload) (void *data);
void *data;
};
grub_err_t grub_efiemu_prepare32 (struct grub_efiemu_prepare_hook
*prepare_hooks,
struct grub_efiemu_configuration_table
*config_tables);
grub_err_t grub_efiemu_prepare64 (struct grub_efiemu_prepare_hook
*prepare_hooks,
struct grub_efiemu_configuration_table
*config_tables);
grub_err_t grub_efiemu_unload (void);
grub_err_t grub_efiemu_prepare (void);
grub_err_t
grub_efiemu_register_prepare_hook (grub_err_t (*hook) (void *data),
void (*unload) (void *data),
void *data);
/* symbols and pointers */
grub_err_t grub_efiemu_alloc_syms (void);
grub_err_t grub_efiemu_request_symbols (int num);
grub_err_t grub_efiemu_resolve_symbol (const char *name,
int *handle, grub_off_t *off);
grub_err_t grub_efiemu_register_symbol (const char *name,
int handle, grub_off_t off);
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

@ -0,0 +1,37 @@
/*
* 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_EFI_EMU_RUNTIME_HEADER
#define GRUB_EFI_EMU_RUNTIME_HEADER 1
struct grub_efiemu_ptv_rel
{
grub_uint64_t addr;
grub_efi_memory_type_t plustype;
grub_efi_memory_type_t minustype;
grub_uint32_t size;
} __attribute__ ((packed));
struct efi_variable
{
grub_efi_guid_t guid;
grub_uint32_t namelen;
grub_uint32_t size;
grub_efi_uint32_t attributes;
} __attribute__ ((packed));
#endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */

2377
grub-core/include/grub/elf.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 2004, 2005, 2006, 2007 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_ELFLOAD_HEADER
#define GRUB_ELFLOAD_HEADER 1
#include <grub/err.h>
#include <grub/elf.h>
#include <grub/file.h>
#include <grub/symbol.h>
#include <grub/types.h>
struct grub_elf_file
{
grub_file_t file;
union {
Elf64_Ehdr ehdr64;
Elf32_Ehdr ehdr32;
} ehdr;
void *phdrs;
};
typedef struct grub_elf_file *grub_elf_t;
typedef grub_err_t (*grub_elf32_load_hook_t)
(Elf32_Phdr *phdr, grub_addr_t *addr, int *load);
typedef grub_err_t (*grub_elf64_load_hook_t)
(Elf64_Phdr *phdr, grub_addr_t *addr, int *load);
grub_elf_t grub_elf_open (const char *);
grub_elf_t grub_elf_file (grub_file_t);
grub_err_t grub_elf_close (grub_elf_t);
int grub_elf_is_elf32 (grub_elf_t);
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
grub_size_t *);
int grub_elf_is_elf64 (grub_elf_t);
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
grub_size_t *);
#endif /* ! GRUB_ELFLOAD_HEADER */

View file

@ -0,0 +1,28 @@
/*
* 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_CONSOLE_UTIL_HEADER
#define GRUB_CONSOLE_UTIL_HEADER 1
/* Initialize the console system. */
void grub_console_init (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif /* ! GRUB_CONSOLE_UTIL_HEADER */

View file

@ -0,0 +1,35 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 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_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
enum grub_dev_abstraction_types {
GRUB_DEV_ABSTRACTION_NONE,
GRUB_DEV_ABSTRACTION_LVM,
GRUB_DEV_ABSTRACTION_RAID,
};
char *grub_guess_root_device (const char *dir);
int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);
char *grub_make_system_path_relative_to_its_root (const char *path);
const char *grub_util_check_block_device (const char *blk_dev);
const char *grub_util_check_char_device (const char *blk_dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */

View file

@ -0,0 +1,30 @@
/* biosdisk.h - emulate biosdisk */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 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_BIOSDISK_MACHINE_UTIL_HEADER
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
#include <grub/disk.h>
void grub_util_biosdisk_init (const char *dev_map);
void grub_util_biosdisk_fini (void);
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

View file

@ -0,0 +1,22 @@
#ifndef GRUB_EMU_MISC_H
#define GRUB_EMU_MISC_H 1
#include <grub/symbol.h>
#include <grub/types.h>
extern int verbosity;
extern const char *program_name;
void grub_init_all (void);
void grub_fini_all (void);
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
char * EXPORT_FUNC(xstrdup) (const char *str);
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
#endif /* GRUB_EMU_MISC_H */

View file

@ -0,0 +1,62 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,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_ENV_HEADER
#define GRUB_ENV_HEADER 1
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/menu.h>
struct grub_env_var;
typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
const char *val);
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
const char *val);
struct grub_env_var
{
char *name;
char *value;
grub_env_read_hook_t read_hook;
grub_env_write_hook_t write_hook;
struct grub_env_var *next;
struct grub_env_var **prevp;
int global;
};
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
char *EXPORT_FUNC(grub_env_get) (const char *name);
void EXPORT_FUNC(grub_env_unset) (const char *name);
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
grub_env_read_hook_t read_hook,
grub_env_write_hook_t write_hook);
grub_err_t grub_env_context_open (int export);
grub_err_t grub_env_context_close (void);
grub_err_t grub_env_export (const char *name);
void grub_env_unset_menu (void);
grub_menu_t grub_env_get_menu (void);
void grub_env_set_menu (grub_menu_t nmenu);
#endif /* ! GRUB_ENV_HEADER */

View file

@ -0,0 +1,46 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,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_ENV_PRIVATE_HEADER
#define GRUB_ENV_PRIVATE_HEADER 1
#include <grub/env.h>
/* The size of the hash table. */
#define HASHSZ 13
/* A hashtable for quick lookup of variables. */
struct grub_env_context
{
/* A hash table for variables. */
struct grub_env_var *vars[HASHSZ];
/* One level deeper on the stack. */
struct grub_env_context *prev;
};
/* This is used for sorting only. */
struct grub_env_sorted_var
{
struct grub_env_var *var;
struct grub_env_sorted_var *next;
};
extern struct grub_env_context *EXPORT_VAR(grub_current_context);
#endif /* ! GRUB_ENV_PRIVATE_HEADER */

View file

@ -0,0 +1,72 @@
/* err.h - error numbers and prototypes */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007,2008 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_ERR_HEADER
#define GRUB_ERR_HEADER 1
#include <grub/symbol.h>
typedef enum
{
GRUB_ERR_NONE = 0,
GRUB_ERR_TEST_FAILURE,
GRUB_ERR_BAD_MODULE,
GRUB_ERR_OUT_OF_MEMORY,
GRUB_ERR_BAD_FILE_TYPE,
GRUB_ERR_FILE_NOT_FOUND,
GRUB_ERR_FILE_READ_ERROR,
GRUB_ERR_BAD_FILENAME,
GRUB_ERR_UNKNOWN_FS,
GRUB_ERR_BAD_FS,
GRUB_ERR_BAD_NUMBER,
GRUB_ERR_OUT_OF_RANGE,
GRUB_ERR_UNKNOWN_DEVICE,
GRUB_ERR_BAD_DEVICE,
GRUB_ERR_READ_ERROR,
GRUB_ERR_WRITE_ERROR,
GRUB_ERR_UNKNOWN_COMMAND,
GRUB_ERR_INVALID_COMMAND,
GRUB_ERR_BAD_ARGUMENT,
GRUB_ERR_BAD_PART_TABLE,
GRUB_ERR_UNKNOWN_OS,
GRUB_ERR_BAD_OS,
GRUB_ERR_NO_KERNEL,
GRUB_ERR_BAD_FONT,
GRUB_ERR_NOT_IMPLEMENTED_YET,
GRUB_ERR_SYMLINK_LOOP,
GRUB_ERR_BAD_GZIP_DATA,
GRUB_ERR_MENU,
GRUB_ERR_TIMEOUT,
GRUB_ERR_IO,
GRUB_ERR_ACCESS_DENIED
}
grub_err_t;
extern grub_err_t EXPORT_VAR(grub_errno);
extern char EXPORT_VAR(grub_errmsg)[];
grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...);
void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_error_push) (void);
int EXPORT_FUNC(grub_error_pop) (void);
void EXPORT_FUNC(grub_print_error) (void);
int grub_err_printf (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
#endif /* ! GRUB_ERR_HEADER */

View file

@ -0,0 +1,55 @@
/*
* 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_EXTCMD_HEADER
#define GRUB_EXTCMD_HEADER 1
#include <grub/lib/arg.h>
#include <grub/command.h>
struct grub_extcmd;
typedef grub_err_t (*grub_extcmd_func_t) (struct grub_extcmd *cmd,
int argc, char **args);
/* The argcmd description. */
struct grub_extcmd
{
grub_command_t cmd;
grub_extcmd_func_t func;
/* The argument parser optionlist. */
const struct grub_arg_option *options;
void *data;
struct grub_arg_list *state;
};
typedef struct grub_extcmd *grub_extcmd_t;
grub_extcmd_t grub_register_extcmd (const char *name,
grub_extcmd_func_t func,
unsigned flags,
const char *summary,
const char *description,
const struct grub_arg_option *parser);
void grub_unregister_extcmd (grub_extcmd_t cmd);
#endif /* ! GRUB_EXTCMD_HEADER */

View file

@ -0,0 +1,182 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 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_FBBLIT_HEADER
#define GRUB_FBBLIT_HEADER 1
/* NOTE: This header is private header for fb driver and should not be used
in other parts of the code. */
struct grub_video_fbblit_info;
void
grub_video_fbblit_replace (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_32bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_24bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_16bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
#endif /* ! GRUB_FBBLIT_HEADER */

View file

@ -0,0 +1,75 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 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_FBFILL_HEADER
#define GRUB_FBFILL_HEADER 1
/* NOTE: This header is private header for fb driver and should not be used
in other parts of the code. */
struct grub_video_fbblit_info;
struct grub_video_fbrender_target
{
/* Copy of the screen's mode info structure, except that width, height and
mode_type has been re-adjusted to requested render target settings. */
struct grub_video_mode_info mode_info;
struct
{
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
} viewport;
/* Indicates whether the data has been allocated by us and must be freed
when render target is destroyed. */
int is_allocated;
/* Pointer to data. Can either be in video card memory or in local host's
memory. */
grub_uint8_t *data;
};
void
grub_video_fbfill (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
#endif /* ! GRUB_FBFILL_HEADER */

View file

@ -0,0 +1,43 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 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/>.
*/
/* NOTE: This header is private header for vbe driver and should not be used
in other parts of the code. */
#ifndef GRUB_VBEUTIL_MACHINE_HEADER
#define GRUB_VBEUTIL_MACHINE_HEADER 1
#include <grub/types.h>
#include <grub/video.h>
struct grub_video_fbblit_info
{
struct grub_video_mode_info *mode_info;
grub_uint8_t *data;
};
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y);
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y);
void set_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y, grub_video_color_t color);
#endif /* ! GRUB_VBEUTIL_MACHINE_HEADER */

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 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_FILE_HEADER
#define GRUB_FILE_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/device.h>
#include <grub/fs.h>
/* File description. */
struct grub_file
{
/* The underlying device. */
grub_device_t device;
/* The underlying filesystem. */
grub_fs_t fs;
/* The current offset. */
grub_off_t offset;
/* The file size. */
grub_off_t size;
/* Filesystem-specific data. */
void *data;
/* This is called when a sector is read. Used only for a disk device. */
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length);
};
typedef struct grub_file *grub_file_t;
/* Get a device name from NAME. */
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);
grub_file_t EXPORT_FUNC(grub_file_open) (const char *name);
grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf,
grub_size_t len);
grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset);
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
static inline grub_off_t
grub_file_size (const grub_file_t file)
{
return file->size;
}
static inline grub_off_t
grub_file_tell (const grub_file_t file)
{
return file->offset;
}
#endif /* ! GRUB_FILE_HEADER */

View file

@ -0,0 +1,118 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,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_FONT_HEADER
#define GRUB_FONT_HEADER 1
#include <grub/types.h>
#include <grub/video.h>
#include <grub/file.h>
/* Forward declaration of opaque structure grub_font.
Users only pass struct grub_font pointers to the font module functions,
and do not have knowledge of the structure contents. */
struct grub_font;
/* Font type used to access font functions. */
typedef struct grub_font *grub_font_t;
struct grub_font_node
{
struct grub_font_node *next;
grub_font_t value;
};
/* Global font registry. */
extern struct grub_font_node *grub_font_list;
struct grub_font_glyph
{
/* Reference to the font this glyph belongs to. */
grub_font_t font;
/* Glyph bitmap width in pixels. */
grub_uint16_t width;
/* Glyph bitmap height in pixels. */
grub_uint16_t height;
/* Glyph bitmap x offset in pixels. Add to screen coordinate. */
grub_int16_t offset_x;
/* Glyph bitmap y offset in pixels. Subtract from screen coordinate. */
grub_int16_t offset_y;
/* Number of pixels to advance to start the next character. */
grub_uint16_t device_width;
/* Row-major order, packed bits (no padding; rows can break within a byte).
The length of the array is (width * height + 7) / 8. Within a
byte, the most significant bit is the first (leftmost/uppermost) pixel.
Pixels are coded as bits, value 1 meaning of opaque pixel and 0 is
transparent. If the length of the array does not fit byte boundary, it
will be padded with 0 bits to make it fit. */
grub_uint8_t bitmap[0];
};
/* Initialize the font loader.
Must be called before any fonts are loaded or used. */
void grub_font_loader_init (void);
/* Load a font and add it to the beginning of the global font list.
Returns: 0 upon success; nonzero upon failure. */
int grub_font_load (const char *filename);
/* Get the font that has the specified name. Font names are in the form
"Family Name Bold Italic 14", where Bold and Italic are optional.
If no font matches the name specified, the most recently loaded font
is returned as a fallback. */
grub_font_t EXPORT_FUNC (grub_font_get) (const char *font_name);
const char *EXPORT_FUNC (grub_font_get_name) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_width) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_height) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_ascent) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_descent) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
const char *str);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph_with_fallback) (grub_font_t font,
grub_uint32_t code);
grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph,
grub_video_color_t color,
int left_x, int baseline_y);
grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
grub_font_t font,
grub_video_color_t color,
int left_x, int baseline_y);
#endif /* ! GRUB_FONT_HEADER */

View file

@ -0,0 +1,38 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 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_FONT_FORMAT_HEADER
#define GRUB_FONT_FORMAT_HEADER 1
/* FONT_FORMAT_PFF2_MAGIC use only 4 relevants bytes and the \0. */
#define FONT_FORMAT_PFF2_MAGIC "PFF2"
#define FONT_FORMAT_SECTION_NAMES_FILE "FILE"
#define FONT_FORMAT_SECTION_NAMES_FONT_NAME "NAME"
#define FONT_FORMAT_SECTION_NAMES_POINT_SIZE "PTSZ"
#define FONT_FORMAT_SECTION_NAMES_WEIGHT "WEIG"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH "MAXW"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT "MAXH"
#define FONT_FORMAT_SECTION_NAMES_ASCENT "ASCE"
#define FONT_FORMAT_SECTION_NAMES_DESCENT "DESC"
#define FONT_FORMAT_SECTION_NAMES_CHAR_INDEX "CHIX"
#define FONT_FORMAT_SECTION_NAMES_DATA "DATA"
#define FONT_FORMAT_SECTION_NAMES_FAMILY "FAMI"
#define FONT_FORMAT_SECTION_NAMES_SLAN "SLAN"
#endif /* ! GRUB_FONT_FORMAT_HEADER */

View file

@ -0,0 +1,96 @@
/* fs.h - filesystem manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,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_FS_HEADER
#define GRUB_FS_HEADER 1
#include <grub/device.h>
#include <grub/symbol.h>
#include <grub/types.h>
/* Forward declaration is required, because of mutual reference. */
struct grub_file;
struct grub_dirhook_info
{
int dir:1;
int mtimeset:1;
int case_insensitive:1;
grub_int32_t mtime;
};
/* Filesystem descriptor. */
struct grub_fs
{
/* My name. */
const char *name;
/* Call HOOK with each file under DIR. */
grub_err_t (*dir) (grub_device_t device, const char *path,
int (*hook) (const char *filename,
const struct grub_dirhook_info *info));
/* Open a file named NAME and initialize FILE. */
grub_err_t (*open) (struct grub_file *file, const char *name);
/* Read LEN bytes data from FILE into BUF. */
grub_ssize_t (*read) (struct grub_file *file, char *buf, grub_size_t len);
/* Close the file FILE. */
grub_err_t (*close) (struct grub_file *file);
/* Return the label of the device DEVICE in LABEL. The label is
returned in a grub_malloc'ed buffer and should be freed by the
caller. */
grub_err_t (*label) (grub_device_t device, char **label);
/* Return the uuid of the device DEVICE in UUID. The uuid is
returned in a grub_malloc'ed buffer and should be freed by the
caller. */
grub_err_t (*uuid) (grub_device_t device, char **uuid);
/* Get writing time of filesystem. */
grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf);
#ifdef GRUB_UTIL
/* Whether this filesystem reserves first sector for DOS-style boot. */
int reserved_first_sector;
#endif
/* The next filesystem. */
struct grub_fs *next;
};
typedef struct grub_fs *grub_fs_t;
/* This is special, because block lists are not files in usual sense. */
extern struct grub_fs grub_fs_blocklist;
/* This hook is used to automatically load filesystem modules.
If this hook loads a module, return non-zero. Otherwise return zero.
The newly loaded filesystem is assumed to be inserted into the head of
the linked list GRUB_FS_LIST through the function grub_fs_register. */
typedef int (*grub_fs_autoload_hook_t) (void);
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
#endif /* ! GRUB_FS_HEADER */

View file

@ -0,0 +1,82 @@
/* fshelp.h -- Filesystem helper functions */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2005,2006,2007,2008 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_FSHELP_HEADER
#define GRUB_FSHELP_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
typedef struct grub_fshelp_node *grub_fshelp_node_t;
#define GRUB_FSHELP_CASE_INSENSITIVE 0x100
#define GRUB_FSHELP_TYPE_MASK 0xff
#define GRUB_FSHELP_FLAGS_MASK 0x100
enum grub_fshelp_filetype
{
GRUB_FSHELP_UNKNOWN,
GRUB_FSHELP_REG,
GRUB_FSHELP_DIR,
GRUB_FSHELP_SYMLINK
};
/* Lookup the node PATH. The node ROOTNODE describes the root of the
directory tree. The node found is returned in FOUNDNODE, which is
either a ROOTNODE or a new malloc'ed node. ITERATE_DIR is used to
iterate over all directory entries in the current node.
READ_SYMLINK is used to read the symlink if a node is a symlink.
EXPECTTYPE is the type node that is expected by the called, an
error is generated if the node is not of the expected type. Make
sure you use the NESTED_FUNC_ATTR macro for HOOK, this is required
because GCC has a nasty bug when using regparm=3. */
grub_err_t
EXPORT_FUNC(grub_fshelp_find_file) (const char *path,
grub_fshelp_node_t rootnode,
grub_fshelp_node_t *foundnode,
int (*iterate_dir) (grub_fshelp_node_t dir,
int NESTED_FUNC_ATTR
(*hook) (const char *filename,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node)),
char *(*read_symlink) (grub_fshelp_node_t node),
enum grub_fshelp_filetype expect);
/* Read LEN bytes from the file NODE on disk DISK into the buffer BUF,
beginning with the block POS. READ_HOOK should be set before
reading a block from the file. GET_BLOCK is used to translate file
blocks to disk blocks. The file is FILESIZE bytes big and the
blocks have a size of LOG2BLOCKSIZE (in log2). */
grub_ssize_t
EXPORT_FUNC(grub_fshelp_read_file) (grub_disk_t disk, grub_fshelp_node_t node,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length),
grub_off_t pos, grub_size_t len, char *buf,
grub_disk_addr_t (*get_block) (grub_fshelp_node_t node,
grub_disk_addr_t block),
grub_off_t filesize, int log2blocksize);
unsigned int
EXPORT_FUNC(grub_fshelp_log2blksize) (unsigned int blksize,
unsigned int *pow);
#endif /* ! GRUB_FSHELP_HEADER */

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,107 @@
/* gfxmenu_view.h - gfxmenu view interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_GFXMENU_VIEW_HEADER
#define GRUB_GFXMENU_VIEW_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/menu.h>
#include <grub/font.h>
#include <grub/gfxwidgets.h>
struct grub_gfxmenu_view; /* Forward declaration of opaque type. */
typedef struct grub_gfxmenu_view *grub_gfxmenu_view_t;
grub_gfxmenu_view_t grub_gfxmenu_view_new (const char *theme_path,
int width, int height);
void grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view);
/* Set properties on the view based on settings from the specified
theme file. */
grub_err_t grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view,
const char *theme_path);
grub_err_t grub_gui_recreate_box (grub_gfxmenu_box_t *boxptr,
const char *pattern, const char *theme_dir);
void grub_gfxmenu_view_draw (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);
void
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
const grub_video_rect_t *region);
void
grub_gfxmenu_clear_timeout (void *data);
void
grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);
/* Implementation details -- this should not be used outside of the
view itself. */
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gui.h>
#include <grub/gfxwidgets.h>
#include <grub/icon_manager.h>
/* Definition of the private representation of the view. */
struct grub_gfxmenu_view
{
grub_video_rect_t screen;
grub_font_t title_font;
grub_font_t message_font;
char *terminal_font_name;
grub_gui_color_t title_color;
grub_gui_color_t message_color;
grub_gui_color_t message_bg_color;
struct grub_video_bitmap *desktop_image;
grub_gui_color_t desktop_color;
grub_gfxmenu_box_t terminal_box;
char *title_text;
char *progress_message_text;
char *theme_path;
grub_gui_container_t canvas;
int double_repaint;
int selected;
grub_video_rect_t progress_message_frame;
grub_menu_t menu;
int nested;
int first_timeout;
};
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */

View file

@ -0,0 +1,44 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 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_GFXTERM_HEADER
#define GRUB_GFXTERM_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/term.h>
#include <grub/video.h>
grub_err_t
EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
const char *font_name, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void);
grub_err_t EXPORT_FUNC (grub_gfxterm_fullscreen) (void);
extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void);
#endif /* ! GRUB_GFXTERM_HEADER */

View file

@ -0,0 +1,49 @@
/* gfxwidgets.h - Widgets for the graphical menu (gfxmenu). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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_GFXWIDGETS_HEADER
#define GRUB_GFXWIDGETS_HEADER 1
#include <grub/video.h>
typedef struct grub_gfxmenu_box *grub_gfxmenu_box_t;
struct grub_gfxmenu_box
{
/* The size of the content. */
int content_width;
int content_height;
struct grub_video_bitmap **raw_pixmaps;
struct grub_video_bitmap **scaled_pixmaps;
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
void (*set_content_size) (grub_gfxmenu_box_t self,
int width, int height);
int (*get_left_pad) (grub_gfxmenu_box_t self);
int (*get_top_pad) (grub_gfxmenu_box_t self);
int (*get_right_pad) (grub_gfxmenu_box_t self);
int (*get_bottom_pad) (grub_gfxmenu_box_t self);
void (*destroy) (grub_gfxmenu_box_t self);
};
grub_gfxmenu_box_t grub_gfxmenu_create_box (const char *pixmaps_prefix,
const char *pixmaps_suffix);
#endif /* ! GRUB_GFXWIDGETS_HEADER */

View file

@ -0,0 +1,71 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2006,2007,2008 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_GPT_PARTITION_HEADER
#define GRUB_GPT_PARTITION_HEADER 1
#include <grub/types.h>
struct grub_gpt_part_type
{
grub_uint32_t data1;
grub_uint16_t data2;
grub_uint16_t data3;
grub_uint8_t data4[8];
} __attribute__ ((aligned(8)));
typedef struct grub_gpt_part_type grub_gpt_part_type_t;
#define GRUB_GPT_PARTITION_TYPE_EMPTY \
{ 0x0, 0x0, 0x0, \
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \
}
#define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
{ grub_cpu_to_le32 (0x21686148), grub_cpu_to_le16 (0x6449), grub_cpu_to_le16 (0x6e6f), \
{ 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
}
struct grub_gpt_header
{
grub_uint8_t magic[8];
grub_uint32_t version;
grub_uint32_t headersize;
grub_uint32_t crc32;
grub_uint32_t unused1;
grub_uint64_t primary;
grub_uint64_t backup;
grub_uint64_t start;
grub_uint64_t end;
grub_uint8_t guid[16];
grub_uint64_t partitions;
grub_uint32_t maxpart;
grub_uint32_t partentry_size;
grub_uint32_t partentry_crc32;
} __attribute__ ((packed));
struct grub_gpt_partentry
{
grub_gpt_part_type_t type;
grub_uint8_t guid[16];
grub_uint64_t start;
grub_uint64_t end;
grub_uint64_t attrib;
char name[72];
} __attribute__ ((packed));
#endif /* ! GRUB_GPT_PARTITION_HEADER */

View file

@ -0,0 +1,230 @@
/* gui.h - GUI components header file. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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/>.
*/
#include <grub/types.h>
#include <grub/err.h>
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gfxmenu_view.h>
#ifndef GRUB_GUI_H
#define GRUB_GUI_H 1
/* A representation of a color. Unlike grub_video_color_t, this
representation is independent of any video mode specifics. */
typedef struct grub_gui_color
{
grub_uint8_t red;
grub_uint8_t green;
grub_uint8_t blue;
grub_uint8_t alpha;
} grub_gui_color_t;
typedef struct grub_gui_component *grub_gui_component_t;
typedef struct grub_gui_container *grub_gui_container_t;
typedef struct grub_gui_list *grub_gui_list_t;
typedef void (*grub_gui_component_callback) (grub_gui_component_t component,
void *userdata);
/* Component interface. */
struct grub_gui_component_ops
{
void (*destroy) (void *self);
const char * (*get_id) (void *self);
int (*is_instance) (void *self, const char *type);
void (*paint) (void *self, const grub_video_rect_t *bounds);
void (*set_parent) (void *self, grub_gui_container_t parent);
grub_gui_container_t (*get_parent) (void *self);
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
void (*get_minimal_size) (void *self, unsigned *width, unsigned *height);
grub_err_t (*set_property) (void *self, const char *name, const char *value);
void (*repaint) (void *self, int second_pass);
};
struct grub_gui_container_ops
{
void (*add) (void *self, grub_gui_component_t comp);
void (*remove) (void *self, grub_gui_component_t comp);
void (*iterate_children) (void *self,
grub_gui_component_callback cb, void *userdata);
};
struct grub_gui_list_ops
{
void (*set_view_info) (void *self,
grub_gfxmenu_view_t view);
};
struct grub_gui_progress_ops
{
void (*set_state) (void *self, int visible, int start, int current, int end);
};
typedef signed grub_fixed_signed_t;
#define GRUB_FIXED_1 0x10000
static inline signed
grub_fixed_sfs_divide (signed a, grub_fixed_signed_t b)
{
return (a * GRUB_FIXED_1) / b;
}
static inline grub_fixed_signed_t
grub_fixed_fsf_divide (grub_fixed_signed_t a, signed b)
{
return a / b;
}
static inline signed
grub_fixed_sfs_multiply (signed a, grub_fixed_signed_t b)
{
return (a * b) / GRUB_FIXED_1;
}
static inline signed
grub_fixed_to_signed (grub_fixed_signed_t in)
{
return in / GRUB_FIXED_1;
}
static inline grub_fixed_signed_t
grub_signed_to_fixed (signed in)
{
return in * GRUB_FIXED_1;
}
struct grub_gui_component
{
struct grub_gui_component_ops *ops;
signed x;
grub_fixed_signed_t xfrac;
signed y;
grub_fixed_signed_t yfrac;
signed w;
grub_fixed_signed_t wfrac;
signed h;
grub_fixed_signed_t hfrac;
};
struct grub_gui_progress
{
struct grub_gui_component component;
struct grub_gui_progress_ops *ops;
};
struct grub_gui_container
{
struct grub_gui_component component;
struct grub_gui_container_ops *ops;
};
struct grub_gui_list
{
struct grub_gui_component component;
struct grub_gui_list_ops *ops;
};
/* Interfaces to concrete component classes. */
grub_gui_container_t grub_gui_canvas_new (void);
grub_gui_container_t grub_gui_vbox_new (void);
grub_gui_container_t grub_gui_hbox_new (void);
grub_gui_component_t grub_gui_label_new (void);
grub_gui_component_t grub_gui_image_new (void);
grub_gui_component_t grub_gui_progress_bar_new (void);
grub_gui_component_t grub_gui_list_new (void);
grub_gui_component_t grub_gui_circular_progress_new (void);
/* Manipulation functions. */
/* Visit all components with the specified ID. */
void grub_gui_find_by_id (grub_gui_component_t root,
const char *id,
grub_gui_component_callback cb,
void *userdata);
/* Visit all components. */
void grub_gui_iterate_recursively (grub_gui_component_t root,
grub_gui_component_callback cb,
void *userdata);
/* Helper functions. */
static __inline void
grub_gui_save_viewport (grub_video_rect_t *r)
{
grub_video_get_viewport ((unsigned *) &r->x,
(unsigned *) &r->y,
(unsigned *) &r->width,
(unsigned *) &r->height);
}
static __inline void
grub_gui_restore_viewport (const grub_video_rect_t *r)
{
grub_video_set_viewport (r->x, r->y, r->width, r->height);
}
/* Set a new viewport relative the the current one, saving the current
viewport in OLD so it can be later restored. */
static __inline void
grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
{
grub_gui_save_viewport (old);
grub_video_set_viewport (old->x + r->x,
old->y + r->y,
r->width,
r->height);
}
static __inline grub_gui_color_t
grub_gui_color_rgb (int r, int g, int b)
{
grub_gui_color_t c;
c.red = r;
c.green = g;
c.blue = b;
c.alpha = 255;
return c;
}
static __inline grub_video_color_t
grub_gui_map_color (grub_gui_color_t c)
{
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
static inline int
grub_video_have_common_points (const grub_video_rect_t *a,
const grub_video_rect_t *b)
{
if (!((a->x <= b->x && b->x <= a->x + a->width)
|| (b->x <= a->x && a->x <= b->x + b->width)))
return 0;
if (!((a->y <= b->y && b->y <= a->y + a->height)
|| (b->y <= a->y && a->y <= b->y + b->height)))
return 0;
return 1;
}
#endif /* ! GRUB_GUI_H */

View file

@ -0,0 +1,37 @@
/* gui_string_util.h - String utilities for the graphical menu interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_GUI_STRING_UTIL_HEADER
#define GRUB_GUI_STRING_UTIL_HEADER 1
#include <grub/types.h>
#include <grub/gui.h>
char *grub_new_substring (const char *buf,
grub_size_t start, grub_size_t end);
char *grub_resolve_relative_path (const char *base, const char *path);
char *grub_get_dirname (const char *file_path);
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
#endif /* GRUB_GUI_STRING_UTIL_HEADER */

View file

@ -0,0 +1,28 @@
/* gzio.h - prototypes for gzio */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007 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_GZIO_H
#define GRUB_GZIO_H 1
#include <grub/file.h>
grub_file_t grub_gzio_open (grub_file_t io, int transparent);
grub_file_t grub_gzfile_open (const char *name, int transparent);
#endif /* ! GRUB_GZIO_H */

View file

@ -0,0 +1,60 @@
/* handler.h - header for grub handler */
/*
* 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_HANDLER_HEADER
#define GRUB_HANDLER_HEADER 1
#include <grub/list.h>
#include <grub/err.h>
struct grub_handler
{
struct grub_handler *next;
const char *name;
grub_err_t (*init) (void);
grub_err_t (*fini) (void);
};
typedef struct grub_handler *grub_handler_t;
struct grub_handler_class
{
struct grub_handler_class *next;
const char *name;
grub_handler_t handler_list;
grub_handler_t cur_handler;
};
typedef struct grub_handler_class *grub_handler_class_t;
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
grub_handler_t handler);
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
grub_handler_t handler);
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
grub_handler_t handler);
#define GRUB_AS_HANDLER(ptr) \
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
(grub_handler_t) ptr : grub_bad_type_cast ())
#endif /* ! GRUB_HANDLER_HEADER */

View file

@ -0,0 +1,61 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007 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_HFS_HEADER
#define GRUB_HFS_HEADER 1
#include <grub/types.h>
#define GRUB_HFS_MAGIC 0x4244
/* A single extent. A file consists of one or more extents. */
struct grub_hfs_extent
{
/* The first physical block. */
grub_uint16_t first_block;
grub_uint16_t count;
};
/* HFS stores extents in groups of 3. */
typedef struct grub_hfs_extent grub_hfs_datarecord_t[3];
/* The HFS superblock (The official name is `Master Directory
Block'). */
struct grub_hfs_sblock
{
grub_uint16_t magic;
grub_uint8_t unused[18];
grub_uint32_t blksz;
grub_uint8_t unused2[4];
grub_uint16_t first_block;
grub_uint8_t unused4[6];
/* A pascal style string that holds the volumename. */
grub_uint8_t volname[28];
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];
grub_hfs_datarecord_t extent_recs;
grub_uint32_t catalog_size;
grub_hfs_datarecord_t catalog_recs;
} __attribute__ ((packed));
#endif /* ! GRUB_HFS_HEADER */

View file

@ -0,0 +1,60 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009,2010 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_I18N_H
#define GRUB_I18N_H 1
#include <config.h>
#include <grub/symbol.h>
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
/* NLS can be disabled through the configure --disable-nls option. */
#if (defined(ENABLE_NLS) && ENABLE_NLS)
# ifdef GRUB_UTIL
# include <locale.h>
# include <libintl.h>
# endif /* GRUB_UTIL */
#else /* ! (defined(ENABLE_NLS) && ENABLE_NLS) */
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# ifdef GRUB_UTIL
# define gettext(Msgid) ((const char *) (Msgid))
# else
# define grub_gettext(str) ((const char *) (str))
# endif /* GRUB_UTIL */
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
#ifdef GRUB_UTIL
# define _(str) gettext(str)
#else
# define _(str) grub_gettext(str)
#endif /* GRUB_UTIL */
#define N_(str) str
#endif /* GRUB_I18N_H */

View file

@ -0,0 +1,25 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* 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_AT_KEYBOARD_HEADER
#define GRUB_CPU_AT_KEYBOARD_HEADER 1
#define KEYBOARD_REG_DATA 0x60
#define KEYBOARD_REG_STATUS 0x64
#endif

View file

@ -0,0 +1,101 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_BSD_CPU_HEADER
#define GRUB_BSD_CPU_HEADER 1
#include <grub/types.h>
#include <grub/i386/freebsd_reboot.h>
#include <grub/i386/netbsd_reboot.h>
#include <grub/i386/openbsd_reboot.h>
#include <grub/i386/freebsd_linker.h>
#include <grub/i386/netbsd_bootinfo.h>
#include <grub/i386/openbsd_bootarg.h>
enum bsd_kernel_types
{
KERNEL_TYPE_NONE,
KERNEL_TYPE_FREEBSD,
KERNEL_TYPE_OPENBSD,
KERNEL_TYPE_NETBSD,
};
#define GRUB_BSD_TEMP_BUFFER 0x80000
#define FREEBSD_B_DEVMAGIC OPENBSD_B_DEVMAGIC
#define FREEBSD_B_SLICESHIFT OPENBSD_B_CTRLSHIFT
#define FREEBSD_B_UNITSHIFT OPENBSD_B_UNITSHIFT
#define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
#define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
#define FREEBSD_MODTYPE_KERNEL "elf kernel"
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
#define FREEBSD_MODTYPE_ELF_MODULE "elf module"
#define FREEBSD_MODTYPE_ELF_MODULE_OBJ "elf obj module"
#define FREEBSD_MODTYPE_RAW "raw"
#define FREEBSD_BOOTINFO_VERSION 1
struct grub_freebsd_bootinfo
{
grub_uint32_t version;
grub_uint8_t unused1[44];
grub_uint32_t length;
grub_uint8_t unused2;
grub_uint8_t boot_device;
grub_uint8_t unused3[18];
grub_uint32_t kern_end;
grub_uint32_t environment;
grub_uint32_t tags;
} __attribute__ ((packed));
struct grub_openbsd_bios_mmap
{
grub_uint64_t addr;
grub_uint64_t len;
#define OPENBSD_MMAP_AVAILABLE 1
#define OPENBSD_MMAP_RESERVED 2
#define OPENBSD_MMAP_ACPI 3
#define OPENBSD_MMAP_NVS 4
grub_uint32_t type;
};
void grub_unix_real_boot (grub_addr_t entry, ...)
__attribute__ ((cdecl,noreturn));
grub_err_t grub_freebsd_load_elfmodule32 (grub_file_t file, int argc,
char *argv[], grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elfmodule_obj64 (grub_file_t file, int argc,
char *argv[],
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta32 (grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta64 (grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_freebsd_add_meta (grub_uint32_t type, void *data,
grub_uint32_t len);
grub_err_t grub_freebsd_add_meta_module (char *filename, char *type,
int argc, char **argv,
grub_addr_t addr, grub_uint32_t size);
extern grub_uint8_t grub_bsd64_trampoline_start, grub_bsd64_trampoline_end;
extern grub_uint32_t grub_bsd64_trampoline_selfjump;
extern grub_uint32_t grub_bsd64_trampoline_gdt;
#endif /* ! GRUB_BSD_CPU_HEADER */

View file

@ -0,0 +1,28 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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_CMOS_H
#define GRUB_CPU_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#define GRUB_CMOS_ADDR_REG 0x70
#define GRUB_CMOS_DATA_REG 0x71
#endif /* GRUB_CPU_CMOS_H */

View file

@ -0,0 +1 @@
#include <grub/i386/pc/boot.h>

View file

@ -0,0 +1,25 @@
/*
* 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_MACHINE_CONSOLE_HEADER
#define GRUB_MACHINE_CONSOLE_HEADER 1
void grub_vga_text_init (void);
void grub_vga_text_fini (void);
#endif /* ! GRUB_MACHINE_CONSOLE_HEADER */

View file

@ -0,0 +1,28 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_INIT_I386_LINUXBIOS_HEADER
#define GRUB_INIT_I386_LINUXBIOS_HEADER 1
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_stop_floppy) (void);
#endif

View file

@ -0,0 +1,28 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 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_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#ifndef ASM_FILE
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -0,0 +1 @@
#include <grub/cpu/loader.h>

View file

@ -0,0 +1,71 @@
/* memory.h - describe the memory map */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 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_MEMORY_MACHINE_LB_HEADER
#define _GRUB_MEMORY_MACHINE_LB_HEADER 1
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
#ifndef ASM_FILE
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
#ifndef ASM_FILE
struct grub_linuxbios_table_header
{
char signature[4];
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
grub_uint32_t tag;
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_item *grub_linuxbios_table_item_t;
struct grub_linuxbios_mem_region
{
grub_uint64_t addr;
grub_uint64_t size;
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
grub_uint32_t type;
};
typedef struct grub_linuxbios_mem_region *mem_region_t;
void grub_machine_mmap_init (void);
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
#endif
#endif /* ! _GRUB_MEMORY_MACHINE_HEADER */

View file

@ -0,0 +1,24 @@
/*
* 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_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
#endif

View file

@ -0,0 +1 @@
#include <grub/i386/pc/time.h>

View file

@ -0,0 +1,24 @@
/*
* 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_CPUID_HEADER
#define GRUB_CPU_CPUID_HEADER 1
extern unsigned char grub_cpuid_has_longmode;
#endif

View file

@ -0,0 +1,33 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007 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_MACHINE_KERNEL_HEADER
#define GRUB_MACHINE_KERNEL_HEADER 1
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */

View file

@ -0,0 +1,22 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2006,2007 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_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
#endif /* ! GRUB_LOADER_MACHINE_HEADER */

View file

@ -0,0 +1 @@
#include <grub/efi/memory.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -0,0 +1,24 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 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_MACHINE_TIME_HEADER
#define GRUB_MACHINE_TIME_HEADER 1
#include <grub/efi/time.h>
#endif /* ! GRUB_MACHINE_TIME_HEADER */

View file

@ -0,0 +1,33 @@
/*
* 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_ARCH_EFI_EMU_HEADER
#define GRUB_ARCH_EFI_EMU_HEADER 1
grub_err_t
grub_arch_efiemu_relocate_symbols32 (grub_efiemu_segment_t segs,
struct grub_efiemu_elf_sym *elfsyms,
void *ehdr);
grub_err_t
grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
struct grub_efiemu_elf_sym *elfsyms,
void *ehdr);
int grub_arch_efiemu_check_header32 (void *ehdr);
int grub_arch_efiemu_check_header64 (void *ehdr);
#endif

View file

@ -0,0 +1,74 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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/>.
*/
/*-
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: stable/8/sys/sys/linker.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_LINKER_CPU_HEADER
#define GRUB_FREEBSD_LINKER_CPU_HEADER 1
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#endif

View file

@ -0,0 +1,77 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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/>.
*/
/*-
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
* $FreeBSD: stable/8/sys/sys/reboot.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_REBOOT_CPU_HEADER
#define GRUB_FREEBSD_REBOOT_CPU_HEADER 1
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#endif

View file

@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
#include <grub/symbol.h>
/* Initialize the console system. */
void grub_console_init (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -0,0 +1 @@
#include <grub/powerpc/ieee1275/ieee1275.h>

View file

@ -0,0 +1 @@
#include <grub/powerpc/ieee1275/kernel.h>

View file

@ -0,0 +1,29 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2007,2008 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_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/multiboot.h>
void grub_rescue_cmd_linux (int argc, char *argv[]);
void grub_rescue_cmd_initrd (int argc, char *argv[]);
#endif /* ! GRUB_LOADER_MACHINE_HEADER */

View file

@ -0,0 +1 @@
#include <grub/i386/pc/memory.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -0,0 +1 @@
#include <grub/powerpc/ieee1275/time.h>

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996,2000,2002,2007 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/>.
*/
/* Based on sys/io.h from GNU libc. */
#ifndef GRUB_IO_H
#define GRUB_IO_H 1
typedef unsigned short int grub_port_t;
static __inline unsigned char
grub_inb (unsigned short int port)
{
unsigned char _v;
__asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port));
return _v;
}
static __inline unsigned short int
grub_inw (unsigned short int port)
{
unsigned short _v;
__asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (port));
return _v;
}
static __inline unsigned int
grub_inl (unsigned short int port)
{
unsigned int _v;
__asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (port));
return _v;
}
static __inline void
grub_outb (unsigned char value, unsigned short int port)
{
__asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
}
static __inline void
grub_outw (unsigned short int value, unsigned short int port)
{
__asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port));
}
static __inline void
grub_outl (unsigned int value, unsigned short int port)
{
__asm__ __volatile__ ("outl %0,%w1": :"a" (value), "Nd" (port));
}
#endif /* _SYS_IO_H */

View file

@ -0,0 +1,35 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#ifdef GRUB_MACHINE_IEEE1275
#define GRUB_MOD_ALIGN 0x1000
#else
#define GRUB_MOD_ALIGN 0x1
#endif
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_CPU_PREFIX 0x2
#define GRUB_KERNEL_CPU_DATA_END 0x42
#endif

View file

@ -0,0 +1,281 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,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_LINUX_MACHINE_HEADER
#define GRUB_LINUX_MACHINE_HEADER 1
#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */
#define GRUB_LINUX_DEFAULT_SETUP_SECTS 4
#define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF
#define GRUB_LINUX_MAX_SETUP_SECTS 64
#define GRUB_LINUX_BOOT_LOADER_TYPE 0x72
#define GRUB_LINUX_HEAP_END_OFFSET (0x9000 - 0x200)
#define GRUB_LINUX_BZIMAGE_ADDR 0x100000
#define GRUB_LINUX_ZIMAGE_ADDR 0x10000
#define GRUB_LINUX_OLD_REAL_MODE_ADDR 0x90000
#define GRUB_LINUX_SETUP_STACK 0x9000
#define GRUB_LINUX_FLAG_BIG_KERNEL 0x1
#define GRUB_LINUX_FLAG_QUIET 0x20
#define GRUB_LINUX_FLAG_CAN_USE_HEAP 0x80
/* Linux's video mode selection support. Actually I hate it! */
#define GRUB_LINUX_VID_MODE_NORMAL 0xFFFF
#define GRUB_LINUX_VID_MODE_EXTENDED 0xFFFE
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
#define GRUB_LINUX_VID_MODE_VESA_START 0x0300
#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
#define GRUB_LINUX_CL_MAGIC 0xA33F
#ifdef __x86_64__
#define GRUB_LINUX_EFI_SIGNATURE \
('4' << 24 | '6' << 16 | 'L' << 8 | 'E')
#else
#define GRUB_LINUX_EFI_SIGNATURE \
('2' << 24 | '3' << 16 | 'L' << 8 | 'E')
#endif
#define GRUB_LINUX_EFI_SIGNATURE_0204 \
('L' << 24 | 'I' << 16 | 'F' << 8 | 'E')
#define GRUB_LINUX_OFW_SIGNATURE \
(' ' << 24 | 'W' << 16 | 'F' << 8 | 'O')
#ifndef ASM_FILE
#define GRUB_E820_RAM 1
#define GRUB_E820_RESERVED 2
#define GRUB_E820_ACPI 3
#define GRUB_E820_NVS 4
#define GRUB_E820_EXEC_CODE 5
#define GRUB_E820_MAX_ENTRY 128
struct grub_e820_mmap
{
grub_uint64_t addr;
grub_uint64_t size;
grub_uint32_t type;
} __attribute__((packed));
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
#define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
/* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header
{
grub_uint8_t code1[0x0020];
grub_uint16_t cl_magic; /* Magic number 0xA33F */
grub_uint16_t cl_offset; /* The offset of command line */
grub_uint8_t code2[0x01F1 - 0x0020 - 2 - 2];
grub_uint8_t setup_sects; /* The size of the setup in sectors */
grub_uint16_t root_flags; /* If the root is mounted readonly */
grub_uint16_t syssize; /* obsolete */
grub_uint16_t swap_dev; /* obsolete */
grub_uint16_t ram_size; /* obsolete */
grub_uint16_t vid_mode; /* Video mode control */
grub_uint16_t root_dev; /* Default root device number */
grub_uint16_t boot_flag; /* 0xAA55 magic number */
grub_uint16_t jump; /* Jump instruction */
grub_uint32_t header; /* Magic signature "HdrS" */
grub_uint16_t version; /* Boot protocol version supported */
grub_uint32_t realmode_swtch; /* Boot loader hook */
grub_uint16_t start_sys; /* The load-low segment (obsolete) */
grub_uint16_t kernel_version; /* Points to kernel version string */
grub_uint8_t type_of_loader; /* Boot loader identifier */
#define LINUX_LOADER_ID_LILO 0x0
#define LINUX_LOADER_ID_LOADLIN 0x1
#define LINUX_LOADER_ID_BOOTSECT 0x2
#define LINUX_LOADER_ID_SYSLINUX 0x3
#define LINUX_LOADER_ID_ETHERBOOT 0x4
#define LINUX_LOADER_ID_ELILO 0x5
#define LINUX_LOADER_ID_GRUB 0x7
#define LINUX_LOADER_ID_UBOOT 0x8
#define LINUX_LOADER_ID_XEN 0x9
#define LINUX_LOADER_ID_GUJIN 0xa
#define LINUX_LOADER_ID_QEMU 0xb
grub_uint8_t loadflags; /* Boot protocol option flags */
grub_uint16_t setup_move_size; /* Move to high memory size */
grub_uint32_t code32_start; /* Boot loader hook */
grub_uint32_t ramdisk_image; /* initrd load address */
grub_uint32_t ramdisk_size; /* initrd size */
grub_uint32_t bootsect_kludge; /* obsolete */
grub_uint16_t heap_end_ptr; /* Free memory after setup end */
grub_uint16_t pad1; /* Unused */
char *cmd_line_ptr; /* Points to the kernel command line */
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
} __attribute__ ((packed));
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
sectors of Linux, and must be simulated by GRUB on EFI, because
the setup sectors depend on BIOS. */
struct linux_kernel_params
{
grub_uint8_t video_cursor_x; /* 0 */
grub_uint8_t video_cursor_y;
grub_uint16_t ext_mem; /* 2 */
grub_uint16_t video_page; /* 4 */
grub_uint8_t video_mode; /* 6 */
grub_uint8_t video_width; /* 7 */
grub_uint8_t padding1[0xa - 0x8];
grub_uint16_t video_ega_bx; /* a */
grub_uint8_t padding2[0xe - 0xc];
grub_uint8_t video_height; /* e */
grub_uint8_t have_vga; /* f */
grub_uint16_t font_size; /* 10 */
grub_uint16_t lfb_width; /* 12 */
grub_uint16_t lfb_height; /* 14 */
grub_uint16_t lfb_depth; /* 16 */
grub_uint32_t lfb_base; /* 18 */
grub_uint32_t lfb_size; /* 1c */
grub_uint16_t cl_magic; /* 20 */
grub_uint16_t cl_offset;
grub_uint16_t lfb_line_len; /* 24 */
grub_uint8_t red_mask_size; /* 26 */
grub_uint8_t red_field_pos;
grub_uint8_t green_mask_size;
grub_uint8_t green_field_pos;
grub_uint8_t blue_mask_size;
grub_uint8_t blue_field_pos;
grub_uint8_t reserved_mask_size;
grub_uint8_t reserved_field_pos;
grub_uint16_t vesapm_segment; /* 2e */
grub_uint16_t vesapm_offset; /* 30 */
grub_uint16_t lfb_pages; /* 32 */
grub_uint16_t vesa_attrib; /* 34 */
grub_uint32_t capabilities; /* 36 */
grub_uint8_t padding3[0x40 - 0x3a];
grub_uint16_t apm_version; /* 40 */
grub_uint16_t apm_code_segment; /* 42 */
grub_uint32_t apm_entry; /* 44 */
grub_uint16_t apm_16bit_code_segment; /* 48 */
grub_uint16_t apm_data_segment; /* 4a */
grub_uint16_t apm_flags; /* 4c */
grub_uint32_t apm_code_len; /* 4e */
grub_uint16_t apm_data_len; /* 52 */
grub_uint8_t padding4[0x60 - 0x54];
grub_uint32_t ist_signature; /* 60 */
grub_uint32_t ist_command; /* 64 */
grub_uint32_t ist_event; /* 68 */
grub_uint32_t ist_perf_level; /* 6c */
grub_uint8_t padding5[0x80 - 0x70];
grub_uint8_t hd0_drive_info[0x10]; /* 80 */
grub_uint8_t hd1_drive_info[0x10]; /* 90 */
grub_uint16_t rom_config_len; /* a0 */
grub_uint8_t padding6[0xb0 - 0xa2];
grub_uint32_t ofw_signature; /* b0 */
grub_uint32_t ofw_num_items; /* b4 */
grub_uint32_t ofw_cif_handler; /* b8 */
grub_uint32_t ofw_idt; /* bc */
grub_uint8_t padding7[0x1b8 - 0xc0];
union
{
struct
{
grub_uint32_t efi_system_table; /* 1b8 */
grub_uint32_t padding7_1; /* 1bc */
grub_uint32_t efi_signature; /* 1c0 */
grub_uint32_t efi_mem_desc_size; /* 1c4 */
grub_uint32_t efi_mem_desc_version; /* 1c8 */
grub_uint32_t efi_mmap_size; /* 1cc */
grub_uint32_t efi_mmap; /* 1d0 */
} v0204;
struct
{
grub_uint32_t padding7_1; /* 1b8 */
grub_uint32_t padding7_2; /* 1bc */
grub_uint32_t efi_signature; /* 1c0 */
grub_uint32_t efi_system_table; /* 1c4 */
grub_uint32_t efi_mem_desc_size; /* 1c8 */
grub_uint32_t efi_mem_desc_version; /* 1cc */
grub_uint32_t efi_mmap; /* 1d0 */
grub_uint32_t efi_mmap_size; /* 1d4 */
grub_uint32_t efi_system_table_hi; /* 1d8 */
grub_uint32_t efi_mmap_hi; /* 1dc */
} v0206;
};
grub_uint32_t alt_mem; /* 1e0 */
grub_uint8_t padding8[0x1e8 - 0x1e4];
grub_uint8_t mmap_size; /* 1e8 */
grub_uint8_t padding9[0x1f1 - 0x1e9];
grub_uint8_t setup_sects; /* The size of the setup in sectors */
grub_uint16_t root_flags; /* If the root is mounted readonly */
grub_uint16_t syssize; /* obsolete */
grub_uint16_t swap_dev; /* obsolete */
grub_uint16_t ram_size; /* obsolete */
grub_uint16_t vid_mode; /* Video mode control */
grub_uint16_t root_dev; /* Default root device number */
grub_uint8_t padding10; /* 1fe */
grub_uint8_t ps_mouse; /* 1ff */
grub_uint16_t jump; /* Jump instruction */
grub_uint32_t header; /* Magic signature "HdrS" */
grub_uint16_t version; /* Boot protocol version supported */
grub_uint32_t realmode_swtch; /* Boot loader hook */
grub_uint16_t start_sys; /* The load-low segment (obsolete) */
grub_uint16_t kernel_version; /* Points to kernel version string */
grub_uint8_t type_of_loader; /* Boot loader identifier */
grub_uint8_t loadflags; /* Boot protocol option flags */
grub_uint16_t setup_move_size; /* Move to high memory size */
grub_uint32_t code32_start; /* Boot loader hook */
grub_uint32_t ramdisk_image; /* initrd load address */
grub_uint32_t ramdisk_size; /* initrd size */
grub_uint32_t bootsect_kludge; /* obsolete */
grub_uint16_t heap_end_ptr; /* Free memory after setup end */
grub_uint16_t pad1; /* Unused */
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
grub_uint8_t pad2[164]; /* 22c */
struct grub_e820_mmap e820_map[GRUB_E820_MAX_ENTRY]; /* 2d0 */
} __attribute__ ((packed));
#endif /* ! ASM_FILE */
#endif /* ! GRUB_LINUX_MACHINE_HEADER */

View file

@ -0,0 +1,37 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2007,2008,2009,2010 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_LOADER_CPU_HEADER
#define GRUB_LOADER_CPU_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/symbol.h>
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);
#ifdef GRUB_MACHINE_PCBIOS
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
extern char *EXPORT_VAR(grub_linux_tmp_addr);
extern char *EXPORT_VAR(grub_linux_real_addr);
extern grub_int32_t EXPORT_VAR(grub_linux_is_bzimage);
grub_err_t EXPORT_FUNC(grub_linux16_real_boot) (void);
#endif
#endif /* ! GRUB_LOADER_CPU_HEADER */

View file

@ -0,0 +1,46 @@
/*
* 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)
struct grub_macho_thread32
{
grub_uint32_t cmd;
grub_uint32_t cmdsize;
grub_uint8_t unknown1[48];
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

@ -0,0 +1,30 @@
/* memory.h - describe the memory map */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,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_MEMORY_CPU_HEADER
#define GRUB_MEMORY_CPU_HEADER 1
/* The flag for protected mode. */
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000040
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
#endif /* ! GRUB_MEMORY_CPU_HEADER */

View file

@ -0,0 +1,41 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,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_MULTIBOOT_CPU_HEADER
#define GRUB_MULTIBOOT_CPU_HEADER 1
extern grub_uint32_t grub_multiboot_payload_eip;
extern char *grub_multiboot_payload_orig;
extern grub_addr_t grub_multiboot_payload_dest;
extern grub_size_t grub_multiboot_payload_size;
#define MULTIBOOT_INITIAL_STATE { .eax = MULTIBOOT_BOOTLOADER_MAGIC, \
.ecx = 0, \
.edx = 0, \
/* Set esp to some random location in low memory to avoid breaking */ \
/* non-compliant kernels. */ \
.esp = 0x7ff00 \
}
#define MULTIBOOT_ENTRY_REGISTER eip
#define MULTIBOOT_MBI_REGISTER ebx
#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386
#define MULTIBOOT_ELF32_MACHINE EM_386
#define MULTIBOOT_ELF64_MACHINE EM_X86_64
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/boot.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/console.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/init.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/kernel.h>

Some files were not shown because too many files have changed in this diff Show more