Workaround QEMU's multiboot loading issue

When QEMU loads a multiboot image based on the ELF headers, it
calculates the total memory size subtracting the minimum address from
the maximum address in the program header.

While the IDT section is removed from the ELF, an empty segment in the
program header is still kept at IDT_LIST base address. Since the IDT
segment isn't contiguous with the loadable code segment, QEMU is tricked
into thinking the total memory size is larger than it really is.

To workaround this, change the address of the IDT section to the address
of the text section. This will make objcopy remove the extra segment
entirely when the IDT section is removed.

This could have been fixed in QEMU since this isn't a bug in Zephyr
per-se, but it will be easier to avoid specific QEMU versions
requirements.

Change-Id: I062b7d0fb8fccfe4d0d0b4cb0afc4667bbb7f7dd
Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
This commit is contained in:
Ido Yariv 2016-01-04 14:59:09 -05:00 committed by Anas Nashif
commit a8c48ea7b7

View file

@ -802,7 +802,7 @@ quiet_cmd_lnk_elf = LINK $@
( \
$(LD) -T final-linker.cmd @$(KERNEL_NAME).lnk staticIdt.o int_vector_alloc.o \
irq_int_vector_map.o -o $@; \
$(OBJCOPY) --set-section-flags intList=noload $@ elf.tmp; \
${OBJCOPY} --change-section-address intList=${CONFIG_PHYS_LOAD_ADDR} $@ elf.tmp;\
$(OBJCOPY) -R intList elf.tmp $@; \
rm elf.tmp \
)