github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/bootstrap/multiboot.h (about)

     1  /*
     2   * multiboot.h:  definitions for the multiboot bootloader specification
     3   *
     4   * Copyright (c) 2010, Intel Corporation
     5   * All rights reserved.
     6   *
     7   * Redistribution and use in source and binary forms, with or without
     8   * modification, are permitted provided that the following conditions
     9   * are met:
    10   *
    11   *   * Redistributions of source code must retain the above copyright
    12   *     notice, this list of conditions and the following disclaimer.
    13   *   * Redistributions in binary form must reproduce the above
    14   *     copyright notice, this list of conditions and the following
    15   *     disclaimer in the documentation and/or other materials provided
    16   *     with the distribution.
    17   *   * Neither the name of the Intel Corporation nor the names of its
    18   *     contributors may be used to endorse or promote products derived
    19   *     from this software without specific prior written permission.
    20   *
    21   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    22   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    23   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    24   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    25   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    26   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    27   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    28   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    29   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    30   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    31   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    32   * OF THE POSSIBILITY OF SUCH DAMAGE.
    33   *
    34   */
    35  
    36  #ifndef __MULTIBOOT_H__
    37  #define __MULTIBOOT_H__
    38  
    39  #include <config.h>
    40  
    41  /* Multiboot Header Definitions of OS image*/
    42  #define MULTIBOOT_HEADER_MAGIC			0x1BADB002
    43  /* Bit definitions of flags field of multiboot header*/
    44  #define MULTIBOOT_HEADER_MODS_ALIGNED	0x1
    45  #define MULTIBOOT_HEADER_WANT_MEMORY	0x2
    46  
    47  /* bit definitions of flags field of multiboot information */
    48  #define MBI_MEMLIMITS    (1<<0)
    49  #define MBI_BOOTDEV      (1<<1)
    50  #define MBI_CMDLINE      (1<<2)
    51  #define MBI_MODULES      (1<<3)
    52  #define MBI_AOUT         (1<<4)
    53  #define MBI_ELF          (1<<5)
    54  #define MBI_MEMMAP       (1<<6)
    55  #define MBI_DRIVES       (1<<7)
    56  #define MBI_CONFIG       (1<<8)
    57  #define MBI_BTLDNAME     (1<<9)
    58  #define MBI_APM          (1<<10)
    59  #define MBI_VBE          (1<<11)
    60  
    61  #ifndef __ASSEMBLY__
    62  
    63  typedef struct {
    64      uint32_t tabsize;
    65      uint32_t strsize;
    66      uint32_t addr;
    67      uint32_t reserved;
    68  } aout_t; /* a.out kernel image */
    69  
    70  typedef struct {
    71      uint32_t num;
    72      uint32_t size;
    73      uint32_t addr;
    74      uint32_t shndx;
    75  } elf_t; /* elf kernel */
    76  
    77  typedef struct {
    78      uint8_t bios_driver;
    79      uint8_t top_level_partition;
    80      uint8_t sub_partition;
    81      uint8_t third_partition;
    82  } boot_device_t;
    83  
    84  typedef struct {
    85      uint32_t flags;
    86  
    87      /* valid if flags[0] (MBI_MEMLIMITS) set */
    88      uint32_t mem_lower;
    89      uint32_t mem_upper;
    90  
    91      /* valid if flags[1] set */
    92      boot_device_t boot_device;
    93  
    94      /* valid if flags[2] (MBI_CMDLINE) set */
    95      uint32_t cmdline;
    96  
    97      /* valid if flags[3] (MBI_MODS) set */
    98      uint32_t mods_count;
    99      uint32_t mods_addr;
   100  
   101      /* valid if flags[4] or flags[5] set */
   102      union {
   103          aout_t aout_image;
   104          elf_t  elf_image;
   105      } syms;
   106  
   107      /* valid if flags[6] (MBI_MEMMAP) set */
   108      uint32_t mmap_length;
   109      uint32_t mmap_addr;
   110  
   111      /* valid if flags[7] set */
   112      uint32_t drives_length;
   113      uint32_t drives_addr;
   114  
   115      /* valid if flags[8] set */
   116      uint32_t config_table;
   117  
   118      /* valid if flags[9] set */
   119      uint32_t boot_loader_name;
   120  
   121      /* valid if flags[10] set */
   122      uint32_t apm_table;
   123  
   124      /* valid if flags[11] set */
   125      uint32_t vbe_control_info;
   126      uint32_t vbe_mode_info;
   127      uint16_t vbe_mode;
   128      uint16_t vbe_interface_seg;
   129      uint16_t vbe_interface_off;
   130      uint16_t vbe_interface_len;
   131  } multiboot_info_t;
   132  
   133  typedef struct {
   134  	uint32_t mod_start;
   135  	uint32_t mod_end;
   136  	uint32_t string;
   137  	uint32_t reserved;
   138  } module_t;
   139  
   140  typedef struct {
   141  	uint32_t size;
   142  	uint32_t base_addr_low;
   143  	uint32_t base_addr_high;
   144  	uint32_t length_low;
   145  	uint32_t length_high;
   146  	uint32_t type;
   147  } memory_map_t;
   148  
   149  extern unsigned long get_mbi_mem_end(const multiboot_info_t *mbi);
   150  
   151  #endif /* __ASSEMBLY__ */
   152  
   153  #endif /* __MULTIBOOT_H__ */
   154