Rewrite the optimized memcpy/bcopy/bzero support subsystem. Rip out the
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 29 Apr 2004 17:25:03 +0000 (17:25 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 29 Apr 2004 17:25:03 +0000 (17:25 +0000)
commit263541dbed4ce4d88ed87b418356a3c7cc501e3b
tree2b8fe55edfc94b0c6499abf0d9a6c1e39c594a96
parentab4bc20f38fc16da37732cc80447337b557a2148
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.
20 files changed:
sys/conf/files.i386
sys/i386/i386/bcopy.s [new file with mode: 0644]
sys/i386/i386/bzero.s [new file with mode: 0644]
sys/i386/i386/genassym.c
sys/i386/i386/globals.s
sys/i386/i386/support.s
sys/i386/i386/swtch.s
sys/i386/include/globaldata.h
sys/i386/include/md_var.h
sys/i386/isa/npx.c
sys/platform/pc32/i386/bcopy.s [new file with mode: 0644]
sys/platform/pc32/i386/bzero.s [new file with mode: 0644]
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/i386/globals.s
sys/platform/pc32/i386/support.s
sys/platform/pc32/i386/swtch.s
sys/platform/pc32/include/globaldata.h
sys/platform/pc32/include/md_var.h
sys/platform/pc32/isa/npx.c
sys/platform/vkernel/i386/genassym.c