- Fix a bug in RtlFillMemory.

- Fix overlap check comments.

svn path=/trunk/; revision=23887
This commit is contained in:
Alex Ionescu 2006-09-02 16:36:48 +00:00
parent 38ca1d7d77
commit 7802140549

View file

@ -110,7 +110,7 @@ _RtlFillMemory@12:
/* Get pattern */ /* Get pattern */
mov al, [esp+16] mov al, [esp+16]
mov ah, al mov ah, al
shr eax, 16 shl eax, 16
mov al, [esp+16] mov al, [esp+16]
mov ah, al mov ah, al
@ -227,7 +227,7 @@ _RtlMoveMemory@12:
mov ecx, [esp+20] mov ecx, [esp+20]
cld cld
/* Check for overlap */ /* Check if the destination is higher (or equal) */
cmp esi, edi cmp esi, edi
jbe Overlap jbe Overlap
@ -252,15 +252,16 @@ ByteMove:
rep stosb rep stosb
DoneMove: DoneMove:
/* Restore volatiles */
pop edi pop edi
pop esi pop esi
ret 12 ret 12
Overlap: Overlap:
/* Avoid full overlap */ /* Don't copy if they're equal */
jz DoneMove jz DoneMove
/* Remove overlap */ /* Compare pointer distance with given length and check for overlap */
mov eax, edi mov eax, edi
sub eax, esi sub eax, esi
cmp ecx, eax cmp ecx, eax
@ -269,7 +270,7 @@ Overlap:
/* Set direction flag for backward move */ /* Set direction flag for backward move */
std std
/* Can only move some bytes, calculate how many */ /* Copy byte-by-byte the non-overlapping distance */
add esi, ecx add esi, ecx
add edi, ecx add edi, ecx
dec esi dec esi