[syslinux] Re: Patch to add Symbols/segments loader for mboot.c

Ram Yalamanchili ramy at stanford.edu
Mon Jan 16 04:41:00 PST 2006


Hi Tim,

Actually, all sections _with_ VA's are already mapped to the program
segments usually.

The ones which are being loaded in my patch are those sections which
have a VA of 0 (invalid) and thus not mapped to any program segment. If
you look in the 2nd if() statement of the section loader code, you will
see I don't load any section if it already has a VA. This is because it
should have been loaded already by your program segment loader. This
being said, place_module_section() seemed to be the easiest way for me
to get memory allocated somewhere. It also didn't seem like its going to
break any other kernel's requirements like consecutive modules in
memory, etc. Also, it should be safe for the kernel to access this
memory since we are already setup in 1-1 protected mode at kernel entry.

A small sample of sections in a section header table (readelf -S):  

[Nr] Name        Type          Addr     Off    Size   ES Flg Lk Inf Al
[22] .data       PROGBITS      0804e860 005860 0000c0 00  WA  0   0 32
[23] .bss        NOBITS        0804e920 005920 0004b4 00  WA  0   0 32
[24] .comment    PROGBITS      00000000 005920 00010e 00      0   0  1
[25] .debug_a    PROGBITS      00000000 005a2e 000020 00      0   0  1
[26] .debug_p    PROGBITS      00000000 005a4e 0000b6 00      0   0  1
[27] .debug_info PROGBITS      00000000 005b04 002391 00      0   0  1

As you see, Data and BSS sections have a VA (Addr) specified, the
debugging segments don't. 

Now if you look at the section to program segment mapping (readelf -l):

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-
tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06

As expected, no .debug_* sections are mapped into the segments. Only
those which the loader will understand are present (meaning those
sections which have a non-zero VA).

Hope this helps,
Ram


On Mon, 2006-01-16 at 11:55 +0000, Tim Deegan wrote:
> Hi Ram,
> 
> Thanks for the patch.  I've tidied it up a little and I'm testing it
> now.  I have a question about the code to load additional sections out
> of the section table.  Why do you use place_module_section() for this?
> Since the sections come with their virtual addresses specified in the
> ELF binary, shouldn't you be using place_kernel_section()?
> 
> Cheers,
> 
> Tim.
> 
> On Fri, Jan 13, 2006 at 05:45:54PM -0800, Ram Yalamanchili wrote:
> > Hi Tim!
> > 
> > I use your mboot.c32 to load multiboot kernels over pxelinux. I appreciate
> > the work you have done on this. However, some kernels require the symbol
> > table and other information in the section header table to be able to load
> > properly. This functionality is not present in mboot.c now, so I added
> > support for it. I haven't touched a.out however.
> > 
> > The patch is attached. It would be great if you can push this into the next
> > release of syslinux so we dont have to distribute patched versions of
> > mboot.c32.
> > 
> > The patch is diff'ed against syslinux-3.11. I wasn't sure who is maintaining
> > this, so i'll send a copy of this message to the syslinux mailing list too,
> > so Peter Anvin can have a look.
> > 
> > thanks,
> > Ram
> 
> 




More information about the Syslinux mailing list