Skip to contentSkip to conversation

memcpy development

DISCUSSION David S. Miller 1 participant 1 message Aug 21, 2004 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

Every arch developer has probably written one of these things at least 4 times, but I figured I'd donate my copy instead of losing it to the sands of time. :-)

It shouldn't be too hard to hack up to use on other platforms. The easiest thing to get working is the verifier, for each of memcpy-*.c simply replace U{1,3}memcpy.S with your platforms memcpy implementations you want to test, add those *.S files and mention them properly in the Makefile. Then just go "make verify", the tests are:

memcpy-{1,2,bi}.c From the gcc testsuite with some mods of
my own. In particular, memcpy-2.c was changed to verify every single case of modulo 64 byte alignment of source and destination. This actually matters on sparc64 as each 64 % 8 alignment uses a different code path in the UltraSparc-I/II/IIi/IIe memcpy routine.

memcpy-mmap.c My own little hack to make sure the routine
does not do loads past the end of the source buffer. This is the hardest to debug when you put it into the kernel since such an error can result in a complete system hang.

The timings are done by test.c, it is testing the in-cache case of course. test2.c is my incredibly crude attempt to try and get some kind of cache-miss testing.

test.c takes 0, 1 or 2 arguments.

- if 0 arguments, both src and dst are 64-byte aligned
- if 1 argument, it is a byte offset to give to the src buffer
- if 2 arguments the first is src offset, the second is dst offset

So you can test the performance of various weird alignments by saying things like "./test 0 1 >out01; ./test 1 0 >out10;" etc.

Enjoy.