> I had to disassemble memcpy to find out how is implemented. The header
files don’t specify anything about it being inlined. rep movs byte ptr ->
on a memory mapped device results in a performance bottleneck.
****
That’s a little surprising, given the source is included with the compiler
install, at least for the Visual Studio version.
The C version, for my install, is found in
c:\Program Files (x86)\Microsoft Visual Studio 10.0\vc\crt\src\memcpy.c
and the assembly-code version is found in
c:\Program Files (x86)\Microsoft Visual Studio
10.0\vc\crt\src\intel\memccpy.asm
Note that the meanings of memcpy and memmove are explicitly documented.
I did some experiments with memmove which passed. For how long will it not
be inlined? Also, the x WinDBG command shows the same location for memcpy
and memmove.
****
memmove semantics are a superset of memcpy semantics. The assembly code
source for memmove.asm, in its entirety, is
;***
;memmove.asm -
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; memmove() copies a source memory buffer to a destination buffer.
; Overlapping buffers are treated specially, to avoid propogation.
;
; NOTE: This stub module scheme is compatible with NT build
; procedure.
;
;*******************************************************************************
MEM_MOVE EQU 1
INCLUDE Intel\MEMCPY.ASM
******
Note that a casual reading of the source shows why they appear to be the
same location.
******
To conclude on WinDDK\7600.16385.1
- memcpy is inlined on chk builds
- the crt does export memcpy and memmove at the same location
- memmove is not inlined.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer