Hello,

my research group is working on lightweight operating systems for many-core processors. We are looking for a full system simulator that supports debugging of x86-64 code and processor state. Qemu does not tell much about the cpu state and the Bochs debugger has problems with addresses in the high 64bit kernel-space. Hence, gem5 is very interesting for us.

Unfortunately, we are not able to boot our kernel ELF images at the moment. I applied the x86 32bit multiboot patches from https://bitbucket.org/chrism333/gem5-patches/src/ and adapted the gem5 configuration successfully. Now gem5 tries to load the ELF image via sim/system.cc, which ends up in ElfObject::loadSections and does fancy things with virtual addresses and hard-coded section names.

The ELF loader is surely doing the correct thing to load 64bit user-space applications. But during the multiboot startup it should really just load all LOAD segments to the requested physical addresses and leave everything else alone -- especially virtual addresses.

Assuming that I am able to implement such a simplified ELF loader for kernel images, what is a good way to integrate it into the existing infrastructure? Is it mandatory to derive the class MultibootX86System (in arch/x86/multiboot/system.hh) from the class System (in sim/system.hh)?

Best regards,
Randolf Rotta


For reference, our kernel ELF image looks like this:
objdump -fph boot32.elf

boot32.elf:     file format elf32-i386
architecture: i386, flags 0x00000012:
EXEC_P, HAS_SYMS
start address 0x00200058

Program Header:
    LOAD off    0x00000078 vaddr 0x00200000 paddr 0x00200000 align 2**3
         filesz 0x000003ed memsz 0x00206000 flags rwx
    LOAD off    0x00000480 vaddr 0x81000000 paddr 0x00800000 align 2**6
         filesz 0x0000da90 memsz 0x00401000 flags rwx

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .init         000003ed  00200000  00200000  00000078  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .initbss      00205000  00201000  00201000  00000465  2**0
                  ALLOC
  2 .text         00009256  81000000  00800000  00000480  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .rodata       00000c4d  81009280  00809280  00009700  2**6
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .eh_frame     00003bb8  81009ed0  00809ed0  0000a350  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .init_array   00000008  8100da88  0080da88  0000df08  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  6 .bss          003f3540  8100dac0  0080dac0  0000df10  2**6
                  ALLOC
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to