Subversion Repositories Kolibri OS

Rev

Rev 6410 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
145 halyavin 1
format ELF
647 andrew_pro 2
 
145 halyavin 3
section '.text' executable
647 andrew_pro 4
include 'proc32.inc'
5
 
145 halyavin 6
public memcpy
7
public memmove
647 andrew_pro 8
 
6410 siemargl 9
proc memcpy c, to:dword,from:dword,count:dword
6433 siemargl 10
    push esi
11
    push edi
12
    mov ecx,[count]
647 andrew_pro 13
	test ecx,ecx
14
	jz no_copy_block
6433 siemargl 15
        mov esi,[from]
647 andrew_pro 16
		mov edi,[to]
6433 siemargl 17
		cld
647 andrew_pro 18
		rep movsb
6433 siemargl 19
no_copy_block:
647 andrew_pro 20
 
6433 siemargl 21
    pop edi
22
    pop esi
23
    mov eax, [to]
647 andrew_pro 24
	ret
25
endp
26
 
6410 siemargl 27
proc memmove c, to:dword,from:dword,count:dword
647 andrew_pro 28
 
6433 siemargl 29
    push esi
30
    push edi
647 andrew_pro 31
	mov ecx,[count]
32
	test ecx,ecx
33
	jz no_copy_block_
34
		mov esi,[from]
35
		mov edi,[to]
6433 siemargl 36
		cmp esi, edi
37
		je no_copy_block_
38
		jg copy_
39
            add	esi, ecx
40
            add	edi, ecx
41
            dec	esi
42
            dec	edi
43
            std
44
copy_:
647 andrew_pro 45
		rep movsb
6433 siemargl 46
        cld
47
no_copy_block_:
647 andrew_pro 48
 
6433 siemargl 49
    pop edi
50
    pop esi
51
    mov eax,[to]
647 andrew_pro 52
	ret
6433 siemargl 53
endp