diff --git a/arch/sh/cpu/sh2/cpu.c b/arch/sh/cpu/sh2/cpu.c index 9a93cf573f..a2f856f459 100644 --- a/arch/sh/cpu/sh2/cpu.c +++ b/arch/sh/cpu/sh2/cpu.c @@ -83,9 +83,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh3/cpu.c b/arch/sh/cpu/sh3/cpu.c index 494f908f64..ea0006a650 100644 --- a/arch/sh/cpu/sh3/cpu.c +++ b/arch/sh/cpu/sh3/cpu.c @@ -66,9 +66,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index 49c58aeb20..aa8d4dfcd1 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -41,9 +41,3 @@ int cpu_eth_init(bd_t *bis) #endif return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 7cb594e31a..aa967c04e7 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -15,3 +15,21 @@ int dram_init(void) return 0; } + +void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr) +{ + void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r; + + if (new_gd->reloc_off) { + memcpy((void *)new_gd->relocaddr, + (void *)(new_gd->relocaddr - new_gd->reloc_off), + new_gd->mon_len); + + reloc_board_init_r += new_gd->reloc_off; + } + + __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp)); + + while (1) + reloc_board_init_r(new_gd, 0x0); +}