Cleanups/optimizations.
This commit is contained in:
@@ -278,9 +278,8 @@ FUNCTION(arch_cpu_user_strlcpy):
|
|||||||
|
|
||||||
/* If count is now 0, skip straight to null terminating
|
/* If count is now 0, skip straight to null terminating
|
||||||
as our loop will otherwise overflow */
|
as our loop will otherwise overflow */
|
||||||
cmp $0,%ecx
|
jnz .L_user_strlcpy_copy_begin
|
||||||
jne .L_user_strlcpy_copy_begin
|
movb $0,(%edi)
|
||||||
movb $0,(%edi)
|
|
||||||
jmp .L_user_strlcpy_source_count
|
jmp .L_user_strlcpy_source_count
|
||||||
|
|
||||||
.L_user_strlcpy_copy_begin:
|
.L_user_strlcpy_copy_begin:
|
||||||
@@ -289,30 +288,24 @@ FUNCTION(arch_cpu_user_strlcpy):
|
|||||||
/* move data by bytes */
|
/* move data by bytes */
|
||||||
movsb
|
movsb
|
||||||
cmpb $0,-1(%esi)
|
cmpb $0,-1(%esi)
|
||||||
je .L_user_strlcpy_copy_loop_done
|
je .L_user_strlcpy_source_done
|
||||||
loop .L_user_strlcpy_copy_loop
|
loop .L_user_strlcpy_copy_loop
|
||||||
|
|
||||||
.L_user_strlcpy_copy_loop_done:
|
|
||||||
/* check if we copied the entire source string */
|
|
||||||
cmp $0,%ecx
|
|
||||||
jne .L_user_strlcpy_source_done
|
|
||||||
|
|
||||||
.L_user_strlcpy_zero_terminate:
|
|
||||||
/* null terminate string */
|
/* null terminate string */
|
||||||
movb $0,(%edi)
|
movb $0,(%edi)
|
||||||
dec %esi
|
dec %esi
|
||||||
|
|
||||||
/* count remaining bytes in src */
|
/* count remaining bytes in src */
|
||||||
.L_user_strlcpy_source_count:
|
.L_user_strlcpy_source_count:
|
||||||
not %ecx
|
not %ecx
|
||||||
movb $0,%al
|
xor %al,%al
|
||||||
repnz
|
repnz
|
||||||
scasb
|
scasb
|
||||||
|
|
||||||
.L_user_strlcpy_source_done:
|
.L_user_strlcpy_source_done:
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
subl 20(%esp),%eax
|
subl 20(%esp),%eax
|
||||||
subl $1,%eax
|
dec %eax
|
||||||
/* restore the old fault handler */
|
/* restore the old fault handler */
|
||||||
movl %ebx,(%edx)
|
movl %ebx,(%edx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user