Hi Dave,
On Thu, Nov 07, 2013 at 08:51:36PM +0000, Dave Martin wrote:
Copying a function with memcpy() and then trying to execute the result isn't trivially portable to Thumb.
This patch modifies the kexec soft restart code to copy its assembler trampoline relocate_new_kernel() using fncpy() instead, so that relocate_new_kernel can be in the same ISA as the rest of the kernel without problems.
Signed-off-by: Dave Martin Dave.Martin@arm.com
[...]
@@ -168,16 +171,16 @@ void machine_kexec(struct kimage *image) /* copy our kernel relocation code to the control code page */
- memcpy(reboot_code_buffer,
relocate_new_kernel, relocate_new_kernel_size);
- reboot_entry = fncpy(reboot_code_buffer,
reboot_entry,
relocate_new_kernel_size);
My only slight gripe with this is that relocate_new_kernel_size also includes a bunch of data following the function (which you have now delimited with ENTRY/ENDPROC), so using fncpy for that feels a bit awkward.
Will