Merge remote-tracking branch 'upstream/master'

This commit is contained in:
David Michael 2017-01-23 13:27:34 -08:00
commit e576eb0cbc
183 changed files with 5507 additions and 2653 deletions

View file

@ -22,6 +22,8 @@
#ifndef GRUB_DSDT_TEST
#include <grub/types.h>
#include <grub/err.h>
#else
#define GRUB_PACKED __attribute__ ((packed))
#endif
#define GRUB_RSDP_SIGNATURE "RSD PTR "
@ -219,9 +221,10 @@ enum
GRUB_ACPI_OPCODE_CONCATRES = 0x84,
GRUB_ACPI_OPCODE_MOD = 0x85,
GRUB_ACPI_OPCODE_INDEX = 0x88,
GRUB_ACPI_OPCODE_TOSTRING = 0x9c,
GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD = 0x8a,
GRUB_ACPI_OPCODE_CREATE_WORD_FIELD = 0x8b,
GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD = 0x8c,
GRUB_ACPI_OPCODE_TOSTRING = 0x9c,
GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff
};
enum
@ -239,6 +242,6 @@ enum
};
struct grub_acpi_fadt *
grub_acpi_find_fadt (void);
EXPORT_FUNC(grub_acpi_find_fadt) (void);
#endif /* ! GRUB_ACPI_HEADER */

View file

@ -40,11 +40,7 @@
# define LINUX_PHYS_OFFSET (0x00008000)
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
static inline grub_addr_t
grub_arm_firmware_get_boot_data (void)
{
return 0;
}
# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
static inline grub_uint32_t
grub_arm_firmware_get_machine_type (void)
{

View file

@ -26,7 +26,7 @@
#endif /* ! ASM_FILE */
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
#define GRUB_KERNEL_MACHINE_STACK_SIZE GRUB_KERNEL_ARM_STACK_SIZE
#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (16 * 1024 * 1024)
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -22,5 +22,13 @@
int grub_arm_64_check_xxxx26_offset (grub_int64_t offset);
void
grub_arm64_set_xxxx26_offset (grub_uint32_t *place, grub_int64_t offset);
int
grub_arm64_check_hi21_signed (grub_int64_t offset);
void
grub_arm64_set_hi21 (grub_uint32_t *place, grub_int64_t offset);
void
grub_arm64_set_abs_lo12 (grub_uint32_t *place, grub_int64_t target);
void
grub_arm64_set_abs_lo12_ldst64 (grub_uint32_t *place, grub_int64_t target);
#endif

View file

@ -35,10 +35,11 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#ifndef GRUB_MACHINE_EMU
#ifdef _mips
void EXPORT_FUNC(grub_arch_sync_dma_caches) (void *address, grub_size_t len);
void EXPORT_FUNC(grub_arch_sync_dma_caches) (volatile void *address,
grub_size_t len);
#else
static inline void
grub_arch_sync_dma_caches (void *address __attribute__ ((unused)),
grub_arch_sync_dma_caches (volatile void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
}

View file

@ -85,6 +85,10 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,
char **path);
#if defined(__arm__) || defined(__aarch64__)
void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
#endif
grub_addr_t grub_efi_modules_addr (void);
void grub_efi_mm_init (void);

View file

@ -2068,6 +2068,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_AARCH64_NONE 0 /* No relocation. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
#define R_AARCH64_ADR_PREL_PG_HI21 275
#define R_AARCH64_ADD_ABS_LO12_NC 277
#define R_AARCH64_LDST64_ABS_LO12_NC 286
#define R_AARCH64_JUMP26 282 /* 26-bit relative. */
#define R_AARCH64_CALL26 283 /* 26-bit relative. */
#define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */

View file

@ -20,6 +20,8 @@
#ifndef GRUB_MEMORY_CPU_HEADER
#define GRUB_MEMORY_CPU_HEADER 1
#define PAGE_SHIFT 12
/* The flag for protected mode. */
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000020
@ -31,6 +33,11 @@
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
/* Some PTE definitions. */
#define GRUB_PAGE_PRESENT 0x00000001
#define GRUB_PAGE_RW 0x00000002
#define GRUB_PAGE_USER 0x00000004
#ifndef ASM_FILE
#define GRUB_MMAP_MALLOC_LOW 1

View file

@ -30,6 +30,17 @@
#define MULTIBOOT_MBI_REGISTER ebx
#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386
#ifdef GRUB_MACHINE_EFI
#ifdef __x86_64__
#define MULTIBOOT_EFI_INITIAL_STATE { .rax = MULTIBOOT_BOOTLOADER_MAGIC, \
.rcx = 0, \
.rdx = 0, \
}
#define MULTIBOOT_EFI_ENTRY_REGISTER rip
#define MULTIBOOT_EFI_MBI_REGISTER rbx
#endif
#endif
#define MULTIBOOT_ELF32_MACHINE EM_386
#define MULTIBOOT_ELF64_MACHINE EM_X86_64

View file

@ -0,0 +1,37 @@
/*
* 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_PMTIMER_HEADER
#define KERNEL_CPU_PMTIMER_HEADER 1
#include <grub/i386/tsc.h>
#include <grub/i386/io.h>
/*
Preconditions:
* Caller has ensured that both pmtimer and tsc are supported
* 1 <= num_pm_ticks <= 3580
Return:
* Number of TSC ticks elapsed
* 0 on failure.
*/
grub_uint64_t
EXPORT_FUNC(grub_pmtimer_wait_count_tsc) (grub_port_t pmtimer,
grub_uint16_t num_pm_ticks);
#endif

View file

@ -65,6 +65,20 @@ struct grub_relocator64_state
grub_addr_t cr3;
};
#ifdef GRUB_MACHINE_EFI
#ifdef __x86_64__
struct grub_relocator64_efi_state
{
grub_uint64_t rax;
grub_uint64_t rbx;
grub_uint64_t rcx;
grub_uint64_t rdx;
grub_uint64_t rip;
grub_uint64_t rsi;
};
#endif
#endif
grub_err_t grub_relocator16_boot (struct grub_relocator *rel,
struct grub_relocator16_state state);
@ -76,4 +90,11 @@ grub_err_t grub_relocator64_boot (struct grub_relocator *rel,
struct grub_relocator64_state state,
grub_addr_t min_addr, grub_addr_t max_addr);
#ifdef GRUB_MACHINE_EFI
#ifdef __x86_64__
grub_err_t grub_relocator64_efi_boot (struct grub_relocator *rel,
struct grub_relocator64_efi_state state);
#endif
#endif
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View file

@ -51,4 +51,20 @@ grub_get_tsc (void)
return (((grub_uint64_t) hi) << 32) | lo;
}
static __inline int
grub_cpu_is_tsc_supported (void)
{
#ifndef GRUB_MACHINE_XEN
grub_uint32_t a,b,c,d;
if (! grub_cpu_is_cpuid_supported ())
return 0;
grub_cpuid(1,a,b,c,d);
return (d & (1 << 4)) != 0;
#else
return 1;
#endif
}
#endif /* ! KERNEL_CPU_TSC_HEADER */

View file

@ -89,7 +89,8 @@ struct grub_xnu_boot_params_v2
grub_uint64_t efi_runtime_first_page_virtual;
grub_uint32_t efi_system_table;
grub_uint32_t unused2[11];
grub_uint32_t unused2[9];
grub_uint64_t ram_size;
grub_uint64_t fsbfreq;
grub_uint32_t unused3[734];
} GRUB_PACKED;

View file

@ -0,0 +1,20 @@
#include <stdint.h>
#include <stdlib.h>
#include <grub/types.h>
#define GRUB_MODULE_VERIFY_SUPPORTS_REL 1
#define GRUB_MODULE_VERIFY_SUPPORTS_RELA 2
struct grub_module_verifier_arch {
const char *name;
int voidp_sizeof;
int bigendian;
int machine;
int flags;
const int *supported_relocations;
const int *short_relocations;
};
void grub_module_verify64(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch);
void grub_module_verify32(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch);

View file

@ -91,10 +91,28 @@ grub_multiboot_set_console (int console_type, int accepted_consoles,
int console_required);
grub_err_t
grub_multiboot_load (grub_file_t file, const char *filename);
struct mbi_load_data
{
grub_file_t file;
const char *filename;
void *buffer;
unsigned int mbi_ver;
int relocatable;
grub_uint32_t min_addr;
grub_uint32_t max_addr;
grub_size_t align;
grub_uint32_t preference;
grub_uint32_t link_base_addr;
grub_uint32_t load_base_addr;
int avoid_efi_boot_services;
};
typedef struct mbi_load_data mbi_load_data_t;
/* Load ELF32 or ELF64. */
grub_err_t
grub_multiboot_load_elf (grub_file_t file, const char *filename,
void *buffer);
grub_multiboot_load_elf (mbi_load_data_t *mld);
extern grub_size_t grub_multiboot_pure_size;
extern grub_size_t grub_multiboot_alloc_mbi;
extern grub_uint32_t grub_multiboot_payload_eip;

View file

@ -191,6 +191,18 @@ typedef struct grub_net_network_level_netaddress
};
} grub_net_network_level_netaddress_t;
struct grub_net_route
{
struct grub_net_route *next;
struct grub_net_route **prev;
grub_net_network_level_netaddress_t target;
char *name;
struct grub_net_network_level_protocol *prot;
int is_gateway;
struct grub_net_network_level_interface *interface;
grub_net_network_level_address_t gw;
};
#define FOR_PACKETS(cont,var) for (var = (cont).first; var; var = var->next)
static inline grub_err_t
@ -368,6 +380,16 @@ grub_net_card_unregister (struct grub_net_card *card);
#define FOR_NET_CARDS_SAFE(var, next) for (var = grub_net_cards, next = (var ? var->next : 0); var; var = next, next = (var ? var->next : 0))
extern struct grub_net_route *grub_net_routes;
static inline void
grub_net_route_register (struct grub_net_route *route)
{
grub_list_push (GRUB_AS_LIST_P (&grub_net_routes),
GRUB_AS_LIST (route));
}
#define FOR_NET_ROUTES(var) for (var = grub_net_routes; var; var = var->next)
struct grub_net_session *
grub_net_open_tcp (char *address, grub_uint16_t port);
@ -393,7 +415,8 @@ grub_net_add_route (const char *name,
grub_err_t
grub_net_add_route_gw (const char *name,
grub_net_network_level_netaddress_t target,
grub_net_network_level_address_t gw);
grub_net_network_level_address_t gw,
struct grub_net_network_level_interface *inter);
#define GRUB_NET_BOOTP_MAC_ADDR_LEN 16

View file

@ -54,6 +54,7 @@
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
#define GRUB_KERNEL_ARM_STACK_SIZE 0x40000
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
@ -120,7 +121,6 @@
#define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8
#define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4
#define GRUB_KERNEL_ARM_UBOOT_LINK_ADDR 0x08000000
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to

33
include/grub/random.h Normal file
View file

@ -0,0 +1,33 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2016 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_RANDOM_HEADER
#define GRUB_RANDOM_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
/* Not peer-reviewed. May not be any better than string of zeros. */
grub_err_t
grub_crypto_get_random (void *buffer, grub_size_t sz);
/* Do not use directly. Use grub_crypto_get_random instead. */
int
grub_crypto_arch_get_random (void *buffer, grub_size_t sz);
#endif

View file

@ -254,55 +254,49 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t _x)
#endif /* ! WORDS_BIGENDIAN */
static inline grub_uint16_t grub_get_unaligned16 (const void *ptr)
struct grub_unaligned_uint16
{
struct grub_unaligned_uint16_t
{
grub_uint16_t d;
} GRUB_PACKED;
const struct grub_unaligned_uint16_t *dd
= (const struct grub_unaligned_uint16_t *) ptr;
return dd->d;
}
static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val)
grub_uint16_t val;
} GRUB_PACKED;
struct grub_unaligned_uint32
{
struct grub_unaligned_uint16_t
{
grub_uint16_t d;
} GRUB_PACKED;
struct grub_unaligned_uint16_t *dd = (struct grub_unaligned_uint16_t *) ptr;
dd->d = val;
}
static inline grub_uint32_t grub_get_unaligned32 (const void *ptr)
{
struct grub_unaligned_uint32_t
{
grub_uint32_t d;
} GRUB_PACKED;
const struct grub_unaligned_uint32_t *dd
= (const struct grub_unaligned_uint32_t *) ptr;
return dd->d;
}
static inline void grub_set_unaligned32 (void *ptr, grub_uint32_t val)
{
struct grub_unaligned_uint32_t
{
grub_uint32_t d;
} GRUB_PACKED;
struct grub_unaligned_uint32_t *dd = (struct grub_unaligned_uint32_t *) ptr;
dd->d = val;
}
grub_uint32_t val;
} GRUB_PACKED;
struct grub_unaligned_uint64
{
grub_uint64_t val;
} GRUB_PACKED;
typedef struct grub_unaligned_uint16 grub_unaligned_uint16_t;
typedef struct grub_unaligned_uint32 grub_unaligned_uint32_t;
typedef struct grub_unaligned_uint64 grub_unaligned_uint64_t;
static inline grub_uint16_t grub_get_unaligned16 (const void *ptr)
{
const struct grub_unaligned_uint16 *dd
= (const struct grub_unaligned_uint16 *) ptr;
return dd->val;
}
static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val)
{
struct grub_unaligned_uint16 *dd = (struct grub_unaligned_uint16 *) ptr;
dd->val = val;
}
static inline grub_uint32_t grub_get_unaligned32 (const void *ptr)
{
const struct grub_unaligned_uint32 *dd
= (const struct grub_unaligned_uint32 *) ptr;
return dd->val;
}
static inline void grub_set_unaligned32 (void *ptr, grub_uint32_t val)
{
struct grub_unaligned_uint32 *dd = (struct grub_unaligned_uint32 *) ptr;
dd->val = val;
}
static inline grub_uint64_t grub_get_unaligned64 (const void *ptr)
{
const struct grub_unaligned_uint64 *dd

185
include/grub/util/mkimage.h Normal file
View file

@ -0,0 +1,185 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_UTIL_MKIMAGE_HEADER
#define GRUB_UTIL_MKIMAGE_HEADER 1
struct grub_mkimage_layout
{
size_t exec_size;
size_t kernel_size;
size_t bss_size;
grub_uint64_t start_address;
void *reloc_section;
size_t reloc_size;
size_t align;
grub_size_t ia64jmp_off;
grub_size_t tramp_off;
grub_size_t ia64_got_off;
grub_size_t got_size;
unsigned ia64jmpnum;
grub_uint32_t bss_start;
grub_uint32_t end;
};
/* Private header. Use only in mkimage-related sources. */
char *
grub_mkimage_load_image32 (const char *kernel_path,
size_t total_module_size,
struct grub_mkimage_layout *layout,
const struct grub_install_image_target_desc *image_target);
char *
grub_mkimage_load_image64 (const char *kernel_path,
size_t total_module_size,
struct grub_mkimage_layout *layout,
const struct grub_install_image_target_desc *image_target);
void
grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target,
int note, char **core_img, size_t *core_size,
Elf32_Addr target_addr, grub_size_t align,
size_t kernel_size, size_t bss_size);
void
grub_mkimage_generate_elf64 (const struct grub_install_image_target_desc *image_target,
int note, char **core_img, size_t *core_size,
Elf64_Addr target_addr, grub_size_t align,
size_t kernel_size, size_t bss_size);
struct grub_install_image_target_desc
{
const char *dirname;
const char *names[6];
grub_size_t voidp_sizeof;
int bigendian;
enum {
IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_SPARC64_CDCORE,
IMAGE_I386_IEEE1275,
IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT, IMAGE_XEN, IMAGE_I386_PC_ELTORITO
} id;
enum
{
PLATFORM_FLAGS_NONE = 0,
PLATFORM_FLAGS_DECOMPRESSORS = 2,
PLATFORM_FLAGS_MODULES_BEFORE_KERNEL = 4,
} flags;
unsigned total_module_size;
unsigned decompressor_compressed_size;
unsigned decompressor_uncompressed_size;
unsigned decompressor_uncompressed_addr;
unsigned reloc_table_offset;
unsigned link_align;
grub_uint16_t elf_target;
unsigned section_align;
signed vaddr_offset;
grub_uint64_t link_addr;
unsigned mod_gap, mod_align;
grub_compression_t default_compression;
grub_uint16_t pe_target;
};
#define grub_target_to_host32(x) (grub_target_to_host32_real (image_target, (x)))
#define grub_host_to_target32(x) (grub_host_to_target32_real (image_target, (x)))
#define grub_target_to_host64(x) (grub_target_to_host64_real (image_target, (x)))
#define grub_host_to_target64(x) (grub_host_to_target64_real (image_target, (x)))
#define grub_host_to_target_addr(x) (grub_host_to_target_addr_real (image_target, (x)))
#define grub_target_to_host16(x) (grub_target_to_host16_real (image_target, (x)))
#define grub_host_to_target16(x) (grub_host_to_target16_real (image_target, (x)))
static inline grub_uint32_t
grub_target_to_host32_real (const struct grub_install_image_target_desc *image_target,
grub_uint32_t in)
{
if (image_target->bigendian)
return grub_be_to_cpu32 (in);
else
return grub_le_to_cpu32 (in);
}
static inline grub_uint64_t
grub_target_to_host64_real (const struct grub_install_image_target_desc *image_target,
grub_uint64_t in)
{
if (image_target->bigendian)
return grub_be_to_cpu64 (in);
else
return grub_le_to_cpu64 (in);
}
static inline grub_uint64_t
grub_host_to_target64_real (const struct grub_install_image_target_desc *image_target,
grub_uint64_t in)
{
if (image_target->bigendian)
return grub_cpu_to_be64 (in);
else
return grub_cpu_to_le64 (in);
}
static inline grub_uint32_t
grub_host_to_target32_real (const struct grub_install_image_target_desc *image_target,
grub_uint32_t in)
{
if (image_target->bigendian)
return grub_cpu_to_be32 (in);
else
return grub_cpu_to_le32 (in);
}
static inline grub_uint16_t
grub_target_to_host16_real (const struct grub_install_image_target_desc *image_target,
grub_uint16_t in)
{
if (image_target->bigendian)
return grub_be_to_cpu16 (in);
else
return grub_le_to_cpu16 (in);
}
static inline grub_uint16_t
grub_host_to_target16_real (const struct grub_install_image_target_desc *image_target,
grub_uint16_t in)
{
if (image_target->bigendian)
return grub_cpu_to_be16 (in);
else
return grub_cpu_to_le16 (in);
}
static inline grub_uint64_t
grub_host_to_target_addr_real (const struct grub_install_image_target_desc *image_target, grub_uint64_t in)
{
if (image_target->voidp_sizeof == 8)
return grub_host_to_target64_real (image_target, in);
else
return grub_host_to_target32_real (image_target, in);
}
static inline grub_uint64_t
grub_target_to_host_real (const struct grub_install_image_target_desc *image_target, grub_uint64_t in)
{
if (image_target->voidp_sizeof == 8)
return grub_target_to_host64_real (image_target, in);
else
return grub_target_to_host32_real (image_target, in);
}
#define grub_target_to_host(val) grub_target_to_host_real(image_target, (val))
#endif

View file

@ -31,5 +31,6 @@ struct grub_util_path_list *
grub_util_resolve_dependencies (const char *prefix,
const char *dep_list_file,
char *modules[]);
void grub_util_free_path_list (struct grub_util_path_list *path_list);
#endif /* ! GRUB_UTIL_RESOLVE_HEADER */

View file

@ -23,11 +23,13 @@
#include <grub/err.h>
#include <grub/relocator.h>
#define XEN_MAX_MAPPINGS 3
struct grub_relocator_xen_state
{
grub_addr_t start_info;
grub_addr_t paging_start;
grub_addr_t paging_size;
grub_addr_t paging_start[XEN_MAX_MAPPINGS];
grub_addr_t paging_size[XEN_MAX_MAPPINGS];
grub_addr_t mfn_list;
grub_addr_t stack;
grub_addr_t entry_point;

View file

@ -35,10 +35,13 @@ struct grub_xen_file_info
grub_uint64_t entry_point;
grub_uint64_t hypercall_page;
grub_uint64_t paddr_offset;
grub_uint64_t p2m_base;
int has_hypercall_page;
int has_note;
int has_xen_guest;
int has_p2m_base;
int extended_cr3;
int unmapped_initrd;
enum
{
GRUB_XEN_FILE_I386 = 1,

View file

@ -60,6 +60,9 @@
#define MULTIBOOT_TAG_TYPE_NETWORK 16
#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
#define MULTIBOOT_TAG_TYPE_EFI_BS 18
#define MULTIBOOT_TAG_TYPE_EFI32_IH 19
#define MULTIBOOT_TAG_TYPE_EFI64_IH 20
#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
#define MULTIBOOT_HEADER_TAG_END 0
#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
@ -69,11 +72,17 @@
#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
#define MULTIBOOT_HEADER_TAG_EFI_BS 7
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
#define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
#define MULTIBOOT_ARCHITECTURE_I386 0
#define MULTIBOOT_ARCHITECTURE_MIPS32 4
#define MULTIBOOT_HEADER_TAG_OPTIONAL 1
#define MULTIBOOT_LOAD_PREFERENCE_NONE 0
#define MULTIBOOT_LOAD_PREFERENCE_LOW 1
#define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
#define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
#define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
@ -158,6 +167,17 @@ struct multiboot_header_tag_module_align
multiboot_uint32_t size;
};
struct multiboot_header_tag_relocatable
{
multiboot_uint16_t type;
multiboot_uint16_t flags;
multiboot_uint32_t size;
multiboot_uint32_t min_addr;
multiboot_uint32_t max_addr;
multiboot_uint32_t align;
multiboot_uint32_t preference;
};
struct multiboot_color
{
multiboot_uint8_t red;
@ -176,7 +196,7 @@ struct multiboot_mmap_entry
#define MULTIBOOT_MEMORY_BADRAM 5
multiboot_uint32_t type;
multiboot_uint32_t zero;
} GRUB_PACKED;
};
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
struct multiboot_tag
@ -370,6 +390,27 @@ struct multiboot_tag_efi_mmap
multiboot_uint8_t efi_mmap[0];
};
struct multiboot_tag_efi32_ih
{
multiboot_uint32_t type;
multiboot_uint32_t size;
multiboot_uint32_t pointer;
};
struct multiboot_tag_efi64_ih
{
multiboot_uint32_t type;
multiboot_uint32_t size;
multiboot_uint64_t pointer;
};
struct multiboot_tag_load_base_addr
{
multiboot_uint32_t type;
multiboot_uint32_t size;
multiboot_uint32_t load_base_addr;
};
#endif /* ! ASM_FILE */
#endif /* ! MULTIBOOT_HEADER */

View file

@ -58,34 +58,31 @@
#define __HYPERVISOR_VIRT_START_PAE 0xF5800000
#define __MACH2PHYS_VIRT_START_PAE 0xF5800000
#define __MACH2PHYS_VIRT_END_PAE 0xF6800000
#define HYPERVISOR_VIRT_START_PAE \
mk_unsigned_long(__HYPERVISOR_VIRT_START_PAE)
#define MACH2PHYS_VIRT_START_PAE \
mk_unsigned_long(__MACH2PHYS_VIRT_START_PAE)
#define MACH2PHYS_VIRT_END_PAE \
mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE)
#define HYPERVISOR_VIRT_START_PAE xen_mk_ulong(__HYPERVISOR_VIRT_START_PAE)
#define MACH2PHYS_VIRT_START_PAE xen_mk_ulong(__MACH2PHYS_VIRT_START_PAE)
#define MACH2PHYS_VIRT_END_PAE xen_mk_ulong(__MACH2PHYS_VIRT_END_PAE)
/* Non-PAE bounds are obsolete. */
#define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000
#define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000
#define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000
#define HYPERVISOR_VIRT_START_NONPAE \
mk_unsigned_long(__HYPERVISOR_VIRT_START_NONPAE)
xen_mk_ulong(__HYPERVISOR_VIRT_START_NONPAE)
#define MACH2PHYS_VIRT_START_NONPAE \
mk_unsigned_long(__MACH2PHYS_VIRT_START_NONPAE)
xen_mk_ulong(__MACH2PHYS_VIRT_START_NONPAE)
#define MACH2PHYS_VIRT_END_NONPAE \
mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE)
xen_mk_ulong(__MACH2PHYS_VIRT_END_NONPAE)
#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE
#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE
#ifndef HYPERVISOR_VIRT_START
#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
#define HYPERVISOR_VIRT_START xen_mk_ulong(__HYPERVISOR_VIRT_START)
#endif
#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
#define MACH2PHYS_VIRT_START xen_mk_ulong(__MACH2PHYS_VIRT_START)
#define MACH2PHYS_VIRT_END xen_mk_ulong(__MACH2PHYS_VIRT_END)
#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
#ifndef machine_to_phys_mapping
#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
@ -104,6 +101,7 @@
do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \
(hnd).p = val; \
} while ( 0 )
#define int64_aligned_t int64_t __attribute__((aligned(8)))
#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
#define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
#define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name)

View file

@ -76,12 +76,12 @@
#define __MACH2PHYS_VIRT_END 0xFFFF804000000000
#ifndef HYPERVISOR_VIRT_START
#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
#define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END)
#define HYPERVISOR_VIRT_START xen_mk_ulong(__HYPERVISOR_VIRT_START)
#define HYPERVISOR_VIRT_END xen_mk_ulong(__HYPERVISOR_VIRT_END)
#endif
#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
#define MACH2PHYS_VIRT_START xen_mk_ulong(__MACH2PHYS_VIRT_START)
#define MACH2PHYS_VIRT_END xen_mk_ulong(__MACH2PHYS_VIRT_END)
#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3)
#ifndef machine_to_phys_mapping
#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)

281
include/xen/elfnote.h Normal file
View file

@ -0,0 +1,281 @@
/******************************************************************************
* elfnote.h
*
* Definitions used for the Xen ELF notes.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Copyright (c) 2006, Ian Campbell, XenSource Ltd.
*/
#ifndef __XEN_PUBLIC_ELFNOTE_H__
#define __XEN_PUBLIC_ELFNOTE_H__
/*
* `incontents 200 elfnotes ELF notes
*
* The notes should live in a PT_NOTE segment and have "Xen" in the
* name field.
*
* Numeric types are either 4 or 8 bytes depending on the content of
* the desc field.
*
* LEGACY indicated the fields in the legacy __xen_guest string which
* this a note type replaces.
*
* String values (for non-legacy) are NULL terminated ASCII, also known
* as ASCIZ type.
*/
/*
* NAME=VALUE pair (string).
*/
#define XEN_ELFNOTE_INFO 0
/*
* The virtual address of the entry point (numeric).
*
* LEGACY: VIRT_ENTRY
*/
#define XEN_ELFNOTE_ENTRY 1
/* The virtual address of the hypercall transfer page (numeric).
*
* LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
* number not a virtual address)
*/
#define XEN_ELFNOTE_HYPERCALL_PAGE 2
/* The virtual address where the kernel image should be mapped (numeric).
*
* Defaults to 0.
*
* LEGACY: VIRT_BASE
*/
#define XEN_ELFNOTE_VIRT_BASE 3
/*
* The offset of the ELF paddr field from the actual required
* pseudo-physical address (numeric).
*
* This is used to maintain backwards compatibility with older kernels
* which wrote __PAGE_OFFSET into that field. This field defaults to 0
* if not present.
*
* LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
*/
#define XEN_ELFNOTE_PADDR_OFFSET 4
/*
* The version of Xen that we work with (string).
*
* LEGACY: XEN_VER
*/
#define XEN_ELFNOTE_XEN_VERSION 5
/*
* The name of the guest operating system (string).
*
* LEGACY: GUEST_OS
*/
#define XEN_ELFNOTE_GUEST_OS 6
/*
* The version of the guest operating system (string).
*
* LEGACY: GUEST_VER
*/
#define XEN_ELFNOTE_GUEST_VERSION 7
/*
* The loader type (string).
*
* LEGACY: LOADER
*/
#define XEN_ELFNOTE_LOADER 8
/*
* The kernel supports PAE (x86/32 only, string = "yes", "no" or
* "bimodal").
*
* For compatibility with Xen 3.0.3 and earlier the "bimodal" setting
* may be given as "yes,bimodal" which will cause older Xen to treat
* this kernel as PAE.
*
* LEGACY: PAE (n.b. The legacy interface included a provision to
* indicate 'extended-cr3' support allowing L3 page tables to be
* placed above 4G. It is assumed that any kernel new enough to use
* these ELF notes will include this and therefore "yes" here is
* equivalent to "yes[entended-cr3]" in the __xen_guest interface.
*/
#define XEN_ELFNOTE_PAE_MODE 9
/*
* The features supported/required by this kernel (string).
*
* The string must consist of a list of feature names (as given in
* features.h, without the "XENFEAT_" prefix) separated by '|'
* characters. If a feature is required for the kernel to function
* then the feature name must be preceded by a '!' character.
*
* LEGACY: FEATURES
*/
#define XEN_ELFNOTE_FEATURES 10
/*
* The kernel requires the symbol table to be loaded (string = "yes" or "no")
* LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
* of this string as a boolean flag rather than requiring "yes" or
* "no".
*/
#define XEN_ELFNOTE_BSD_SYMTAB 11
/*
* The lowest address the hypervisor hole can begin at (numeric).
*
* This must not be set higher than HYPERVISOR_VIRT_START. Its presence
* also indicates to the hypervisor that the kernel can deal with the
* hole starting at a higher address.
*/
#define XEN_ELFNOTE_HV_START_LOW 12
/*
* List of maddr_t-sized mask/value pairs describing how to recognize
* (non-present) L1 page table entries carrying valid MFNs (numeric).
*/
#define XEN_ELFNOTE_L1_MFN_VALID 13
/*
* Whether or not the guest supports cooperative suspend cancellation.
* This is a numeric value.
*
* Default is 0
*/
#define XEN_ELFNOTE_SUSPEND_CANCEL 14
/*
* The (non-default) location the initial phys-to-machine map should be
* placed at by the hypervisor (Dom0) or the tools (DomU).
* The kernel must be prepared for this mapping to be established using
* large pages, despite such otherwise not being available to guests.
* The kernel must also be able to handle the page table pages used for
* this mapping not being accessible through the initial mapping.
* (Only x86-64 supports this at present.)
*/
#define XEN_ELFNOTE_INIT_P2M 15
/*
* Whether or not the guest can deal with being passed an initrd not
* mapped through its initial page tables.
*/
#define XEN_ELFNOTE_MOD_START_PFN 16
/*
* The features supported by this kernel (numeric).
*
* Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a
* kernel to specify support for features that older hypervisors don't
* know about. The set of features 4.2 and newer hypervisors will
* consider supported by the kernel is the combination of the sets
* specified through this and the string note.
*
* LEGACY: FEATURES
*/
#define XEN_ELFNOTE_SUPPORTED_FEATURES 17
/*
* Physical entry point into the kernel.
*
* 32bit entry point into the kernel. When requested to launch the
* guest kernel in a HVM container, Xen will use this entry point to
* launch the guest in 32bit protected mode with paging disabled.
* Ignored otherwise.
*/
#define XEN_ELFNOTE_PHYS32_ENTRY 18
/*
* The number of the highest elfnote defined.
*/
#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_ENTRY
/*
* System information exported through crash notes.
*
* The kexec / kdump code will create one XEN_ELFNOTE_CRASH_INFO
* note in case of a system crash. This note will contain various
* information about the system, see xen/include/xen/elfcore.h.
*/
#define XEN_ELFNOTE_CRASH_INFO 0x1000001
/*
* System registers exported through crash notes.
*
* The kexec / kdump code will create one XEN_ELFNOTE_CRASH_REGS
* note per cpu in case of a system crash. This note is architecture
* specific and will contain registers not saved in the "CORE" note.
* See xen/include/xen/elfcore.h for more information.
*/
#define XEN_ELFNOTE_CRASH_REGS 0x1000002
/*
* xen dump-core none note.
* xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_NONE
* in its dump file to indicate that the file is xen dump-core
* file. This note doesn't have any other information.
* See tools/libxc/xc_core.h for more information.
*/
#define XEN_ELFNOTE_DUMPCORE_NONE 0x2000000
/*
* xen dump-core header note.
* xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_HEADER
* in its dump file.
* See tools/libxc/xc_core.h for more information.
*/
#define XEN_ELFNOTE_DUMPCORE_HEADER 0x2000001
/*
* xen dump-core xen version note.
* xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_XEN_VERSION
* in its dump file. It contains the xen version obtained via the
* XENVER hypercall.
* See tools/libxc/xc_core.h for more information.
*/
#define XEN_ELFNOTE_DUMPCORE_XEN_VERSION 0x2000002
/*
* xen dump-core format version note.
* xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION
* in its dump file. It contains a format version identifier.
* See tools/libxc/xc_core.h for more information.
*/
#define XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION 0x2000003
#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/

View file

@ -52,6 +52,19 @@ DEFINE_XEN_GUEST_HANDLE(void);
DEFINE_XEN_GUEST_HANDLE(uint64_t);
DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
/* Turn a plain number into a C unsigned (long) constant. */
#define __xen_mk_uint(x) x ## U
#define __xen_mk_ulong(x) x ## UL
#define xen_mk_uint(x) __xen_mk_uint(x)
#define xen_mk_ulong(x) __xen_mk_ulong(x)
#else
/* In assembly code we cannot use C numeric constant suffixes. */
#define xen_mk_uint(x) x
#define xen_mk_ulong(x) x
#endif
/*
@ -101,6 +114,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
#define __HYPERVISOR_kexec_op 37
#define __HYPERVISOR_tmem_op 38
#define __HYPERVISOR_xc_reserved_op 39 /* reserved for XenClient */
#define __HYPERVISOR_xenpmu_op 40
/* Architecture-specific hypercall definitions. */
#define __HYPERVISOR_arch_0 48
@ -160,6 +174,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
#define VIRQ_MEM_EVENT 10 /* G. (DOM0) A memory event has occured */
#define VIRQ_XC_RESERVED 11 /* G. Reserved for XenClient */
#define VIRQ_ENOMEM 12 /* G. (DOM0) Low on heap memory */
#define VIRQ_XENPMU 13 /* V. PMC interrupt */
/* Architecture-specific VIRQ definitions. */
#define VIRQ_ARCH_0 16
@ -449,13 +464,13 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
/* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. */
/* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */
/* ` enum uvm_flags { */
#define UVMF_NONE (0UL<<0) /* No flushing at all. */
#define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */
#define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */
#define UVMF_FLUSHTYPE_MASK (3UL<<0)
#define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */
#define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */
#define UVMF_ALL (1UL<<2) /* Flush all TLBs. */
#define UVMF_NONE (xen_mk_ulong(0)<<0) /* No flushing at all. */
#define UVMF_TLB_FLUSH (xen_mk_ulong(1)<<0) /* Flush entire TLB(s). */
#define UVMF_INVLPG (xen_mk_ulong(2)<<0) /* Flush only one entry. */
#define UVMF_FLUSHTYPE_MASK (xen_mk_ulong(3)<<0)
#define UVMF_MULTI (xen_mk_ulong(0)<<2) /* Flush subset of TLBs. */
#define UVMF_LOCAL (xen_mk_ulong(0)<<2) /* Flush local TLB. */
#define UVMF_ALL (xen_mk_ulong(1)<<2) /* Flush all TLBs. */
/* ` } */
/*
@ -486,17 +501,27 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
/* x86/PAE guests: support PDPTs above 4GB. */
#define VMASST_TYPE_pae_extended_cr3 3
/*
* x86/64 guests: strictly hide M2P from user mode.
* This allows the guest to control respective hypervisor behavior:
* - when not set, L4 tables get created with the respective slot blank,
* and whenever the L4 table gets used as a kernel one the missing
* mapping gets inserted,
* - when set, L4 tables get created with the respective slot initialized
* as before, and whenever the L4 table gets used as a user one the
* mapping gets zapped.
*/
#define VMASST_TYPE_m2p_strict 32
#if __XEN_INTERFACE_VERSION__ < 0x00040600
#define MAX_VMASST_TYPE 3
#ifndef __ASSEMBLY__
typedef uint16_t domid_t;
#endif
/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
#define DOMID_FIRST_RESERVED (0x7FF0U)
#define DOMID_FIRST_RESERVED xen_mk_uint(0x7FF0)
/* DOMID_SELF is used in certain contexts to refer to oneself. */
#define DOMID_SELF (0x7FF0U)
#define DOMID_SELF xen_mk_uint(0x7FF0)
/*
* DOMID_IO is used to restrict page-table updates to mapping I/O memory.
@ -507,7 +532,7 @@ typedef uint16_t domid_t;
* This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
* be specified by any calling domain.
*/
#define DOMID_IO (0x7FF1U)
#define DOMID_IO xen_mk_uint(0x7FF1)
/*
* DOMID_XEN is used to allow privileged domains to map restricted parts of
@ -515,17 +540,21 @@ typedef uint16_t domid_t;
* This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
* the caller is privileged.
*/
#define DOMID_XEN (0x7FF2U)
#define DOMID_XEN xen_mk_uint(0x7FF2)
/*
* DOMID_COW is used as the owner of sharable pages */
#define DOMID_COW (0x7FF3U)
#define DOMID_COW xen_mk_uint(0x7FF3)
/* DOMID_INVALID is used to identify pages with unknown owner. */
#define DOMID_INVALID (0x7FF4U)
#define DOMID_INVALID xen_mk_uint(0x7FF4)
/* Idle domain. */
#define DOMID_IDLE (0x7FFFU)
#define DOMID_IDLE xen_mk_uint(0x7FFF)
#ifndef __ASSEMBLY__
typedef uint16_t domid_t;
/*
* Send an array of these to HYPERVISOR_mmu_update().
@ -682,6 +711,12 @@ struct shared_info {
uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */
uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
#if !defined(__i386__)
uint32_t wc_sec_hi;
# define xen_wc_sec_hi wc_sec_hi
#elif !defined(__XEN__) && !defined(__XEN_TOOLS__)
# define xen_wc_sec_hi arch.wc_sec_hi
#endif
struct arch_shared_info arch;
@ -698,24 +733,27 @@ typedef struct shared_info shared_info_t;
* 3. This the order of bootstrap elements in the initial virtual region:
* a. relocated kernel image
* b. initial ram disk [mod_start, mod_len]
* (may be omitted)
* c. list of allocated page frames [mfn_list, nr_pages]
* (unless relocated due to XEN_ELFNOTE_INIT_P2M)
* d. start_info_t structure [register ESI (x86)]
* e. bootstrap page tables [pt_base and CR3 (x86)]
* f. bootstrap stack [register ESP (x86)]
* in case of dom0 this page contains the console info, too
* e. unless dom0: xenstore ring page
* f. unless dom0: console ring page
* g. bootstrap page tables [pt_base and CR3 (x86)]
* h. bootstrap stack [register ESP (x86)]
* 4. Bootstrap elements are packed together, but each is 4kB-aligned.
* 5. The initial ram disk may be omitted.
* 6. The list of page frames forms a contiguous 'pseudo-physical' memory
* 5. The list of page frames forms a contiguous 'pseudo-physical' memory
* layout for the domain. In particular, the bootstrap virtual-memory
* region is a 1:1 mapping to the first section of the pseudo-physical map.
* 7. All bootstrap elements are mapped read-writable for the guest OS. The
* 6. All bootstrap elements are mapped read-writable for the guest OS. The
* only exception is the bootstrap page table, which is mapped read-only.
* 8. There is guaranteed to be at least 512kB padding after the final
* 7. There is guaranteed to be at least 512kB padding after the final
* bootstrap element. If necessary, the bootstrap virtual region is
* extended by an extra 4MB to ensure this.
*
* Note: Prior to 25833:bb85bbccb1c9. ("x86/32-on-64 adjust Dom0 initial page
* table layout") a bug caused the pt_base (3.e above) and cr3 to not point
* table layout") a bug caused the pt_base (3.g above) and cr3 to not point
* to the start of the guest page tables (it was offset by two pages).
* This only manifested itself on 32-on-64 dom0 kernels and not 32-on-64 domU
* or 64-bit kernels of any colour. The page tables for a 32-on-64 dom0 got
@ -759,6 +797,29 @@ struct start_info {
};
typedef struct start_info start_info_t;
/*
* Start of day structure passed to PVH guests in %ebx.
*
* NOTE: nothing will be loaded at physical address 0, so
* a 0 value in any of the address fields should be treated
* as not present.
*/
struct hvm_start_info {
#define HVM_START_MAGIC_VALUE 0x336ec578
uint32_t magic; /* Contains the magic value 0x336ec578 */
/* ("xEn3" with the 0x80 bit of the "E" set).*/
uint32_t flags; /* SIF_xxx flags. */
uint32_t cmdline_paddr; /* Physical address of the command line. */
uint32_t nr_modules; /* Number of modules passed to the kernel. */
uint32_t modlist_paddr; /* Physical address of an array of */
/* hvm_modlist_entry. */
};
struct hvm_modlist_entry {
uint32_t paddr; /* Physical address of the module. */
uint32_t size; /* Size of the module in bytes. */
};
/* New console union for dom0 introduced in 0x00030203. */
#if __XEN_INTERFACE_VERSION__ < 0x00030203
#define console_mfn console.domU.mfn
@ -771,6 +832,8 @@ typedef struct start_info start_info_t;
#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
#define SIF_MULTIBOOT_MOD (1<<2) /* Is mod_start a multiboot module? */
#define SIF_MOD_START_PFN (1<<3) /* Is mod_start a PFN? */
#define SIF_VIRT_P2M_4TOOLS (1<<4) /* Do Xen tools understand a virt. mapped */
/* P->M making the 3 level tree obsolete? */
#define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */
/*
@ -851,25 +914,19 @@ typedef struct dom0_vga_console_info {
typedef uint8_t xen_domain_handle_t[16];
/* Turn a plain number into a C unsigned long constant. */
#define __mk_unsigned_long(x) x ## UL
#define mk_unsigned_long(x) __mk_unsigned_long(x)
__DEFINE_XEN_GUEST_HANDLE(uint8, uint8_t);
__DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t);
__DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t);
__DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
#else /* __ASSEMBLY__ */
/* In assembly code we cannot use C numeric constant suffixes. */
#define mk_unsigned_long(x) x
#endif /* !__ASSEMBLY__ */
/* Default definitions for macros used by domctl/sysctl. */
#if defined(__XEN__) || defined(__XEN_TOOLS__)
#ifndef int64_aligned_t
#define int64_aligned_t int64_t
#endif
#ifndef uint64_aligned_t
#define uint64_aligned_t uint64_t
#endif