Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1368090
| From | Matt Redfearn <matt.redfearn@imgtec.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 06/11] MIPS: Call relocate_kernel if CONFIG_RELOCATABLE=y |
| Date | 2016-03-31 11:40 +0200 |
| Message-ID | <riHf4-2VE-5@gated-at.bofh.it> (permalink) |
| References | <riGVH-2I1-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
If CONFIG_RELOCATABLE is enabled, call relocate_kernel. This function will return the entry point of the relocated kernel if copy/relocate is sucessful or the original entry point if not. The stack pointer must then be pointed into the new image. Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com> --- Changes in v2: None arch/mips/kernel/head.S | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index 4e4cc5b9a771..7dc043349d66 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S @@ -132,7 +132,27 @@ not_found: set_saved_sp sp, t0, t1 PTR_SUBU sp, 4 * SZREG # init stack pointer +#ifdef CONFIG_RELOCATABLE + /* Copy kernel and apply the relocations */ + jal relocate_kernel + + /* Repoint the sp into the new kernel image */ + PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE + PTR_ADDU sp, $28 + set_saved_sp sp, t0, t1 + PTR_SUBU sp, 4 * SZREG # init stack pointer + + /* + * relocate_kernel returns the entry point either + * in the relocated kernel or the original if for + * some reason relocation failed - jump there now + * with instruction hazard barrier because of the + * newly sync'd icache. + */ + jr.hb v0 +#else j start_kernel +#endif END(kernel_entry) #ifdef CONFIG_SMP -- 2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/11] MIPS relocatable kernel & KASLR Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:20 +0200 [PATCH v2 10/11] MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:20 +0200 [PATCH v2 01/11] MIPS: tools: Add relocs tool Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:20 +0200 [PATCH v2 04/11] MIPS: Generate relocation table when CONFIG_RELOCATABLE Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:20 +0200 [PATCH v2 06/11] MIPS: Call relocate_kernel if CONFIG_RELOCATABLE=y Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:40 +0200 [PATCH v2 07/11] MIPS: bootmem: When relocatable, free memory below kernel Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:40 +0200 [PATCH v2 05/11] MIPS: Kernel: Add relocate.c Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:40 +0200 [PATCH v2 08/11] MIPS: Add CONFIG_RELOCATABLE Kconfig option Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:50 +0200
csiph-web