2010-08-11 10:46:23 +00:00
|
|
|
;
|
2011-03-02 05:32:25 +01:00
|
|
|
; Written by the Chair for Operating Systems, RWTH Aachen University
|
|
|
|
;
|
2012-05-24 10:49:45 +02:00
|
|
|
; NO Copyright (C) 2010-2012, Stefan Lankes
|
2011-03-02 05:32:25 +01:00
|
|
|
; consider these trivial functions to be public domain.
|
|
|
|
;
|
|
|
|
; These functions are distributed on an "AS IS" BASIS,
|
2010-08-11 10:46:23 +00:00
|
|
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
;
|
|
|
|
|
2012-06-10 08:05:24 +02:00
|
|
|
[BITS 64]
|
2011-03-31 12:38:04 -07:00
|
|
|
SECTION .text
|
2010-08-11 10:46:23 +00:00
|
|
|
global strcpy
|
|
|
|
strcpy:
|
2012-06-10 08:05:24 +02:00
|
|
|
push rdi
|
2010-08-11 10:46:23 +00:00
|
|
|
|
|
|
|
L1:
|
|
|
|
lodsb
|
|
|
|
stosb
|
|
|
|
test al, al
|
|
|
|
jne L1
|
|
|
|
|
2012-06-10 08:05:24 +02:00
|
|
|
pop rax
|
2010-08-11 10:46:23 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
global strncpy
|
|
|
|
strncpy:
|
2012-06-10 08:05:24 +02:00
|
|
|
push rdi
|
|
|
|
mov rcx, rdx
|
2010-08-11 10:46:23 +00:00
|
|
|
|
|
|
|
L2:
|
2012-06-10 08:05:24 +02:00
|
|
|
dec rcx
|
2010-08-11 10:46:23 +00:00
|
|
|
js L3
|
|
|
|
lodsb
|
|
|
|
stosb
|
|
|
|
test al, al
|
|
|
|
jne L1
|
|
|
|
rep
|
|
|
|
stosb
|
|
|
|
|
|
|
|
L3:
|
2012-06-10 08:05:24 +02:00
|
|
|
pop rax
|
2010-08-11 10:46:23 +00:00
|
|
|
ret
|
2011-02-16 21:19:44 +01:00
|
|
|
|
|
|
|
SECTION .note.GNU-stack noalloc noexec nowrite progbits
|