[PATCH 1/5] powerpc/lib/sstep: Add cmpb instruction emulation

Segher Boessenkool segher at kernel.crashing.org
Thu Jul 13 16:46:13 AEST 2017


On Thu, Jul 13, 2017 at 01:25:44PM +1000, Matt Brown wrote:
> +static nokprobe_inline void do_cmpb(struct pt_regs *regs, unsigned long v1,
> +				unsigned long v2, int rd)
> +{
> +	unsigned long out_val, mask;
> +	int i;
> +
> +	out_val = 0;
> +	for (i = 0; i < 8; i++) {
> +		mask = 0xff << (i * 8);

0xffUL ?

> +
> +		if ((v1 & mask) == (v2 & mask))
> +			out_val |= mask;
> +	}
> +
> +	regs->gpr[rd] = out_val;
> +}


Segher


More information about the Linuxppc-dev mailing list