Skip to content

Commit

Permalink
selftests/powerpc: Fix build failure of load_unaligned_zeropad test
Browse files Browse the repository at this point in the history
Commit 7a5692e ("arch/powerpc: provide zero_bytemask() for
big-endian") added a call to __fls() in our word-at-a-time.h. That was
fine for the kernel build but missed the fact that we also use
word-at-a-time.h in a userspace test.

Pulling in the kernel version of __fls() gets messy, so just define our
own, it's unlikely to change often.

Fixes: 7a5692e ("arch/powerpc: provide zero_bytemask() for big-endian")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Michael Ellerman committed Oct 13, 2015
1 parent f2dd80e commit abb39bc
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@

#define FIXUP_SECTION ".ex_fixup"

static inline unsigned long __fls(unsigned long x);

#include "word-at-a-time.h"

#include "utils.h"

static inline unsigned long __fls(unsigned long x)
{
int lz;

asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
return sizeof(unsigned long) - 1 - lz;
}

static int page_size;
static char *mem_region;
Expand Down

0 comments on commit abb39bc

Please sign in to comment.