Fork me on GitHub

root/include/fiwix/multiboot1.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* multiboot.h - Multiboot header file. */
   2 /* Copyright (C) 1999,2003,2007,2008,2009,2010  Free Software Foundation, Inc.
   3  *
   4  *  Permission is hereby granted, free of charge, to any person obtaining a copy
   5  *  of this software and associated documentation files (the "Software"), to
   6  *  deal in the Software without restriction, including without limitation the
   7  *  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   8  *  sell copies of the Software, and to permit persons to whom the Software is
   9  *  furnished to do so, subject to the following conditions:
  10  *
  11  *  The above copyright notice and this permission notice shall be included in
  12  *  all copies or substantial portions of the Software.
  13  *
  14  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ANY
  17  *  DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  18  *  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  19  *  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20  */
  21 
  22 #ifndef MULTIBOOT_HEADER
  23 #define MULTIBOOT_HEADER 1
  24 
  25 /* How many bytes from the start of the file we search for the header. */
  26 #define MULTIBOOT_SEARCH                        8192
  27 #define MULTIBOOT_HEADER_ALIGN                  4
  28 
  29 /* The magic field should contain this. */
  30 #define MULTIBOOT_HEADER_MAGIC                  0x1BADB002
  31 
  32 /* This should be in %eax. */
  33 #define MULTIBOOT_BOOTLOADER_MAGIC              0x2BADB002
  34 
  35 /* Alignment of multiboot modules. */
  36 #define MULTIBOOT_MOD_ALIGN                     0x00001000
  37 
  38 /* Alignment of the multiboot info structure. */
  39 #define MULTIBOOT_INFO_ALIGN                    0x00000004
  40 
  41 /* Flags set in the ’flags’ member of the multiboot header. */
  42 
  43 /* Align all boot modules on i386 page (4KB) boundaries. */
  44 #define MULTIBOOT_PAGE_ALIGN                    0x00000001
  45 
  46 /* Must pass memory information to OS. */
  47 #define MULTIBOOT_MEMORY_INFO                   0x00000002
  48 
  49 /* Must pass video information to OS. */
  50 #define MULTIBOOT_VIDEO_MODE                    0x00000004
  51 
  52 /* This flag indicates the use of the address fields in the header. */
  53 #define MULTIBOOT_AOUT_KLUDGE                   0x00010000
  54 
  55 /* Flags to be set in the ’flags’ member of the multiboot info structure. */
  56 
  57 /* is there basic lower/upper memory information? */
  58 #define MULTIBOOT_INFO_MEMORY                   0x00000001
  59 /* is there a boot device set? */
  60 #define MULTIBOOT_INFO_BOOTDEV                  0x00000002
  61 /* is the command-line defined? */
  62 #define MULTIBOOT_INFO_CMDLINE                  0x00000004
  63 /* are there modules to do something with? */
  64 #define MULTIBOOT_INFO_MODS                     0x00000008
  65 
  66 /* These next two are mutually exclusive */
  67 
  68 /* is there a symbol table loaded? */
  69 #define MULTIBOOT_INFO_AOUT_SYMS                0x00000010
  70 /* is there an ELF section header table? */
  71 #define MULTIBOOT_INFO_ELF_SHDR                 0X00000020
  72 
  73 /* is there a full memory map? */
  74 #define MULTIBOOT_INFO_MEM_MAP                  0x00000040
  75 
  76 /* Is there drive info? */
  77 #define MULTIBOOT_INFO_DRIVE_INFO               0x00000080
  78 
  79 /* Is there a config table? */
  80 #define MULTIBOOT_INFO_CONFIG_TABLE             0x00000100
  81 
  82 /* Is there a boot loader name? */
  83 #define MULTIBOOT_INFO_BOOT_LOADER_NAME         0x00000200
  84 
  85 /* Is there a APM table? */
  86 #define MULTIBOOT_INFO_APM_TABLE                0x00000400
  87 
  88 /* Is there video information? */
  89 #define MULTIBOOT_INFO_VBE_INFO                 0x00000800
  90 #define MULTIBOOT_INFO_FRAMEBUFFER_INFO         0x00001000
  91 
  92 #ifndef ASM_FILE
  93 
  94 typedef unsigned char           multiboot_uint8_t;
  95 typedef unsigned short          multiboot_uint16_t;
  96 typedef unsigned int            multiboot_uint32_t;
  97 typedef unsigned long long      multiboot_uint64_t;
  98 
  99 struct multiboot_header
 100 {
 101   /* Must be MULTIBOOT_MAGIC - see above. */
 102   multiboot_uint32_t magic;
 103 
 104   /* Feature flags. */
 105   multiboot_uint32_t flags;
 106 
 107   /* The above fields plus this one must equal 0 mod 2^32. */
 108   multiboot_uint32_t checksum;
 109 
 110   /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
 111   multiboot_uint32_t header_addr;
 112   multiboot_uint32_t load_addr;
 113   multiboot_uint32_t load_end_addr;
 114   multiboot_uint32_t bss_end_addr;
 115   multiboot_uint32_t entry_addr;
 116 
 117   /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
 118   multiboot_uint32_t mode_type;
 119   multiboot_uint32_t width;
 120   multiboot_uint32_t height;
 121   multiboot_uint32_t depth;
 122 };
 123 
 124 /* The symbol table for a.out. */
 125 struct multiboot_aout_symbol_table
 126 {
 127   multiboot_uint32_t tabsize;
 128   multiboot_uint32_t strsize;
 129   multiboot_uint32_t addr;
 130   multiboot_uint32_t reserved;
 131 };
 132 typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
 133 
 134 /* The section header table for ELF. */
 135 struct multiboot_elf_section_header_table
 136 {
 137   multiboot_uint32_t num;
 138   multiboot_uint32_t size;
 139   multiboot_uint32_t addr;
 140   multiboot_uint32_t shndx;
 141 };
 142 typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
 143 
 144 struct multiboot_info
 145 {
 146   /* Multiboot info version number */
 147   multiboot_uint32_t flags;
 148 
 149   /* Available memory from BIOS */
 150   multiboot_uint32_t mem_lower;
 151   multiboot_uint32_t mem_upper;
 152 
 153   /* "root" partition */
 154   multiboot_uint32_t boot_device;
 155 
 156   /* Kernel command line */
 157   multiboot_uint32_t cmdline;
 158 
 159   /* Boot-Module list */
 160   multiboot_uint32_t mods_count;
 161   multiboot_uint32_t mods_addr;
 162 
 163   union
 164   {
 165     multiboot_aout_symbol_table_t aout_sym;
 166     multiboot_elf_section_header_table_t elf_sec;
 167   } u;
 168 
 169   /* Memory Mapping buffer */
 170   multiboot_uint32_t mmap_length;
 171   multiboot_uint32_t mmap_addr;
 172 
 173   /* Drive Info buffer */
 174   multiboot_uint32_t drives_length;
 175   multiboot_uint32_t drives_addr;
 176 
 177   /* ROM configuration table */
 178   multiboot_uint32_t config_table;
 179 
 180   /* Boot Loader Name */
 181   multiboot_uint32_t boot_loader_name;
 182 
 183   /* APM table */
 184   multiboot_uint32_t apm_table;
 185 
 186   /* Video */
 187   multiboot_uint32_t vbe_control_info;
 188   multiboot_uint32_t vbe_mode_info;
 189   multiboot_uint16_t vbe_mode;
 190   multiboot_uint16_t vbe_interface_seg;
 191   multiboot_uint16_t vbe_interface_off;
 192   multiboot_uint16_t vbe_interface_len;
 193 
 194   multiboot_uint64_t framebuffer_addr;
 195   multiboot_uint32_t framebuffer_pitch;
 196   multiboot_uint32_t framebuffer_width;
 197   multiboot_uint32_t framebuffer_height;
 198   multiboot_uint8_t framebuffer_bpp;
 199 #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
 200 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB     1
 201 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT     2
 202   multiboot_uint8_t framebuffer_type;
 203   union
 204   {
 205     struct
 206     {
 207       multiboot_uint32_t framebuffer_palette_addr;
 208       multiboot_uint16_t framebuffer_palette_num_colors;
 209     };
 210     struct
 211     {
 212       multiboot_uint8_t framebuffer_red_field_position;
 213       multiboot_uint8_t framebuffer_red_mask_size;
 214       multiboot_uint8_t framebuffer_green_field_position;
 215       multiboot_uint8_t framebuffer_green_mask_size;
 216       multiboot_uint8_t framebuffer_blue_field_position;
 217       multiboot_uint8_t framebuffer_blue_mask_size;
 218     };
 219   };
 220 };
 221 typedef struct multiboot_info multiboot_info_t;
 222 
 223 struct multiboot_color
 224 {
 225   multiboot_uint8_t red;
 226   multiboot_uint8_t green;
 227   multiboot_uint8_t blue;
 228 };
 229 
 230 struct multiboot_mmap_entry
 231 {
 232   multiboot_uint32_t size;
 233   multiboot_uint64_t addr;
 234   multiboot_uint64_t len;
 235 #define MULTIBOOT_MEMORY_AVAILABLE              1
 236 #define MULTIBOOT_MEMORY_RESERVED               2
 237 #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE       3
 238 #define MULTIBOOT_MEMORY_NVS                    4
 239 #define MULTIBOOT_MEMORY_BADRAM                 5
 240   multiboot_uint32_t type;
 241 } __attribute__((packed));
 242 typedef struct multiboot_mmap_entry multiboot_memory_map_t;
 243 
 244 struct multiboot_mod_list
 245 {
 246   /* the memory used goes from bytes ’mod_start’ to ’mod_end-1’ inclusive */
 247   multiboot_uint32_t mod_start;
 248   multiboot_uint32_t mod_end;
 249 
 250   /* Module command line */
 251   multiboot_uint32_t cmdline;
 252 
 253   /* padding to take it to 16 bytes (must be zero) */
 254   multiboot_uint32_t pad;
 255 };
 256 typedef struct multiboot_mod_list multiboot_module_t;
 257 
 258 /* APM BIOS info. */
 259 struct multiboot_apm_info
 260 {
 261   multiboot_uint16_t version;
 262   multiboot_uint16_t cseg;
 263   multiboot_uint32_t offset;
 264   multiboot_uint16_t cseg_16;
 265   multiboot_uint16_t dseg;
 266   multiboot_uint16_t flags;
 267   multiboot_uint16_t cseg_len;
 268   multiboot_uint16_t cseg_16_len;
 269   multiboot_uint16_t dseg_len;
 270 };
 271 
 272 /* VBE controller information. */
 273 struct vbe_controller
 274 {
 275   unsigned char signature[4];
 276   unsigned short version;
 277   unsigned long oem_string;
 278   unsigned long capabilities;
 279   unsigned long video_mode;
 280   unsigned short total_memory;
 281   unsigned short oem_software_rev;
 282   unsigned long oem_vendor_name;
 283   unsigned long oem_product_name;
 284   unsigned long oem_product_rev;
 285   unsigned char reserved[222];
 286   unsigned char oem_data[256];
 287 } __attribute__ ((packed));
 288 
 289 /* VBE mode information.  */
 290 struct vbe_mode
 291 {
 292   unsigned short mode_attributes;
 293   unsigned char win_a_attributes;
 294   unsigned char win_b_attributes;
 295   unsigned short win_granularity;
 296   unsigned short win_size;
 297   unsigned short win_a_segment;
 298   unsigned short win_b_segment;
 299   unsigned long win_func;
 300   unsigned short bytes_per_scanline;
 301 
 302   /* >=1.2 */
 303   unsigned short x_resolution;
 304   unsigned short y_resolution;
 305   unsigned char x_char_size;
 306   unsigned char y_char_size;
 307   unsigned char number_of_planes;
 308   unsigned char bits_per_pixel;
 309   unsigned char number_of_banks;
 310   unsigned char memory_model;
 311   unsigned char bank_size;
 312   unsigned char number_of_image_pages;
 313   unsigned char reserved0;
 314 
 315   /* direct color */
 316   unsigned char red_mask_size;
 317   unsigned char red_field_position;
 318   unsigned char green_mask_size;
 319   unsigned char green_field_position;
 320   unsigned char blue_mask_size;
 321   unsigned char blue_field_position;
 322   unsigned char reserved_mask_size;
 323   unsigned char reserved_field_position;
 324   unsigned char direct_color_mode_info;
 325 
 326   /* >=2.0 */
 327   unsigned long phys_base;
 328   unsigned long reserved1;
 329   unsigned short reversed2;
 330 
 331   /* >=3.0 */
 332   unsigned short linear_bytes_per_scanline;
 333   unsigned char banked_number_of_image_pages;
 334   unsigned char linear_number_of_image_pages;
 335   unsigned char linear_red_mask_size;
 336   unsigned char linear_red_field_position;
 337   unsigned char linear_green_mask_size;
 338   unsigned char linear_green_field_position;
 339   unsigned char linear_blue_mask_size;
 340   unsigned char linear_blue_field_position;
 341   unsigned char linear_reserved_mask_size;
 342   unsigned char linear_reserved_field_position;
 343   unsigned long max_pixel_clock;
 344 
 345   unsigned char reserved3[190];
 346 } __attribute__ ((packed));
 347 
 348 
 349 #endif /* ! ASM_FILE */
 350 
 351 #endif /* ! MULTIBOOT_HEADER */

/* [previous][next][first][last][top][bottom][index][help] */