Subject: Re: Adding Multiboot support (or not)
To: None <pavel.cahyna@st.mff.cuni.cz>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 02/11/2006 12:44:37
On Saturday 11 February 2006 12:18, Pavel Cahyna wrote:
> On Sat, Feb 11, 2006 at 10:06:51AM +0100, Julio M. Merino Vidal wrote:
> > Thanks for the info.  But note that NetBSD also uses the Multiboot
> > header to reserve some extra space after the BSS so that it can later
> > copy the symbol table there.  It tells the boot loader that the
> > BSS is actually longer than it is so that the loader will leave that
> > space untouched (grep for MULTIBOOT_SYMTAB_SPACE).  How could we do
> > this (without reserving space in the data section, that is)?
>
> Why is it necessary to copy the symbol table somewhere? Can't you leave it
> where it is?

Because the kernel needs a different format that the one passed in by
Multiboot.  It needs a minimal ELF image that contains the symbol table
(see the copy_syms function in multiboot.c) and then sets 'ssym' and
'esym' to the beginning and end of this image, respectively.  (It also
expects it to be just after the kernel image, so that it is properly
relocated.)

The restriction of it being just after the kernel image can be solved.
But I'm not sure about the fact that the minimal ELF image needs to be
contiguous in memory (between ssym and esym).  Who warrants that the
memory before where GRUB put the symbol table is free?  (Because we'd
need to write the ELF header there.)

Anyway, I'm sure there is a solution to avoid the copy.  But it already
felt very complex when I wrote the code as is.

-- 
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/