Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-10 Thread Mark Kettenis
> Date: Wed, 10 Jun 2020 20:08:31 +0200 > From: Christian Weisgerber > > Next try. > Optimized versions for kernel ffs(3) on arm64, powerpc, powerpc64. > > I have tested arm64; cwen@ has tested powerpc in userland. > powerpc64 is copied from powerpc. > > ok? ok kettenis@ > Index:

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-10 Thread Christian Weisgerber
Next try. Optimized versions for kernel ffs(3) on arm64, powerpc, powerpc64. I have tested arm64; cwen@ has tested powerpc in userland. powerpc64 is copied from powerpc. ok? Index: lib/libkern/arch/arm64/ffs.S === RCS file:

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Theo de Raadt
Mark Kettenis wrote: > > Date: Tue, 9 Jun 2020 23:43:50 +0200 > > From: Christian Weisgerber > > > > Mark Kettenis: > > > > > Unfortunately that doesn't quite work. At least in my build it > > > doesn't pick up .c files in the linker/arch directories. > > > > > > > Index:

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Mark Kettenis
> Date: Tue, 9 Jun 2020 23:43:50 +0200 > From: Christian Weisgerber > > Mark Kettenis: > > > Unfortunately that doesn't quite work. At least in my build it > > doesn't pick up .c files in the linker/arch directories. > > > > > Index: lib/libkern/arch/arm64/ffs.c > > I was certain I had

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Christian Weisgerber
Mark Kettenis: > Unfortunately that doesn't quite work. At least in my build it > doesn't pick up .c files in the linker/arch directories. > > > Index: lib/libkern/arch/arm64/ffs.c I was certain I had checked this, but indeed it doesn't work. The Makefile rules are generated from

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Mark Kettenis
> From: Christian Weisgerber > Date: Tue, 9 Jun 2020 18:39:45 - (UTC) > > Here are optimized ffs(3) implementations for > * arm64 (superseding the earlier ffs.S) > * powerpc > * powerpc64 > > arm64 tested by myself, powerpc tested by cwen@. > > OK? > > (Some other archs fell through.

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Christian Weisgerber
On 2020-06-09, Christian Weisgerber wrote: > Here are optimized ffs(3) implementations for > * arm64 (superseding the earlier ffs.S) > * powerpc > * powerpc64 > +int ffs(int x) Oops, I'm going to change that to int ffs(int x) before commit. -- Christian "naddy" Weisgerber

Re: libkern: ffs() for arm64

2020-06-08 Thread Joerg Sonnenberger
On Mon, Jun 08, 2020 at 11:16:59PM +0200, Christian Weisgerber wrote: > I blame dlg@ for making me scrutinize the POWER7 instruction set, > which led me to the clz instruction, which led me to ffs(). I > wanted to add this to libc, but then realized the futility because > the compiler already

Re: libkern: ffs() for arm64

2020-06-08 Thread Theo de Raadt
Either works for me. Honestly - either one is hard to understand without referring to the docs (and then realizing power numbers bits backwards). - It is simple enough it has to work or there will be chaos and I'm not that afraid of more poeple seeing RETGUARD stubs :) Christian Weisgerber

Re: libkern: ffs() for arm64

2020-06-08 Thread Todd C . Miller
On Mon, 08 Jun 2020 22:35:42 -, Christian Weisgerber wrote: > Style question: > Since this mostly comes down to embedding a single special instruction > in between normal C operations, I wonder whether I should just do .c > with asm() instead of .S, and leave all the boilerplate to the >

Re: libkern: ffs() for arm64

2020-06-08 Thread Christian Weisgerber
On 2020-06-08, Christian Weisgerber wrote: > More archs to come... Style question: Since this mostly comes down to embedding a single special instruction in between normal C operations, I wonder whether I should just do .c with asm() instead of .S, and leave all the boilerplate to the compiler?

libkern: ffs() for arm64

2020-06-08 Thread Christian Weisgerber
Here is an optimized kernel ffs(3) for arm64. I blame dlg@ for making me scrutinize the POWER7 instruction set, which led me to the clz instruction, which led me to ffs(). I wanted to add this to libc, but then realized the futility because the compiler already inlines its optimized copy of