Commit e64ac41a authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/uaccess: Switch __patch_instruction() to __put_user_asm_goto()

__patch_instruction() is the only user of __put_user_asm() outside
of asm/uaccess.h

Switch to the new __put_user_asm_goto() to enable retirement of
__put_user_asm() in a later patch.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b9745b122f4a9ae72cef445c61320022ab8b77b7.1599216721.git.christophe.leroy@csgroup.eu
parent ee0a49a6
...@@ -21,21 +21,18 @@ ...@@ -21,21 +21,18 @@
static int __patch_instruction(struct ppc_inst *exec_addr, struct ppc_inst instr, static int __patch_instruction(struct ppc_inst *exec_addr, struct ppc_inst instr,
struct ppc_inst *patch_addr) struct ppc_inst *patch_addr)
{ {
int err = 0; if (!ppc_inst_prefixed(instr))
__put_user_asm_goto(ppc_inst_val(instr), patch_addr, failed, "stw");
if (!ppc_inst_prefixed(instr)) { else
__put_user_asm(ppc_inst_val(instr), patch_addr, err, "stw"); __put_user_asm_goto(ppc_inst_as_u64(instr), patch_addr, failed, "std");
} else {
__put_user_asm(ppc_inst_as_u64(instr), patch_addr, err, "std");
}
if (err)
return err;
asm ("dcbst 0, %0; sync; icbi 0,%1; sync; isync" :: "r" (patch_addr), asm ("dcbst 0, %0; sync; icbi 0,%1; sync; isync" :: "r" (patch_addr),
"r" (exec_addr)); "r" (exec_addr));
return 0; return 0;
failed:
return -EFAULT;
} }
int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment