Commit e0c2ef43 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

powerpc/modules: Use PPC_LI macros instead of opencoding

parent 4390a58e
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -256,9 +256,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
			       value, (uint32_t)location);
			pr_debug("Location before: %08X.\n",
			       *(uint32_t *)location);
			value = (*(uint32_t *)location & ~0x03fffffc)
				| ((value - (uint32_t)location)
				   & 0x03fffffc);
			value = (*(uint32_t *)location & ~PPC_LI_MASK) |
				PPC_LI(value - (uint32_t)location);

			if (patch_instruction(location, ppc_inst(value)))
				return -EFAULT;
@@ -266,10 +265,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
			pr_debug("Location after: %08X.\n",
			       *(uint32_t *)location);
			pr_debug("ie. jump to %08X+%08X = %08X\n",
			       *(uint32_t *)location & 0x03fffffc,
			       (uint32_t)location,
			       (*(uint32_t *)location & 0x03fffffc)
			       + (uint32_t)location);
				 *(uint32_t *)PPC_LI((uint32_t)location), (uint32_t)location,
				 (*(uint32_t *)PPC_LI((uint32_t)location)) + (uint32_t)location);
			break;

		case R_PPC_REL32:
+1 −2
Original line number Diff line number Diff line
@@ -653,8 +653,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
			}

			/* Only replace bits 2 through 26 */
			value = (*(uint32_t *)location & ~0x03fffffc)
				| (value & 0x03fffffc);
			value = (*(uint32_t *)location & ~PPC_LI_MASK) | PPC_LI(value);

			if (patch_instruction((u32 *)location, ppc_inst(value)))
				return -EFAULT;