diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-09-21 11:11:06 +0100 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2016-09-21 16:25:43 +0200 |
commit | d263cda5ae41279208d9576eab1c5215a57252a6 (patch) | |
tree | 287efea0e6b14588278c579a20a522c6feb64a7a /arch/mips/cpu/u-boot.lds | |
parent | ad8783cb1cb258b71d81800f72cd64eb44081653 (diff) | |
download | u-boot-imx-d263cda5ae41279208d9576eab1c5215a57252a6.zip u-boot-imx-d263cda5ae41279208d9576eab1c5215a57252a6.tar.gz u-boot-imx-d263cda5ae41279208d9576eab1c5215a57252a6.tar.bz2 |
MIPS: Fix cache maintenance in relocate_code & simplify
The relocate_code function was handling cache maintenance incorrectly.
It copied U-Boot to its new location, flushed the caches & then
proceeded to apply relocations & jump to the new code without flushing
the caches again. This is problematic as the instruction cache could
potentially have already fetched instructions that hadn't had relocs
applied.
Rework this to perform the flush_cache call using the code in the
original copy of U-Boot, after having applied relocations to the new
copy of U-Boot. The new U-Boot can then be jumped to safely once that
cache flush has been performed.
As part of this, since the old U-Boot is used up until after that cache
flush, complexity around loading values from the GOT using a jump & link
instruction & loads from a table is removed. Instead we can simply load
the needed values with PTR_LA fromt the original GOT.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Diffstat (limited to 'arch/mips/cpu/u-boot.lds')
-rw-r--r-- | arch/mips/cpu/u-boot.lds | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds index 7d71c11..0129c99 100644 --- a/arch/mips/cpu/u-boot.lds +++ b/arch/mips/cpu/u-boot.lds @@ -19,7 +19,9 @@ SECTIONS . = ALIGN(4); .text : { + __text_start = .; *(.text*) + __text_end = .; } . = ALIGN(4); |