summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/common.c')
-rw-r--r--arch/arm/cpu/common.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/arch/arm/cpu/common.c b/arch/arm/cpu/common.c
index 8cfcc8f6ce..e9118b450d 100644
--- a/arch/arm/cpu/common.c
+++ b/arch/arm/cpu/common.c
@@ -23,6 +23,12 @@
*/
void sync_caches_for_execution(void)
{
+ /* if caches are disabled, don't do data cache maintenance */
+ if (!(get_cr() & CR_C)) {
+ icache_invalidate();
+ return;
+ }
+
/*
* Despite the name arm_early_mmu_cache_flush not only flushes the
* data cache, but also invalidates the instruction cache.
@@ -53,18 +59,21 @@ void pbl_barebox_break(void)
/*
* relocate binary to the currently running address
*/
-void relocate_to_current_adr(void)
+void __prereloc relocate_to_current_adr(void)
{
- unsigned long offset, offset_var;
+ unsigned long offset;
unsigned long __maybe_unused *dynsym, *dynend;
void *dstart, *dend;
/* Get offset between linked address and runtime address */
offset = get_runtime_offset();
- offset_var = global_variable_offset();
- dstart = (void *)__rel_dyn_start + offset_var;
- dend = (void *)__rel_dyn_end + offset_var;
+ /*
+ * We have yet to relocate, so using runtime_address
+ * to compute the relocated address
+ */
+ dstart = runtime_address(__rel_dyn_start);
+ dend = runtime_address(__rel_dyn_end);
#if defined(CONFIG_CPU_64)
while (dstart < dend) {
@@ -84,14 +93,14 @@ void relocate_to_current_adr(void)
putc_ll(' ');
puthex_ll(rel->r_addend);
putc_ll('\n');
- panic("");
+ __hang();
}
dstart += sizeof(*rel);
}
#elif defined(CONFIG_CPU_32)
- dynsym = (void *)__dynsym_start + offset_var;
- dynend = (void *)__dynsym_end + offset_var;
+ dynsym = runtime_address(__dynsym_start);
+ dynend = runtime_address(__dynsym_end);
while (dstart < dend) {
struct elf32_rel *rel = dstart;
@@ -114,7 +123,7 @@ void relocate_to_current_adr(void)
putc_ll(' ');
puthex_ll(rel->r_offset);
putc_ll('\n');
- panic("");
+ __hang();
}
dstart += sizeof(*rel);