2008-07-17 Bean <bean123ch@gmail.com>
* conf/i386/efi.rmk (pkglib_MODULES): add pci.mod and lspci.mod. (appleldr_mod_SOURCE): New variavle. (appleldr_mod_CFLAGS): Likewise. (appleldr_mod_LDFLAGS): Likewise. (pci_mod_SOURCES): Likewise. (pci_mod_CFLAGS): Likewise. (pci_mod_LDFLAGS): Likewise. (lspci_mod_SOURCES): Likewise. (lspci_mod_CFLAGS): Likewise. (lspci_mod_LDFLAGS): Likewise. * conf/x86_64-efi.rmk: New file. * disk/efi/efidisk.c (grub_efidisk_read): Wrap efi calls with efi_call_N macro. (grub_efidisk_write): Likewise. * include/efi/api.h (efi_call_0): New macro. (efi_call_1): Likewise. (efi_call_2): Likewise. (efi_call_3): Likewise. (efi_call_4): Likewise. (efi_call_5): Likewise. (efi_call_6): Likewise. * include/grub/efi/chainloader.h (grub_chainloader_cmd): Rename to grub_rescue_cmd_chainloader. * include/grub/efi/pe32.h (GRUB_PE32_MACHINE_X86_64): New macro. (grub_pe32_optional_header): Change some fields based on i386 or x86_64 platform. (GRUB_PE32_PE32_MAGIC): Likewise. * include/grub/efi/uga_draw.h: New file. * include/grub/elf.h (STN_ABS): New constant. (R_X86_64_NONE): Relocation constant for x86_64. (R_X86_64_64): Likewise. (R_X86_64_PC32): Likewise. (R_X86_64_GOT32): Likewise. (R_X86_64_PLT32): Likewise. (R_X86_64_COPY): Likewise. (R_X86_64_GLOB_DAT): Likewise. (R_X86_64_JUMP_SLOT): Likewise. (R_X86_64_RELATIVE): Likewise. (R_X86_64_GOTPCREL): Likewise. (R_X86_64_32): Likewise. (R_X86_64_32S): Likewise. (R_X86_64_16): Likewise. (R_X86_64_PC16): Likewise. (R_X86_64_8): Likewise. (R_X86_64_PC8): Likewise. * include/grub/i386/efi/pci.h: New file. * include/grub/i386/linux.h (GRUB_LINUX_EFI_SIGNATURE): Change it value based on platform. (GRUB_LINUX_EFI_SIGNATURE_0204): New constant. (GRUB_E820_RAM): Likewise. (GRUB_E820_RESERVED): Likewise. (GRUB_E820_ACPI): Likewise. (GRUB_E820_NVS): Likewise. (GRUB_E820_EXEC_CODE): Likewise. (GRUB_E820_MAX_ENTRY): Likewise. (grub_e820_mmap): New structure. (linux_kernel_header): Change the efi field according to different kernel version, also field from linux_kernel_header. * include/grub/kernel.h (grub_module_info): Add padding for x86_64. * include/grub/pci.h (GRUB_PCI_ADDR_SPACE_MASK): New constant. (GRUB_PCI_ADDR_SPACE_MEMORY): Likewise. (GRUB_PCI_ADDR_SPACE_IO): Likewise. (GRUB_PCI_ADDR_MEM_TYPE_MASK): Likewise. (GRUB_PCI_ADDR_MEM_TYPE_32): Likewise. (GRUB_PCI_ADDR_MEM_TYPE_1M): Likewise. (GRUB_PCI_ADDR_MEM_TYPE_64): Likewise. (GRUB_PCI_ADDR_MEM_PREFETCH): Likewise. (GRUB_PCI_ADDR_MEM_MASK): Likewise. (GRUB_PCI_ADDR_IO_MASK): Likewise. * include/grub/x86_64/efi/kernel.h: New file. * include/grub/x86_64/efi/loader.h: Likewise. * include/grub/x86_64/efi/machine.h: Likewise. * include/grub/x86_64/efi/pci.h: Likewise. * include/grub/x86_64/efi/time.h: Likewise. * include/grub/x86_64/linux.h: Likewise. * include/grub/x86_64/setjmp.h: Likewise. * include/grub/x86_64/time.h: Likewise. * include/grub/x86_64/types.h: Likewise. * kern/dl.c (GRUB_CPU_SIZEOF_VOID_P): Changed to GRUB_TARGET_SIZEOF_VOID_P. * kern/efi/efi.c (grub_efi_locate_protocol): Wrap efi calls. (grub_efi_locate_handle): Likewise. (grub_efi_open_protocol): Likewise. (grub_efi_set_text_mode): Likewise. (grub_efi_stall): Likewise. (grub_exit): Likewise. (grub_reboot): Likewise. (grub_halt): Likewise. (grub_efi_exit_boot_services): Likewise. (grub_get_rtc): Likewise. * kern/efi/mm.c (MEMORY_MAP_SIZE): Change to 0x3000 for new models. (GRUB_CPU_SIZEOF_VOID_P): Changed to GRUB_TARGET_SIZEOF_VOID_P. (grub_efi_allocate_pages): Wrap efi calls. (grub_efi_free_pages): Wrap efi calls. (grub_efi_get_memory_map): Wrap efi calls. * kern/x86_64/dl.c: New file. * kern/x86_64/efi/callwrap.S: Likewise. * kern/x86_64/efi/startup.S: Likewise. * loader/efi/appleloader.c: Likewise. * loader/efi/chainloader.c (cmdline): New variable. (grub_chainloader_unload): Wrap efi calls. (grub_chainloader_boot): Likewise. (grub_rescue_cmd_chainloader): Wrap efi calls, handle command line. * loader/efi/chainloader_normal.c (chainloader_command): Change grub_chainloader_cmd to grub_rescue_cmd_chainloader, pass command line. * loader/i386/efi/linux.c (allocate_pages): Change allocation method. (grub_e820_add_region): New function. (grub_linux_boot): Construct e820 map from efi map, handle x86_64 booting. (grub_find_video_card): New function. (grub_linux_setup_video): New function. (grub_rescue_cmd_linux): Probe for video information. * normal/x86_64/setjmp.S: New file. * term/efi/console.c (map_char): New function. (grub_console_putchar): Map unicode char. (grub_console_checkkey): Wrap efi calls. (grub_console_getkey): Likewise. (grub_console_getwh): Likewise. (grub_console_gotoxy): Likewise. (grub_console_cls): Likewise. (grub_console_setcolorstate): Likewise. (grub_console_setcursor): Likewise. * util/i386/efi/grub-mkimage.c: Add support for x86_64.
This commit is contained in:
parent
ef29405511
commit
2001169405
39 changed files with 3960 additions and 309 deletions
|
@ -1095,4 +1095,42 @@ 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)
|
||||
|
||||
#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)
|
||||
|
||||
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);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_EFI_API_HEADER */
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
#ifndef GRUB_EFI_CHAINLOADER_HEADER
|
||||
#define GRUB_EFI_CHAINLOADER_HEADER 1
|
||||
|
||||
void grub_chainloader_cmd (const char *filename);
|
||||
void grub_rescue_cmd_chainloader (int argc, char *argv[]);
|
||||
|
||||
#endif /* ! GRUB_EFI_CHAINLOADER_HEADER */
|
||||
|
|
|
@ -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
|
||||
|
@ -98,9 +99,13 @@ struct grub_pe32_optional_header
|
|||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
grub_uint32_t data_base;
|
||||
|
||||
grub_uint32_t image_base;
|
||||
#else
|
||||
grub_uint64_t image_base;
|
||||
#endif
|
||||
|
||||
grub_uint32_t section_alignment;
|
||||
grub_uint32_t file_alignment;
|
||||
grub_uint16_t major_os_version;
|
||||
|
@ -115,10 +120,23 @@ 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;
|
||||
|
||||
|
@ -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
|
||||
|
|
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 */
|
|
@ -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. */
|
||||
|
|
19
include/grub/i386/efi/pci.h
Normal file
19
include/grub/i386/efi/pci.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/i386/pc/pci.h>
|
|
@ -44,14 +44,44 @@
|
|||
#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_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
|
||||
#define GRUB_VIDEO_TYPE_EFI 0x70
|
||||
|
||||
/* For the Linux/i386 boot protocol version 2.03. */
|
||||
struct linux_kernel_header
|
||||
{
|
||||
|
@ -164,26 +194,74 @@ struct linux_kernel_params
|
|||
grub_uint32_t ofw_cif_handler; /* b8 */
|
||||
grub_uint32_t ofw_idt; /* bc */
|
||||
|
||||
grub_uint8_t padding7[0x1c0 - 0xc0];
|
||||
|
||||
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 padding8[0x1e0 - 0x1d8];
|
||||
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 padding9[0x1e8 - 0x1e4];
|
||||
grub_uint8_t padding8[0x1e8 - 0x1e4];
|
||||
|
||||
grub_uint32_t mmap_size; /* 1e8 */
|
||||
|
||||
grub_uint8_t padding10[0x1ff - 0x1ec];
|
||||
grub_uint8_t padding9[0x1f1 - 0x1ec];
|
||||
|
||||
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 */
|
||||
|
||||
|
|
|
@ -38,6 +38,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. */
|
||||
|
|
|
@ -22,6 +22,19 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_PCI_ADDR_SPACE_MASK 0x01
|
||||
#define GRUB_PCI_ADDR_SPACE_MEMORY 0x00
|
||||
#define GRUB_PCI_ADDR_SPACE_IO 0x01
|
||||
|
||||
#define GRUB_PCI_ADDR_MEM_TYPE_MASK 0x06
|
||||
#define GRUB_PCI_ADDR_MEM_TYPE_32 0x00 /* 32 bit address */
|
||||
#define GRUB_PCI_ADDR_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
|
||||
#define GRUB_PCI_ADDR_MEM_TYPE_64 0x04 /* 64 bit address */
|
||||
#define GRUB_PCI_ADDR_MEM_PREFETCH 0x08 /* prefetchable */
|
||||
|
||||
#define GRUB_PCI_ADDR_MEM_MASK ~0xf
|
||||
#define GRUB_PCI_ADDR_IO_MASK ~0x03
|
||||
|
||||
typedef grub_uint32_t grub_pci_id_t;
|
||||
typedef int (*grub_pci_iteratefunc_t) (int bus, int device, int func,
|
||||
grub_pci_id_t pciid);
|
||||
|
|
33
include/grub/x86_64/efi/kernel.h
Normal file
33
include/grub/x86_64/efi/kernel.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
||||
|
32
include/grub/x86_64/efi/loader.h
Normal file
32
include/grub/x86_64/efi/loader.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2006,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* 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[]);
|
||||
|
||||
void EXPORT_FUNC(grub_linux_real_boot) (void);
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
24
include/grub/x86_64/efi/machine.h
Normal file
24
include/grub/x86_64/efi/machine.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_MACHINE_HEADER
|
||||
#define GRUB_MACHINE_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_EFI 1
|
||||
|
||||
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
|
19
include/grub/x86_64/efi/pci.h
Normal file
19
include/grub/x86_64/efi/pci.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/i386/pc/pci.h>
|
24
include/grub/x86_64/efi/time.h
Normal file
24
include/grub/x86_64/efi/time.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_TIME_HEADER
|
||||
#define GRUB_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/efi/time.h>
|
||||
|
||||
#endif /* ! GRUB_MACHINE_TIME_HEADER */
|
19
include/grub/x86_64/linux.h
Normal file
19
include/grub/x86_64/linux.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/i386/linux.h>
|
27
include/grub/x86_64/setjmp.h
Normal file
27
include/grub/x86_64/setjmp.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,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_SETJMP_CPU_HEADER
|
||||
#define GRUB_SETJMP_CPU_HEADER 1
|
||||
|
||||
typedef unsigned long grub_jmp_buf[8];
|
||||
|
||||
int grub_setjmp (grub_jmp_buf env);
|
||||
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_SETJMP_CPU_HEADER */
|
29
include/grub/x86_64/time.h
Normal file
29
include/grub/x86_64/time.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
static __inline void
|
||||
grub_cpu_idle (void)
|
||||
{
|
||||
/* FIXME: this can't work until we handle interrupts. */
|
||||
/* __asm__ __volatile__ ("hlt"); */
|
||||
}
|
||||
|
||||
#endif /* ! KERNEL_CPU_TIME_HEADER */
|
31
include/grub/x86_64/types.h
Normal file
31
include/grub/x86_64/types.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_TARGET_SIZEOF_VOID_P 8
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_TARGET_SIZEOF_LONG 8
|
||||
|
||||
/* x86_64 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
Loading…
Add table
Add a link
Reference in a new issue