u-boot-brain/arch/x86/lib
Simon Glass 62f7970a5a x86: Add error checking to x86 relocation code
This does not actually change normal behaviour, but adds a check that
should detect corruption of relocation data (e.g. by using BSS data
prior to relocation).

Also add additional debugging output when enabled.

During this investigation, two situations have been seen:
1. calculate_relocation_address():
	uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;

turns into
     111166f:	b8 83 c4 17 01       	mov    $0x117c483,%eax

whih is beyond the end of bss:

0117b484 g       .bss	00000000 __bss_end

Somehow the __bss_end here is 255 bytes ahead.

2. do_elf_reloc_fixups():

	uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;

Here the __text_start is 0 in the file:

 1111d9f:	bb a0 e0 13 01       	mov    $0x113e0a0,%ebx
1111da4:	81 ef 00 00 00 00    	sub    $0x0,%edi

As it happens, both of these are in pre-relocation code.

For these reasons we silent check and ignore bad relocations.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-04 15:57:48 -08:00
..
bios.h x86: Remove unused real mode code 2013-02-14 20:19:03 -08:00
board.c x86: Support relocation of FDT on start-up 2013-03-04 15:57:47 -08:00
bootm.c x86: Refactor the zboot innards so they can be reused with a vboot image 2011-12-19 13:26:16 +11:00
cmd_boot.c x86: Move do_go_exec() out of board.c 2012-01-04 22:35:20 +11:00
gcc.c x86: Wrap small helper functions from libgcc to avoid an ABI mismatch 2011-11-29 21:31:24 +11:00
init_helpers.c x86: Support relocation of FDT on start-up 2013-03-04 15:57:47 -08:00
init_wrappers.c x86: Support relocation of FDT on start-up 2013-03-04 15:57:47 -08:00
interrupts.c cosmetic: checkpatch cleanup of arch/x86/lib/*.c 2011-11-29 21:03:43 +11:00
Makefile x86: Remove unused real mode code 2013-02-14 20:19:03 -08:00
pcat_interrupts.c cosmetic: checkpatch cleanup of arch/x86/lib/*.c 2011-11-29 21:03:43 +11:00
pcat_timer.c x86: Fix typo in pcat_timer.c 2012-11-30 13:44:05 -08:00
pci_type1.c x86: Misc PCI touchups 2011-11-29 21:10:08 +11:00
pci.c x86: Provide more configuration granularity 2011-11-29 21:09:52 +11:00
physmem.c x86: Implement arch_phys_memset so that it can wipe memory above 4GB 2012-12-06 14:30:41 -08:00
relocate.c x86: Add error checking to x86 relocation code 2013-03-04 15:57:48 -08:00
string.c x86: Import glibc memcpy implementation 2012-01-02 03:58:46 +11:00
timer.c x86: Permit bootstage and timer data to be used prior to relocation 2013-03-04 15:57:36 -08:00
video.c x86: Remove unused real mode code 2013-02-14 20:19:03 -08:00
zimage.c x86: Remove unused real mode code 2013-02-14 20:19:03 -08:00