diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/include/l4/bootinfo.h hurd-l4/include/l4/bootinfo.h --- ref/hurd-l4/include/l4/bootinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ hurd-l4/include/l4/bootinfo.h 2005-02-14 12:06:01.000000000 +0100 @@ -0,0 +1,190 @@ +/* l4/bootinfo.h - Public interface to the L4 bootinfo structures. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Matthieu Lemerre . + + This file is part of the GNU L4 library. + + The GNU L4 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU L4 library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU L4 library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef _L4_BOOTINFO_H +#define _L4_BOOTINFO_H 1 + +#include +#include + +#define _L4_BOOT_INFO_MAGIC 0x14b0021d +#define _L4_BOOT_INFO_VERSION 1 + + +/* + * Implemented types + */ +#define _L4_BOOT_INFO_MULTIBOOT 0x0102 +#define _L4_BOOT_INFO_MODULE 0x0001 + + +/* + * Generic BootInfo structures + */ + +struct _L4_generic_boot_info +{ + _L4_word_t magic; + _L4_word_t version; + _L4_word_t size; + _L4_word_t first_entry; + _L4_word_t num_entries; + _L4_word_t padded[3]; +}; + +typedef struct _L4_generic_boot_info *_L4_generic_boot_info_t; + +struct _L4_generic_boot_rec +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; +}; + +typedef struct _L4_generic_boot_rec *_L4_generic_boot_rec_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_valid (_L4_generic_boot_info_t boot_info) +{ + return (boot_info->magic == _L4_BOOT_INFO_MAGIC + && boot_info->version == _L4_BOOT_INFO_VERSION); +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_size (_L4_generic_boot_info_t boot_info) +{ + return boot_info->size; +} + +static inline _L4_generic_boot_rec_t +_L4_attribute_always_inline +_L4_generic_boot_info_first_entry (_L4_generic_boot_info_t boot_info) +{ + return (_L4_generic_boot_rec_t) (((_L4_word_t) boot_info) + boot_info->first_entry); +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_entries (_L4_generic_boot_info_t boot_info) +{ + return boot_info->num_entries; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_rec_type (_L4_generic_boot_rec_t boot_rec) +{ + return boot_rec->type; +} + +static inline _L4_generic_boot_rec_t +_L4_attribute_always_inline +_L4_generic_boot_rec_next (_L4_generic_boot_rec_t boot_rec) +{ + return (_L4_generic_boot_rec_t) (((_L4_word_t) boot_rec) + boot_rec->offset_next); +} + + +/* + * Bootinfo type: Multiboot info (type 0x0102) + * Delivers location of the first byte of the mutiboot structure + */ + +struct _L4_generic_boot_info_MBI +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; + _L4_word_t address; +}; + +typedef struct _L4_generic_boot_info_MBI *_L4_generic_boot_info_MBI_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_MBI_address (_L4_generic_boot_info_MBI_t mbi) +{ + return mbi->address; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_MBI_address_from_bootinfo (_L4_generic_boot_info_t bi) +{ + _L4_generic_boot_rec_t boot_rec; + int num_entries = (int) bi->num_entries; + for (boot_rec = (_L4_generic_boot_rec_t) _L4_generic_boot_info_first_entry (bi); + boot_rec->type != _L4_BOOT_INFO_MULTIBOOT && num_entries-- > 0; + boot_rec += boot_rec->offset_next); + if (!num_entries) + return 0; + return _L4_MBI_address ((_L4_generic_boot_info_MBI_t) boot_rec); +} + + + +/* + * Module Type (type 0x0001) + * Binary file inserted in the memory by the bootloader + */ + +struct _L4_generic_boot_info_module +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; + _L4_word_t start; + _L4_word_t size; + _L4_word_t cmdline_offset; +}; + +typedef struct _L4_generic_boot_info_module *_L4_generic_boot_info_module_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_start (_L4_generic_boot_info_module_t mod) +{ + return mod->start; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_size (_L4_generic_boot_info_module_t mod) +{ + return mod->size; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_cmdline (_L4_generic_boot_info_module_t mod) +{ + return mod->cmdline_offset; +} + + +#ifdef _L4_INTERFACE_GNU +#include +#endif + +#endif /* l4/bootinfo.h */ + diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/include/l4/gnu/bootinfo.h hurd-l4/include/l4/gnu/bootinfo.h --- ref/hurd-l4/include/l4/gnu/bootinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ hurd-l4/include/l4/gnu/bootinfo.h 2005-02-13 21:56:50.000000000 +0100 @@ -0,0 +1,120 @@ +/* l4/bootinfo.h - Public GNU interface to the L4 bootinfo structures. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Alexandre Buisse . + + This file is part of the GNU L4 library. + + The GNU L4 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU L4 library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU L4 library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + +#ifndef _L4_BOOTINFO_H +# error "Never use directly; include instead." +#endif + +typedef struct _L4_generic_boot_info l4_generic_boot_info; + +typedef _L4_generic_boot_info_t l4_generic_boot_info_t; + +typedef struct _L4_generic_boot_rec l4_generic_boot_rec; + +typedef _L4_generic_boot_rec_t l4_generic_boot_rec_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_valid (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_valid (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_size (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_size (boot_info); +} + +static inline l4_generic_boot_rec_t +_L4_attribute_always_inline +l4_generic_boot_info_first_entry (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_first_entry (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_entries (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_entries (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_rec_type (l4_generic_boot_rec_t boot_rec) +{ + return _L4_generic_boot_rec_type (boot_rec); +} + +static inline l4_generic_boot_rec_t +_L4_attribute_always_inline +l4_generic_boot_rec_next (l4_generic_boot_rec_t boot_rec) +{ + return _L4_generic_boot_rec_next (boot_rec); +} + +typedef struct _L4_generic_boot_info_MBI l4_generic_boot_info_MBI; + +typedef _L4_generic_boot_info_MBI_t l4_generic_boot_info_MBI_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_MBI_address (l4_generic_boot_info_MBI_t mbi) +{ + return _L4_MBI_address (mbi); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_MBI_address_from_bootinfo (l4_generic_boot_info_t boot_info) +{ + return _L4_MBI_address_from_bootinfo (boot_info); +} + + +typedef struct _L4_generic_boot_info_module l4_generic_boot_info_module; + +typedef _L4_generic_boot_info_module_t l4_generic_boot_info_module_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_start (l4_generic_boot_info_module_t mod) +{ + return _L4_module_start (mod); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_size (l4_generic_boot_info_module_t mod) +{ + return _L4_module_size (mod); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_cmdline (l4_generic_boot_info_module_t mod) +{ + return _L4_module_cmdline (mod); +} + diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/include/l4.h hurd-l4/include/l4.h --- ref/hurd-l4/include/l4.h 2005-02-14 16:32:34.076072304 +0100 +++ hurd-l4/include/l4.h 2005-02-13 19:47:44.000000000 +0100 @@ -31,5 +31,6 @@ #include #include #include +#include #endif /* l4.h */ diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/Makefile.am hurd-l4/laden/Makefile.am --- ref/hurd-l4/laden/Makefile.am 2005-02-14 16:32:45.340359872 +0100 +++ hurd-l4/laden/Makefile.am 2005-02-14 16:44:57.517052096 +0100 @@ -19,8 +19,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA if ARCH_IA32 - ARCH_SOURCES = multiboot.h ia32-crt0.S ia32-cmain.c \ - ia32-output.c output-vga.c output-serial.c ia32-shutdown.c + ARCH_SOURCES = multiboot.h ia32-crt0.S ia32-btinfo.c ia32-cmain.c \ + ia32-output.c output-vga.c output-serial.c \ + ia32-shutdown.c endif bootdir = $(prefix)/boot diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/ia32-btinfo.c hurd-l4/laden/ia32-btinfo.c --- ref/hurd-l4/laden/ia32-btinfo.c 1970-01-01 01:00:00.000000000 +0100 +++ hurd-l4/laden/ia32-btinfo.c 2005-02-14 16:27:41.879492936 +0100 @@ -0,0 +1,323 @@ +/* ia32-btinfo.c - Generic bootinfo support. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Alexandre Buisse . + + This file is part of the GNU Hurd. + + The GNU Hurd 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 2, or (at + your option) any later version. + + The GNU Hurd 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + +#include "laden.h" +#include + +#include + +#include "multiboot.h" + +#define START_ADDR 0x30000 /* FIXME: should we place it here ? */ + + +static int num_entries = 1; +static l4_word_t next; +static l4_generic_boot_info_t bootinfo = (l4_generic_boot_info_t) START_ADDR; +static multiboot_info_t *mbi; + + +/* This adds the module info in a new generic bootinfo record */ +static void +add_generic_bootinfo_module (module_t * mod) +{ + l4_generic_boot_info_module_t bootinfo_mod = (l4_generic_boot_info_module_t) next; + + bootinfo_mod->type = _L4_BOOT_INFO_MODULE; + bootinfo_mod->version = _L4_BOOT_INFO_VERSION; + bootinfo_mod->offset_next = sizeof (l4_generic_boot_info_module); + bootinfo_mod->start = (l4_word_t) mod->mod_start; + bootinfo_mod->size = (l4_word_t) (mod->mod_end - mod->mod_start); + bootinfo_mod->cmdline_offset = (l4_word_t) ((l4_word_t) mod->string - (l4_word_t) bootinfo); + debug ("module at %x inserted at %x, with size %x, cmdline_offset %x and offset_next %x\n", + bootinfo_mod->start, (l4_word_t) bootinfo_mod, bootinfo_mod->size, + bootinfo_mod->cmdline_offset, bootinfo_mod->offset_next); + next += bootinfo_mod->offset_next; + num_entries++; + return; +} + +/* Dump of multiboot info we retrieved from grub */ +static void +debug_dump (void) +{ + if (CHECK_FLAG (mbi->flags, 9)) + debug ("Booted by %s\n", (char *) mbi->boot_loader_name); + + if (CHECK_FLAG (mbi->flags, 0)) + debug ("Memory: Lower %u KB, Upper %u KB\n", + mbi->mem_lower, mbi->mem_upper); + + if (CHECK_FLAG (mbi->flags, 3)) + { + module_t *mod = (module_t *) mbi->mods_addr; + int nr; + + for (nr = 0; nr < mbi->mods_count; nr++) + debug ("Module %i: Start 0x%x, End 0x%x, Cmd %s\n", + nr + 1, mod[nr].mod_start, mod[nr].mod_end, + (char *) mod[nr].string); + } + + if (CHECK_FLAG (mbi->flags, 6)) + { + memory_map_t *mmap; + int nr = 1; + + for (mmap = (memory_map_t *) mbi->mmap_addr; + (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((uint32_t) mmap + + mmap->size + sizeof (mmap->size))) + debug ("Memory Map %i: Type %i, Base 0x%llx, Length 0x%llx\n", + nr++, mmap->type, mmap->base_addr, mmap->length); + } +} + + +/* The following must be defined and are used to calculate the extents + of the laden binary itself. */ +extern char _start; +extern char _end; + + +/* Find the kernel, the initial servers and the other information + required for booting. */ +void +find_components (multiboot_info_t* mbi) +{ + l4_word_t start; + l4_word_t end; + + debug_dump (); + + /* Load the module information. */ + if (CHECK_FLAG (mbi->flags, 3)) + { + module_t *mod = (module_t *) mbi->mods_addr; + + if (mbi->mods_count > 0) + { + add_generic_bootinfo_module (mod); + kernel.low = mod->mod_start; + kernel.high = mod->mod_end; + mod++; + mbi->mods_count--; + } + if (mbi->mods_count > 0) + { + add_generic_bootinfo_module (mod); + sigma0.low = mod->mod_start; + sigma0.high = mod->mod_end; + mod++; + mbi->mods_count--; + } + /* Swallow the modules we used so far. This makes the + rootserver the first module in the list, regardless if + sigma1 is used or not. FIXME: The rootserver might need the + information about the other modules, though. */ + mbi->mods_addr = (l4_word_t) mod; + if (mbi->mods_count > 0) + { + add_generic_bootinfo_module (mod); + rootserver.low = mod->mod_start; + rootserver.high = mod->mod_end; + } + + /* finish adding the modules in the generic bootinfo structure */ + int nr; + for (nr = 1, mod++; nr < mbi->mods_count; nr++, mod++) + add_generic_bootinfo_module (mod); + bootinfo->size = (l4_word_t) ((l4_word_t) next - (l4_word_t) bootinfo); + bootinfo->num_entries = (l4_word_t) num_entries; + debug ("num-entries: %d\n", num_entries); + } + + /* Now create the memory map. */ + + /* First, add the whole address space as shared memory by default to + allow arbitrary device access. */ + add_memory_map (0, -1, L4_MEMDESC_SHARED, 0); + + /* Now add what GRUB tells us. */ + if (CHECK_FLAG (mbi->flags, 6)) + { + /* mmap_* are valid. */ + memory_map_t *mmap; + + for (mmap = (memory_map_t *) mbi->mmap_addr; + (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((uint32_t) mmap + + mmap->size + sizeof (mmap->size))) + { + uint64_t end; + + if (mmap->base_addr >> 32) + panic ("L4 does not support more than 4 GB on ia32"); + + end = mmap->base_addr + mmap->length - 1; + + if (end >> 32) + panic ("L4 does not support more than 4 GB on ia32"); + + if (mmap->base_addr & ((1 << 10) - 1) + || mmap->length & ((1 << 10) - 1)) + panic ("Memory region (0x%llx - 0x%llx) is unaligned", + mmap->base_addr, end); + + add_memory_map ((uint32_t) mmap->base_addr, (uint32_t) end, + mmap->type == 1 + ? L4_MEMDESC_CONVENTIONAL : L4_MEMDESC_ARCH, + mmap->type == 1 ? 0 : mmap->type); + } + } + else if (CHECK_FLAG (mbi->flags, 0)) + { + /* mem_* are valid. */ + + add_memory_map (0, (mbi->mem_lower << 10) - 1, + L4_MEMDESC_CONVENTIONAL, 0); + add_memory_map (0x100000, (0x100000 + (mbi->mem_upper << 10)) - 1, + L4_MEMDESC_CONVENTIONAL, 0); + } + + /* The VGA memory, and ROM extension, is usually not included in the + BIOS map. We add it here. */ + add_memory_map (0xa0000, 0xf0000 - 1, L4_MEMDESC_SHARED, 0); + + /* The amount of conventional memory to be reserved for the kernel. */ +#define KMEM_SIZE (16 * 0x100000) + + /* The upper limit for the end of the kernel memory. */ +#define KMEM_MAX (240 * 0x100000) + + if (CHECK_FLAG (mbi->flags, 6)) + { + memory_map_t *mmap; + + for (mmap = (memory_map_t *) mbi->mmap_addr; + (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((uint32_t) mmap + + mmap->size + sizeof (mmap->size))) + { + if (mmap->type != 1) + continue; + + if (((uint32_t) mmap->length) >= KMEM_SIZE + && ((uint32_t) mmap->base_addr) <= KMEM_MAX - KMEM_SIZE) + { + uint32_t high = ((uint32_t) mmap->base_addr) + + ((uint32_t) mmap->length); + uint32_t low; + + if (high > KMEM_MAX) + high = KMEM_MAX; + low = high - KMEM_SIZE; + /* Round up to the next super page (4 MB). */ + low = (low + 0x3fffff) & ~0x3fffff; + + add_memory_map (low, high, L4_MEMDESC_RESERVED, 0); + } + } + } + else if (CHECK_FLAG (mbi->flags, 0)) + { + if ((mbi->mem_upper << 10) >= KMEM_SIZE) + { + uint32_t high = (mbi->mem_upper << 10) + 0x100000; + uint32_t low; + + if (high > KMEM_MAX) + high = KMEM_MAX; + + low = high - KMEM_SIZE; + /* Round up to the next super page (4 MB). */ + low = (low + 0x3fffff) & ~0x3fffff; + + add_memory_map (low, high, L4_MEMDESC_RESERVED, 0); + } + } + + /* Now protect ourselves, the multiboot info and the generic multiboot + info (at least the module configuration. */ + loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end); + loader_add_region ("generic-btinfo", (l4_word_t) bootinfo, (l4_word_t) (bootinfo + bootinfo->size)); + + start = (l4_word_t) mbi; + end = start + sizeof (*mbi); + loader_add_region ("grub-mbi", start, end); + + if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count) + { + module_t *mod = (module_t *) mbi->mods_addr; + int nr; + + start = (l4_word_t) mod; + end = ((l4_word_t) mod) + mbi->mods_count * sizeof (*mod); + loader_add_region ("grub-mods", start, end); + + start = (l4_word_t) mod[0].string; + end = start + 1; + for (nr = 0; nr < mbi->mods_count; nr++) + { + char *str = (char *) mod[nr].string; + + if (str) + { + if (((l4_word_t) str) < start) + start = (l4_word_t) str; + while (*str) + str++; + if (((l4_word_t) str) + 1 > end) + end = (l4_word_t) str + 1; + } + } + loader_add_region ("grub-mods-cmdlines", start, end); + } +} + + + + +/* Convert a multiboot info to a generic bootinfo structure */ +l4_word_t +mbi_to_generic_bootinfo (multiboot_info_t *multiboot_info) +{ + mbi = multiboot_info; + /* Initial values */ + bootinfo->magic = _L4_BOOT_INFO_MAGIC; + bootinfo->version = _L4_BOOT_INFO_VERSION; + bootinfo->first_entry = sizeof(l4_generic_boot_info); + next = (l4_word_t) ((l4_word_t) bootinfo + bootinfo->first_entry); + + /* MBI structure */ + l4_generic_boot_info_MBI_t bootinfo_mbi = (l4_generic_boot_info_MBI_t) next; + bootinfo_mbi->type = _L4_BOOT_INFO_MULTIBOOT; + bootinfo_mbi->version = _L4_BOOT_INFO_VERSION; + bootinfo_mbi->offset_next = sizeof(l4_generic_boot_info_MBI); + bootinfo_mbi->address = (l4_word_t) mbi; + debug ("mbi: %x, bootinfo_mbi: %x\n", (l4_word_t) mbi, (l4_word_t) bootinfo_mbi); + next += bootinfo_mbi->offset_next; + + find_components(mbi); + + return (l4_word_t) bootinfo; +} + + diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/ia32-cmain.c hurd-l4/laden/ia32-cmain.c --- ref/hurd-l4/laden/ia32-cmain.c 2005-02-14 16:32:45.341359720 +0100 +++ hurd-l4/laden/ia32-cmain.c 2005-02-13 21:39:44.000000000 +0100 @@ -25,6 +25,8 @@ #include "multiboot.h" +extern l4_word_t mbi_to_generic_bootinfo (multiboot_info_t*); + /* Return a help text for this architecture. */ const char * @@ -54,10 +56,6 @@ start_kernel (l4_word_t ip) } -/* Check if the bit BIT in FLAGS is set. */ -#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) - - /* Setup the argument vector and pass control over to the main function. */ void @@ -125,10 +123,13 @@ cmain (uint32_t magic, multiboot_info_t argv[1] = 0; } + parse_args (argc, argv); + /* The boot info is set to the multiboot info on ia32. We use this also to get at the multiboot info from other functions called at a later time. */ - boot_info = (uint32_t) mbi; + boot_info = (uint32_t) mbi_to_generic_bootinfo (mbi); + /* Now invoke the main function. */ main (argc, argv); @@ -136,231 +137,3 @@ cmain (uint32_t magic, multiboot_info_t /* Never reached. */ } - -static void -debug_dump (void) -{ - multiboot_info_t *mbi = (multiboot_info_t *) boot_info; - - if (CHECK_FLAG (mbi->flags, 9)) - debug ("Booted by %s\n", (char *) mbi->boot_loader_name); - - if (CHECK_FLAG (mbi->flags, 0)) - debug ("Memory: Lower %u KB, Upper %u KB\n", - mbi->mem_lower, mbi->mem_upper); - - if (CHECK_FLAG (mbi->flags, 3)) - { - module_t *mod = (module_t *) mbi->mods_addr; - int nr; - - for (nr = 0; nr < mbi->mods_count; nr++) - debug ("Module %i: Start 0x%x, End 0x%x, Cmd %s\n", - nr + 1, mod[nr].mod_start, mod[nr].mod_end, - (char *) mod[nr].string); - } - - if (CHECK_FLAG (mbi->flags, 6)) - { - memory_map_t *mmap; - int nr = 1; - - for (mmap = (memory_map_t *) mbi->mmap_addr; - (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((uint32_t) mmap - + mmap->size + sizeof (mmap->size))) - debug ("Memory Map %i: Type %i, Base 0x%llx, Length 0x%llx\n", - nr++, mmap->type, mmap->base_addr, mmap->length); - } -} - - -/* The following must be defined and are used to calculate the extents - of the laden binary itself. */ -extern char _start; -extern char _end; - - -/* Find the kernel, the initial servers and the other information - required for booting. */ -void -find_components (void) -{ - multiboot_info_t *mbi = (multiboot_info_t *) boot_info; - l4_word_t start; - l4_word_t end; - - debug_dump (); - - /* Load the module information. */ - if (CHECK_FLAG (mbi->flags, 3)) - { - module_t *mod = (module_t *) mbi->mods_addr; - - if (mbi->mods_count > 0) - { - kernel.low = mod->mod_start; - kernel.high = mod->mod_end; - mod++; - mbi->mods_count--; - } - if (mbi->mods_count > 0) - { - sigma0.low = mod->mod_start; - sigma0.high = mod->mod_end; - mod++; - mbi->mods_count--; - } - /* Swallow the modules we used so far. This makes the - rootserver the first module in the list, regardless if - sigma1 is used or not. FIXME: The rootserver might need the - information about the other modules, though. */ - mbi->mods_addr = (l4_word_t) mod; - if (mbi->mods_count > 0) - { - rootserver.low = mod->mod_start; - rootserver.high = mod->mod_end; - } - } - - /* Now create the memory map. */ - - /* First, add the whole address space as shared memory by default to - allow arbitrary device access. */ - add_memory_map (0, -1, L4_MEMDESC_SHARED, 0); - - /* Now add what GRUB tells us. */ - if (CHECK_FLAG (mbi->flags, 6)) - { - /* mmap_* are valid. */ - memory_map_t *mmap; - - for (mmap = (memory_map_t *) mbi->mmap_addr; - (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((uint32_t) mmap - + mmap->size + sizeof (mmap->size))) - { - uint64_t end; - - if (mmap->base_addr >> 32) - panic ("L4 does not support more than 4 GB on ia32"); - - end = mmap->base_addr + mmap->length - 1; - - if (end >> 32) - panic ("L4 does not support more than 4 GB on ia32"); - - if (mmap->base_addr & ((1 << 10) - 1) - || mmap->length & ((1 << 10) - 1)) - panic ("Memory region (0x%llx - 0x%llx) is unaligned", - mmap->base_addr, end); - - add_memory_map ((uint32_t) mmap->base_addr, (uint32_t) end, - mmap->type == 1 - ? L4_MEMDESC_CONVENTIONAL : L4_MEMDESC_ARCH, - mmap->type == 1 ? 0 : mmap->type); - } - } - else if (CHECK_FLAG (mbi->flags, 0)) - { - /* mem_* are valid. */ - - add_memory_map (0, (mbi->mem_lower << 10) - 1, - L4_MEMDESC_CONVENTIONAL, 0); - add_memory_map (0x100000, (0x100000 + (mbi->mem_upper << 10)) - 1, - L4_MEMDESC_CONVENTIONAL, 0); - } - - /* The VGA memory, and ROM extension, is usually not included in the - BIOS map. We add it here. */ - add_memory_map (0xa0000, 0xf0000 - 1, L4_MEMDESC_SHARED, 0); - - /* The amount of conventional memory to be reserved for the kernel. */ -#define KMEM_SIZE (16 * 0x100000) - - /* The upper limit for the end of the kernel memory. */ -#define KMEM_MAX (240 * 0x100000) - - if (CHECK_FLAG (mbi->flags, 6)) - { - memory_map_t *mmap; - - for (mmap = (memory_map_t *) mbi->mmap_addr; - (uint32_t) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((uint32_t) mmap - + mmap->size + sizeof (mmap->size))) - { - if (mmap->type != 1) - continue; - - if (((uint32_t) mmap->length) >= KMEM_SIZE - && ((uint32_t) mmap->base_addr) <= KMEM_MAX - KMEM_SIZE) - { - uint32_t high = ((uint32_t) mmap->base_addr) - + ((uint32_t) mmap->length); - uint32_t low; - - if (high > KMEM_MAX) - high = KMEM_MAX; - low = high - KMEM_SIZE; - /* Round up to the next super page (4 MB). */ - low = (low + 0x3fffff) & ~0x3fffff; - - add_memory_map (low, high, L4_MEMDESC_RESERVED, 0); - } - } - } - else if (CHECK_FLAG (mbi->flags, 0)) - { - if ((mbi->mem_upper << 10) >= KMEM_SIZE) - { - uint32_t high = (mbi->mem_upper << 10) + 0x100000; - uint32_t low; - - if (high > KMEM_MAX) - high = KMEM_MAX; - - low = high - KMEM_SIZE; - /* Round up to the next super page (4 MB). */ - low = (low + 0x3fffff) & ~0x3fffff; - - add_memory_map (low, high, L4_MEMDESC_RESERVED, 0); - } - } - - /* Now protect ourselves and the mulitboot info (at least the module - configuration. */ - loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end); - - start = (l4_word_t) mbi; - end = start + sizeof (*mbi); - loader_add_region ("grub-mbi", start, end); - - if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count) - { - module_t *mod = (module_t *) mbi->mods_addr; - int nr; - - start = (l4_word_t) mod; - end = ((l4_word_t) mod) + mbi->mods_count * sizeof (*mod); - loader_add_region ("grub-mods", start, end); - - start = (l4_word_t) mod[0].string; - end = start + 1; - for (nr = 0; nr < mbi->mods_count; nr++) - { - char *str = (char *) mod[nr].string; - - if (str) - { - if (((l4_word_t) str) < start) - start = (l4_word_t) str; - while (*str) - str++; - if (((l4_word_t) str) + 1 > end) - end = (l4_word_t) str + 1; - } - } - loader_add_region ("grub-mods-cmdlines", start, end); - } -} diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/laden.c hurd-l4/laden/laden.c --- ref/hurd-l4/laden/laden.c 2005-02-14 16:32:45.369355464 +0100 +++ hurd-l4/laden/laden.c 2005-02-13 21:40:28.000000000 +0100 @@ -102,7 +102,7 @@ load_components (void) } -static void +void parse_args (int argc, char *argv[]) { int i = 1; @@ -192,11 +192,11 @@ parse_args (int argc, char *argv[]) int main (int argc, char *argv[]) { - parse_args (argc, argv); + /*parse_args (argc, argv);*/ debug ("%s " PACKAGE_VERSION "\n", program_name); - find_components (); + /* find_components (); */ load_components (); diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/laden.h hurd-l4/laden/laden.h --- ref/hurd-l4/laden/laden.h 2005-02-14 16:32:45.368355616 +0100 +++ hurd-l4/laden/laden.h 2005-02-13 21:46:41.000000000 +0100 @@ -30,6 +30,11 @@ #include "shutdown.h" #include "loader.h" + +/* Check if the bit BIT in FLAGS is set. */ +#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) + + /* The program name. */ extern char *program_name; @@ -39,7 +44,7 @@ extern char *program_name; /* Find the kernel, the initial servers and the other information required for booting. */ -void find_components (void); +/*void find_components (void);*/ /* Start kernel. IP is the entry point. */ void start_kernel (l4_word_t ip); @@ -85,8 +90,7 @@ const char *help_arch (void); descriptors to be loaded. */ int load_mem_info (l4_memory_desc_t memdesc, int nr); - -/* The generic code defines these functions. */ +void parse_args (int, char**); void kip_fixup (void); diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/laden/loader.c hurd-l4/laden/loader.c --- ref/hurd-l4/laden/loader.c 2004-03-30 01:23:31.000000000 +0200 +++ hurd-l4/laden/loader.c 2005-02-12 17:13:59.000000000 +0100 @@ -117,7 +117,7 @@ static int nr_regions; static void check_region (const char *name, l4_word_t start, l4_word_t end) { - int i; + int i, j; mem_check (name, start, end); @@ -125,10 +125,15 @@ check_region (const char *name, l4_word_ { if ((start >= used_regions[i].start && start < used_regions[i].end) || (end >= used_regions[i].start && end <= used_regions[i].end) - || (start < used_regions[i].start && end > used_regions[i].start)) + || (start < used_regions[i].start && end > used_regions[i].start)) { + debug ("Panic detected! Region map:\n"); + for (j = 0; j < nr_regions; j++) { + debug ("%s (0x%x - 0%x)\n", used_regions[j].name, used_regions[j].start, used_regions[j].end); + } panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)", name, start, end, used_regions[i].name, used_regions[i].start, used_regions[i].end); + } } } diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/libl4/l4/bootinfo.h hurd-l4/libl4/l4/bootinfo.h --- ref/hurd-l4/libl4/l4/bootinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ hurd-l4/libl4/l4/bootinfo.h 2005-02-14 12:05:58.000000000 +0100 @@ -0,0 +1,190 @@ +/* l4/bootinfo.h - Public interface to the L4 bootinfo structures. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Matthieu Lemerre . + + This file is part of the GNU L4 library. + + The GNU L4 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU L4 library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU L4 library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef _L4_BOOTINFO_H +#define _L4_BOOTINFO_H 1 + +#include +#include + +#define _L4_BOOT_INFO_MAGIC 0x14b0021d +#define _L4_BOOT_INFO_VERSION 1 + + +/* + * Implemented types + */ +#define _L4_BOOT_INFO_MULTIBOOT 0x0102 +#define _L4_BOOT_INFO_MODULE 0x0001 + + +/* + * Generic BootInfo structures + */ + +struct _L4_generic_boot_info +{ + _L4_word_t magic; + _L4_word_t version; + _L4_word_t size; + _L4_word_t first_entry; + _L4_word_t num_entries; + _L4_word_t padded[3]; +}; + +typedef struct _L4_generic_boot_info *_L4_generic_boot_info_t; + +struct _L4_generic_boot_rec +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; +}; + +typedef struct _L4_generic_boot_rec *_L4_generic_boot_rec_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_valid (_L4_generic_boot_info_t boot_info) +{ + return (boot_info->magic == _L4_BOOT_INFO_MAGIC + && boot_info->version == _L4_BOOT_INFO_VERSION); +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_size (_L4_generic_boot_info_t boot_info) +{ + return boot_info->size; +} + +static inline _L4_generic_boot_rec_t +_L4_attribute_always_inline +_L4_generic_boot_info_first_entry (_L4_generic_boot_info_t boot_info) +{ + return (_L4_generic_boot_rec_t) (((_L4_word_t) boot_info) + boot_info->first_entry); +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_info_entries (_L4_generic_boot_info_t boot_info) +{ + return boot_info->num_entries; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_generic_boot_rec_type (_L4_generic_boot_rec_t boot_rec) +{ + return boot_rec->type; +} + +static inline _L4_generic_boot_rec_t +_L4_attribute_always_inline +_L4_generic_boot_rec_next (_L4_generic_boot_rec_t boot_rec) +{ + return (_L4_generic_boot_rec_t) (((_L4_word_t) boot_rec) + boot_rec->offset_next); +} + + +/* + * Bootinfo type: Multiboot info (type 0x0102) + * Delivers location of the first byte of the mutiboot structure + */ + +struct _L4_generic_boot_info_MBI +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; + _L4_word_t address; +}; + +typedef struct _L4_generic_boot_info_MBI *_L4_generic_boot_info_MBI_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_MBI_address (_L4_generic_boot_info_MBI_t mbi) +{ + return mbi->address; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_MBI_address_from_bootinfo (_L4_generic_boot_info_t bi) +{ + _L4_generic_boot_rec_t boot_rec; + int num_entries = (int) bi->num_entries; + for (boot_rec = (_L4_generic_boot_rec_t) _L4_generic_boot_info_first_entry (bi); + boot_rec->type != _L4_BOOT_INFO_MULTIBOOT && num_entries-- > 0; + boot_rec += boot_rec->offset_next); + if (!num_entries) + return 0; + return _L4_MBI_address ((_L4_generic_boot_info_MBI_t) boot_rec); +} + + + +/* + * Module Type (type 0x0001) + * Binary file inserted in the memory by the bootloader + */ + +struct _L4_generic_boot_info_module +{ + _L4_word_t type; + _L4_word_t version; + _L4_word_t offset_next; + _L4_word_t start; + _L4_word_t size; + _L4_word_t cmdline_offset; +}; + +typedef struct _L4_generic_boot_info_module *_L4_generic_boot_info_module_t; + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_start (_L4_generic_boot_info_module_t mod) +{ + return mod->start; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_size (_L4_generic_boot_info_module_t mod) +{ + return mod->size; +} + +static inline _L4_word_t +_L4_attribute_always_inline +_L4_module_cmdline (_L4_generic_boot_info_module_t mod) +{ + return mod->cmdline_offset; +} + + +#ifdef _L4_INTERFACE_GNU +#include +#endif + +#endif /* l4/bootinfo.h */ + diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/libl4/l4/gnu/bootinfo.h hurd-l4/libl4/l4/gnu/bootinfo.h --- ref/hurd-l4/libl4/l4/gnu/bootinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ hurd-l4/libl4/l4/gnu/bootinfo.h 2005-02-13 21:56:55.000000000 +0100 @@ -0,0 +1,120 @@ +/* l4/bootinfo.h - Public GNU interface to the L4 bootinfo structures. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Alexandre Buisse . + + This file is part of the GNU L4 library. + + The GNU L4 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU L4 library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU L4 library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + +#ifndef _L4_BOOTINFO_H +# error "Never use directly; include instead." +#endif + +typedef struct _L4_generic_boot_info l4_generic_boot_info; + +typedef _L4_generic_boot_info_t l4_generic_boot_info_t; + +typedef struct _L4_generic_boot_rec l4_generic_boot_rec; + +typedef _L4_generic_boot_rec_t l4_generic_boot_rec_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_valid (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_valid (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_size (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_size (boot_info); +} + +static inline l4_generic_boot_rec_t +_L4_attribute_always_inline +l4_generic_boot_info_first_entry (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_first_entry (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_info_entries (l4_generic_boot_info_t boot_info) +{ + return _L4_generic_boot_info_entries (boot_info); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_generic_boot_rec_type (l4_generic_boot_rec_t boot_rec) +{ + return _L4_generic_boot_rec_type (boot_rec); +} + +static inline l4_generic_boot_rec_t +_L4_attribute_always_inline +l4_generic_boot_rec_next (l4_generic_boot_rec_t boot_rec) +{ + return _L4_generic_boot_rec_next (boot_rec); +} + +typedef struct _L4_generic_boot_info_MBI l4_generic_boot_info_MBI; + +typedef _L4_generic_boot_info_MBI_t l4_generic_boot_info_MBI_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_MBI_address (l4_generic_boot_info_MBI_t mbi) +{ + return _L4_MBI_address (mbi); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_MBI_address_from_bootinfo (l4_generic_boot_info_t boot_info) +{ + return _L4_MBI_address_from_bootinfo (boot_info); +} + + +typedef struct _L4_generic_boot_info_module l4_generic_boot_info_module; + +typedef _L4_generic_boot_info_module_t l4_generic_boot_info_module_t; + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_start (l4_generic_boot_info_module_t mod) +{ + return _L4_module_start (mod); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_size (l4_generic_boot_info_module_t mod) +{ + return _L4_module_size (mod); +} + +static inline l4_word_t +_L4_attribute_always_inline +l4_module_cmdline (l4_generic_boot_info_module_t mod) +{ + return _L4_module_cmdline (mod); +} + diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/libl4/l4.h hurd-l4/libl4/l4.h --- ref/hurd-l4/libl4/l4.h 2005-02-14 16:32:34.076072304 +0100 +++ hurd-l4/libl4/l4.h 2005-02-13 19:47:44.000000000 +0100 @@ -31,5 +31,6 @@ #include #include #include +#include #endif /* l4.h */ diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/wortel/Makefile.am hurd-l4/wortel/Makefile.am --- ref/hurd-l4/wortel/Makefile.am 2005-02-12 20:07:00.000000000 +0100 +++ hurd-l4/wortel/Makefile.am 2005-02-12 17:14:00.000000000 +0100 @@ -25,8 +25,7 @@ if ARCH_IA32 endif bootdir = $(prefix)/boot -boot_PROGRAMS = wortel -noinst_PROGRAMS = startup +boot_PROGRAMS = startup wortel # The startup "program" is glue code that is injected into a new task # started by wortel. It is responsible for mapping in the from the diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/wortel/ia32-cmain.c hurd-l4/wortel/ia32-cmain.c --- ref/hurd-l4/wortel/ia32-cmain.c 2005-02-14 16:32:45.379353944 +0100 +++ hurd-l4/wortel/ia32-cmain.c 2005-02-14 16:30:20.636358224 +0100 @@ -29,6 +29,7 @@ #include #include #include +#include #include "wortel-intern.h" #include "multiboot.h" @@ -44,16 +45,16 @@ void cmain (void) { - multiboot_info_t *mbi; + l4_generic_boot_info_t bi; int argc = 0; char **argv = 0; l4_init (); l4_init_stubs (); - - mbi = (multiboot_info_t *) l4_boot_info (); - debug ("Multiboot Info: %p\n", mbi); - + + bi = (l4_generic_boot_info_t) (l4_boot_info()); + + multiboot_info_t *mbi = (multiboot_info_t *) (l4_MBI_address_from_bootinfo (bi)); if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count > 0) { /* A command line is available. */ @@ -165,7 +166,7 @@ add_unused_area (l4_word_t start, l4_wor void find_components (void) { - multiboot_info_t *mbi = (multiboot_info_t *) l4_boot_info (); + multiboot_info_t *mbi = (multiboot_info_t *) (l4_MBI_address_from_bootinfo ((l4_generic_boot_info_t) l4_boot_info())); /* Load the module information. */ if (CHECK_FLAG (mbi->flags, 3)) diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/wortel/loader.c hurd-l4/wortel/loader.c --- ref/hurd-l4/wortel/loader.c 2004-03-30 01:23:30.000000000 +0200 +++ hurd-l4/wortel/loader.c 2005-02-12 17:14:00.000000000 +0100 @@ -125,10 +125,14 @@ check_region (const char *name, l4_word_ { if ((start >= used_regions[i].start && start < used_regions[i].end) || (end >= used_regions[i].start && end <= used_regions[i].end) - || (start < used_regions[i].start && end > used_regions[i].start)) + || (start < used_regions[i].start && end > used_regions[i].start)) { + debug ("Conflict Detected! Memory map:\n"); + for (i = 0; i < nr_regions; i++) + debug ("%s (0x%x - 0x%x)\n", used_regions[i].name, used_regions[i].start, used_regions[i].end); panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)", name, start, end, used_regions[i].name, used_regions[i].start, used_regions[i].end); + } } } @@ -139,7 +143,7 @@ check_region (const char *name, l4_word_ void loader_add_region (const char *name, l4_word_t start, l4_word_t end) { - debug ("Protected Region: %s (0x%x - 0x%x)\n", name, start, end); + debug ("Adding region: %s (0x%x - 0x%x)\n", name, start, end); if (nr_regions == MAX_REGIONS) panic ("Too many memory regions, region %s doesn't fit", name); diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/wortel/sigma0.c hurd-l4/wortel/sigma0.c --- ref/hurd-l4/wortel/sigma0.c 2004-03-16 04:39:00.000000000 +0100 +++ hurd-l4/wortel/sigma0.c 2005-02-12 17:14:00.000000000 +0100 @@ -94,6 +94,8 @@ sigma0_get_fpage (l4_fpage_t fpage) l4_msg_tag_t tag; l4_map_item_t map_item; + debug ("requesting fpage %x\n", l4_address (fpage)); + l4_accept (l4_map_grant_items (L4_COMPLETE_ADDRESS_SPACE)); l4_msg_clear (msg); l4_set_msg_label (msg, SIGMA0_RPC); diff -Nupr --exclude '*deps*' --exclude '*CVS*' --exclude Makefile.in --exclude Makefile --exclude '*eps' --exclude 'stamp*' --exclude README --exclude COPYING --exclude '*m4*' --exclude '*swp' --exclude INSTALL --exclude compile --exclude 'config*' --exclude '*rej' --exclude tests --exclude powerpc --exclude ChangeLog --exclude missing --exclude mkinstalldirs --exclude depcomp --exclude 'kip*' --exclude 'install*' --exclude wortel/Makefile.am --exclude multiboot.h ref/hurd-l4/wortel/wortel.c hurd-l4/wortel/wortel.c --- ref/hurd-l4/wortel/wortel.c 2005-01-30 20:45:15.000000000 +0100 +++ hurd-l4/wortel/wortel.c 2005-02-12 17:14:00.000000000 +0100 @@ -141,6 +141,8 @@ load_components (void) l4_word_t addr; l4_word_t end_addr; + debug ("load components\n"); + /* One issue we have to solve is to make sure that when the physical memory server requests all the available physical fpages, we know which fpages we can give to it, and which we can't. This can be @@ -174,6 +176,7 @@ load_components (void) (inseparable) fpages. */ for (i = 0; i < mods_count; i++) { + debug ("mod %d/%d: %s (0x%x - 0x%x)\n", i+1, mods_count, mods[i].name, mods[i].start, mods[i].end); if (mods[i].start & (min_page_size - 1)) panic ("Module %s does not start on a page boundary", mods[i].name); loader_add_region (mods[i].name, mods[i].start, mods[i].end);