mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:13:01 +00:00
- Fix a bug in RtlFillMemory.
- Fix overlap check comments. svn path=/trunk/; revision=23887
This commit is contained in:
parent
38ca1d7d77
commit
7802140549
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue