Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Don't use 'struct ppc_inst' to reference instruction location

'struct ppc_inst' is an internal representation of an instruction, but
in-memory instructions are and will remain a table of 'u32' forever.

Replace all 'struct ppc_inst *' used for locating an instruction in
memory by 'u32 *'. This removes a lot of undue casts to 'struct
ppc_inst *'.

It also helps locating ab-use of 'struct ppc_inst' dereference.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Fix ppc_inst_next(), use u32 instead of unsigned int]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7062722b087228e42cbd896e39bfdf526d6a340a.1621516826.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
69d4d6e5 e90a21ea

+159 -176
+10 -11
arch/powerpc/include/asm/code-patching.h
··· 23 23 #define BRANCH_ABSOLUTE 0x2 24 24 25 25 bool is_offset_in_branch_range(long offset); 26 - int create_branch(struct ppc_inst *instr, const struct ppc_inst *addr, 26 + int create_branch(struct ppc_inst *instr, const u32 *addr, 27 27 unsigned long target, int flags); 28 - int create_cond_branch(struct ppc_inst *instr, const struct ppc_inst *addr, 28 + int create_cond_branch(struct ppc_inst *instr, const u32 *addr, 29 29 unsigned long target, int flags); 30 - int patch_branch(struct ppc_inst *addr, unsigned long target, int flags); 31 - int patch_instruction(struct ppc_inst *addr, struct ppc_inst instr); 32 - int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr); 30 + int patch_branch(u32 *addr, unsigned long target, int flags); 31 + int patch_instruction(u32 *addr, struct ppc_inst instr); 32 + int raw_patch_instruction(u32 *addr, struct ppc_inst instr); 33 33 34 34 static inline unsigned long patch_site_addr(s32 *site) 35 35 { ··· 38 38 39 39 static inline int patch_instruction_site(s32 *site, struct ppc_inst instr) 40 40 { 41 - return patch_instruction((struct ppc_inst *)patch_site_addr(site), instr); 41 + return patch_instruction((u32 *)patch_site_addr(site), instr); 42 42 } 43 43 44 44 static inline int patch_branch_site(s32 *site, unsigned long target, int flags) 45 45 { 46 - return patch_branch((struct ppc_inst *)patch_site_addr(site), target, flags); 46 + return patch_branch((u32 *)patch_site_addr(site), target, flags); 47 47 } 48 48 49 49 static inline int modify_instruction(unsigned int *addr, unsigned int clr, 50 50 unsigned int set) 51 51 { 52 - return patch_instruction((struct ppc_inst *)addr, ppc_inst((*addr & ~clr) | set)); 52 + return patch_instruction(addr, ppc_inst((*addr & ~clr) | set)); 53 53 } 54 54 55 55 static inline int modify_instruction_site(s32 *site, unsigned int clr, unsigned int set) ··· 59 59 60 60 int instr_is_relative_branch(struct ppc_inst instr); 61 61 int instr_is_relative_link_branch(struct ppc_inst instr); 62 - unsigned long branch_target(const struct ppc_inst *instr); 63 - int translate_branch(struct ppc_inst *instr, const struct ppc_inst *dest, 64 - const struct ppc_inst *src); 62 + unsigned long branch_target(const u32 *instr); 63 + int translate_branch(struct ppc_inst *instr, const u32 *dest, const u32 *src); 65 64 extern bool is_conditional_branch(struct ppc_inst instr); 66 65 #ifdef CONFIG_PPC_BOOK3E_64 67 66 void __patch_exception(int exc, unsigned long addr);
+8 -8
arch/powerpc/include/asm/inst.h
··· 80 80 return ppc_inst_prefix(swab32(ppc_inst_val(x)), swab32(ppc_inst_suffix(x))); 81 81 } 82 82 83 - static inline struct ppc_inst ppc_inst_read(const struct ppc_inst *ptr) 83 + static inline struct ppc_inst ppc_inst_read(const u32 *ptr) 84 84 { 85 85 u32 val, suffix; 86 86 87 - val = *(u32 *)ptr; 87 + val = *ptr; 88 88 if ((val >> 26) == OP_PREFIX) { 89 - suffix = *((u32 *)ptr + 1); 89 + suffix = *(ptr + 1); 90 90 return ppc_inst_prefix(val, suffix); 91 91 } else { 92 92 return ppc_inst(val); ··· 114 114 return ppc_inst(swab32(ppc_inst_val(x))); 115 115 } 116 116 117 - static inline struct ppc_inst ppc_inst_read(const struct ppc_inst *ptr) 117 + static inline struct ppc_inst ppc_inst_read(const u32 *ptr) 118 118 { 119 - return *ptr; 119 + return ppc_inst(*ptr); 120 120 } 121 121 122 122 #endif /* CONFIG_PPC64 */ ··· 139 139 * Return the address of the next instruction, if the instruction @value was 140 140 * located at @location. 141 141 */ 142 - static inline struct ppc_inst *ppc_inst_next(void *location, struct ppc_inst *value) 142 + static inline u32 *ppc_inst_next(u32 *location, u32 *value) 143 143 { 144 144 struct ppc_inst tmp; 145 145 146 146 tmp = ppc_inst_read(value); 147 147 148 - return location + ppc_inst_len(tmp); 148 + return (void *)location + ppc_inst_len(tmp); 149 149 } 150 150 151 151 static inline unsigned long ppc_inst_as_ulong(struct ppc_inst x) ··· 177 177 __str; \ 178 178 }) 179 179 180 - int copy_inst_from_kernel_nofault(struct ppc_inst *inst, struct ppc_inst *src); 180 + int copy_inst_from_kernel_nofault(struct ppc_inst *inst, u32 *src); 181 181 182 182 #endif /* _ASM_POWERPC_INST_H */
+2 -2
arch/powerpc/include/asm/uprobes.h
··· 24 24 25 25 struct arch_uprobe { 26 26 union { 27 - struct ppc_inst insn; 28 - struct ppc_inst ixol; 27 + u32 insn[2]; 28 + u32 ixol[2]; 29 29 }; 30 30 }; 31 31
+2 -2
arch/powerpc/kernel/crash_dump.c
··· 35 35 36 36 static void __init create_trampoline(unsigned long addr) 37 37 { 38 - struct ppc_inst *p = (struct ppc_inst *)addr; 38 + u32 *p = (u32 *)addr; 39 39 40 40 /* The maximum range of a single instruction branch, is the current 41 41 * instruction's address + (32 MB - 4) bytes. For the trampoline we ··· 46 46 * two instructions it doesn't require any registers. 47 47 */ 48 48 patch_instruction(p, ppc_inst(PPC_RAW_NOP())); 49 - patch_branch((void *)p + 4, addr + PHYSICAL_START, 0); 49 + patch_branch(p + 1, addr + PHYSICAL_START, 0); 50 50 } 51 51 52 52 void __init setup_kdump_trampoline(void)
+2 -2
arch/powerpc/kernel/epapr_paravirt.c
··· 38 38 39 39 for (i = 0; i < (len / 4); i++) { 40 40 struct ppc_inst inst = ppc_inst(be32_to_cpu(insts[i])); 41 - patch_instruction((struct ppc_inst *)(epapr_hypercall_start + i), inst); 41 + patch_instruction(epapr_hypercall_start + i, inst); 42 42 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64) 43 - patch_instruction((struct ppc_inst *)(epapr_ev_idle_start + i), inst); 43 + patch_instruction(epapr_ev_idle_start + i, inst); 44 44 #endif 45 45 } 46 46
+1 -1
arch/powerpc/kernel/jump_label.c
··· 11 11 void arch_jump_label_transform(struct jump_entry *entry, 12 12 enum jump_label_type type) 13 13 { 14 - struct ppc_inst *addr = (struct ppc_inst *)jump_entry_code(entry); 14 + u32 *addr = (u32 *)jump_entry_code(entry); 15 15 16 16 if (type == JUMP_LABEL_JMP) 17 17 patch_branch(addr, jump_entry_target(entry), 0);
+4 -5
arch/powerpc/kernel/kgdb.c
··· 417 417 418 418 int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) 419 419 { 420 + u32 instr, *addr = (u32 *)bpt->bpt_addr; 420 421 int err; 421 - unsigned int instr; 422 - struct ppc_inst *addr = (struct ppc_inst *)bpt->bpt_addr; 423 422 424 - err = get_kernel_nofault(instr, (unsigned *) addr); 423 + err = get_kernel_nofault(instr, addr); 425 424 if (err) 426 425 return err; 427 426 ··· 428 429 if (err) 429 430 return -EFAULT; 430 431 431 - *(unsigned int *)bpt->saved_instr = instr; 432 + *(u32 *)bpt->saved_instr = instr; 432 433 433 434 return 0; 434 435 } ··· 437 438 { 438 439 int err; 439 440 unsigned int instr = *(unsigned int *)bpt->saved_instr; 440 - struct ppc_inst *addr = (struct ppc_inst *)bpt->bpt_addr; 441 + u32 *addr = (u32 *)bpt->bpt_addr; 441 442 442 443 err = patch_instruction(addr, ppc_inst(instr)); 443 444 if (err)
+8 -9
arch/powerpc/kernel/kprobes.c
··· 107 107 { 108 108 int ret = 0; 109 109 struct kprobe *prev; 110 - struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->addr); 110 + struct ppc_inst insn = ppc_inst_read(p->addr); 111 111 112 112 if ((unsigned long)p->addr & 0x03) { 113 113 printk("Attempt to register kprobe at an unaligned address\n"); ··· 116 116 printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n"); 117 117 ret = -EINVAL; 118 118 } else if ((unsigned long)p->addr & ~PAGE_MASK && 119 - ppc_inst_prefixed(ppc_inst_read((struct ppc_inst *)(p->addr - 1)))) { 119 + ppc_inst_prefixed(ppc_inst_read(p->addr - 1))) { 120 120 printk("Cannot register a kprobe on the second word of prefixed instruction\n"); 121 121 ret = -EINVAL; 122 122 } 123 123 preempt_disable(); 124 124 prev = get_kprobe(p->addr - 1); 125 125 preempt_enable_no_resched(); 126 - if (prev && 127 - ppc_inst_prefixed(ppc_inst_read((struct ppc_inst *)prev->ainsn.insn))) { 126 + if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { 128 127 printk("Cannot register a kprobe on the second word of prefixed instruction\n"); 129 128 ret = -EINVAL; 130 129 } ··· 137 138 } 138 139 139 140 if (!ret) { 140 - patch_instruction((struct ppc_inst *)p->ainsn.insn, insn); 141 + patch_instruction(p->ainsn.insn, insn); 141 142 p->opcode = ppc_inst_val(insn); 142 143 } 143 144 ··· 148 149 149 150 void arch_arm_kprobe(struct kprobe *p) 150 151 { 151 - patch_instruction((struct ppc_inst *)p->addr, ppc_inst(BREAKPOINT_INSTRUCTION)); 152 + patch_instruction(p->addr, ppc_inst(BREAKPOINT_INSTRUCTION)); 152 153 } 153 154 NOKPROBE_SYMBOL(arch_arm_kprobe); 154 155 155 156 void arch_disarm_kprobe(struct kprobe *p) 156 157 { 157 - patch_instruction((struct ppc_inst *)p->addr, ppc_inst(p->opcode)); 158 + patch_instruction(p->addr, ppc_inst(p->opcode)); 158 159 } 159 160 NOKPROBE_SYMBOL(arch_disarm_kprobe); 160 161 ··· 227 228 static int try_to_emulate(struct kprobe *p, struct pt_regs *regs) 228 229 { 229 230 int ret; 230 - struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->ainsn.insn); 231 + struct ppc_inst insn = ppc_inst_read(p->ainsn.insn); 231 232 232 233 /* regs->nip is also adjusted if emulate_step returns 1 */ 233 234 ret = emulate_step(regs, insn); ··· 438 439 if (!cur || user_mode(regs)) 439 440 return 0; 440 441 441 - len = ppc_inst_len(ppc_inst_read((struct ppc_inst *)cur->ainsn.insn)); 442 + len = ppc_inst_len(ppc_inst_read(cur->ainsn.insn)); 442 443 /* make sure we got here for instruction we have a kprobe on */ 443 444 if (((unsigned long)cur->ainsn.insn + len) != regs->nip) 444 445 return 0;
+1 -1
arch/powerpc/kernel/mce_power.c
··· 463 463 pfn = addr_to_pfn(regs, regs->nip); 464 464 if (pfn != ULONG_MAX) { 465 465 instr_addr = (pfn << PAGE_SHIFT) + (regs->nip & ~PAGE_MASK); 466 - instr = ppc_inst_read((struct ppc_inst *)instr_addr); 466 + instr = ppc_inst_read((u32 *)instr_addr); 467 467 if (!analyse_instr(&op, &tmp, instr)) { 468 468 pfn = addr_to_pfn(regs, op.ea); 469 469 *addr = op.ea;
+18 -27
arch/powerpc/kernel/optprobes.c
··· 89 89 * Ensure that the instruction is not a conditional branch, 90 90 * and that can be emulated. 91 91 */ 92 - if (!is_conditional_branch(ppc_inst_read((struct ppc_inst *)p->ainsn.insn)) && 93 - analyse_instr(&op, &regs, 94 - ppc_inst_read((struct ppc_inst *)p->ainsn.insn)) == 1) { 92 + if (!is_conditional_branch(ppc_inst_read(p->ainsn.insn)) && 93 + analyse_instr(&op, &regs, ppc_inst_read(p->ainsn.insn)) == 1) { 95 94 emulate_update_regs(&regs, &op); 96 95 nip = regs.nip; 97 96 } ··· 131 132 132 133 static void patch_imm32_load_insns(unsigned long val, int reg, kprobe_opcode_t *addr) 133 134 { 134 - patch_instruction((struct ppc_inst *)addr, 135 - ppc_inst(PPC_RAW_LIS(reg, IMM_H(val)))); 135 + patch_instruction(addr, ppc_inst(PPC_RAW_LIS(reg, IMM_H(val)))); 136 136 addr++; 137 137 138 - patch_instruction((struct ppc_inst *)addr, 139 - ppc_inst(PPC_RAW_ORI(reg, reg, IMM_L(val)))); 138 + patch_instruction(addr, ppc_inst(PPC_RAW_ORI(reg, reg, IMM_L(val)))); 140 139 } 141 140 142 141 /* ··· 144 147 static void patch_imm64_load_insns(unsigned long long val, int reg, kprobe_opcode_t *addr) 145 148 { 146 149 /* lis reg,(op)@highest */ 147 - patch_instruction((struct ppc_inst *)addr, 150 + patch_instruction(addr, 148 151 ppc_inst(PPC_INST_ADDIS | ___PPC_RT(reg) | 149 152 ((val >> 48) & 0xffff))); 150 153 addr++; 151 154 152 155 /* ori reg,reg,(op)@higher */ 153 - patch_instruction((struct ppc_inst *)addr, 156 + patch_instruction(addr, 154 157 ppc_inst(PPC_INST_ORI | ___PPC_RA(reg) | 155 158 ___PPC_RS(reg) | ((val >> 32) & 0xffff))); 156 159 addr++; 157 160 158 161 /* rldicr reg,reg,32,31 */ 159 - patch_instruction((struct ppc_inst *)addr, 162 + patch_instruction(addr, 160 163 ppc_inst(PPC_INST_RLDICR | ___PPC_RA(reg) | 161 164 ___PPC_RS(reg) | __PPC_SH64(32) | __PPC_ME64(31))); 162 165 addr++; 163 166 164 167 /* oris reg,reg,(op)@h */ 165 - patch_instruction((struct ppc_inst *)addr, 168 + patch_instruction(addr, 166 169 ppc_inst(PPC_INST_ORIS | ___PPC_RA(reg) | 167 170 ___PPC_RS(reg) | ((val >> 16) & 0xffff))); 168 171 addr++; 169 172 170 173 /* ori reg,reg,(op)@l */ 171 - patch_instruction((struct ppc_inst *)addr, 174 + patch_instruction(addr, 172 175 ppc_inst(PPC_INST_ORI | ___PPC_RA(reg) | 173 176 ___PPC_RS(reg) | (val & 0xffff))); 174 177 } ··· 222 225 size = (TMPL_END_IDX * sizeof(kprobe_opcode_t)) / sizeof(int); 223 226 pr_devel("Copying template to %p, size %lu\n", buff, size); 224 227 for (i = 0; i < size; i++) { 225 - rc = patch_instruction((struct ppc_inst *)(buff + i), 226 - ppc_inst(*(optprobe_template_entry + i))); 228 + rc = patch_instruction(buff + i, ppc_inst(*(optprobe_template_entry + i))); 227 229 if (rc < 0) 228 230 goto error; 229 231 } ··· 243 247 goto error; 244 248 } 245 249 246 - rc = create_branch(&branch_op_callback, 247 - (struct ppc_inst *)(buff + TMPL_CALL_HDLR_IDX), 250 + rc = create_branch(&branch_op_callback, buff + TMPL_CALL_HDLR_IDX, 248 251 (unsigned long)op_callback_addr, 249 252 BRANCH_SET_LINK); 250 253 251 - rc |= create_branch(&branch_emulate_step, 252 - (struct ppc_inst *)(buff + TMPL_EMULATE_IDX), 254 + rc |= create_branch(&branch_emulate_step, buff + TMPL_EMULATE_IDX, 253 255 (unsigned long)emulate_step_addr, 254 256 BRANCH_SET_LINK); 255 257 256 258 if (rc) 257 259 goto error; 258 260 259 - patch_instruction((struct ppc_inst *)(buff + TMPL_CALL_HDLR_IDX), 260 - branch_op_callback); 261 - patch_instruction((struct ppc_inst *)(buff + TMPL_EMULATE_IDX), 262 - branch_emulate_step); 261 + patch_instruction(buff + TMPL_CALL_HDLR_IDX, branch_op_callback); 262 + patch_instruction(buff + TMPL_EMULATE_IDX, branch_emulate_step); 263 263 264 264 /* 265 265 * 3. load instruction to be emulated into relevant register, and 266 266 */ 267 - temp = ppc_inst_read((struct ppc_inst *)p->ainsn.insn); 267 + temp = ppc_inst_read(p->ainsn.insn); 268 268 patch_imm_load_insns(ppc_inst_as_ulong(temp), 4, buff + TMPL_INSN_IDX); 269 269 270 270 /* 271 271 * 4. branch back from trampoline 272 272 */ 273 - patch_branch((struct ppc_inst *)(buff + TMPL_RET_IDX), (unsigned long)nip, 0); 273 + patch_branch(buff + TMPL_RET_IDX, nip, 0); 274 274 275 275 flush_icache_range((unsigned long)buff, 276 276 (unsigned long)(&buff[TMPL_END_IDX])); ··· 309 317 */ 310 318 memcpy(op->optinsn.copied_insn, op->kp.addr, 311 319 RELATIVEJUMP_SIZE); 312 - create_branch(&instr, 313 - (struct ppc_inst *)op->kp.addr, 320 + create_branch(&instr, op->kp.addr, 314 321 (unsigned long)op->optinsn.insn, 0); 315 - patch_instruction((struct ppc_inst *)op->kp.addr, instr); 322 + patch_instruction(op->kp.addr, instr); 316 323 list_del_init(&op->list); 317 324 } 318 325 }
+1 -1
arch/powerpc/kernel/setup_32.c
··· 74 74 */ 75 75 notrace void __init machine_init(u64 dt_ptr) 76 76 { 77 - struct ppc_inst *addr = (struct ppc_inst *)patch_site_addr(&patch__memset_nocache); 77 + u32 *addr = (u32 *)patch_site_addr(&patch__memset_nocache); 78 78 struct ppc_inst insn; 79 79 80 80 /* Configure static keys first, now that we're relocated. */
+16 -17
arch/powerpc/kernel/trace/ftrace.c
··· 49 49 addr = ppc_function_entry((void *)addr); 50 50 51 51 /* if (link) set op to 'bl' else 'b' */ 52 - create_branch(&op, (struct ppc_inst *)ip, addr, link ? 1 : 0); 52 + create_branch(&op, (u32 *)ip, addr, link ? 1 : 0); 53 53 54 54 return op; 55 55 } ··· 79 79 } 80 80 81 81 /* replace the text with the new text */ 82 - if (patch_instruction((struct ppc_inst *)ip, new)) 82 + if (patch_instruction((u32 *)ip, new)) 83 83 return -EPERM; 84 84 85 85 return 0; ··· 94 94 addr = ppc_function_entry((void *)addr); 95 95 96 96 /* use the create_branch to verify that this offset can be branched */ 97 - return create_branch(&op, (struct ppc_inst *)ip, addr, 0) == 0; 97 + return create_branch(&op, (u32 *)ip, addr, 0) == 0; 98 98 } 99 99 100 100 static int is_bl_op(struct ppc_inst op) ··· 208 208 } 209 209 #endif /* CONFIG_MPROFILE_KERNEL */ 210 210 211 - if (patch_instruction((struct ppc_inst *)ip, pop)) { 211 + if (patch_instruction((u32 *)ip, pop)) { 212 212 pr_err("Patching NOP failed.\n"); 213 213 return -EPERM; 214 214 } ··· 280 280 281 281 op = ppc_inst(PPC_RAW_NOP()); 282 282 283 - if (patch_instruction((struct ppc_inst *)ip, op)) 283 + if (patch_instruction((u32 *)ip, op)) 284 284 return -EPERM; 285 285 286 286 return 0; ··· 380 380 return -1; 381 381 } 382 382 383 - if (patch_branch((struct ppc_inst *)tramp, ptr, 0)) { 383 + if (patch_branch((u32 *)tramp, ptr, 0)) { 384 384 pr_debug("REL24 out of range!\n"); 385 385 return -1; 386 386 } ··· 424 424 } 425 425 } 426 426 427 - if (patch_instruction((struct ppc_inst *)ip, ppc_inst(PPC_RAW_NOP()))) { 427 + if (patch_instruction((u32 *)ip, ppc_inst(PPC_RAW_NOP()))) { 428 428 pr_err("Patching NOP failed.\n"); 429 429 return -EPERM; 430 430 } ··· 589 589 { 590 590 int err; 591 591 struct ppc_inst op; 592 - unsigned long ip = rec->ip; 592 + u32 *ip = (u32 *)rec->ip; 593 593 594 594 /* read where this goes */ 595 - if (copy_inst_from_kernel_nofault(&op, (void *)ip)) 595 + if (copy_inst_from_kernel_nofault(&op, ip)) 596 596 return -EFAULT; 597 597 598 598 /* It should be pointing to a nop */ ··· 608 608 } 609 609 610 610 /* create the branch to the trampoline */ 611 - err = create_branch(&op, (struct ppc_inst *)ip, 612 - rec->arch.mod->arch.tramp, BRANCH_SET_LINK); 611 + err = create_branch(&op, ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK); 613 612 if (err) { 614 613 pr_err("REL24 out of range!\n"); 615 614 return -EINVAL; ··· 616 617 617 618 pr_devel("write to %lx\n", rec->ip); 618 619 619 - if (patch_instruction((struct ppc_inst *)ip, op)) 620 + if (patch_instruction(ip, op)) 620 621 return -EPERM; 621 622 622 623 return 0; ··· 761 762 /* The new target may be within range */ 762 763 if (test_24bit_addr(ip, addr)) { 763 764 /* within range */ 764 - if (patch_branch((struct ppc_inst *)ip, addr, BRANCH_SET_LINK)) { 765 + if (patch_branch((u32 *)ip, addr, BRANCH_SET_LINK)) { 765 766 pr_err("REL24 out of range!\n"); 766 767 return -EINVAL; 767 768 } ··· 789 790 } 790 791 791 792 /* Ensure branch is within 24 bits */ 792 - if (create_branch(&op, (struct ppc_inst *)ip, tramp, BRANCH_SET_LINK)) { 793 + if (create_branch(&op, (u32 *)ip, tramp, BRANCH_SET_LINK)) { 793 794 pr_err("Branch out of range\n"); 794 795 return -EINVAL; 795 796 } 796 797 797 - if (patch_branch((struct ppc_inst *)ip, tramp, BRANCH_SET_LINK)) { 798 + if (patch_branch((u32 *)ip, tramp, BRANCH_SET_LINK)) { 798 799 pr_err("REL24 out of range!\n"); 799 800 return -EINVAL; 800 801 } ··· 850 851 struct ppc_inst old, new; 851 852 int ret; 852 853 853 - old = ppc_inst_read((struct ppc_inst *)&ftrace_call); 854 + old = ppc_inst_read((u32 *)&ftrace_call); 854 855 new = ftrace_call_replace(ip, (unsigned long)func, 1); 855 856 ret = ftrace_modify_code(ip, old, new); 856 857 ··· 858 859 /* Also update the regs callback function */ 859 860 if (!ret) { 860 861 ip = (unsigned long)(&ftrace_regs_call); 861 - old = ppc_inst_read((struct ppc_inst *)&ftrace_regs_call); 862 + old = ppc_inst_read((u32 *)&ftrace_regs_call); 862 863 new = ftrace_call_replace(ip, (unsigned long)func, 1); 863 864 ret = ftrace_modify_code(ip, old, new); 864 865 }
+3 -3
arch/powerpc/kernel/uprobes.c
··· 42 42 return -EINVAL; 43 43 44 44 if (cpu_has_feature(CPU_FTR_ARCH_31) && 45 - ppc_inst_prefixed(ppc_inst_read(&auprobe->insn)) && 45 + ppc_inst_prefixed(ppc_inst_read(auprobe->insn)) && 46 46 (addr & 0x3f) == 60) { 47 47 pr_info_ratelimited("Cannot register a uprobe on 64 byte unaligned prefixed instruction\n"); 48 48 return -EINVAL; ··· 119 119 * support doesn't exist and have to fix-up the next instruction 120 120 * to be executed. 121 121 */ 122 - regs->nip = (unsigned long)ppc_inst_next((void *)utask->vaddr, &auprobe->insn); 122 + regs->nip = (unsigned long)ppc_inst_next((void *)utask->vaddr, auprobe->insn); 123 123 124 124 user_disable_single_step(current); 125 125 return 0; ··· 182 182 * emulate_step() returns 1 if the insn was successfully emulated. 183 183 * For all other cases, we need to single-step in hardware. 184 184 */ 185 - ret = emulate_step(regs, ppc_inst_read(&auprobe->insn)); 185 + ret = emulate_step(regs, ppc_inst_read(auprobe->insn)); 186 186 if (ret > 0) 187 187 return true; 188 188
+23 -26
arch/powerpc/lib/code-patching.c
··· 18 18 #include <asm/setup.h> 19 19 #include <asm/inst.h> 20 20 21 - static int __patch_instruction(struct ppc_inst *exec_addr, struct ppc_inst instr, 22 - struct ppc_inst *patch_addr) 21 + static int __patch_instruction(u32 *exec_addr, struct ppc_inst instr, u32 *patch_addr) 23 22 { 24 23 if (!ppc_inst_prefixed(instr)) { 25 24 u32 val = ppc_inst_val(instr); ··· 39 40 return -EFAULT; 40 41 } 41 42 42 - int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) 43 + int raw_patch_instruction(u32 *addr, struct ppc_inst instr) 43 44 { 44 45 return __patch_instruction(addr, instr, addr); 45 46 } ··· 147 148 return 0; 148 149 } 149 150 150 - static int do_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) 151 + static int do_patch_instruction(u32 *addr, struct ppc_inst instr) 151 152 { 152 153 int err; 153 - struct ppc_inst *patch_addr = NULL; 154 + u32 *patch_addr = NULL; 154 155 unsigned long flags; 155 156 unsigned long text_poke_addr; 156 157 unsigned long kaddr = (unsigned long)addr; ··· 171 172 goto out; 172 173 } 173 174 174 - patch_addr = (struct ppc_inst *)(text_poke_addr + (kaddr & ~PAGE_MASK)); 175 + patch_addr = (u32 *)(text_poke_addr + (kaddr & ~PAGE_MASK)); 175 176 176 177 __patch_instruction(addr, instr, patch_addr); 177 178 ··· 186 187 } 187 188 #else /* !CONFIG_STRICT_KERNEL_RWX */ 188 189 189 - static int do_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) 190 + static int do_patch_instruction(u32 *addr, struct ppc_inst instr) 190 191 { 191 192 return raw_patch_instruction(addr, instr); 192 193 } 193 194 194 195 #endif /* CONFIG_STRICT_KERNEL_RWX */ 195 196 196 - int patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) 197 + int patch_instruction(u32 *addr, struct ppc_inst instr) 197 198 { 198 199 /* Make sure we aren't patching a freed init section */ 199 200 if (init_mem_is_free && init_section_contains(addr, 4)) { ··· 204 205 } 205 206 NOKPROBE_SYMBOL(patch_instruction); 206 207 207 - int patch_branch(struct ppc_inst *addr, unsigned long target, int flags) 208 + int patch_branch(u32 *addr, unsigned long target, int flags) 208 209 { 209 210 struct ppc_inst instr; 210 211 ··· 256 257 } 257 258 NOKPROBE_SYMBOL(is_conditional_branch); 258 259 259 - int create_branch(struct ppc_inst *instr, 260 - const struct ppc_inst *addr, 260 + int create_branch(struct ppc_inst *instr, const u32 *addr, 261 261 unsigned long target, int flags) 262 262 { 263 263 long offset; ··· 276 278 return 0; 277 279 } 278 280 279 - int create_cond_branch(struct ppc_inst *instr, const struct ppc_inst *addr, 281 + int create_cond_branch(struct ppc_inst *instr, const u32 *addr, 280 282 unsigned long target, int flags) 281 283 { 282 284 long offset; ··· 323 325 return instr_is_relative_branch(instr) && (ppc_inst_val(instr) & BRANCH_SET_LINK); 324 326 } 325 327 326 - static unsigned long branch_iform_target(const struct ppc_inst *instr) 328 + static unsigned long branch_iform_target(const u32 *instr) 327 329 { 328 330 signed long imm; 329 331 ··· 339 341 return (unsigned long)imm; 340 342 } 341 343 342 - static unsigned long branch_bform_target(const struct ppc_inst *instr) 344 + static unsigned long branch_bform_target(const u32 *instr) 343 345 { 344 346 signed long imm; 345 347 ··· 355 357 return (unsigned long)imm; 356 358 } 357 359 358 - unsigned long branch_target(const struct ppc_inst *instr) 360 + unsigned long branch_target(const u32 *instr) 359 361 { 360 362 if (instr_is_branch_iform(ppc_inst_read(instr))) 361 363 return branch_iform_target(instr); ··· 365 367 return 0; 366 368 } 367 369 368 - int translate_branch(struct ppc_inst *instr, const struct ppc_inst *dest, 369 - const struct ppc_inst *src) 370 + int translate_branch(struct ppc_inst *instr, const u32 *dest, const u32 *src) 370 371 { 371 372 unsigned long target; 372 373 target = branch_target(src); ··· 392 395 * instruction of the exception, not the first one 393 396 */ 394 397 395 - patch_branch((struct ppc_inst *)(ibase + (exc / 4) + 1), addr, 0); 398 + patch_branch(ibase + (exc / 4) + 1, addr, 0); 396 399 } 397 400 #endif 398 401 399 402 #ifdef CONFIG_CODE_PATCHING_SELFTEST 400 403 401 - static int instr_is_branch_to_addr(const struct ppc_inst *instr, unsigned long addr) 404 + static int instr_is_branch_to_addr(const u32 *instr, unsigned long addr) 402 405 { 403 406 if (instr_is_branch_iform(ppc_inst_read(instr)) || 404 407 instr_is_branch_bform(ppc_inst_read(instr))) ··· 420 423 int err; 421 424 struct ppc_inst instr; 422 425 u32 tmp[2]; 423 - struct ppc_inst *iptr = (struct ppc_inst *)tmp; 426 + u32 *iptr = tmp; 424 427 unsigned long addr = (unsigned long)tmp; 425 428 426 429 /* The simplest case, branch to self, no flags */ ··· 498 501 499 502 static void __init test_create_function_call(void) 500 503 { 501 - struct ppc_inst *iptr; 504 + u32 *iptr; 502 505 unsigned long dest; 503 506 struct ppc_inst instr; 504 507 505 508 /* Check we can create a function call */ 506 - iptr = (struct ppc_inst *)ppc_function_entry(test_trampoline); 509 + iptr = (u32 *)ppc_function_entry(test_trampoline); 507 510 dest = ppc_function_entry(test_create_function_call); 508 511 create_branch(&instr, iptr, dest, BRANCH_SET_LINK); 509 512 patch_instruction(iptr, instr); ··· 514 517 { 515 518 int err; 516 519 unsigned long addr; 517 - struct ppc_inst *iptr, instr; 520 + struct ppc_inst instr; 518 521 u32 tmp[2]; 522 + u32 *iptr = tmp; 519 523 unsigned int flags; 520 524 521 - iptr = (struct ppc_inst *)tmp; 522 525 addr = (unsigned long)iptr; 523 526 524 527 /* The simplest case, branch to self, no flags */ ··· 723 726 extern unsigned int code_patching_test1_expected[]; 724 727 extern unsigned int end_code_patching_test1[]; 725 728 726 - __patch_instruction((struct ppc_inst *)code_patching_test1, 729 + __patch_instruction(code_patching_test1, 727 730 ppc_inst_prefix(OP_PREFIX << 26, 0x00000000), 728 - (struct ppc_inst *)code_patching_test1); 731 + code_patching_test1); 729 732 730 733 check(!memcmp(code_patching_test1, 731 734 code_patching_test1_expected,
+47 -48
arch/powerpc/lib/feature-fixups.c
··· 33 33 long alt_end_off; 34 34 }; 35 35 36 - static struct ppc_inst *calc_addr(struct fixup_entry *fcur, long offset) 36 + static u32 *calc_addr(struct fixup_entry *fcur, long offset) 37 37 { 38 38 /* 39 39 * We store the offset to the code as a negative offset from 40 40 * the start of the alt_entry, to support the VDSO. This 41 41 * routine converts that back into an actual address. 42 42 */ 43 - return (struct ppc_inst *)((unsigned long)fcur + offset); 43 + return (u32 *)((unsigned long)fcur + offset); 44 44 } 45 45 46 - static int patch_alt_instruction(struct ppc_inst *src, struct ppc_inst *dest, 47 - struct ppc_inst *alt_start, struct ppc_inst *alt_end) 46 + static int patch_alt_instruction(u32 *src, u32 *dest, u32 *alt_start, u32 *alt_end) 48 47 { 49 48 int err; 50 49 struct ppc_inst instr; ··· 51 52 instr = ppc_inst_read(src); 52 53 53 54 if (instr_is_relative_branch(ppc_inst_read(src))) { 54 - struct ppc_inst *target = (struct ppc_inst *)branch_target(src); 55 + u32 *target = (u32 *)branch_target(src); 55 56 56 57 /* Branch within the section doesn't need translating */ 57 58 if (target < alt_start || target > alt_end) { ··· 68 69 69 70 static int patch_feature_section(unsigned long value, struct fixup_entry *fcur) 70 71 { 71 - struct ppc_inst *start, *end, *alt_start, *alt_end, *src, *dest, nop; 72 + u32 *start, *end, *alt_start, *alt_end, *src, *dest; 72 73 73 74 start = calc_addr(fcur, fcur->start_off); 74 75 end = calc_addr(fcur, fcur->end_off); ··· 90 91 return 1; 91 92 } 92 93 93 - nop = ppc_inst(PPC_RAW_NOP()); 94 - for (; dest < end; dest = ppc_inst_next(dest, &nop)) 95 - raw_patch_instruction(dest, nop); 94 + for (; dest < end; dest++) 95 + raw_patch_instruction(dest, ppc_inst(PPC_RAW_NOP())); 96 96 97 97 return 0; 98 98 } ··· 150 152 151 153 // See comment in do_entry_flush_fixups() RE order of patching 152 154 if (types & STF_BARRIER_FALLBACK) { 153 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 154 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 155 - patch_branch((struct ppc_inst *)(dest + 1), 155 + patch_instruction(dest, ppc_inst(instrs[0])); 156 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 157 + patch_branch(dest + 1, 156 158 (unsigned long)&stf_barrier_fallback, BRANCH_SET_LINK); 157 159 } else { 158 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 159 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 160 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 160 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 161 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 162 + patch_instruction(dest, ppc_inst(instrs[0])); 161 163 } 162 164 } 163 165 ··· 210 212 211 213 pr_devel("patching dest %lx\n", (unsigned long)dest); 212 214 213 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 214 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 215 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 216 - patch_instruction((struct ppc_inst *)(dest + 3), ppc_inst(instrs[3])); 217 - patch_instruction((struct ppc_inst *)(dest + 4), ppc_inst(instrs[4])); 218 - patch_instruction((struct ppc_inst *)(dest + 5), ppc_inst(instrs[5])); 215 + patch_instruction(dest, ppc_inst(instrs[0])); 216 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 217 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 218 + patch_instruction(dest + 3, ppc_inst(instrs[3])); 219 + patch_instruction(dest + 4, ppc_inst(instrs[4])); 220 + patch_instruction(dest + 5, ppc_inst(instrs[5])); 219 221 } 220 222 printk(KERN_DEBUG "stf-barrier: patched %d exit locations (%s barrier)\n", i, 221 223 (types == STF_BARRIER_NONE) ? "no" : ··· 279 281 280 282 pr_devel("patching dest %lx\n", (unsigned long)dest); 281 283 282 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 284 + patch_instruction(dest, ppc_inst(instrs[0])); 283 285 284 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 285 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 286 - patch_instruction((struct ppc_inst *)(dest + 3), ppc_inst(instrs[3])); 286 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 287 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 288 + patch_instruction(dest + 3, ppc_inst(instrs[3])); 287 289 } 288 290 289 291 printk(KERN_DEBUG "uaccess-flush: patched %d locations (%s flush)\n", i, ··· 355 357 pr_devel("patching dest %lx\n", (unsigned long)dest); 356 358 357 359 if (types == L1D_FLUSH_FALLBACK) { 358 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 359 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 360 - patch_branch((struct ppc_inst *)(dest + 1), 360 + patch_instruction(dest, ppc_inst(instrs[0])); 361 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 362 + patch_branch(dest + 1, 361 363 (unsigned long)&entry_flush_fallback, BRANCH_SET_LINK); 362 364 } else { 363 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 364 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 365 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 365 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 366 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 367 + patch_instruction(dest, ppc_inst(instrs[0])); 366 368 } 367 369 } 368 370 ··· 374 376 pr_devel("patching dest %lx\n", (unsigned long)dest); 375 377 376 378 if (types == L1D_FLUSH_FALLBACK) { 377 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 378 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 379 - patch_branch((struct ppc_inst *)(dest + 1), 379 + patch_instruction(dest, ppc_inst(instrs[0])); 380 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 381 + patch_branch(dest + 1, 380 382 (unsigned long)&scv_entry_flush_fallback, BRANCH_SET_LINK); 381 383 } else { 382 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 383 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 384 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 384 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 385 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 386 + patch_instruction(dest, ppc_inst(instrs[0])); 385 387 } 386 388 } 387 389 ··· 440 442 441 443 pr_devel("patching dest %lx\n", (unsigned long)dest); 442 444 443 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 444 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 445 - patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 445 + patch_instruction(dest, ppc_inst(instrs[0])); 446 + patch_instruction(dest + 1, ppc_inst(instrs[1])); 447 + patch_instruction(dest + 2, ppc_inst(instrs[2])); 446 448 } 447 449 448 450 printk(KERN_DEBUG "rfi-flush: patched %d locations (%s flush)\n", i, ··· 475 477 dest = (void *)start + *start; 476 478 477 479 pr_devel("patching dest %lx\n", (unsigned long)dest); 478 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instr)); 480 + patch_instruction(dest, ppc_inst(instr)); 479 481 } 480 482 481 483 printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); ··· 518 520 dest = (void *)start + *start; 519 521 520 522 pr_devel("patching dest %lx\n", (unsigned long)dest); 521 - patch_instruction((struct ppc_inst *)dest, ppc_inst(instr[0])); 522 - patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instr[1])); 523 + patch_instruction(dest, ppc_inst(instr[0])); 524 + patch_instruction(dest + 1, ppc_inst(instr[1])); 523 525 } 524 526 525 527 printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); ··· 533 535 end = (void *)curr + *(curr + 1); 534 536 for (; start < end; start++) { 535 537 pr_devel("patching dest %lx\n", (unsigned long)start); 536 - patch_instruction((struct ppc_inst *)start, ppc_inst(PPC_RAW_NOP())); 538 + patch_instruction(start, ppc_inst(PPC_RAW_NOP())); 537 539 } 538 540 } 539 541 ··· 552 554 void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) 553 555 { 554 556 long *start, *end; 555 - struct ppc_inst *dest; 557 + u32 *dest; 556 558 557 559 if (!(value & CPU_FTR_LWSYNC)) 558 560 return ; ··· 569 571 static void do_final_fixups(void) 570 572 { 571 573 #if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE) 572 - struct ppc_inst inst, *src, *dest, *end; 574 + struct ppc_inst inst; 575 + u32 *src, *dest, *end; 573 576 574 577 if (PHYSICAL_START == 0) 575 578 return; 576 579 577 - src = (struct ppc_inst *)(KERNELBASE + PHYSICAL_START); 578 - dest = (struct ppc_inst *)KERNELBASE; 580 + src = (u32 *)(KERNELBASE + PHYSICAL_START); 581 + dest = (u32 *)KERNELBASE; 579 582 end = (void *)src + (__end_interrupts - _stext); 580 583 581 584 while (src < end) {
+2 -2
arch/powerpc/mm/maccess.c
··· 12 12 return is_kernel_addr((unsigned long)unsafe_src); 13 13 } 14 14 15 - int copy_inst_from_kernel_nofault(struct ppc_inst *inst, struct ppc_inst *src) 15 + int copy_inst_from_kernel_nofault(struct ppc_inst *inst, u32 *src) 16 16 { 17 17 unsigned int val, suffix; 18 18 int err; ··· 21 21 if (err) 22 22 return err; 23 23 if (IS_ENABLED(CONFIG_PPC64) && get_op(val) == OP_PREFIX) { 24 - err = copy_from_kernel_nofault(&suffix, (void *)src + 4, 4); 24 + err = copy_from_kernel_nofault(&suffix, src + 1, sizeof(suffix)); 25 25 *inst = ppc_inst_prefix(val, suffix); 26 26 } else { 27 27 *inst = ppc_inst(val);
+2 -2
arch/powerpc/perf/core-book3s.c
··· 460 460 sizeof(instr))) 461 461 return 0; 462 462 463 - return branch_target((struct ppc_inst *)&instr); 463 + return branch_target(&instr); 464 464 } 465 465 466 466 /* Userspace: need copy instruction here then translate it */ ··· 468 468 sizeof(instr))) 469 469 return 0; 470 470 471 - target = branch_target((struct ppc_inst *)&instr); 471 + target = branch_target(&instr); 472 472 if ((!target) || (instr & BRANCH_ABSOLUTE)) 473 473 return target; 474 474
+2 -2
arch/powerpc/platforms/86xx/mpc86xx_smp.c
··· 73 73 74 74 /* Setup fake reset vector to call __secondary_start_mpc86xx. */ 75 75 target = (unsigned long) __secondary_start_mpc86xx; 76 - patch_branch((struct ppc_inst *)vector, target, BRANCH_SET_LINK); 76 + patch_branch(vector, target, BRANCH_SET_LINK); 77 77 78 78 /* Kick that CPU */ 79 79 smp_86xx_release_core(nr); ··· 83 83 mdelay(1); 84 84 85 85 /* Restore the exception vector */ 86 - patch_instruction((struct ppc_inst *)vector, ppc_inst(save_vector)); 86 + patch_instruction(vector, ppc_inst(save_vector)); 87 87 88 88 local_irq_restore(flags); 89 89
+2 -2
arch/powerpc/platforms/powermac/smp.c
··· 810 810 * b __secondary_start_pmac_0 + nr*8 811 811 */ 812 812 target = (unsigned long) __secondary_start_pmac_0 + nr * 8; 813 - patch_branch((struct ppc_inst *)vector, target, BRANCH_SET_LINK); 813 + patch_branch(vector, target, BRANCH_SET_LINK); 814 814 815 815 /* Put some life in our friend */ 816 816 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0); ··· 823 823 mdelay(1); 824 824 825 825 /* Restore our exception vector */ 826 - patch_instruction((struct ppc_inst *)vector, ppc_inst(save_vector)); 826 + patch_instruction(vector, ppc_inst(save_vector)); 827 827 828 828 local_irq_restore(flags); 829 829 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
+5 -5
arch/powerpc/xmon/xmon.c
··· 100 100 /* Breakpoint stuff */ 101 101 struct bpt { 102 102 unsigned long address; 103 - struct ppc_inst *instr; 103 + u32 *instr; 104 104 atomic_t ref_count; 105 105 int enabled; 106 106 unsigned long pad; ··· 946 946 } 947 947 948 948 patch_instruction(bp->instr, instr); 949 - patch_instruction(ppc_inst_next(bp->instr, &instr), 949 + patch_instruction(ppc_inst_next(bp->instr, bp->instr), 950 950 ppc_inst(bpinstr)); 951 951 if (bp->enabled & BP_CIABR) 952 952 continue; 953 - if (patch_instruction((struct ppc_inst *)bp->address, 953 + if (patch_instruction((u32 *)bp->address, 954 954 ppc_inst(bpinstr)) != 0) { 955 955 printf("Couldn't write instruction at %lx, " 956 956 "disabling breakpoint there\n", bp->address); ··· 992 992 if (mread_instr(bp->address, &instr) 993 993 && ppc_inst_equal(instr, ppc_inst(bpinstr)) 994 994 && patch_instruction( 995 - (struct ppc_inst *)bp->address, ppc_inst_read(bp->instr)) != 0) 995 + (u32 *)bp->address, ppc_inst_read(bp->instr)) != 0) 996 996 printf("Couldn't remove breakpoint at %lx\n", 997 997 bp->address); 998 998 } ··· 2214 2214 if (setjmp(bus_error_jmp) == 0) { 2215 2215 catch_memory_errors = 1; 2216 2216 sync(); 2217 - *instr = ppc_inst_read((struct ppc_inst *)adrs); 2217 + *instr = ppc_inst_read((u32 *)adrs); 2218 2218 sync(); 2219 2219 /* wait a little while to see if we get a machine check */ 2220 2220 __delay(200);