x86[-64]: Fix arch_cpu_user_strlcpy() for small buffers

The case for small buffers was broken, since scasb operates on edi/rdi,
not esi/rsi.
This commit is contained in:
Ingo Weinhold 2013-05-05 18:01:12 +02:00
parent 2bf492b64b
commit bcbf22a316
2 changed files with 6 additions and 0 deletions

View File

@ -264,9 +264,12 @@ FUNCTION(arch_cpu_user_strlcpy):
/* count remaining bytes in src */
.L_user_strlcpy_source_count:
not %ecx
# %ecx was 0 and is now max
xor %al,%al
movl %esi,%edi
repnz
scasb
movl %edi,%esi
.L_user_strlcpy_source_done:
movl %esi,%eax

View File

@ -251,9 +251,12 @@ FUNCTION(arch_cpu_user_strlcpy):
.L_user_strlcpy_source_count:
// Count remaining bytes in src
not %rcx
# %rcx was 0 and is now max
xor %al, %al
movl %rsi, %rdi
repnz
scasb
movl %rdi, %rsi
.L_user_strlcpy_source_done:
// Restore the old fault handler