Commit 6836f099 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/lib/sstep: use truncate_if_32bit()

Use truncate_if_32bit() when possible instead of open coding.

truncate_if_32bit() returns an unsigned long, so don't use it when
a signed value is expected.
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/7e1c07123f13156d4a27991a2e2694fb584bc068.1642752375.git.christophe.leroy@csgroup.eu
parent 7c3bba91
...@@ -1065,8 +1065,7 @@ int emulate_dcbz(unsigned long ea, struct pt_regs *regs) ...@@ -1065,8 +1065,7 @@ int emulate_dcbz(unsigned long ea, struct pt_regs *regs)
int err; int err;
unsigned long size = l1_dcache_bytes(); unsigned long size = l1_dcache_bytes();
if (!(regs->msr & MSR_64BIT)) ea = truncate_if_32bit(regs->msr, ea);
ea &= 0xffffffffUL;
ea &= ~(size - 1); ea &= ~(size - 1);
if (!address_ok(regs, ea, size)) if (!address_ok(regs, ea, size))
return -EFAULT; return -EFAULT;
...@@ -1164,10 +1163,8 @@ static nokprobe_inline void add_with_carry(const struct pt_regs *regs, ...@@ -1164,10 +1163,8 @@ static nokprobe_inline void add_with_carry(const struct pt_regs *regs,
op->type = COMPUTE + SETREG + SETXER; op->type = COMPUTE + SETREG + SETXER;
op->reg = rd; op->reg = rd;
op->val = val; op->val = val;
if (!(regs->msr & MSR_64BIT)) { val = truncate_if_32bit(regs->msr, val);
val = (unsigned int) val; val1 = truncate_if_32bit(regs->msr, val1);
val1 = (unsigned int) val1;
}
op->xerval = regs->xer; op->xerval = regs->xer;
if (val < val1 || (carry_in && val == val1)) if (val < val1 || (carry_in && val == val1))
op->xerval |= XER_CA; op->xerval |= XER_CA;
......
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