Segher Boessenkool <seg...@kernel.crashing.org> writes: > On Tue, Jul 25, 2017 at 01:33:19PM +1000, Matt Brown wrote: >> +static nokprobe_inline void do_prty(struct pt_regs *regs, unsigned long v, >> + int size, int ra) >> +{ >> + unsigned long long res = v; >> + >> + res = (0x0001000100010001 & res) + (0x0001000100010001 & (res >> 8)); >> + res = (0x0000000700000007 & res) + (0x0000000700000007 & (res >> 16)); >> + if (size == 32) { /* prtyw */ >> + regs->gpr[ra] = (0x0000000100000001 & res); >> + return; >> + } >> + >> + res = (0x000000000000000f & res) + (0x000000000000000f & (res >> 32)); >> + regs->gpr[ra] = res & 1; /*prtyd */ >> +} > > Does 7's and 0xf look strange (since the top bit in the values there > is always 0). You always "and" the values with 1 later, you could do > that immediately (and change + to ^). > > A general question about these patches: some things are inside #ifdef > __powerpc64__, some are not. It seems it is the wrong macro, and it > should be used (or not used) consistently?
Why is it the wrong macro? Because we tend to use CONFIG_PPC64 you mean? I thought the reason some are #ifdef'ed is that some are 64-bit only. ie. bpermd is 64-bit only ? cheers