17c478bd9Sstevel@tonic-gate /* multiboot.h - the header for Multiboot */
27c478bd9Sstevel@tonic-gate /* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
37c478bd9Sstevel@tonic-gate 
47c478bd9Sstevel@tonic-gate    This program is free software; you can redistribute it and/or modify
57c478bd9Sstevel@tonic-gate    it under the terms of the GNU General Public License as published by
67c478bd9Sstevel@tonic-gate    the Free Software Foundation; either version 2 of the License, or
77c478bd9Sstevel@tonic-gate    (at your option) any later version.
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate    This program is distributed in the hope that it will be useful,
107c478bd9Sstevel@tonic-gate    but WITHOUT ANY WARRANTY; without even the implied warranty of
117c478bd9Sstevel@tonic-gate    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
127c478bd9Sstevel@tonic-gate    GNU General Public License for more details.
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate    You should have received a copy of the GNU General Public License
157c478bd9Sstevel@tonic-gate    along with this program; if not, write to the Free Software
167c478bd9Sstevel@tonic-gate    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate /* Macros.  */
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate /* The magic number for the Multiboot header.  */
217c478bd9Sstevel@tonic-gate #define MULTIBOOT_HEADER_MAGIC		0x1BADB002
227c478bd9Sstevel@tonic-gate 
237c478bd9Sstevel@tonic-gate /* The flags for the Multiboot header.  */
247c478bd9Sstevel@tonic-gate #ifdef __ELF__
257c478bd9Sstevel@tonic-gate # define MULTIBOOT_HEADER_FLAGS		0x00000003
267c478bd9Sstevel@tonic-gate #else
277c478bd9Sstevel@tonic-gate # define MULTIBOOT_HEADER_FLAGS		0x00010003
287c478bd9Sstevel@tonic-gate #endif
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /* The magic number passed by a Multiboot-compliant boot loader.  */
317c478bd9Sstevel@tonic-gate #define MULTIBOOT_BOOTLOADER_MAGIC	0x2BADB002
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /* The size of our stack (16KB).  */
347c478bd9Sstevel@tonic-gate #define STACK_SIZE			0x4000
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /* C symbol format. HAVE_ASM_USCORE is defined by configure.  */
377c478bd9Sstevel@tonic-gate #ifdef HAVE_ASM_USCORE
387c478bd9Sstevel@tonic-gate # define EXT_C(sym)			_ ## sym
397c478bd9Sstevel@tonic-gate #else
407c478bd9Sstevel@tonic-gate # define EXT_C(sym)			sym
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifndef ASM
447c478bd9Sstevel@tonic-gate /* Do not include here in boot.S.  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /* Types.  */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /* The Multiboot header.  */
497c478bd9Sstevel@tonic-gate typedef struct multiboot_header
507c478bd9Sstevel@tonic-gate {
517c478bd9Sstevel@tonic-gate   unsigned long magic;
527c478bd9Sstevel@tonic-gate   unsigned long flags;
537c478bd9Sstevel@tonic-gate   unsigned long checksum;
547c478bd9Sstevel@tonic-gate   unsigned long header_addr;
557c478bd9Sstevel@tonic-gate   unsigned long load_addr;
567c478bd9Sstevel@tonic-gate   unsigned long load_end_addr;
577c478bd9Sstevel@tonic-gate   unsigned long bss_end_addr;
587c478bd9Sstevel@tonic-gate   unsigned long entry_addr;
597c478bd9Sstevel@tonic-gate } multiboot_header_t;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /* The symbol table for a.out.  */
627c478bd9Sstevel@tonic-gate typedef struct aout_symbol_table
637c478bd9Sstevel@tonic-gate {
647c478bd9Sstevel@tonic-gate   unsigned long tabsize;
657c478bd9Sstevel@tonic-gate   unsigned long strsize;
667c478bd9Sstevel@tonic-gate   unsigned long addr;
677c478bd9Sstevel@tonic-gate   unsigned long reserved;
687c478bd9Sstevel@tonic-gate } aout_symbol_table_t;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /* The section header table for ELF.  */
717c478bd9Sstevel@tonic-gate typedef struct elf_section_header_table
727c478bd9Sstevel@tonic-gate {
737c478bd9Sstevel@tonic-gate   unsigned long num;
747c478bd9Sstevel@tonic-gate   unsigned long size;
757c478bd9Sstevel@tonic-gate   unsigned long addr;
767c478bd9Sstevel@tonic-gate   unsigned long shndx;
777c478bd9Sstevel@tonic-gate } elf_section_header_table_t;
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /* The Multiboot information.  */
807c478bd9Sstevel@tonic-gate typedef struct multiboot_info
817c478bd9Sstevel@tonic-gate {
827c478bd9Sstevel@tonic-gate   unsigned long flags;
837c478bd9Sstevel@tonic-gate   unsigned long mem_lower;
847c478bd9Sstevel@tonic-gate   unsigned long mem_upper;
857c478bd9Sstevel@tonic-gate   unsigned long boot_device;
867c478bd9Sstevel@tonic-gate   unsigned long cmdline;
877c478bd9Sstevel@tonic-gate   unsigned long mods_count;
887c478bd9Sstevel@tonic-gate   unsigned long mods_addr;
897c478bd9Sstevel@tonic-gate   union
907c478bd9Sstevel@tonic-gate   {
917c478bd9Sstevel@tonic-gate     aout_symbol_table_t aout_sym;
927c478bd9Sstevel@tonic-gate     elf_section_header_table_t elf_sec;
937c478bd9Sstevel@tonic-gate   } u;
947c478bd9Sstevel@tonic-gate   unsigned long mmap_length;
957c478bd9Sstevel@tonic-gate   unsigned long mmap_addr;
967c478bd9Sstevel@tonic-gate } multiboot_info_t;
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /* The module structure.  */
997c478bd9Sstevel@tonic-gate typedef struct module
1007c478bd9Sstevel@tonic-gate {
1017c478bd9Sstevel@tonic-gate   unsigned long mod_start;
1027c478bd9Sstevel@tonic-gate   unsigned long mod_end;
1037c478bd9Sstevel@tonic-gate   unsigned long string;
1047c478bd9Sstevel@tonic-gate   unsigned long reserved;
1057c478bd9Sstevel@tonic-gate } module_t;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /* The memory map. Be careful that the offset 0 is base_addr_low
1087c478bd9Sstevel@tonic-gate    but no size.  */
1097c478bd9Sstevel@tonic-gate typedef struct memory_map
1107c478bd9Sstevel@tonic-gate {
1117c478bd9Sstevel@tonic-gate   unsigned long size;
1127c478bd9Sstevel@tonic-gate   unsigned long base_addr_low;
1137c478bd9Sstevel@tonic-gate   unsigned long base_addr_high;
1147c478bd9Sstevel@tonic-gate   unsigned long length_low;
1157c478bd9Sstevel@tonic-gate   unsigned long length_high;
1167c478bd9Sstevel@tonic-gate   unsigned long type;
1177c478bd9Sstevel@tonic-gate } memory_map_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #endif /* ! ASM */
120