Resync with trunk
This commit is contained in:
commit
e68d3b243f
706 changed files with 157184 additions and 45875 deletions
75
include/grub/acpi.h
Normal file
75
include/grub/acpi.h
Normal 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 */
|
91
include/grub/aout.h
Normal file
91
include/grub/aout.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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_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_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)
|
||||
|
||||
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 /* ! GRUB_AOUT_HEADER */
|
168
include/grub/ata.h
Normal file
168
include/grub/ata.h
Normal 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. */
|
||||
int ioaddress;
|
||||
int 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 */
|
37
include/grub/auth.h
Normal file
37
include/grub/auth.h
Normal 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 */
|
78
include/grub/autoefi.h
Normal file
78
include/grub/autoefi.h
Normal 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
|
28
include/grub/bufio.h
Normal file
28
include/grub/bufio.h
Normal 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 grub_bufio_open (grub_file_t io, int size);
|
||||
grub_file_t grub_buffile_open (const char *name, int size);
|
||||
|
||||
#endif /* ! GRUB_BUFIO_H */
|
121
include/grub/charset.h
Normal file
121
include/grub/charset.h
Normal 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
|
127
include/grub/command.h
Normal file
127
include/grub/command.h
Normal 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 */
|
275
include/grub/crypto.h
Normal file
275
include/grub/crypto.h
Normal 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
|
48
include/grub/datetime.h
Normal file
48
include/grub/datetime.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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. */
|
||||
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
|
||||
|
||||
/* Set date and time. */
|
||||
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
||||
|
||||
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 */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -37,9 +37,18 @@ enum grub_disk_dev_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
|
||||
|
@ -48,8 +57,8 @@ struct grub_disk_dev
|
|||
const char *name;
|
||||
|
||||
/* The device id used by the cache manager. */
|
||||
unsigned long id;
|
||||
|
||||
enum grub_disk_dev_id id;
|
||||
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (const char *name));
|
||||
|
||||
|
@ -67,6 +76,10 @@ struct grub_disk_dev
|
|||
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;
|
||||
};
|
||||
|
@ -91,7 +104,7 @@ struct grub_disk
|
|||
|
||||
/* The id used by the disk cache manager. */
|
||||
unsigned long id;
|
||||
|
||||
|
||||
/* The partition information. This is machine-specific. */
|
||||
struct grub_partition *partition;
|
||||
|
||||
|
@ -105,6 +118,15 @@ struct grub_disk
|
|||
};
|
||||
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
|
||||
|
@ -129,23 +151,27 @@ 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,
|
||||
char *buf);
|
||||
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 char *buf);
|
||||
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);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_raid_init (void);
|
||||
void grub_raid_fini (void);
|
||||
void grub_lvm_init (void);
|
||||
void grub_lvm_fini (void);
|
||||
#endif
|
||||
/* 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 */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* dl.h - types and prototypes for loadable module support */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/elf.h>
|
||||
|
||||
#define GRUB_MOD_INIT(name) \
|
||||
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
|
||||
|
@ -40,6 +41,13 @@ grub_module_##name##_fini (void) { grub_mod_fini (); } \
|
|||
static void \
|
||||
grub_mod_fini (void)
|
||||
|
||||
#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) \
|
||||
static const char grub_module_name_##name[] \
|
||||
__attribute__((section(".modname"), __used__)) = #name
|
||||
|
@ -47,6 +55,7 @@ static const char grub_module_name_##name[] \
|
|||
#define GRUB_MOD_DEP(name) \
|
||||
static const char grub_module_depend_##name[] \
|
||||
__attribute__((section(".moddeps"), __used__)) = #name
|
||||
#endif
|
||||
|
||||
struct grub_dl_segment
|
||||
{
|
||||
|
@ -72,25 +81,39 @@ struct grub_dl
|
|||
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_err_t EXPORT_FUNC(grub_dl_check_header) (void *ehdr, grub_size_t size);
|
||||
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);
|
||||
#ifdef GRUB_UTIL
|
||||
static inline int
|
||||
grub_dl_ref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
static inline int
|
||||
grub_dl_unref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
#endif
|
||||
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 EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
|
||||
grub_dl_t mod);
|
||||
void *EXPORT_FUNC(grub_dl_resolve_symbol) (const char *name);
|
||||
|
||||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* efi.h - declare EFI types and functions */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -21,6 +21,7 @@
|
|||
#define GRUB_EFI_API_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* For consistency and safety, we name the EFI-defined types differently.
|
||||
All names are transformed into lower case, _t appended, and
|
||||
|
@ -40,15 +41,15 @@
|
|||
#define GRUB_EFI_TPL_NOTIFY 16
|
||||
#define GRUB_EFI_TPL_HIGH_LEVEL 31
|
||||
|
||||
#define GRUB_EFI_MEMORY_UC 0x0000000000000001
|
||||
#define GRUB_EFI_MEMORY_WC 0x0000000000000002
|
||||
#define GRUB_EFI_MEMORY_WT 0x0000000000000004
|
||||
#define GRUB_EFI_MEMORY_WB 0x0000000000000008
|
||||
#define GRUB_EFI_MEMORY_UCE 0x0000000000000010
|
||||
#define GRUB_EFI_MEMORY_WP 0x0000000000001000
|
||||
#define GRUB_EFI_MEMORY_RP 0x0000000000002000
|
||||
#define GRUB_EFI_MEMORY_XP 0x0000000000004000
|
||||
#define GRUB_EFI_MEMORY_RUNTIME 0x8000000000000000
|
||||
#define GRUB_EFI_MEMORY_UC 0x0000000000000001LL
|
||||
#define GRUB_EFI_MEMORY_WC 0x0000000000000002LL
|
||||
#define GRUB_EFI_MEMORY_WT 0x0000000000000004LL
|
||||
#define GRUB_EFI_MEMORY_WB 0x0000000000000008LL
|
||||
#define GRUB_EFI_MEMORY_UCE 0x0000000000000010LL
|
||||
#define GRUB_EFI_MEMORY_WP 0x0000000000001000LL
|
||||
#define GRUB_EFI_MEMORY_RP 0x0000000000002000LL
|
||||
#define GRUB_EFI_MEMORY_XP 0x0000000000004000LL
|
||||
#define GRUB_EFI_MEMORY_RUNTIME 0x8000000000000000LL
|
||||
|
||||
#define GRUB_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
|
||||
#define GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
|
||||
|
@ -88,6 +89,26 @@
|
|||
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_MPS_TABLE_GUID \
|
||||
{ 0xeb9d2d2f, 0x2d88, 0x11d3, \
|
||||
{ 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_ACPI_TABLE_GUID \
|
||||
{ 0xeb9d2d30, 0x2d88, 0x11d3, \
|
||||
{ 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_ACPI_20_TABLE_GUID \
|
||||
{ 0x8868e871, 0xe4f1, 0x11d3, \
|
||||
{ 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_SMBIOS_TABLE_GUID \
|
||||
{ 0xeb9d2d31, 0x2d88, 0x11d3, \
|
||||
{ 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
/* Enumerations. */
|
||||
enum grub_efi_timer_delay
|
||||
{
|
||||
|
@ -563,6 +584,16 @@ struct grub_efi_protocol_device_path
|
|||
};
|
||||
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
|
||||
|
||||
struct grub_efi_piwg_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid __attribute__ ((packed));
|
||||
};
|
||||
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
|
||||
|
||||
|
||||
/* BIOS Boot Specification Device Path. */
|
||||
#define GRUB_EFI_BIOS_DEVICE_PATH_TYPE 5
|
||||
|
||||
|
@ -599,7 +630,7 @@ struct grub_efi_time
|
|||
grub_efi_int16_t time_zone;
|
||||
grub_efi_uint8_t daylight;
|
||||
grub_efi_uint8_t pad2;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_time grub_efi_time_t;
|
||||
|
||||
struct grub_efi_time_capabilities
|
||||
|
@ -642,38 +673,38 @@ typedef struct grub_efi_table_header grub_efi_table_header_t;
|
|||
struct grub_efi_boot_services
|
||||
{
|
||||
grub_efi_table_header_t hdr;
|
||||
|
||||
|
||||
grub_efi_tpl_t
|
||||
(*raise_tpl) (grub_efi_tpl_t new_tpl);
|
||||
|
||||
|
||||
void
|
||||
(*restore_tpl) (grub_efi_tpl_t old_tpl);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*allocate_pages) (grub_efi_allocate_type_t type,
|
||||
grub_efi_memory_type_t memory_type,
|
||||
grub_efi_uintn_t pages,
|
||||
grub_efi_physical_address_t *memory);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*free_pages) (grub_efi_physical_address_t memory,
|
||||
grub_efi_uintn_t pages);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*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_status_t
|
||||
(*allocate_pool) (grub_efi_memory_type_t pool_type,
|
||||
grub_efi_uintn_t size,
|
||||
void **buffer);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*free_pool) (void *buffer);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*create_event) (grub_efi_uint32_t type,
|
||||
grub_efi_tpl_t notify_tpl,
|
||||
|
@ -686,7 +717,7 @@ struct grub_efi_boot_services
|
|||
(*set_timer) (grub_efi_event_t event,
|
||||
grub_efi_timer_delay_t type,
|
||||
grub_efi_uint64_t trigger_time);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*wait_for_event) (grub_efi_uintn_t num_events,
|
||||
grub_efi_event_t *event,
|
||||
|
@ -694,10 +725,10 @@ struct grub_efi_boot_services
|
|||
|
||||
grub_efi_status_t
|
||||
(*signal_event) (grub_efi_event_t event);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*close_event) (grub_efi_event_t event);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*check_event) (grub_efi_event_t event);
|
||||
|
||||
|
@ -706,13 +737,13 @@ struct grub_efi_boot_services
|
|||
grub_efi_guid_t *protocol,
|
||||
grub_efi_interface_type_t interface_type,
|
||||
void *interface);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*reinstall_protocol_interface) (grub_efi_handle_t handle,
|
||||
grub_efi_guid_t *protocol,
|
||||
void *old_interface,
|
||||
void *new_interface);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*uninstall_protocol_interface) (grub_efi_handle_t handle,
|
||||
grub_efi_guid_t *protocol,
|
||||
|
@ -722,9 +753,9 @@ struct grub_efi_boot_services
|
|||
(*handle_protocol) (grub_efi_handle_t handle,
|
||||
grub_efi_guid_t *protocol,
|
||||
void **interface);
|
||||
|
||||
|
||||
void *reserved;
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*register_protocol_notify) (grub_efi_guid_t *protocol,
|
||||
grub_efi_event_t event,
|
||||
|
@ -854,7 +885,7 @@ struct grub_efi_runtime_services
|
|||
{
|
||||
grub_efi_table_header_t hdr;
|
||||
|
||||
grub_efi_status_t
|
||||
grub_efi_status_t
|
||||
(*get_time) (grub_efi_time_t *time,
|
||||
grub_efi_time_capabilities_t *capabilities);
|
||||
|
||||
|
@ -913,19 +944,22 @@ struct grub_efi_configuration_table
|
|||
{
|
||||
grub_efi_guid_t vendor_guid;
|
||||
void *vendor_table;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_configuration_table grub_efi_configuration_table_t;
|
||||
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_SIGNATURE 0x5453595320494249LL
|
||||
#define GRUB_EFIEMU_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552LL
|
||||
|
||||
struct grub_efi_simple_input_interface
|
||||
{
|
||||
grub_efi_status_t
|
||||
(*reset) (struct grub_efi_simple_input_interface *this,
|
||||
grub_efi_boolean_t extended_verification);
|
||||
|
||||
|
||||
grub_efi_status_t
|
||||
(*read_key_stroke) (struct grub_efi_simple_input_interface *this,
|
||||
grub_efi_input_key_t *key);
|
||||
|
||||
|
||||
grub_efi_event_t wait_for_key;
|
||||
};
|
||||
typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t;
|
||||
|
@ -950,7 +984,7 @@ struct grub_efi_simple_text_output_interface
|
|||
grub_efi_uintn_t *columns,
|
||||
grub_efi_uintn_t *rows);
|
||||
|
||||
grub_efi_status_t
|
||||
grub_efi_status_t
|
||||
(*set_mode) (struct grub_efi_simple_text_output_interface *this,
|
||||
grub_efi_uintn_t mode_number);
|
||||
|
||||
|
@ -969,7 +1003,7 @@ struct grub_efi_simple_text_output_interface
|
|||
grub_efi_status_t
|
||||
(*enable_cursor) (struct grub_efi_simple_text_output_interface *this,
|
||||
grub_efi_boolean_t visible);
|
||||
|
||||
|
||||
grub_efi_simple_text_output_mode_t *mode;
|
||||
};
|
||||
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
|
||||
|
@ -1095,4 +1129,63 @@ struct grub_efi_block_io
|
|||
};
|
||||
typedef struct grub_efi_block_io grub_efi_block_io_t;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
|
||||
#define efi_call_0(func) func()
|
||||
#define efi_call_1(func, a) func(a)
|
||||
#define efi_call_2(func, a, b) func(a, b)
|
||||
#define efi_call_3(func, a, b, c) func(a, b, c)
|
||||
#define efi_call_4(func, a, b, c, d) func(a, b, c, d)
|
||||
#define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e)
|
||||
#define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) func(a, b, c, d, e, f, g, h, i, j)
|
||||
|
||||
#else
|
||||
|
||||
#define efi_call_0(func) \
|
||||
efi_wrap_0(func)
|
||||
#define efi_call_1(func, a) \
|
||||
efi_wrap_1(func, (grub_uint64_t) a)
|
||||
#define efi_call_2(func, a, b) \
|
||||
efi_wrap_2(func, (grub_uint64_t) a, (grub_uint64_t) b)
|
||||
#define efi_call_3(func, a, b, c) \
|
||||
efi_wrap_3(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c)
|
||||
#define efi_call_4(func, a, b, c, d) \
|
||||
efi_wrap_4(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d)
|
||||
#define efi_call_5(func, a, b, c, d, e) \
|
||||
efi_wrap_5(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e)
|
||||
#define efi_call_6(func, a, b, c, d, e, f) \
|
||||
efi_wrap_6(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f)
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
|
||||
efi_wrap_10(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f, (grub_uint64_t) g, \
|
||||
(grub_uint64_t) h, (grub_uint64_t) i, (grub_uint64_t) j)
|
||||
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_2) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_3) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_4) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_5) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6, grub_uint64_t arg7,
|
||||
grub_uint64_t arg8, grub_uint64_t arg9,
|
||||
grub_uint64_t arg10);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_EFI_API_HEADER */
|
||||
|
|
|
@ -19,19 +19,6 @@
|
|||
#ifndef GRUB_EFI_CONSOLE_HEADER
|
||||
#define GRUB_EFI_CONSOLE_HEADER 1
|
||||
|
||||
/* Define scan codes. */
|
||||
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
|
||||
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
|
||||
#define GRUB_CONSOLE_KEY_UP 0x4800
|
||||
#define GRUB_CONSOLE_KEY_DOWN 0x5000
|
||||
#define GRUB_CONSOLE_KEY_IC 0x5200
|
||||
#define GRUB_CONSOLE_KEY_DC 0x5300
|
||||
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
|
||||
#define GRUB_CONSOLE_KEY_HOME 0x4700
|
||||
#define GRUB_CONSOLE_KEY_END 0x4F00
|
||||
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
|
||||
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* efi.h - declare variables and functions for EFI support */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -61,6 +61,11 @@ 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);
|
||||
|
|
96
include/grub/efi/graphics_output.h
Normal file
96
include/grub/efi/graphics_output.h
Normal 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
|
48
include/grub/efi/memory.h
Normal file
48
include/grub/efi/memory.h
Normal 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 EXPORT_FUNC(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 */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -64,6 +64,7 @@ struct grub_pe32_coff_header
|
|||
};
|
||||
|
||||
#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
|
||||
|
@ -97,10 +98,14 @@ struct grub_pe32_optional_header
|
|||
grub_uint32_t bss_size;
|
||||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
grub_uint32_t data_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;
|
||||
|
@ -115,13 +120,26 @@ struct grub_pe32_optional_header
|
|||
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;
|
||||
|
@ -141,8 +159,16 @@ struct grub_pe32_optional_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
|
||||
|
@ -168,11 +194,23 @@ struct grub_pe32_section_table
|
|||
#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];
|
||||
|
||||
|
@ -193,6 +231,46 @@ struct grub_pe32_fixup_block
|
|||
#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 */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* This is destined to overflow when one minute passes by. */
|
||||
/* 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. */
|
||||
|
|
76
include/grub/efi/uga_draw.h
Normal file
76
include/grub/efi/uga_draw.h
Normal 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 */
|
286
include/grub/efiemu/efiemu.h
Normal file
286
include/grub/efiemu/efiemu.h
Normal 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 */
|
37
include/grub/efiemu/runtime.h
Normal file
37
include/grub/efiemu/runtime.h
Normal 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 */
|
|
@ -1,5 +1,5 @@
|
|||
/* This file defines standard ELF types, structures, and macros.
|
||||
Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999,2000,2001,2002,2008,2009 Free Software Foundation, Inc.
|
||||
This file was part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
@ -206,18 +206,18 @@ typedef struct
|
|||
#define EM_68HC12 53 /* Motorola M68HC12 */
|
||||
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
|
||||
#define EM_PCP 55 /* Siemens PCP */
|
||||
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
|
||||
#define EM_NCPU 56 /* Sony nCPU embedded RISC */
|
||||
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
|
||||
#define EM_STARCORE 58 /* Motorola Start*Core processor */
|
||||
#define EM_ME16 59 /* Toyota ME16 processor */
|
||||
#define EM_ST100 60 /* STMicroelectronic ST100 processor */
|
||||
#define EM_ST100 60 /* STMicroelectronics ST100 processor */
|
||||
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
|
||||
#define EM_X86_64 62 /* AMD x86-64 architecture */
|
||||
#define EM_PDSP 63 /* Sony DSP Processor */
|
||||
|
||||
#define EM_FX66 66 /* Siemens FX66 microcontroller */
|
||||
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
|
||||
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
|
||||
#define EM_ST7 68 /* STMicroelectronics ST7 8 bit mc */
|
||||
#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
|
||||
#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
|
||||
#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
|
||||
|
@ -319,7 +319,7 @@ typedef struct
|
|||
#define SHT_FINI_ARRAY 15 /* Array of destructors */
|
||||
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
|
||||
#define SHT_GROUP 17 /* Section group */
|
||||
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
|
||||
#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
|
||||
#define SHT_NUM 19 /* Number of defined types. */
|
||||
#define SHT_LOOS 0x60000000 /* Start OS-specific */
|
||||
#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
|
||||
|
@ -454,6 +454,7 @@ typedef struct
|
|||
the end of a chain, meaning no further symbols are found in that bucket. */
|
||||
|
||||
#define STN_UNDEF 0 /* End of a chain. */
|
||||
#define STN_ABS 65521
|
||||
|
||||
|
||||
/* How to extract and insert information held in the st_other field. */
|
||||
|
@ -1108,8 +1109,27 @@ typedef struct
|
|||
/* Keep this the last entry. */
|
||||
#define R_386_NUM 38
|
||||
|
||||
|
||||
/* SUN SPARC specific definitions. */
|
||||
|
||||
/* x86_64 specific definitions. */
|
||||
#define R_X86_64_NONE 0
|
||||
#define R_X86_64_64 1
|
||||
#define R_X86_64_PC32 2
|
||||
#define R_X86_64_GOT32 3
|
||||
#define R_X86_64_PLT32 4
|
||||
#define R_X86_64_COPY 5
|
||||
#define R_X86_64_GLOB_DAT 6
|
||||
#define R_X86_64_JUMP_SLOT 7
|
||||
#define R_X86_64_RELATIVE 8
|
||||
#define R_X86_64_GOTPCREL 9
|
||||
#define R_X86_64_32 10
|
||||
#define R_X86_64_32S 11
|
||||
#define R_X86_64_16 12
|
||||
#define R_X86_64_PC16 13
|
||||
#define R_X86_64_8 14
|
||||
#define R_X86_64_PC8 15
|
||||
|
||||
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
|
||||
|
||||
#define STT_REGISTER 13 /* Global register reserved to app. */
|
||||
|
@ -1171,7 +1191,7 @@ typedef struct
|
|||
#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
|
||||
#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
|
||||
#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
|
||||
#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
|
||||
#define R_SPARC_PC_LM22 39 /* Low middle 22 bits of ... */
|
||||
#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
|
||||
#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
|
||||
#define R_SPARC_7 43 /* Direct 7 bit */
|
||||
|
@ -1605,9 +1625,9 @@ typedef Elf32_Addr Elf32_Conflict;
|
|||
#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
|
||||
#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
|
||||
|
||||
/* Additional section indeces. */
|
||||
/* Additional section indices. */
|
||||
|
||||
#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
|
||||
#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared
|
||||
symbols in ANSI C. */
|
||||
#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
|
||||
|
||||
|
@ -1764,7 +1784,7 @@ typedef Elf32_Addr Elf32_Conflict;
|
|||
|
||||
/* Legal values for sh_type field of Elf64_Shdr. */
|
||||
|
||||
/* These two are primerily concerned with ECOFF debugging info. */
|
||||
/* These two are primarily concerned with ECOFF debugging info. */
|
||||
#define SHT_ALPHA_DEBUG 0x70000001
|
||||
#define SHT_ALPHA_REGINFO 0x70000002
|
||||
|
||||
|
@ -2310,4 +2330,48 @@ typedef Elf32_Addr Elf32_Conflict;
|
|||
|
||||
#define R_X86_64_NUM 24
|
||||
|
||||
#if GRUB_TARGET_WORDSIZE == 32
|
||||
|
||||
typedef Elf32_Addr Elf_Addr;
|
||||
typedef Elf32_Ehdr Elf_Ehdr;
|
||||
typedef Elf32_Half Elf_Half;
|
||||
typedef Elf32_Off Elf_Off;
|
||||
typedef Elf32_Rel Elf_Rel;
|
||||
typedef Elf32_Rela Elf_Rela;
|
||||
typedef Elf32_Section Elf_Section;
|
||||
typedef Elf32_Shdr Elf_Shdr;
|
||||
typedef Elf32_Sword Elf_Sword;
|
||||
typedef Elf32_Sym Elf_Sym;
|
||||
typedef Elf32_Word Elf_Word;
|
||||
typedef Elf32_Xword Elf_Xword;
|
||||
|
||||
#define ELF_ST_BIND(val) ELF32_ST_BIND(val)
|
||||
#define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
|
||||
#define ELF_R_SYM(val) ELF32_R_SYM(val)
|
||||
#define ELF_R_TYPE(val) ELF32_R_TYPE(val)
|
||||
#define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type)
|
||||
|
||||
#elif GRUB_TARGET_WORDSIZE == 64
|
||||
|
||||
typedef Elf64_Addr Elf_Addr;
|
||||
typedef Elf64_Ehdr Elf_Ehdr;
|
||||
typedef Elf64_Half Elf_Half;
|
||||
typedef Elf64_Off Elf_Off;
|
||||
typedef Elf64_Rel Elf_Rel;
|
||||
typedef Elf64_Rela Elf_Rela;
|
||||
typedef Elf64_Section Elf_Section;
|
||||
typedef Elf64_Shdr Elf_Shdr;
|
||||
typedef Elf64_Sword Elf_Sword;
|
||||
typedef Elf64_Sym Elf_Sym;
|
||||
typedef Elf64_Word Elf_Word;
|
||||
typedef Elf64_Xword Elf_Xword;
|
||||
|
||||
#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
||||
#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
||||
#define ELF_R_SYM(val) ELF64_R_SYM(val)
|
||||
#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
|
||||
#define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type)
|
||||
|
||||
#endif /* GRUB_TARGET_WORDSIZE == 64 */
|
||||
|
||||
#endif /* ! GRUB_ELF_H */
|
||||
|
|
|
@ -37,9 +37,9 @@ struct grub_elf_file
|
|||
typedef struct grub_elf_file *grub_elf_t;
|
||||
|
||||
typedef grub_err_t (*grub_elf32_load_hook_t)
|
||||
(Elf32_Phdr *phdr, grub_addr_t *addr);
|
||||
(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);
|
||||
(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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -60,7 +60,7 @@ void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
|||
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 EXPORT_FUNC(grub_env_context_open) (void);
|
||||
grub_err_t EXPORT_FUNC(grub_env_context_open) (int export);
|
||||
grub_err_t EXPORT_FUNC(grub_env_context_close) (void);
|
||||
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* err.h - error numbers and prototypes */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -51,7 +51,10 @@ typedef enum
|
|||
GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
GRUB_ERR_SYMLINK_LOOP,
|
||||
GRUB_ERR_BAD_GZIP_DATA,
|
||||
GRUB_ERR_MENU
|
||||
GRUB_ERR_MENU,
|
||||
GRUB_ERR_TIMEOUT,
|
||||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
@ -63,5 +66,7 @@ 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 EXPORT_FUNC(grub_err_printf) (const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
#endif /* ! GRUB_ERR_HEADER */
|
||||
|
|
55
include/grub/extcmd.h
Normal file
55
include/grub/extcmd.h
Normal 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 */
|
182
include/grub/fbblit.h
Normal file
182
include/grub/fbblit.h
Normal 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 */
|
75
include/grub/fbfill.h
Normal file
75
include/grub/fbfill.h
Normal 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 */
|
|
@ -25,19 +25,19 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
struct grub_video_i386_vbeblit_info
|
||||
struct grub_video_fbblit_info
|
||||
{
|
||||
struct grub_video_mode_info *mode_info;
|
||||
void *data;
|
||||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *get_data_ptr (struct grub_video_i386_vbeblit_info *source,
|
||||
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_i386_vbeblit_info *source,
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
void set_pixel (struct grub_video_i386_vbeblit_info *source,
|
||||
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 */
|
|
@ -52,7 +52,7 @@ typedef struct grub_file *grub_file_t;
|
|||
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, char *buf,
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -20,34 +20,96 @@
|
|||
#define GRUB_FONT_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
#define GRUB_FONT_MAGIC "PPF\x7f"
|
||||
/* 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
|
||||
{
|
||||
/* Glyph width in pixels. */
|
||||
grub_uint8_t width;
|
||||
|
||||
/* Glyph height in pixels. */
|
||||
grub_uint8_t height;
|
||||
|
||||
/* Glyph width in characters. */
|
||||
grub_uint8_t char_width;
|
||||
|
||||
/* Glyph baseline position in pixels (from up). */
|
||||
grub_uint8_t baseline;
|
||||
|
||||
/* Glyph bitmap data array of bytes in ((width + 7) / 8) * height.
|
||||
Bitmap is formulated by height scanlines, each scanline having
|
||||
width number of pixels. Pixels are coded as bits, value 1 meaning
|
||||
of opaque pixel and 0 is transparent. If width does not fit byte
|
||||
boundary, it will be padded with 0 to make it fit. */
|
||||
grub_uint8_t bitmap[32];
|
||||
/* 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];
|
||||
};
|
||||
|
||||
typedef struct grub_font_glyph *grub_font_glyph_t;
|
||||
/* Initialize the font loader.
|
||||
Must be called before any fonts are loaded or used. */
|
||||
void grub_font_loader_init (void);
|
||||
|
||||
int grub_font_get_glyph (grub_uint32_t code,
|
||||
grub_font_glyph_t glyph);
|
||||
/* 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 grub_font_get (const char *font_name);
|
||||
|
||||
const char *grub_font_get_name (grub_font_t font);
|
||||
|
||||
int grub_font_get_max_char_width (grub_font_t font);
|
||||
|
||||
int grub_font_get_max_char_height (grub_font_t font);
|
||||
|
||||
int grub_font_get_ascent (grub_font_t font);
|
||||
|
||||
int grub_font_get_descent (grub_font_t font);
|
||||
|
||||
int grub_font_get_leading (grub_font_t font);
|
||||
|
||||
int grub_font_get_height (grub_font_t font);
|
||||
|
||||
int grub_font_get_string_width (grub_font_t font, const char *str);
|
||||
|
||||
struct grub_font_glyph *grub_font_get_glyph (grub_font_t font,
|
||||
grub_uint32_t code);
|
||||
|
||||
struct grub_font_glyph *grub_font_get_glyph_with_fallback (grub_font_t font,
|
||||
grub_uint32_t code);
|
||||
|
||||
grub_err_t grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y);
|
||||
|
||||
grub_err_t 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 */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* fs.h - filesystem manager */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -27,6 +27,14 @@
|
|||
/* 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
|
||||
{
|
||||
|
@ -35,22 +43,36 @@ struct grub_fs
|
|||
|
||||
/* Call HOOK with each file under DIR. */
|
||||
grub_err_t (*dir) (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename, int dir));
|
||||
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* fshelp.h -- Filesystem helper functions */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -26,6 +26,10 @@
|
|||
|
||||
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,
|
||||
|
@ -64,11 +68,11 @@ EXPORT_FUNC(grub_fshelp_find_file) (const char *path,
|
|||
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),
|
||||
int pos, grub_size_t len, char *buf,
|
||||
int (*get_block) (grub_fshelp_node_t node,
|
||||
int block),
|
||||
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
|
||||
|
|
71
include/grub/gpt_partition.h
Normal file
71
include/grub/gpt_partition.h
Normal 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 */
|
60
include/grub/handler.h
Normal file
60
include/grub/handler.h
Normal 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 */
|
|
@ -47,8 +47,9 @@ struct grub_hfs_sblock
|
|||
|
||||
/* A pascal style string that holds the volumename. */
|
||||
grub_uint8_t volname[28];
|
||||
|
||||
grub_uint8_t unused5[60];
|
||||
|
||||
grub_uint8_t unused5[52];
|
||||
grub_uint64_t num_serial;
|
||||
grub_uint16_t embed_sig;
|
||||
struct grub_hfs_extent embed_extent;
|
||||
grub_uint8_t unused6[4];
|
||||
|
|
61
include/grub/i18n.h
Normal file
61
include/grub/i18n.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
# ifdef GRUB_UTIL
|
||||
|
||||
# include <locale.h>
|
||||
# include <libintl.h>
|
||||
|
||||
# endif /* GRUB_UTIL */
|
||||
|
||||
#else /* ! 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 /* 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 */
|
58
include/grub/i386/at_keyboard.h
Normal file
58
include/grub/i386/at_keyboard.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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 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
|
||||
|
||||
#define KEYBOARD_REG_DATA 0x60
|
||||
#define KEYBOARD_REG_STATUS 0x64
|
||||
|
||||
/* 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
|
278
include/grub/i386/bsd.h
Normal file
278
include/grub/i386/bsd.h
Normal file
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
enum bsd_kernel_types
|
||||
{
|
||||
KERNEL_TYPE_NONE,
|
||||
KERNEL_TYPE_FREEBSD,
|
||||
KERNEL_TYPE_OPENBSD,
|
||||
KERNEL_TYPE_NETBSD,
|
||||
};
|
||||
|
||||
#define GRUB_BSD_TEMP_BUFFER 0x80000
|
||||
|
||||
#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 */
|
||||
|
||||
#define FREEBSD_B_DEVMAGIC 0xa0000000
|
||||
#define FREEBSD_B_SLICESHIFT 20
|
||||
#define FREEBSD_B_UNITSHIFT 16
|
||||
#define FREEBSD_B_PARTSHIFT 8
|
||||
#define FREEBSD_B_TYPESHIFT 0
|
||||
|
||||
#define FREEBSD_BOOTINFO_VERSION 1
|
||||
#define FREEBSD_N_BIOS_GEOM 8
|
||||
|
||||
#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 */
|
||||
|
||||
#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"
|
||||
|
||||
struct grub_freebsd_bootinfo
|
||||
{
|
||||
grub_uint32_t bi_version;
|
||||
grub_uint8_t *bi_kernelname;
|
||||
struct nfs_diskless *bi_nfs_diskless;
|
||||
grub_uint32_t bi_n_bios_used;
|
||||
grub_uint32_t bi_bios_geom[FREEBSD_N_BIOS_GEOM];
|
||||
grub_uint32_t bi_size;
|
||||
grub_uint8_t bi_memsizes_valid;
|
||||
grub_uint8_t bi_bios_dev;
|
||||
grub_uint8_t bi_pad[2];
|
||||
grub_uint32_t bi_basemem;
|
||||
grub_uint32_t bi_extmem;
|
||||
grub_uint32_t bi_symtab;
|
||||
grub_uint32_t bi_esymtab;
|
||||
grub_uint32_t bi_kernend;
|
||||
grub_uint32_t bi_envp;
|
||||
grub_uint32_t bi_modulep;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
|
||||
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
|
||||
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
|
||||
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
|
||||
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
|
||||
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
|
||||
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
|
||||
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
|
||||
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
|
||||
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
|
||||
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
|
||||
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
|
||||
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
|
||||
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
|
||||
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
|
||||
|
||||
#define OPENBSD_B_DEVMAGIC 0xa0000000
|
||||
#define OPENBSD_B_ADAPTORSHIFT 24
|
||||
#define OPENBSD_B_CTRLSHIFT 20
|
||||
#define OPENBSD_B_UNITSHIFT 16
|
||||
#define OPENBSD_B_PARTSHIFT 8
|
||||
#define OPENBSD_B_TYPESHIFT 0
|
||||
|
||||
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
|
||||
OPENBSD_BAPIV_ENV | \
|
||||
OPENBSD_BAPIV_BMEMMAP)
|
||||
|
||||
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
|
||||
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
|
||||
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
|
||||
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
|
||||
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
|
||||
|
||||
#define OPENBSD_BOOTARG_ENV 0x1000
|
||||
#define OPENBSD_BOOTARG_END -1
|
||||
|
||||
#define OPENBSD_BOOTARG_MMAP 0
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
struct grub_openbsd_bootargs
|
||||
{
|
||||
int ba_type;
|
||||
int ba_size;
|
||||
struct grub_openbsd_bootargs *ba_next;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
|
||||
|
||||
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
|
||||
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
|
||||
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
|
||||
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
|
||||
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
|
||||
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
|
||||
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
|
||||
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
|
||||
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
|
||||
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
|
||||
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
|
||||
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
|
||||
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
|
||||
|
||||
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
|
||||
|
||||
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
|
||||
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
|
||||
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
|
||||
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
|
||||
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
|
||||
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
|
||||
|
||||
struct grub_netbsd_bootinfo
|
||||
{
|
||||
grub_uint32_t bi_count;
|
||||
void *bi_data[1];
|
||||
};
|
||||
|
||||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
|
||||
struct grub_netbsd_btinfo_common
|
||||
{
|
||||
int len;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_header
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
grub_uint32_t count;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_entry
|
||||
{
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#define NETBSD_MMAP_AVAILABLE 1
|
||||
#define NETBSD_MMAP_RESERVED 2
|
||||
#define NETBSD_MMAP_ACPI 3
|
||||
#define NETBSD_MMAP_NVS 4
|
||||
grub_uint32_t type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootpath
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char bootpath[80];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_rootdevice
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char devname[16];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootdisk
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
int labelsector; /* label valid if != -1 */
|
||||
struct
|
||||
{
|
||||
grub_uint16_t type, checksum;
|
||||
char packname[16];
|
||||
} label;
|
||||
int biosdev;
|
||||
int partition;
|
||||
};
|
||||
|
||||
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 */
|
74
include/grub/i386/cmos.h
Normal file
74
include/grub/i386/cmos.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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/i386/io.h>
|
||||
|
||||
#define GRUB_CMOS_ADDR_REG 0x70
|
||||
#define GRUB_CMOS_DATA_REG 0x71
|
||||
|
||||
#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_CPU_CMOS_H */
|
25
include/grub/i386/coreboot/console.h
Normal file
25
include/grub/i386/coreboot/console.h
Normal 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 */
|
|
@ -22,7 +22,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/i386/pc/memory.h>
|
||||
|
||||
void EXPORT_FUNC(grub_stop) (void);
|
||||
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_stop_floppy) (void);
|
||||
|
||||
#endif
|
|
@ -21,9 +21,8 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1000
|
||||
|
||||
/* Non-zero value is only needed for some IEEE-1275 platforms. */
|
||||
#define GRUB_MOD_GAP 0
|
||||
#ifndef ASM_FILE
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -24,14 +24,14 @@
|
|||
#include <grub/i386/pc/memory.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE 0xf0000 /* 960 kiB */
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
@ -55,13 +55,15 @@ struct grub_linuxbios_mem_region
|
|||
{
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t size;
|
||||
#define GRUB_LINUXBIOS_MEMORY_AVAILABLE 1
|
||||
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
|
||||
grub_uint32_t type;
|
||||
};
|
||||
typedef struct grub_linuxbios_mem_region *mem_region_t;
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_available_iterate)
|
||||
(int (*hook) (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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -16,9 +16,9 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_MACHINE_HEADER
|
||||
#define GRUB_MACHINE_MACHINE_HEADER 1
|
||||
#ifndef GRUB_CPU_CPUID_HEADER
|
||||
#define GRUB_CPU_CPUID_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_EFI 1
|
||||
extern unsigned char grub_cpuid_has_longmode;
|
||||
|
||||
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
|
||||
#endif
|
|
@ -19,9 +19,4 @@
|
|||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
|
||||
/* It is necessary to export these functions, because normal mode commands
|
||||
reuse rescue mode commands. */
|
||||
void grub_rescue_cmd_linux (int argc, char *argv[]);
|
||||
void grub_rescue_cmd_initrd (int argc, char *argv[]);
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
||||
|
|
1
include/grub/i386/efi/memory.h
Normal file
1
include/grub/i386/efi/memory.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/efi/memory.h>
|
33
include/grub/i386/efiemu.h
Normal file
33
include/grub/i386/efiemu.h
Normal 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
|
|
@ -21,8 +21,10 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
void EXPORT_FUNC(grub_keyboard_controller_init) (void);
|
||||
int EXPORT_FUNC(grub_console_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_console_getkey) (void);
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/multiboot.h>
|
||||
|
||||
void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void grub_rescue_cmd_linux (int argc, char *argv[]);
|
||||
void grub_rescue_cmd_initrd (int argc, char *argv[]);
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
||||
|
|
35
include/grub/i386/kernel.h
Normal file
35
include/grub/i386/kernel.h
Normal 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
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -21,7 +21,6 @@
|
|||
|
||||
#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */
|
||||
#define GRUB_LINUX_DEFAULT_SETUP_SECTS 4
|
||||
#define GRUB_LINUX_FLAG_CAN_USE_HEAP 0x80
|
||||
#define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF
|
||||
#define GRUB_LINUX_MAX_SETUP_SECTS 64
|
||||
#define GRUB_LINUX_BOOT_LOADER_TYPE 0x72
|
||||
|
@ -33,25 +32,60 @@
|
|||
#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_CL_OFFSET 0x9000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
|
||||
#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
|
||||
#define GRUB_LINUX_CL_MAGIC 0xA33F
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
#define GRUB_LINUX_EFI_SIGNATURE \
|
||||
('E' << 24 | 'F' << 16 | 'I' << 8 | 'L')
|
||||
('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 */
|
||||
|
@ -71,6 +105,17 @@ struct linux_kernel_header
|
|||
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 */
|
||||
|
@ -92,21 +137,21 @@ struct linux_kernel_params
|
|||
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 */
|
||||
|
@ -129,8 +174,9 @@ struct linux_kernel_params
|
|||
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 - 0x36];
|
||||
grub_uint8_t padding3[0x40 - 0x3a];
|
||||
|
||||
grub_uint16_t apm_version; /* 40 */
|
||||
grub_uint16_t apm_code_segment; /* 42 */
|
||||
|
@ -140,40 +186,95 @@ struct linux_kernel_params
|
|||
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[0x1c0 - 0xa2];
|
||||
|
||||
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_uint8_t padding7[0x1e0 - 0x1d8];
|
||||
|
||||
grub_uint32_t alt_mem; /* 1e0 */
|
||||
|
||||
grub_uint8_t padding8[0x1e8 - 0x1e4];
|
||||
|
||||
grub_uint32_t mmap_size; /* 1e8 */
|
||||
grub_uint8_t padding6[0xb0 - 0xa2];
|
||||
|
||||
grub_uint8_t padding9[0x1ff - 0x1ec];
|
||||
|
||||
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 */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -20,29 +20,18 @@
|
|||
#define GRUB_LOADER_CPU_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/multiboot.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);
|
||||
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
|
||||
extern grub_size_t EXPORT_VAR(grub_os_area_size);
|
||||
|
||||
void EXPORT_FUNC(grub_linux_boot) (void) __attribute__ ((noreturn));
|
||||
|
||||
/* The asm part of the multiboot loader. */
|
||||
void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
/* It is necessary to export these functions, because normal mode commands
|
||||
reuse rescue mode commands. */
|
||||
void grub_rescue_cmd_linux (int argc, char *argv[]);
|
||||
void grub_rescue_cmd_initrd (int argc, char *argv[]);
|
||||
grub_err_t EXPORT_FUNC(grub_linux16_real_boot) (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_LOADER_CPU_HEADER */
|
||||
|
|
46
include/grub/i386/macho.h
Normal file
46
include/grub/i386/macho.h
Normal 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
|
30
include/grub/i386/memory.h
Normal file
30
include/grub/i386/memory.h
Normal 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 */
|
35
include/grub/i386/multiboot.h
Normal file
35
include/grub/i386/multiboot.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
/* The asm part of the multiboot loader. */
|
||||
void grub_multiboot_real_boot (grub_addr_t entry,
|
||||
struct multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void grub_multiboot2_real_boot (grub_addr_t entry,
|
||||
struct multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
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;
|
||||
|
||||
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -23,6 +23,15 @@
|
|||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_BIOSDISK_FLAG_LBA 1
|
||||
#define GRUB_BIOSDISK_FLAG_CDROM 2
|
||||
|
||||
#define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0
|
||||
#define GRUB_BIOSDISK_CDTYPE_1_2_M 1
|
||||
#define GRUB_BIOSDISK_CDTYPE_1_44_M 2
|
||||
#define GRUB_BIOSDISK_CDTYPE_2_88_M 3
|
||||
#define GRUB_BIOSDISK_CDTYPE_HARDDISK 4
|
||||
|
||||
#define GRUB_BIOSDISK_CDTYPE_MASK 0xF
|
||||
|
||||
struct grub_biosdisk_data
|
||||
{
|
||||
|
@ -63,13 +72,30 @@ struct grub_biosdisk_drp
|
|||
grub_uint8_t device_path[8];
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t checksum;
|
||||
|
||||
|
||||
/* XXX: This is necessary, because the BIOS of Thinkpad X20
|
||||
writes a garbage to the tail of drive parameters,
|
||||
regardless of a size specified in a caller. */
|
||||
grub_uint8_t dummy[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_biosdisk_cdrp
|
||||
{
|
||||
grub_uint8_t size;
|
||||
grub_uint8_t media_type;
|
||||
grub_uint8_t drive_no;
|
||||
grub_uint8_t controller_no;
|
||||
grub_uint32_t image_lba;
|
||||
grub_uint16_t device_spec;
|
||||
grub_uint16_t cache_seg;
|
||||
grub_uint16_t load_seg;
|
||||
grub_uint16_t length_sec512;
|
||||
grub_uint8_t cylinders;
|
||||
grub_uint8_t sectors;
|
||||
grub_uint8_t heads;
|
||||
grub_uint8_t dummy[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Disk Address Packet. */
|
||||
struct grub_biosdisk_dap
|
||||
{
|
||||
|
@ -86,6 +112,8 @@ int EXPORT_FUNC(grub_biosdisk_rw_standard) (int ah, int drive, int coff, int hof
|
|||
int EXPORT_FUNC(grub_biosdisk_check_int13_extensions) (int drive);
|
||||
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_int13_extensions) (int drive,
|
||||
void *drp);
|
||||
int EXPORT_FUNC(grub_biosdisk_get_cdinfo_int13_extensions) (int drive,
|
||||
void *cdrp);
|
||||
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_standard) (int drive,
|
||||
unsigned long *cylinders,
|
||||
unsigned long *heads,
|
||||
|
|
6
include/grub/i386/pc/biosnum.h
Normal file
6
include/grub/i386/pc/biosnum.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef GRUB_BIOSNUM_MACHINE_HEADER
|
||||
#define GRUB_BIOSNUM_MACHINE_HEADER 1
|
||||
|
||||
extern int (*grub_get_root_biosnumber) (void);
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2002,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2002,2005,2006,2007,2008,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
|
||||
|
@ -26,25 +26,16 @@
|
|||
#define GRUB_BOOT_MACHINE_BPB_START 0x3
|
||||
|
||||
/* The offset of the end of BPB (BIOS Parameter Block). */
|
||||
#define GRUB_BOOT_MACHINE_BPB_END 0x3e
|
||||
|
||||
/* The offset of the major version. */
|
||||
#define GRUB_BOOT_MACHINE_VER_MAJ 0x3e
|
||||
|
||||
/* The offset of BOOT_DRIVE. */
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x4c
|
||||
|
||||
/* The offset of KERNEL_ADDRESS. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS 0x40
|
||||
#define GRUB_BOOT_MACHINE_BPB_END 0x5a
|
||||
|
||||
/* The offset of KERNEL_SECTOR. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x44
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x5c
|
||||
|
||||
/* The offset of KERNEL_SEGMENT. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x42
|
||||
/* The offset of BOOT_DRIVE. */
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x64
|
||||
|
||||
/* The offset of BOOT_DRIVE_CHECK. */
|
||||
#define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x4e
|
||||
#define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x66
|
||||
|
||||
/* The offset of a magic number used by Windows NT. */
|
||||
#define GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8
|
||||
|
@ -75,4 +66,16 @@
|
|||
/* The size of a block list used in the kernel startup code. */
|
||||
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct grub_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -27,7 +27,4 @@ typedef enum
|
|||
GRUB_CHAINLOADER_FORCE = 0x1
|
||||
} grub_chainloader_flags_t;
|
||||
|
||||
void EXPORT_FUNC(grub_chainloader_cmd) (const char * file,
|
||||
grub_chainloader_flags_t flags);
|
||||
|
||||
#endif /* GRUB_CHAINLOADER_MACHINE_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -29,19 +29,19 @@
|
|||
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
|
||||
#define GRUB_CONSOLE_KEY_HOME 0x4700
|
||||
#define GRUB_CONSOLE_KEY_END 0x4F00
|
||||
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
|
||||
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
|
||||
#define GRUB_CONSOLE_KEY_NPAGE 0x5100
|
||||
#define GRUB_CONSOLE_KEY_PPAGE 0x4900
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i386/vga_common.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
extern grub_uint8_t grub_console_cur_color;
|
||||
void grub_console_real_putchar (int c);
|
||||
int EXPORT_FUNC(grub_console_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_console_getkey) (void);
|
||||
int grub_console_checkkey (void);
|
||||
int grub_console_getkey (void);
|
||||
grub_uint16_t grub_console_getxy (void);
|
||||
void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_console_cls (void);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -16,9 +16,9 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_MACHINE_HEADER
|
||||
#define GRUB_MACHINE_MACHINE_HEADER 1
|
||||
#ifndef GRUB_MACHINE_EFI_EMU_HEADER
|
||||
#define GRUB_MACHINE_EFI_EMU_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_PCBIOS 1
|
||||
grub_err_t grub_machine_efiemu_init_tables (void);
|
||||
|
||||
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2004,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
|
||||
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
|
||||
/* Get the memory size in KB. If EXTENDED is zero, return conventional
|
||||
memory, otherwise return extended memory. */
|
||||
|
@ -30,28 +31,14 @@ grub_uint16_t grub_get_memsize (int extended);
|
|||
in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. */
|
||||
grub_uint32_t grub_get_eisa_mmap (void);
|
||||
|
||||
struct grub_machine_mmap_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
grub_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Get a memory map entry. Return next continuation value. Zero means
|
||||
the end. */
|
||||
grub_uint32_t grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
|
||||
grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *entry,
|
||||
grub_uint32_t cont);
|
||||
|
||||
/* Turn on/off Gate A20. */
|
||||
void grub_gate_a20 (int on);
|
||||
|
||||
/* Reboot the machine. */
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
|
||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||
* use APM even if it is available. */
|
||||
void EXPORT_FUNC (grub_halt) (int no_apm);
|
||||
|
||||
void EXPORT_FUNC(grub_stop_floppy) (void);
|
||||
|
||||
#endif /* ! GRUB_INIT_MACHINE_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,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
|
||||
|
@ -34,17 +34,17 @@
|
|||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_MEMDISK_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE 0x1c
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x20
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x5c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0x4A0
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0)
|
||||
|
||||
/* Enable LZMA compression */
|
||||
#define ENABLE_LZMA 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
@ -63,21 +63,12 @@ extern grub_int32_t grub_install_dos_part;
|
|||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The size of memory disk image, if present. */
|
||||
extern grub_int32_t grub_memdisk_image_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_int32_t grub_boot_drive;
|
||||
|
||||
/* The end address of the kernel. */
|
||||
extern grub_addr_t grub_end_addr;
|
||||
|
||||
extern grub_addr_t EXPORT_FUNC(grub_arch_memdisk_addr) (void);
|
||||
extern grub_off_t EXPORT_FUNC(grub_arch_memdisk_size) (void);
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* memory.h - describe the memory map */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007,2008 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -21,11 +21,14 @@
|
|||
#define GRUB_MEMORY_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/machine.h>
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/memory.h>
|
||||
#endif
|
||||
|
||||
#include <grub/i386/memory.h>
|
||||
|
||||
/* The scratch buffer used in real mode code. */
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||
|
@ -61,9 +64,6 @@
|
|||
/* The address where another boot loader is loaded. */
|
||||
#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
|
||||
|
||||
/* The flag for protected mode. */
|
||||
#define GRUB_MEMORY_MACHINE_CR0_PE_ON 0x1
|
||||
|
||||
/* The code segment of the protected mode. */
|
||||
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
|
||||
|
||||
|
@ -76,11 +76,65 @@
|
|||
/* The data segment of the pseudo real mode. */
|
||||
#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
|
||||
|
||||
#ifndef GRUB_MACHINE_IEEE1275
|
||||
#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
|
||||
|
||||
#ifndef ASM_FILE
|
||||
extern grub_size_t EXPORT_VAR(grub_lower_mem);
|
||||
extern grub_size_t EXPORT_VAR(grub_upper_mem);
|
||||
|
||||
/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
|
||||
description of the BIOS Data Area layout. */
|
||||
struct grub_machine_bios_data_area
|
||||
{
|
||||
grub_uint8_t unused1[0x17];
|
||||
grub_uint8_t keyboard_flag_lower; /* 0x17 */
|
||||
grub_uint8_t unused2[0xf0 - 0x18];
|
||||
};
|
||||
|
||||
struct grub_machine_mmap_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#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_MAX_TYPE 4
|
||||
/* This one is special: it's used internally but is never reported
|
||||
by firmware. */
|
||||
#define GRUB_MACHINE_MEMORY_HOLE 5
|
||||
|
||||
grub_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
|
||||
grub_uint64_t grub_mmap_get_post64 (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
|
||||
#define GRUB_MMAP_MALLOC_LOW 1
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
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);
|
||||
#else
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
int type __attribute__ ((unused)),
|
||||
int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
314
include/grub/i386/pc/pxe.h
Normal file
314
include/grub/i386/pc/pxe.h
Normal file
|
@ -0,0 +1,314 @@
|
|||
/*
|
||||
* 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_PXE_H
|
||||
#define GRUB_CPU_PXE_H
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_PXENV_TFTP_OPEN 0x0020
|
||||
#define GRUB_PXENV_TFTP_CLOSE 0x0021
|
||||
#define GRUB_PXENV_TFTP_READ 0x0022
|
||||
#define GRUB_PXENV_TFTP_READ_FILE 0x0023
|
||||
#define GRUB_PXENV_TFTP_READ_FILE_PMODE 0x0024
|
||||
#define GRUB_PXENV_TFTP_GET_FSIZE 0x0025
|
||||
|
||||
#define GRUB_PXENV_UDP_OPEN 0x0030
|
||||
#define GRUB_PXENV_UDP_CLOSE 0x0031
|
||||
#define GRUB_PXENV_UDP_READ 0x0032
|
||||
#define GRUB_PXENV_UDP_WRITE 0x0033
|
||||
|
||||
#define GRUB_PXENV_START_UNDI 0x0000
|
||||
#define GRUB_PXENV_UNDI_STARTUP 0x0001
|
||||
#define GRUB_PXENV_UNDI_CLEANUP 0x0002
|
||||
#define GRUB_PXENV_UNDI_INITIALIZE 0x0003
|
||||
#define GRUB_PXENV_UNDI_RESET_NIC 0x0004
|
||||
#define GRUB_PXENV_UNDI_SHUTDOWN 0x0005
|
||||
#define GRUB_PXENV_UNDI_OPEN 0x0006
|
||||
#define GRUB_PXENV_UNDI_CLOSE 0x0007
|
||||
#define GRUB_PXENV_UNDI_TRANSMIT 0x0008
|
||||
#define GRUB_PXENV_UNDI_SET_MCAST_ADDR 0x0009
|
||||
#define GRUB_PXENV_UNDI_SET_STATION_ADDR 0x000A
|
||||
#define GRUB_PXENV_UNDI_SET_PACKET_FILTER 0x000B
|
||||
#define GRUB_PXENV_UNDI_GET_INFORMATION 0x000C
|
||||
#define GRUB_PXENV_UNDI_GET_STATISTICS 0x000D
|
||||
#define GRUB_PXENV_UNDI_CLEAR_STATISTICS 0x000E
|
||||
#define GRUB_PXENV_UNDI_INITIATE_DIAGS 0x000F
|
||||
#define GRUB_PXENV_UNDI_FORCE_INTERRUPT 0x0010
|
||||
#define GRUB_PXENV_UNDI_GET_MCAST_ADDR 0x0011
|
||||
#define GRUB_PXENV_UNDI_GET_NIC_TYPE 0x0012
|
||||
#define GRUB_PXENV_UNDI_GET_IFACE_INFO 0x0013
|
||||
#define GRUB_PXENV_UNDI_ISR 0x0014
|
||||
#define GRUB_PXENV_STOP_UNDI 0x0015
|
||||
#define GRUB_PXENV_UNDI_GET_STATE 0x0015
|
||||
|
||||
#define GRUB_PXENV_UNLOAD_STACK 0x0070
|
||||
#define GRUB_PXENV_GET_CACHED_INFO 0x0071
|
||||
#define GRUB_PXENV_RESTART_DHCP 0x0072
|
||||
#define GRUB_PXENV_RESTART_TFTP 0x0073
|
||||
#define GRUB_PXENV_MODE_SWITCH 0x0074
|
||||
#define GRUB_PXENV_START_BASE 0x0075
|
||||
#define GRUB_PXENV_STOP_BASE 0x0076
|
||||
|
||||
#define GRUB_PXENV_EXIT_SUCCESS 0x0000
|
||||
#define GRUB_PXENV_EXIT_FAILURE 0x0001
|
||||
|
||||
#define GRUB_PXENV_STATUS_SUCCESS 0x00
|
||||
#define GRUB_PXENV_STATUS_FAILURE 0x01
|
||||
#define GRUB_PXENV_STATUS_BAD_FUNC 0x02
|
||||
#define GRUB_PXENV_STATUS_UNSUPPORTED 0x03
|
||||
#define GRUB_PXENV_STATUS_KEEP_UNDI 0x04
|
||||
#define GRUB_PXENV_STATUS_KEEP_ALL 0x05
|
||||
#define GRUB_PXENV_STATUS_OUT_OF_RESOURCES 0x06
|
||||
#define GRUB_PXENV_STATUS_ARP_TIMEOUT 0x11
|
||||
#define GRUB_PXENV_STATUS_UDP_CLOSED 0x18
|
||||
#define GRUB_PXENV_STATUS_UDP_OPEN 0x19
|
||||
#define GRUB_PXENV_STATUS_TFTP_CLOSED 0x1A
|
||||
#define GRUB_PXENV_STATUS_TFTP_OPEN 0x1B
|
||||
#define GRUB_PXENV_STATUS_MCOPY_PROBLEM 0x20
|
||||
#define GRUB_PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
|
||||
#define GRUB_PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
|
||||
#define GRUB_PXENV_STATUS_BIS_INIT_FAILURE 0x23
|
||||
#define GRUB_PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
|
||||
#define GRUB_PXENV_STATUS_BIS_GBOA_FAILURE 0x25
|
||||
#define GRUB_PXENV_STATUS_BIS_FREE_FAILURE 0x26
|
||||
#define GRUB_PXENV_STATUS_BIS_GSI_FAILURE 0x27
|
||||
#define GRUB_PXENV_STATUS_BIS_BAD_CKSUM 0x28
|
||||
#define GRUB_PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
|
||||
#define GRUB_PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
|
||||
|
||||
#define GRUB_PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
|
||||
#define GRUB_PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
|
||||
#define GRUB_PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
|
||||
#define GRUB_PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
|
||||
#define GRUB_PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
|
||||
#define GRUB_PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3A
|
||||
#define GRUB_PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3B
|
||||
#define GRUB_PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3C
|
||||
#define GRUB_PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3D
|
||||
#define GRUB_PXENV_STATUS_TFTP_NO_FILESIZE 0x3E
|
||||
#define GRUB_PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3F
|
||||
#define GRUB_PXENV_STATUS_DHCP_TIMEOUT 0x51
|
||||
#define GRUB_PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
|
||||
#define GRUB_PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
|
||||
#define GRUB_PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
|
||||
#define GRUB_PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
|
||||
#define GRUB_PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
|
||||
#define GRUB_PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
|
||||
#define GRUB_PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
|
||||
#define GRUB_PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
|
||||
#define GRUB_PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
|
||||
#define GRUB_PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
|
||||
#define GRUB_PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
|
||||
#define GRUB_PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
|
||||
#define GRUB_PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
|
||||
#define GRUB_PXENV_STATUS_UNDI_INVALID_STATE 0x6A
|
||||
#define GRUB_PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6B
|
||||
#define GRUB_PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6C
|
||||
#define GRUB_PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
|
||||
#define GRUB_PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
|
||||
#define GRUB_PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
|
||||
#define GRUB_PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
|
||||
#define GRUB_PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
|
||||
#define GRUB_PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xA0
|
||||
#define GRUB_PXENV_STATUS_BINL_NO_PXE_SERVER 0xA1
|
||||
#define GRUB_PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xA2
|
||||
#define GRUB_PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xA3
|
||||
#define GRUB_PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xB0
|
||||
#define GRUB_PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xC0
|
||||
#define GRUB_PXENV_STATUS_LOADER_NO_BC_ROMID 0xC1
|
||||
#define GRUB_PXENV_STATUS_LOADER_BAD_BC_ROMID 0xC2
|
||||
#define GRUB_PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xC3
|
||||
#define GRUB_PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xC4
|
||||
#define GRUB_PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xC5
|
||||
#define GRUB_PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xC6
|
||||
#define GRUB_PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xC8
|
||||
#define GRUB_PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xC9
|
||||
#define GRUB_PXENV_STATUS_LOADER_UNDI_START 0xCA
|
||||
#define GRUB_PXENV_STATUS_LOADER_BC_START 0xCB
|
||||
|
||||
#define GRUB_PXENV_PACKET_TYPE_DHCP_DISCOVER 1
|
||||
#define GRUB_PXENV_PACKET_TYPE_DHCP_ACK 2
|
||||
#define GRUB_PXENV_PACKET_TYPE_CACHED_REPLY 3
|
||||
|
||||
#define GRUB_PXE_BOOTP_REQ 1
|
||||
#define GRUB_PXE_BOOTP_REP 2
|
||||
|
||||
#define GRUB_PXE_BOOTP_BCAST 0x8000
|
||||
|
||||
#if 1
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size. */
|
||||
#else
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 312 /* DHCP standard vendor field size. */
|
||||
#endif
|
||||
|
||||
#define GRUB_PXE_MIN_BLKSIZE 512
|
||||
#define GRUB_PXE_MAX_BLKSIZE 1432
|
||||
|
||||
#define GRUB_PXE_TFTP_PORT 69
|
||||
|
||||
#define GRUB_PXE_VM_RFC1048 0x63825363L
|
||||
|
||||
#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
struct grub_pxenv
|
||||
{
|
||||
grub_uint8_t signature[6]; /* 'PXENV+'. */
|
||||
grub_uint16_t version; /* MSB = major, LSB = minor. */
|
||||
grub_uint8_t length; /* structure length. */
|
||||
grub_uint8_t checksum; /* checksum pad. */
|
||||
grub_uint32_t rm_entry; /* SEG:OFF to PXE entry point. */
|
||||
grub_uint32_t pm_offset; /* Protected mode entry. */
|
||||
grub_uint16_t pm_selector; /* Protected mode selector. */
|
||||
grub_uint16_t stack_seg; /* Stack segment address. */
|
||||
grub_uint16_t stack_size; /* Stack segment size (bytes). */
|
||||
grub_uint16_t bc_code_seg; /* BC Code segment address. */
|
||||
grub_uint16_t bc_code_size; /* BC Code segment size (bytes). */
|
||||
grub_uint16_t bc_data_seg; /* BC Data segment address. */
|
||||
grub_uint16_t bc_data_size; /* BC Data segment size (bytes). */
|
||||
grub_uint16_t undi_data_seg; /* UNDI Data segment address. */
|
||||
grub_uint16_t undi_data_size; /* UNDI Data segment size (bytes). */
|
||||
grub_uint16_t undi_code_seg; /* UNDI Code segment address. */
|
||||
grub_uint16_t undi_code_size; /* UNDI Code segment size (bytes). */
|
||||
grub_uint32_t pxe_ptr; /* SEG:OFF to !PXE struct. */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_get_cached_info
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint16_t packet_type;
|
||||
grub_uint16_t buffer_size;
|
||||
grub_uint32_t buffer;
|
||||
grub_uint16_t buffer_limit;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_PXE_MAC_ADDR_LEN 16
|
||||
|
||||
typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_pxenv_boot_player
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t hw_type; /* hardware type. */
|
||||
grub_uint8_t hw_len; /* hardware addr len. */
|
||||
grub_uint8_t gate_hops; /* zero it. */
|
||||
grub_uint32_t ident; /* random number chosen by client. */
|
||||
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
|
||||
grub_uint16_t flags;
|
||||
grub_uint32_t client_ip;
|
||||
grub_uint32_t your_ip;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_pxe_mac_addr_t mac_addr;
|
||||
grub_uint8_t server_name[64];
|
||||
grub_uint8_t boot_file[128];
|
||||
union
|
||||
{
|
||||
grub_uint8_t d[GRUB_PXE_BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options. */
|
||||
struct
|
||||
{
|
||||
grub_uint32_t magic; /* DHCP magic cookie. */
|
||||
grub_uint32_t flags; /* bootp flags/opcodes. */
|
||||
grub_uint8_t padding[56];
|
||||
} v;
|
||||
} vendor;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_open
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_uint8_t filename[128];
|
||||
grub_uint16_t tftp_port;
|
||||
grub_uint16_t packet_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_close
|
||||
{
|
||||
grub_uint16_t status;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_read
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint16_t packet_number;
|
||||
grub_uint16_t buffer_size;
|
||||
grub_uint32_t buffer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_get_fsize
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_uint8_t filename[128];
|
||||
grub_uint32_t file_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_udp_open
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint32_t src_ip;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_udp_close
|
||||
{
|
||||
grub_uint16_t status;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_udp_write
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint32_t ip;
|
||||
grub_uint32_t gateway;
|
||||
grub_uint16_t src_port;
|
||||
grub_uint16_t dst_port;
|
||||
grub_uint16_t buffer_size;
|
||||
grub_uint32_t buffer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_udp_read
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint32_t src_ip;
|
||||
grub_uint32_t dst_ip;
|
||||
grub_uint16_t src_port;
|
||||
grub_uint16_t dst_port;
|
||||
grub_uint16_t buffer_size;
|
||||
grub_uint32_t buffer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_unload_stack
|
||||
{
|
||||
grub_uint16_t status;
|
||||
grub_uint8_t reserved[10];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
|
||||
int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
|
||||
|
||||
extern struct grub_pxenv *grub_pxe_pxenv;
|
||||
|
||||
void grub_pxe_unload (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_CPU_PXE_H */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -19,10 +19,7 @@
|
|||
#ifndef GRUB_VBE_MACHINE_HEADER
|
||||
#define GRUB_VBE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
|
||||
/* Default video mode to be used. */
|
||||
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
|
||||
|
@ -30,9 +27,32 @@
|
|||
/* VBE status codes. */
|
||||
#define GRUB_VBE_STATUS_OK 0x004f
|
||||
|
||||
/* VBE memory model types. */
|
||||
#define GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL 0x04
|
||||
#define GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR 0x06
|
||||
#define GRUB_VBE_CAPABILITY_DACWIDTH (1 << 0)
|
||||
|
||||
/* Bits from the GRUB_VBE "mode_attributes" field in the mode info struct. */
|
||||
#define GRUB_VBE_MODEATTR_SUPPORTED (1 << 0)
|
||||
#define GRUB_VBE_MODEATTR_RESERVED_1 (1 << 1)
|
||||
#define GRUB_VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2)
|
||||
#define GRUB_VBE_MODEATTR_COLOR (1 << 3)
|
||||
#define GRUB_VBE_MODEATTR_GRAPHICS (1 << 4)
|
||||
#define GRUB_VBE_MODEATTR_VGA_COMPATIBLE (1 << 5)
|
||||
#define GRUB_VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6)
|
||||
#define GRUB_VBE_MODEATTR_LFB_AVAIL (1 << 7)
|
||||
#define GRUB_VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8)
|
||||
#define GRUB_VBE_MODEATTR_INTERLACED_AVAIL (1 << 9)
|
||||
#define GRUB_VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10)
|
||||
#define GRUB_VBE_MODEATTR_STEREO_AVAIL (1 << 11)
|
||||
#define GRUB_VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12)
|
||||
|
||||
/* Values for the GRUB_VBE memory_model field in the mode info struct. */
|
||||
#define GRUB_VBE_MEMORY_MODEL_TEXT 0x00
|
||||
#define GRUB_VBE_MEMORY_MODEL_CGA 0x01
|
||||
#define GRUB_VBE_MEMORY_MODEL_HERCULES 0x02
|
||||
#define GRUB_VBE_MEMORY_MODEL_PLANAR 0x03
|
||||
#define GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL 0x04
|
||||
#define GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256 0x05
|
||||
#define GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR 0x06
|
||||
#define GRUB_VBE_MEMORY_MODEL_YUV 0x07
|
||||
|
||||
/* Note:
|
||||
|
||||
|
@ -122,9 +142,9 @@ struct grub_vbe_mode_info_block
|
|||
grub_uint8_t lin_rsvd_field_position;
|
||||
grub_uint32_t max_pixel_clock;
|
||||
|
||||
/* Reserved field to make structure to be 256 bytes long, VESA BIOS
|
||||
Extension 3.0 Specification says to reserve 189 bytes here but
|
||||
that doesn't make structure to be 256 bytes. So additional one is
|
||||
/* Reserved field to make structure to be 256 bytes long, VESA BIOS
|
||||
Extension 3.0 Specification says to reserve 189 bytes here but
|
||||
that doesn't make structure to be 256 bytes. So additional one is
|
||||
added here. */
|
||||
grub_uint8_t reserved4[189 + 1];
|
||||
} __attribute__ ((packed));
|
||||
|
@ -160,6 +180,11 @@ grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_controller_info) (struct grub_vb
|
|||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode_info) (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
|
||||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_getset_dac_palette_width) (int set, int *width);
|
||||
|
||||
#define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
|
||||
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
|
||||
|
||||
/* Call VESA BIOS 0x4f02 to set video mode, return status. */
|
||||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_mode) (grub_uint32_t mode,
|
||||
struct grub_vbe_crtc_info_block *crtc_info);
|
||||
|
@ -203,54 +228,5 @@ grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
|
|||
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
|
||||
/* VBE module internal prototypes (should not be used from elsewhere). */
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
struct grub_video_render_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. */
|
||||
void *data;
|
||||
};
|
||||
|
||||
grub_uint8_t * grub_video_vbe_get_video_ptr (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_uint32_t x, grub_uint32_t y);
|
||||
|
||||
grub_video_color_t grub_video_vbe_map_rgb (grub_uint8_t red, grub_uint8_t green,
|
||||
grub_uint8_t blue);
|
||||
|
||||
grub_video_color_t grub_video_vbe_map_rgba (grub_uint8_t red,
|
||||
grub_uint8_t green,
|
||||
grub_uint8_t blue,
|
||||
grub_uint8_t alpha);
|
||||
|
||||
grub_err_t grub_video_vbe_unmap_color (grub_video_color_t color,
|
||||
grub_uint8_t *red,
|
||||
grub_uint8_t *green,
|
||||
grub_uint8_t *blue,
|
||||
grub_uint8_t *alpha);
|
||||
|
||||
void grub_video_vbe_unmap_color_int (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_video_color_t color,
|
||||
grub_uint8_t *red,
|
||||
grub_uint8_t *green,
|
||||
grub_uint8_t *blue,
|
||||
grub_uint8_t *alpha);
|
||||
|
||||
#endif /* ! GRUB_VBE_MACHINE_HEADER */
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* 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_VBEBLIT_MACHINE_HEADER
|
||||
#define GRUB_VBEBLIT_MACHINE_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for vbe driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8A8_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8X8_R8G8B8X8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8_R8G8B8X8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_index_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_index_R8G8B8X8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8A8_R8G8B8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_R8G8B8_R8G8B8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_index_R8G8B8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_index_index (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
#endif /* ! GRUB_VBEBLIT_MACHINE_HEADER */
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* 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_VBEFILL_MACHINE_HEADER
|
||||
#define GRUB_VBEFILL_MACHINE_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for vbe driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_R8G8B8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_index (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
#endif /* ! GRUB_VBEFILL_MACHINE_HEADER */
|
86
include/grub/i386/pci.h
Normal file
86
include/grub/i386/pci.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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_CPU_PCI_H
|
||||
#define GRUB_CPU_PCI_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/i386/io.h>
|
||||
|
||||
#define GRUB_PCI_ADDR_REG 0xcf8
|
||||
#define GRUB_PCI_DATA_REG 0xcfc
|
||||
|
||||
static inline grub_uint32_t
|
||||
grub_pci_read (grub_pci_address_t addr)
|
||||
{
|
||||
grub_outl (addr, GRUB_PCI_ADDR_REG);
|
||||
return grub_inl (GRUB_PCI_DATA_REG);
|
||||
}
|
||||
|
||||
static inline grub_uint16_t
|
||||
grub_pci_read_word (grub_pci_address_t addr)
|
||||
{
|
||||
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
|
||||
return grub_inw (GRUB_PCI_DATA_REG + (addr & 3));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_pci_read_byte (grub_pci_address_t addr)
|
||||
{
|
||||
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
|
||||
return grub_inb (GRUB_PCI_DATA_REG + (addr & 3));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
|
||||
{
|
||||
grub_outl (addr, GRUB_PCI_ADDR_REG);
|
||||
grub_outl (data, GRUB_PCI_DATA_REG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
|
||||
{
|
||||
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
|
||||
grub_outw (data, GRUB_PCI_DATA_REG + (addr & 3));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
||||
{
|
||||
grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
|
||||
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
|
||||
}
|
||||
|
||||
static inline void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base,
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) base;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
void *mem __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif /* GRUB_CPU_PCI_H */
|
|
@ -16,10 +16,12 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _GRUB_CONSOLE_MACHINE_LB_HEADER
|
||||
#define _GRUB_CONSOLE_MACHINE_LB_HEADER 1
|
||||
#include <grub/i386/pc/console.h>
|
||||
#ifndef KERNEL_CPU_PIT_HEADER
|
||||
#define KERNEL_CPU_PIT_HEADER 1
|
||||
|
||||
void grub_keyboard_controller_init (void);
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
#endif /* ! _GRUB_CONSOLE_MACHINE_LB_HEADER */
|
||||
void EXPORT_FUNC(grub_pit_wait) (grub_uint16_t tics);
|
||||
|
||||
#endif /* ! KERNEL_CPU_PIT_HEADER */
|
28
include/grub/i386/qemu/boot.h
Normal file
28
include/grub/i386/qemu/boot.h
Normal 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_BOOT_MACHINE_HEADER
|
||||
#define GRUB_BOOT_MACHINE_HEADER 1
|
||||
|
||||
/* The size of boot.img. */
|
||||
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR 0x4
|
||||
|
||||
#endif
|
1
include/grub/i386/qemu/console.h
Normal file
1
include/grub/i386/qemu/console.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/console.h>
|
1
include/grub/i386/qemu/init.h
Normal file
1
include/grub/i386/qemu/init.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/init.h>
|
53
include/grub/i386/qemu/kernel.h
Normal file
53
include/grub/i386/qemu/kernel.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
extern grub_addr_t grub_core_entry_addr;
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
1
include/grub/i386/qemu/loader.h
Normal file
1
include/grub/i386/qemu/loader.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/cpu/loader.h>
|
|
@ -1,3 +1,4 @@
|
|||
/* memory.h - describe the memory map */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
|
||||
|
@ -16,21 +17,29 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_RESCUE_HEADER
|
||||
#define GRUB_RESCUE_HEADER 1
|
||||
#ifndef _GRUB_MEMORY_MACHINE_HEADER
|
||||
#define _GRUB_MEMORY_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/i386/pc/memory.h>
|
||||
|
||||
/* Enter rescue mode. */
|
||||
void grub_enter_rescue_mode (void);
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#endif
|
||||
|
||||
/* Register a rescue mode command. */
|
||||
void EXPORT_FUNC(grub_rescue_register_command) (const char *name,
|
||||
void (*func) (int argc,
|
||||
char *argv[]),
|
||||
const char *message);
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
|
||||
|
||||
/* Unregister a rescue mode command. */
|
||||
void EXPORT_FUNC(grub_rescue_unregister_command) (const char *name);
|
||||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
|
||||
|
||||
#endif /* ! GRUB_RESCUE_HEADER */
|
||||
#ifndef ASM_FILE
|
||||
|
||||
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 */
|
1
include/grub/i386/qemu/serial.h
Normal file
1
include/grub/i386/qemu/serial.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/serial.h>
|
1
include/grub/i386/qemu/time.h
Normal file
1
include/grub/i386/qemu/time.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/time.h>
|
41
include/grub/i386/relocator.h
Normal file
41
include/grub/i386/relocator.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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_RELOCATOR_CPU_HEADER
|
||||
#define GRUB_RELOCATOR_CPU_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
struct grub_relocator32_state
|
||||
{
|
||||
grub_uint32_t esp;
|
||||
grub_uint32_t eax;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t ecx;
|
||||
grub_uint32_t edx;
|
||||
grub_uint32_t eip;
|
||||
};
|
||||
|
||||
void *grub_relocator32_alloc (grub_size_t size);
|
||||
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
|
||||
struct grub_relocator32_state state);
|
||||
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
|
||||
void grub_relocator32_free (void *relocator);
|
||||
|
||||
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,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
|
||||
|
@ -21,7 +21,12 @@
|
|||
|
||||
typedef unsigned long grub_jmp_buf[6];
|
||||
|
||||
#ifdef __MINGW32__
|
||||
int grub_setjmp (grub_jmp_buf env) __attribute__ ((cdecl, regparm (3)));
|
||||
#else
|
||||
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice, cdecl,
|
||||
regparm (3)));
|
||||
#endif
|
||||
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl,
|
||||
regparm (3)));
|
||||
|
||||
|
|
141
include/grub/i386/tsc.h
Normal file
141
include/grub/i386/tsc.h
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* 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 KERNEL_CPU_TSC_HEADER
|
||||
#define KERNEL_CPU_TSC_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
/* Read the TSC value, which increments with each CPU clock cycle. */
|
||||
static __inline grub_uint64_t
|
||||
grub_get_tsc (void)
|
||||
{
|
||||
grub_uint32_t lo, hi;
|
||||
|
||||
/* The CPUID instruction is a 'serializing' instruction, and
|
||||
avoids out-of-order execution of the RDTSC instruction. */
|
||||
#ifdef APPLE_CC
|
||||
__asm__ __volatile__ ("xorl %%eax, %%eax\n\t"
|
||||
#ifdef __x86_64__
|
||||
"push %%rbx\n"
|
||||
#else
|
||||
"push %%ebx\n"
|
||||
#endif
|
||||
"cpuid\n"
|
||||
#ifdef __x86_64__
|
||||
"pop %%rbx\n"
|
||||
#else
|
||||
"pop %%ebx\n"
|
||||
#endif
|
||||
:::"%rax", "%rcx", "%rdx");
|
||||
#else
|
||||
__asm__ __volatile__ ("xorl %%eax, %%eax\n\t"
|
||||
"cpuid":::"%rax", "%rbx", "%rcx", "%rdx");
|
||||
#endif
|
||||
/* Read TSC value. We cannot use "=A", since this would use
|
||||
%rax on x86_64. */
|
||||
__asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi));
|
||||
|
||||
return (((grub_uint64_t) hi) << 32) | lo;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
static __inline int
|
||||
grub_cpu_is_cpuid_supported (void)
|
||||
{
|
||||
grub_uint64_t id_supported;
|
||||
|
||||
__asm__ ("pushfq\n\t"
|
||||
"popq %%rax /* Get EFLAGS into EAX */\n\t"
|
||||
"movq %%rax, %%rcx /* Save original flags in ECX */\n\t"
|
||||
"xorq $0x200000, %%rax /* Flip ID bit in EFLAGS */\n\t"
|
||||
"pushq %%rax /* Store modified EFLAGS on stack */\n\t"
|
||||
"popfq /* Replace current EFLAGS */\n\t"
|
||||
"pushfq /* Read back the EFLAGS */\n\t"
|
||||
"popq %%rax /* Get EFLAGS into EAX */\n\t"
|
||||
"xorq %%rcx, %%rax /* Check if flag could be modified */\n\t"
|
||||
: "=a" (id_supported)
|
||||
: /* No inputs. */
|
||||
: /* Clobbered: */ "%rcx");
|
||||
|
||||
return id_supported != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static __inline int
|
||||
grub_cpu_is_cpuid_supported (void)
|
||||
{
|
||||
grub_uint32_t id_supported;
|
||||
|
||||
__asm__ ("pushfl\n\t"
|
||||
"popl %%eax /* Get EFLAGS into EAX */\n\t"
|
||||
"movl %%eax, %%ecx /* Save original flags in ECX */\n\t"
|
||||
"xorl $0x200000, %%eax /* Flip ID bit in EFLAGS */\n\t"
|
||||
"pushl %%eax /* Store modified EFLAGS on stack */\n\t"
|
||||
"popfl /* Replace current EFLAGS */\n\t"
|
||||
"pushfl /* Read back the EFLAGS */\n\t"
|
||||
"popl %%eax /* Get EFLAGS into EAX */\n\t"
|
||||
"xorl %%ecx, %%eax /* Check if flag could be modified */\n\t"
|
||||
: "=a" (id_supported)
|
||||
: /* No inputs. */
|
||||
: /* Clobbered: */ "%rcx");
|
||||
|
||||
return id_supported != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static __inline int
|
||||
grub_cpu_is_tsc_supported (void)
|
||||
{
|
||||
if (! grub_cpu_is_cpuid_supported ())
|
||||
return 0;
|
||||
|
||||
grub_uint32_t features;
|
||||
#ifdef APPLE_CC
|
||||
__asm__ ("movl $1, %%eax\n\t"
|
||||
#ifdef __x86_64__
|
||||
"push %%rbx\n"
|
||||
#else
|
||||
"push %%ebx\n"
|
||||
#endif
|
||||
"cpuid\n"
|
||||
#ifdef __x86_64__
|
||||
"pop %%rbx\n"
|
||||
#else
|
||||
"pop %%ebx\n"
|
||||
#endif
|
||||
: "=d" (features)
|
||||
: /* No inputs. */
|
||||
: /* Clobbered: */ "%rax", "%rcx");
|
||||
#else
|
||||
__asm__ ("movl $1, %%eax\n\t"
|
||||
"cpuid\n"
|
||||
: "=d" (features)
|
||||
: /* No inputs. */
|
||||
: /* Clobbered: */ "%rax", "%rbx", "%rcx");
|
||||
#endif
|
||||
return (features & (1 << 4)) != 0;
|
||||
}
|
||||
|
||||
void grub_tsc_init (void);
|
||||
grub_uint64_t grub_tsc_get_time_ms (void);
|
||||
|
||||
#endif /* ! KERNEL_CPU_TSC_HEADER */
|
40
include/grub/i386/vga_common.h
Normal file
40
include/grub/i386/vga_common.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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_VGA_COMMON_CPU_HEADER
|
||||
#define GRUB_VGA_COMMON_CPU_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
extern grub_uint8_t grub_console_cur_color;
|
||||
|
||||
void grub_console_putchar (grub_uint32_t c);
|
||||
grub_ssize_t grub_console_getcharwidth (grub_uint32_t c);
|
||||
grub_uint16_t grub_console_getwh (void);
|
||||
void grub_console_setcolorstate (grub_term_color_state state);
|
||||
void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
|
||||
void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
|
||||
|
||||
/* Implemented in both kern/i386/pc/startup.S and vga_text.c; this symbol
|
||||
is not exported, so there's no collision, but vga_common.c expects this
|
||||
prototype to be the same. */
|
||||
void grub_console_real_putchar (int c);
|
||||
|
||||
#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */
|
121
include/grub/i386/xnu.h
Normal file
121
include/grub/i386/xnu.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* 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_XNU_H
|
||||
#define GRUB_CPU_XNU_H 1
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
|
||||
#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
|
||||
|
||||
#define GRUB_XNU_PAGESIZE 4096
|
||||
typedef grub_uint32_t grub_xnu_ptr_t;
|
||||
|
||||
struct grub_xnu_boot_params
|
||||
{
|
||||
grub_uint16_t verminor;
|
||||
grub_uint16_t vermajor;
|
||||
/* Command line passed to xnu. */
|
||||
grub_uint8_t cmdline[1024];
|
||||
|
||||
/* Later are the same as EFI's get_memory_map (). */
|
||||
grub_xnu_ptr_t efi_mmap;
|
||||
grub_uint32_t efi_mmap_size;
|
||||
grub_uint32_t efi_mem_desc_size;
|
||||
grub_uint32_t efi_mem_desc_version;
|
||||
|
||||
/* Later are video parameters. */
|
||||
grub_xnu_ptr_t lfb_base;
|
||||
#define GRUB_XNU_VIDEO_SPLASH 1
|
||||
#define GRUB_XNU_VIDEO_TEXT_IN_VIDEO 2
|
||||
grub_uint32_t lfb_mode;
|
||||
grub_uint32_t lfb_line_len;
|
||||
grub_uint32_t lfb_width;
|
||||
grub_uint32_t lfb_height;
|
||||
grub_uint32_t lfb_depth;
|
||||
|
||||
/* Pointer to device tree and its len. */
|
||||
grub_xnu_ptr_t devtree;
|
||||
grub_uint32_t devtreelen;
|
||||
|
||||
/* First used address by kernel or boot structures. */
|
||||
grub_xnu_ptr_t heap_start;
|
||||
/* Last used address by kernel or boot structures minus previous value. */
|
||||
grub_uint32_t heap_size;
|
||||
|
||||
/* First memory page containing runtime code or data. */
|
||||
grub_uint32_t efi_runtime_first_page;
|
||||
/* First memory page containing runtime code or data minus previous value. */
|
||||
grub_uint32_t efi_runtime_npages;
|
||||
grub_uint32_t efi_system_table;
|
||||
/* Size of grub_efi_uintn_t in bits. */
|
||||
grub_uint8_t efi_uintnbits;
|
||||
} __attribute__ ((packed));
|
||||
#define GRUB_XNU_BOOTARGS_VERMINOR 5
|
||||
#define GRUB_XNU_BOOTARGS_VERMAJOR 1
|
||||
|
||||
struct grub_xnu_devprop_header
|
||||
{
|
||||
grub_uint32_t length;
|
||||
/* Always set to 1. Version? */
|
||||
grub_uint32_t alwaysone;
|
||||
grub_uint32_t num_devices;
|
||||
};
|
||||
|
||||
struct grub_xnu_devprop_device_header
|
||||
{
|
||||
grub_uint32_t length;
|
||||
grub_uint32_t num_values;
|
||||
};
|
||||
|
||||
void grub_cpu_xnu_unload (void);
|
||||
|
||||
struct grub_xnu_devprop_device_descriptor;
|
||||
|
||||
struct grub_xnu_devprop_device_descriptor *
|
||||
grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name, void *data, int datalen);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
grub_uint16_t *name, int namelen,
|
||||
void *data, int datalen);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name);
|
||||
void grub_cpu_xnu_init (void);
|
||||
void grub_cpu_xnu_fini (void);
|
||||
|
||||
extern grub_uint32_t grub_xnu_entry_point;
|
||||
extern grub_uint32_t grub_xnu_stack;
|
||||
extern grub_uint32_t grub_xnu_arg1;
|
||||
extern char grub_xnu_cmdline[1024];
|
||||
grub_err_t grub_xnu_boot (void);
|
||||
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
|
||||
grub_err_t
|
||||
grub_cpu_xnu_fill_devicetree (void);
|
||||
extern grub_uint32_t grub_xnu_heap_will_be_at;
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/* ieee1275.h - Access the Open Firmware client interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,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
|
||||
|
@ -20,7 +20,6 @@
|
|||
#ifndef GRUB_IEEE1275_HEADER
|
||||
#define GRUB_IEEE1275_HEADER 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/machine/ieee1275.h>
|
||||
|
@ -33,19 +32,22 @@ struct grub_ieee1275_devalias
|
|||
char *type;
|
||||
};
|
||||
|
||||
struct grub_ieee1275_mem_region
|
||||
struct grub_ieee1275_mem_region
|
||||
{
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
#define IEEE1275_MAX_PROP_LEN 8192
|
||||
#define IEEE1275_MAX_PATH_LEN 256
|
||||
|
||||
#ifndef IEEE1275_CALL_ENTRY_FN
|
||||
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
|
||||
#endif
|
||||
|
||||
/* All backcalls to the firmware is done by calling an entry function
|
||||
which was passed to us from the bootloader. When doing the backcall,
|
||||
a structure is passed which specifies what the firmware should do.
|
||||
/* All backcalls to the firmware is done by calling an entry function
|
||||
which was passed to us from the bootloader. When doing the backcall,
|
||||
a structure is passed which specifies what the firmware should do.
|
||||
NAME is the requested service. NR_INS and NR_OUTS is the number of
|
||||
passed arguments and the expected number of return values, resp. */
|
||||
struct grub_ieee1275_common_hdr
|
||||
|
@ -60,8 +62,8 @@ struct grub_ieee1275_common_hdr
|
|||
(p)->nr_ins = (grub_ieee1275_cell_t) xins; \
|
||||
(p)->nr_outs = (grub_ieee1275_cell_t) xouts
|
||||
|
||||
typedef grub_ieee1275_cell_t grub_ieee1275_ihandle_t;
|
||||
typedef grub_ieee1275_cell_t grub_ieee1275_phandle_t;
|
||||
typedef grub_uint32_t grub_ieee1275_ihandle_t;
|
||||
typedef grub_uint32_t grub_ieee1275_phandle_t;
|
||||
|
||||
extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
|
||||
extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
|
||||
|
@ -89,6 +91,15 @@ enum grub_ieee1275_flag
|
|||
|
||||
/* Open Hack'Ware stops when trying to set colors */
|
||||
GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS,
|
||||
|
||||
/* Open Hack'Ware stops when grub_ieee1275_interpret is used. */
|
||||
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET,
|
||||
|
||||
/* Open Hack'Ware has no memory map, just claim what we need. */
|
||||
GRUB_IEEE1275_FLAG_FORCE_CLAIM,
|
||||
|
||||
/* Open Hack'Ware don't support the ANSI sequence. */
|
||||
GRUB_IEEE1275_FLAG_NO_ANSI,
|
||||
};
|
||||
|
||||
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
|
||||
|
@ -97,6 +108,7 @@ extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag);
|
|||
|
||||
|
||||
|
||||
void EXPORT_FUNC(grub_ieee1275_init) (void);
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
|
||||
grub_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
|
||||
|
@ -109,14 +121,14 @@ int EXPORT_FUNC(grub_ieee1275_get_integer_property) (grub_ieee1275_phandle_t pha
|
|||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_next_property) (grub_ieee1275_phandle_t phandle,
|
||||
char *prev_prop, char *prop);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property_length)
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property_length)
|
||||
(grub_ieee1275_phandle_t phandle, const char *prop, grub_ssize_t *length);
|
||||
int EXPORT_FUNC(grub_ieee1275_instance_to_package)
|
||||
int EXPORT_FUNC(grub_ieee1275_instance_to_package)
|
||||
(grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle,
|
||||
char *path, grub_size_t len,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_instance_to_path)
|
||||
int EXPORT_FUNC(grub_ieee1275_instance_to_path)
|
||||
(grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle,
|
||||
|
@ -153,12 +165,12 @@ int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
|
|||
int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs);
|
||||
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_devalias_iterate)
|
||||
int EXPORT_FUNC(grub_devalias_iterate)
|
||||
(int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
grub_err_t EXPORT_FUNC(grub_children_iterate) (char *devpath,
|
||||
int EXPORT_FUNC(grub_children_iterate) (char *devpath,
|
||||
int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
grub_err_t EXPORT_FUNC(grub_available_iterate)
|
||||
(int (*hook) (grub_uint64_t, grub_uint64_t));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||
|
||||
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,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
|
||||
|
@ -22,13 +22,20 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
enum
|
||||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
struct grub_module_header
|
||||
{
|
||||
/* The offset of object code. */
|
||||
grub_target_off_t offset;
|
||||
/* The size of object code plus this header. */
|
||||
grub_target_size_t size;
|
||||
/* The type of object. */
|
||||
grub_uint8_t type;
|
||||
/* The size of object (including this header). */
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
||||
/* "gmim" (GRUB Module Info Magic). */
|
||||
|
@ -38,6 +45,9 @@ struct grub_module_info
|
|||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
grub_uint32_t padding;
|
||||
#endif
|
||||
/* The offset of the modules. */
|
||||
grub_target_off_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
|
@ -46,6 +56,8 @@ struct grub_module_info
|
|||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
|
||||
|
@ -53,7 +65,7 @@ void grub_main (void);
|
|||
void grub_machine_init (void);
|
||||
|
||||
/* The machine-specific finalization. */
|
||||
void EXPORT_FUNC (grub_machine_fini) (void);
|
||||
void EXPORT_FUNC(grub_machine_fini) (void);
|
||||
|
||||
/* The machine-specific prefix initialization. */
|
||||
void grub_machine_set_prefix (void);
|
||||
|
|
130
include/grub/lib/LzFind.h
Normal file
130
include/grub/lib/LzFind.h
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (c) 1999-2008 Igor Pavlov
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code was taken from LZMA SDK 4.58 beta, and was slightly modified
|
||||
* to adapt it to GRUB's requirement.
|
||||
*
|
||||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#ifndef __LZFIND_H
|
||||
#define __LZFIND_H
|
||||
|
||||
#include <grub/lib/LzmaTypes.h>
|
||||
|
||||
typedef UInt32 CLzRef;
|
||||
|
||||
typedef struct _CMatchFinder
|
||||
{
|
||||
Byte *buffer;
|
||||
UInt32 pos;
|
||||
UInt32 posLimit;
|
||||
UInt32 streamPos;
|
||||
UInt32 lenLimit;
|
||||
|
||||
UInt32 cyclicBufferPos;
|
||||
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
|
||||
|
||||
UInt32 matchMaxLen;
|
||||
CLzRef *hash;
|
||||
CLzRef *son;
|
||||
UInt32 hashMask;
|
||||
UInt32 cutValue;
|
||||
|
||||
Byte *bufferBase;
|
||||
ISeqInStream *stream;
|
||||
int streamEndWasReached;
|
||||
|
||||
UInt32 blockSize;
|
||||
UInt32 keepSizeBefore;
|
||||
UInt32 keepSizeAfter;
|
||||
|
||||
UInt32 numHashBytes;
|
||||
int directInput;
|
||||
int btMode;
|
||||
/* int skipModeBits; */
|
||||
int bigHash;
|
||||
UInt32 historySize;
|
||||
UInt32 fixedHashSize;
|
||||
UInt32 hashSizeSum;
|
||||
UInt32 numSons;
|
||||
SRes result;
|
||||
UInt32 crc[256];
|
||||
} CMatchFinder;
|
||||
|
||||
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
|
||||
#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
|
||||
|
||||
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
|
||||
|
||||
int MatchFinder_NeedMove(CMatchFinder *p);
|
||||
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
|
||||
void MatchFinder_MoveBlock(CMatchFinder *p);
|
||||
void MatchFinder_ReadIfRequired(CMatchFinder *p);
|
||||
|
||||
void MatchFinder_Construct(CMatchFinder *p);
|
||||
|
||||
/* Conditions:
|
||||
historySize <= 3 GB
|
||||
keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
|
||||
*/
|
||||
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
|
||||
ISzAlloc *alloc);
|
||||
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
|
||||
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
|
||||
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
|
||||
|
||||
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
|
||||
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||
UInt32 *distances, UInt32 maxLen);
|
||||
|
||||
/*
|
||||
Conditions:
|
||||
Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
|
||||
Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
|
||||
*/
|
||||
|
||||
typedef void (*Mf_Init_Func)(void *object);
|
||||
typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
|
||||
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
|
||||
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
|
||||
typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
|
||||
typedef void (*Mf_Skip_Func)(void *object, UInt32);
|
||||
|
||||
typedef struct _IMatchFinder
|
||||
{
|
||||
Mf_Init_Func Init;
|
||||
Mf_GetIndexByte_Func GetIndexByte;
|
||||
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
|
||||
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
|
||||
Mf_GetMatches_Func GetMatches;
|
||||
Mf_Skip_Func Skip;
|
||||
} IMatchFinder;
|
||||
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
|
||||
|
||||
void MatchFinder_Init(CMatchFinder *p);
|
||||
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
|
||||
#endif
|
77
include/grub/lib/LzHash.h
Normal file
77
include/grub/lib/LzHash.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (c) 1999-2008 Igor Pavlov
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code was taken from LZMA SDK 4.58 beta, and was slightly modified
|
||||
* to adapt it to GRUB's requirement.
|
||||
*
|
||||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#ifndef __LZHASH_H
|
||||
#define __LZHASH_H
|
||||
|
||||
#define kHash2Size (1 << 10)
|
||||
#define kHash3Size (1 << 16)
|
||||
#define kHash4Size (1 << 20)
|
||||
|
||||
#define kFix3HashSize (kHash2Size)
|
||||
#define kFix4HashSize (kHash2Size + kHash3Size)
|
||||
#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
||||
|
||||
#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
|
||||
|
||||
#define HASH3_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
|
||||
|
||||
#define HASH4_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||
hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
|
||||
|
||||
#define HASH5_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
|
||||
hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
|
||||
hash4Value &= (kHash4Size - 1); }
|
||||
|
||||
/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
|
||||
#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
|
||||
|
||||
|
||||
#define MT_HASH2_CALC \
|
||||
hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
|
||||
|
||||
#define MT_HASH3_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
|
||||
|
||||
#define MT_HASH4_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
|
||||
|
||||
#endif
|
246
include/grub/lib/LzmaDec.h
Normal file
246
include/grub/lib/LzmaDec.h
Normal file
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (c) 1999-2008 Igor Pavlov
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code was taken from LZMA SDK 4.58 beta, and was slightly modified
|
||||
* to adapt it to GRUB's requirement.
|
||||
*
|
||||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#ifndef __LZMADEC_H
|
||||
#define __LZMADEC_H
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
/* #define _LZMA_PROB32 */
|
||||
/* _LZMA_PROB32 can increase the speed on some CPUs,
|
||||
but memory usage for CLzmaDec::probs will be doubled in that case */
|
||||
|
||||
#ifdef _LZMA_PROB32
|
||||
#define CLzmaProb UInt32
|
||||
#else
|
||||
#define CLzmaProb UInt16
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------- LZMA Properties ---------- */
|
||||
|
||||
#define LZMA_PROPS_SIZE 5
|
||||
|
||||
typedef struct _CLzmaProps
|
||||
{
|
||||
unsigned lc, lp, pb;
|
||||
UInt32 dicSize;
|
||||
} CLzmaProps;
|
||||
|
||||
/* LzmaProps_Decode - decodes properties
|
||||
Returns:
|
||||
SZ_OK
|
||||
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
*/
|
||||
|
||||
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
|
||||
|
||||
|
||||
/* ---------- LZMA Decoder state ---------- */
|
||||
|
||||
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
|
||||
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
|
||||
|
||||
#define LZMA_REQUIRED_INPUT_MAX 20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CLzmaProps prop;
|
||||
CLzmaProb *probs;
|
||||
Byte *dic;
|
||||
const Byte *buf;
|
||||
UInt32 range, code;
|
||||
SizeT dicPos;
|
||||
SizeT dicBufSize;
|
||||
UInt32 processedPos;
|
||||
UInt32 checkDicSize;
|
||||
unsigned state;
|
||||
UInt32 reps[4];
|
||||
unsigned remainLen;
|
||||
int needFlush;
|
||||
int needInitState;
|
||||
UInt32 numProbs;
|
||||
unsigned tempBufSize;
|
||||
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
|
||||
} CLzmaDec;
|
||||
|
||||
#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
|
||||
|
||||
void LzmaDec_Init(CLzmaDec *p);
|
||||
|
||||
/* There are two types of LZMA streams:
|
||||
0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
|
||||
1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LZMA_FINISH_ANY, /* finish at any point */
|
||||
LZMA_FINISH_END /* block must be finished at the end */
|
||||
} ELzmaFinishMode;
|
||||
|
||||
/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
|
||||
|
||||
You must use LZMA_FINISH_END, when you know that current output buffer
|
||||
covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
|
||||
|
||||
If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
|
||||
and output value of destLen will be less than output buffer size limit.
|
||||
You can check status result also.
|
||||
|
||||
You can use multiple checks to test data integrity after full decompression:
|
||||
1) Check Result and "status" variable.
|
||||
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
|
||||
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
|
||||
You must use correct finish mode in that case. */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
|
||||
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
|
||||
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
|
||||
LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
|
||||
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
|
||||
} ELzmaStatus;
|
||||
|
||||
/* ELzmaStatus is used only as output value for function call */
|
||||
|
||||
|
||||
/* ---------- Interfaces ---------- */
|
||||
|
||||
/* There are 3 levels of interfaces:
|
||||
1) Dictionary Interface
|
||||
2) Buffer Interface
|
||||
3) One Call Interface
|
||||
You can select any of these interfaces, but don't mix functions from different
|
||||
groups for same object. */
|
||||
|
||||
|
||||
/* There are two variants to allocate state for Dictionary Interface:
|
||||
1) LzmaDec_Allocate / LzmaDec_Free
|
||||
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
|
||||
You can use variant 2, if you set dictionary buffer manually.
|
||||
For Buffer Interface you must always use variant 1.
|
||||
|
||||
LzmaDec_Allocate* can return:
|
||||
SZ_OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
*/
|
||||
|
||||
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
|
||||
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
|
||||
|
||||
SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
|
||||
void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
|
||||
|
||||
/* ---------- Dictionary Interface ---------- */
|
||||
|
||||
/* You can use it, if you want to eliminate the overhead for data copying from
|
||||
dictionary to some other external buffer.
|
||||
You must work with CLzmaDec variables directly in this interface.
|
||||
|
||||
STEPS:
|
||||
LzmaDec_Constr()
|
||||
LzmaDec_Allocate()
|
||||
for (each new stream)
|
||||
{
|
||||
LzmaDec_Init()
|
||||
while (it needs more decompression)
|
||||
{
|
||||
LzmaDec_DecodeToDic()
|
||||
use data from CLzmaDec::dic and update CLzmaDec::dicPos
|
||||
}
|
||||
}
|
||||
LzmaDec_Free()
|
||||
*/
|
||||
|
||||
/* LzmaDec_DecodeToDic
|
||||
|
||||
The decoding to internal dictionary buffer (CLzmaDec::dic).
|
||||
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
|
||||
|
||||
finishMode:
|
||||
It has meaning only if the decoding reaches output limit (dicLimit).
|
||||
LZMA_FINISH_ANY - Decode just dicLimit bytes.
|
||||
LZMA_FINISH_END - Stream must be finished after dicLimit.
|
||||
|
||||
Returns:
|
||||
SZ_OK
|
||||
status:
|
||||
LZMA_STATUS_FINISHED_WITH_MARK
|
||||
LZMA_STATUS_NOT_FINISHED
|
||||
LZMA_STATUS_NEEDS_MORE_INPUT
|
||||
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||
SZ_ERROR_DATA - Data error
|
||||
*/
|
||||
|
||||
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
|
||||
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||
|
||||
|
||||
/* ---------- Buffer Interface ---------- */
|
||||
|
||||
/* It's zlib-like interface.
|
||||
See LzmaDec_DecodeToDic description for information about STEPS and return results,
|
||||
but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
|
||||
to work with CLzmaDec variables manually.
|
||||
|
||||
finishMode:
|
||||
It has meaning only if the decoding reaches output limit (*destLen).
|
||||
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||
*/
|
||||
|
||||
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
||||
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||
|
||||
|
||||
/* ---------- One Call Interface ---------- */
|
||||
|
||||
/* LzmaDecode
|
||||
|
||||
finishMode:
|
||||
It has meaning only if the decoding reaches output limit (*destLen).
|
||||
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||
|
||||
Returns:
|
||||
SZ_OK
|
||||
status:
|
||||
LZMA_STATUS_FINISHED_WITH_MARK
|
||||
LZMA_STATUS_NOT_FINISHED
|
||||
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||
SZ_ERROR_DATA - Data error
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
||||
*/
|
||||
|
||||
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
||||
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
|
||||
ELzmaStatus *status, ISzAlloc *alloc);
|
||||
|
||||
#endif
|
95
include/grub/lib/LzmaEnc.h
Normal file
95
include/grub/lib/LzmaEnc.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (c) 1999-2008 Igor Pavlov
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code was taken from LZMA SDK 4.58 beta, and was slightly modified
|
||||
* to adapt it to GRUB's requirement.
|
||||
*
|
||||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#ifndef __LZMAENC_H
|
||||
#define __LZMAENC_H
|
||||
|
||||
#include "LzmaTypes.h"
|
||||
|
||||
#define LZMA_PROPS_SIZE 5
|
||||
|
||||
typedef struct _CLzmaEncProps
|
||||
{
|
||||
int level; /* 0 <= level <= 9 */
|
||||
UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
|
||||
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version
|
||||
default = (1 << 24) */
|
||||
int lc; /* 0 <= lc <= 8, default = 3 */
|
||||
int lp; /* 0 <= lp <= 4, default = 0 */
|
||||
int pb; /* 0 <= pb <= 4, default = 2 */
|
||||
int algo; /* 0 - fast, 1 - normal, default = 1 */
|
||||
int fb; /* 5 <= fb <= 273, default = 32 */
|
||||
int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
|
||||
int numHashBytes; /* 2, 3 or 4, default = 4 */
|
||||
UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
|
||||
unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
|
||||
int numThreads; /* 1 or 2, default = 2 */
|
||||
} CLzmaEncProps;
|
||||
|
||||
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||
void LzmaEncProps_Normalize(CLzmaEncProps *p);
|
||||
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
|
||||
|
||||
|
||||
/* ---------- CLzmaEncHandle Interface ---------- */
|
||||
|
||||
/* LzmaEnc_* functions can return the following exit codes:
|
||||
Returns:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_PARAM - Incorrect parameter in props
|
||||
SZ_ERROR_WRITE - Write callback error.
|
||||
SZ_ERROR_PROGRESS - some break from progress callback
|
||||
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
*/
|
||||
|
||||
typedef void * CLzmaEncHandle;
|
||||
|
||||
CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
|
||||
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
|
||||
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
|
||||
SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
|
||||
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
|
||||
/* ---------- One Call Interface ---------- */
|
||||
|
||||
/* LzmaEncode
|
||||
Return code:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_PARAM - Incorrect parameter
|
||||
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
*/
|
||||
|
||||
SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
||||
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
|
||||
#endif
|
151
include/grub/lib/LzmaTypes.h
Normal file
151
include/grub/lib/LzmaTypes.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (c) 1999-2008 Igor Pavlov
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code was taken from LZMA SDK 4.58 beta, and was slightly modified
|
||||
* to adapt it to GRUB's requirement.
|
||||
*
|
||||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#ifndef __7Z_TYPES_H
|
||||
#define __7Z_TYPES_H
|
||||
|
||||
#define SZ_OK 0
|
||||
|
||||
#define SZ_ERROR_DATA 1
|
||||
#define SZ_ERROR_MEM 2
|
||||
#define SZ_ERROR_CRC 3
|
||||
#define SZ_ERROR_UNSUPPORTED 4
|
||||
#define SZ_ERROR_PARAM 5
|
||||
#define SZ_ERROR_INPUT_EOF 6
|
||||
#define SZ_ERROR_OUTPUT_EOF 7
|
||||
#define SZ_ERROR_READ 8
|
||||
#define SZ_ERROR_WRITE 9
|
||||
#define SZ_ERROR_PROGRESS 10
|
||||
#define SZ_ERROR_FAIL 11
|
||||
#define SZ_ERROR_THREAD 12
|
||||
|
||||
#define SZ_ERROR_ARCHIVE 16
|
||||
#define SZ_ERROR_NO_ARCHIVE 17
|
||||
|
||||
typedef int SRes;
|
||||
|
||||
#ifndef RINOK
|
||||
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||
#endif
|
||||
|
||||
typedef unsigned char Byte;
|
||||
typedef short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
|
||||
#ifdef _LZMA_UINT32_IS_ULONG
|
||||
typedef long Int32;
|
||||
typedef unsigned long UInt32;
|
||||
#else
|
||||
typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
#endif
|
||||
|
||||
/* #define _SZ_NO_INT_64 */
|
||||
/* define it if your compiler doesn't support 64-bit integers */
|
||||
|
||||
#ifdef _SZ_NO_INT_64
|
||||
|
||||
typedef long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
|
||||
#else
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 Int64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
#else
|
||||
typedef long long int Int64;
|
||||
typedef unsigned long long int UInt64;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _LZMA_NO_SYSTEM_SIZE_T
|
||||
typedef UInt32 SizeT;
|
||||
#else
|
||||
#include <stddef.h>
|
||||
typedef size_t SizeT;
|
||||
#endif
|
||||
|
||||
typedef int Bool;
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#if _MSC_VER >= 1300
|
||||
#define MY_NO_INLINE __declspec(noinline)
|
||||
#else
|
||||
#define MY_NO_INLINE
|
||||
#endif
|
||||
|
||||
#define MY_CDECL __cdecl
|
||||
#define MY_STD_CALL __stdcall
|
||||
#define MY_FAST_CALL MY_NO_INLINE __fastcall
|
||||
|
||||
#else
|
||||
|
||||
#define MY_CDECL
|
||||
#define MY_STD_CALL
|
||||
#define MY_FAST_CALL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* The following interfaces use first parameter as pointer to structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||
(output(*size) < input(*size)) is allowed */
|
||||
} ISeqInStream;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t (*Write)(void *p, const void *buf, size_t size);
|
||||
/* Returns: result - the number of actually written bytes.
|
||||
(result < size) means error */
|
||||
} ISeqOutStream;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
|
||||
/* Returns: result. (result != SZ_OK) means break.
|
||||
Value (UInt64)(Int64)-1 for size means unknown value. */
|
||||
} ICompressProgress;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *(*Alloc)(void *p, size_t size);
|
||||
void (*Free)(void *p, void *address); /* address can be 0 */
|
||||
} ISzAlloc;
|
||||
|
||||
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
|
||||
#define IAlloc_Free(p, a) (p)->Free((p), a)
|
||||
|
||||
#endif
|
|
@ -62,4 +62,11 @@ struct grub_arg_list
|
|||
char *arg;
|
||||
};
|
||||
|
||||
struct grub_extcmd;
|
||||
|
||||
int grub_arg_parse (struct grub_extcmd *cmd, int argc, char **argv,
|
||||
struct grub_arg_list *usr, char ***args, int *argnum);
|
||||
|
||||
void grub_arg_show_help (struct grub_extcmd *cmd);
|
||||
|
||||
#endif /* ! GRUB_ARG_HEADER */
|
25
include/grub/lib/crc.h
Normal file
25
include/grub/lib/crc.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* crc.h - prototypes for crc */
|
||||
/*
|
||||
* 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_CRC_H
|
||||
#define GRUB_CRC_H 1
|
||||
|
||||
grub_uint32_t grub_getcrc32 (grub_uint32_t crc, void *buf, int size);
|
||||
|
||||
#endif /* ! GRUB_CRC_H */
|
55
include/grub/lib/envblk.h
Normal file
55
include/grub/lib/envblk.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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_ENVBLK_HEADER
|
||||
#define GRUB_ENVBLK_HEADER 1
|
||||
|
||||
#define GRUB_ENVBLK_SIGNATURE "# GRUB Environment Block\n"
|
||||
#define GRUB_ENVBLK_DEFCFG "grubenv"
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
struct grub_envblk
|
||||
{
|
||||
char *buf;
|
||||
grub_size_t size;
|
||||
};
|
||||
typedef struct grub_envblk *grub_envblk_t;
|
||||
|
||||
grub_envblk_t grub_envblk_open (char *buf, grub_size_t size);
|
||||
int grub_envblk_set (grub_envblk_t envblk, const char *name, const char *value);
|
||||
void grub_envblk_delete (grub_envblk_t envblk, const char *name);
|
||||
void grub_envblk_iterate (grub_envblk_t envblk,
|
||||
int hook (const char *name, const char *value));
|
||||
void grub_envblk_close (grub_envblk_t envblk);
|
||||
|
||||
static inline char *
|
||||
grub_envblk_buffer (const grub_envblk_t envblk)
|
||||
{
|
||||
return envblk->buf;
|
||||
}
|
||||
|
||||
static inline grub_size_t
|
||||
grub_envblk_size (const grub_envblk_t envblk)
|
||||
{
|
||||
return envblk->size;
|
||||
}
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_ENVBLK_HEADER */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue