[PATCH v8 11/30] powerpc: Use a datatype for instructions

Jordan Niethe jniethe5 at gmail.com
Sun May 17 20:48:00 AEST 2020


mpe, this is to go with the fixup I posted for mmu_patch_addis() in
[PATCH v8 12/30] powerpc: Use a function for reading instructions.
Thanks to Christophe pointing it out.

diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c
@@ -98,11 +98,12 @@ static void mmu_patch_cmp_limit(s32 *site,
unsigned long mapped)

 static void mmu_patch_addis(s32 *site, long simm)
 {
-    unsigned int instr = *(unsigned int *)patch_site_addr(site);
+    struct ppc_inst instr = *(struct ppc_inst *)patch_site_addr(site);
+    unsigned int val = ppc_inst_val(instr);

-    instr &= 0xffff0000;
-    instr |= ((unsigned long)simm) >> 16;
-    patch_instruction_site(site, ppc_inst(instr));
+    val &= 0xffff0000;
+    val |= ((unsigned long)simm) >> 16;
+    patch_instruction_site(site, ppc_inst(val));
 }

 static void mmu_mapin_ram_chunk(unsigned long offset, unsigned long
top, pgprot_t prot)
--


More information about the Linuxppc-dev mailing list