mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-15 19:12:35 +03:00
56 lines
642 B
Plaintext
56 lines
642 B
Plaintext
section .text
|
|
|
|
global memcpy
|
|
memcpy:
|
|
mov rcx, rdx
|
|
mov rax, rdi
|
|
rep movsb
|
|
ret
|
|
|
|
global memset
|
|
memset:
|
|
push rdi
|
|
mov rax, rsi
|
|
mov rcx, rdx
|
|
rep stosb
|
|
pop rax
|
|
ret
|
|
|
|
global memmove
|
|
memmove:
|
|
mov rcx, rdx
|
|
mov rax, rdi
|
|
|
|
cmp rdi, rsi
|
|
ja .copy_backwards
|
|
|
|
rep movsb
|
|
jmp .done
|
|
|
|
.copy_backwards:
|
|
lea rdi, [rdi+rcx-1]
|
|
lea rsi, [rsi+rcx-1]
|
|
std
|
|
rep movsb
|
|
cld
|
|
|
|
.done:
|
|
ret
|
|
|
|
global memcmp
|
|
memcmp:
|
|
mov rcx, rdx
|
|
repe cmpsb
|
|
je .equal
|
|
|
|
mov al, byte [rdi-1]
|
|
sub al, byte [rsi-1]
|
|
movsx rax, al
|
|
jmp .done
|
|
|
|
.equal:
|
|
xor eax, eax
|
|
|
|
.done:
|
|
ret
|