Rewrite the optimized memcpy/bcopy/bzero support subsystem. Rip out the
old FreeBSD code almost entirely.
* Add support for stacked ONFAULT routines, allowing copyin and copyout to
call the general memcpy entry point instead of rolling their own.
* Split memcpy/bcopy and bzero into their own files
* Add support for XMM (128 bit) and MMX (64 bit) media instruction copies
* Rewrite the integer code. Also note that most of the previous integer
and FP special case support had been ripped out of DragonFly long ago
in that the assembly was no longer being referenced. It doesn't make
sense to have a dozen different zeroing/copying routines so focus on
the ones that work well with recent (last ~5 years) cpus.
* Rewrite the FP state handling code. Instead of restoring the FP state
let it hang, which allows userland to make multiple syscalls and/or for
the system to make multiple bcopy()/memcpy() calls without having to
save/restore the FP state on each call. Userland will take a fault when
it needs the FP again.
Note that FP optimized copies only occur for block sizes >= 2048 bytes,
so this is not something that userland, or the kernel, will trip up on
every time it tries to do a bcopy().
* LWKT threads need to be able to save the FP state, add the simple
conditional and 5 lines of assembly required to do that.
AMD Athlon notes: 64 bit media instructions will get us 90% of the way
there. It is possible to squeeze out slightly more memory bandwidth from
the 128 bit XMM instructions (SSE2). While it does not exist in this commit
there are two additional features that can be used: prefetching and
non-temporal writes. Prefetching is a 3dNOW instruction and can squeeze
out significant additionaL performance if you fetch ~128 bytes ahead of
the game, but I believe it is AMD-only. Non-temporal writes can double
UNCACHED memory bandwidth, but they have a horrible effect on L1/L2
performance and you can't mix non-temporal writes with normal writes without
completely destroying memory performance (e.g. multiple GB/s -> less then
100 MBytes/sec).
Neither prefetching nor non-temporal writes are implemented in this commit.