summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorJordan Niethe <jniethe5@gmail.com>2020-05-06 05:40:37 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2020-05-18 16:10:38 +0200
commit622cf6f436a12338bbcfbb3474629755547fd112 (patch)
treeb26ffcbde6ecc0514d9a8a06ef4d8548d526b80b /arch/powerpc/lib
parentpowerpc: Define and use get_user_instr() et. al. (diff)
downloadlinux-622cf6f436a12338bbcfbb3474629755547fd112.tar.xz
linux-622cf6f436a12338bbcfbb3474629755547fd112.zip
powerpc: Introduce a function for reporting instruction length
Currently all instructions have the same length, but in preparation for prefixed instructions introduce a function for returning instruction length. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Alistair Popple <alistair@popple.id.au> Link: https://lore.kernel.org/r/20200506034050.24806-18-jniethe5@gmail.com
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/feature-fixups.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
index 3c55097d406d..0c9ffdef8096 100644
--- a/arch/powerpc/lib/feature-fixups.c
+++ b/arch/powerpc/lib/feature-fixups.c
@@ -392,20 +392,20 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
static void do_final_fixups(void)
{
#if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE)
- struct ppc_inst *src, *dest;
- unsigned long length;
+ struct ppc_inst inst, *src, *dest, *end;
if (PHYSICAL_START == 0)
return;
src = (struct ppc_inst *)(KERNELBASE + PHYSICAL_START);
dest = (struct ppc_inst *)KERNELBASE;
- length = (__end_interrupts - _stext) / sizeof(struct ppc_inst);
+ end = (void *)src + (__end_interrupts - _stext);
- while (length--) {
- raw_patch_instruction(dest, ppc_inst_read(src));
- src++;
- dest++;
+ while (src < end) {
+ inst = ppc_inst_read(src);
+ raw_patch_instruction(dest, inst);
+ src = (void *)src + ppc_inst_len(inst);
+ dest = (void *)dest + ppc_inst_len(inst);
}
#endif
}