using SSE2 in kernel C code (improving AES-NI module)

Konstantin Belousov kostikbel at gmail.com
Sun Oct 21 06:10:24 UTC 2012


On Sat, Oct 20, 2012 at 07:47:26PM -0700, John-Mark Gurney wrote:
> Peter Wemm wrote this message on Sat, Oct 20, 2012 at 11:10 -0700:
> > Or, another option.. do something like genassym or the many other
> > kernel build tools.  aicasm builds and runs a userland tool to
> > generate something to build into the kernel.  With sufficient
> > cross-contamination safeguards I wonder if something similar might be
> > able to be done here.
> 
> Well, looks like I may this working...  Turns out I can't name the file
> .s otherwise config puts it in SFILES which causes all sorts of problems..
> So, I went w/ .nos, does any one else have any suggestions?
> 
> how does this look to people:
> aesni_wrap2.nos                 optional aesni                             \
>         dependency      "$S/crypto/aesni/aesni_wrap2.c"                    \
>         compile-with    "${CC} -O3 -fPIC -S -o aesni_wrap2.nos $S/crypto/aesni/aesni_wrap2.c" \   
>         no-obj no-implicit-rule before-depend                              \
>         clean           "aesni_wrap2.nos"
> aesni_wrap2.o                   optional aesni                             \
>         dependency      "aesni_wrap2.nos"                                  \
>         compile-with    "${NORMAL_S} aesni_wrap2.nos"                      \
>         no-implicit-rule                                                   \
>         clean           "aesni_wrap2.o"
> 
> We'll have to do something similar in the module Makefile, but that is
> easier...
> 
> Also, I thought we had a better way to note that some devices depend
> upon others than just throwing a depend error...  If you include aesni
> w/o crypto, you get error about missing cryptodev_if.h...
> 
Hm, if such thing is possible, why do you need to compile through the
.S at all ? All you need is to specify the special compiling flags,
including -msse and -msse2.

Note, you shall not need -fPIC, at least for amd64. I would suggest to use
-O2, as well as to try to honour the -g settings.

Most likely, you can put the ${CFLAGS} on the command line, followed
by -msse -msse2.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20121021/45098c93/attachment.sig>


More information about the freebsd-arch mailing list