added 1 changeset to branch 'refs/remotes/HaikuPM-github/package-management' old head: 2bf492b64bad5dcaa62b23362557917f308c0e94 new head: bcbf22a316baf9c159b286ca774b27b21102b53f overview: https://github.com/haiku/HaikuPM/compare/2bf492b...bcbf22a ---------------------------------------------------------------------------- bcbf22a: 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. [ Ingo Weinhold <ingo_weinhold@xxxxxx> ] ---------------------------------------------------------------------------- Commit: bcbf22a316baf9c159b286ca774b27b21102b53f Author: Ingo Weinhold <ingo_weinhold@xxxxxx> Date: Sun May 5 16:01:12 2013 UTC ---------------------------------------------------------------------------- 2 files changed, 6 insertions(+) src/system/kernel/arch/x86/32/arch.S | 3 +++ src/system/kernel/arch/x86/64/arch.S | 3 +++ ---------------------------------------------------------------------------- diff --git a/src/system/kernel/arch/x86/32/arch.S b/src/system/kernel/arch/x86/32/arch.S index 90ef56b..68d7038 100644 --- a/src/system/kernel/arch/x86/32/arch.S +++ b/src/system/kernel/arch/x86/32/arch.S @@ -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 diff --git a/src/system/kernel/arch/x86/64/arch.S b/src/system/kernel/arch/x86/64/arch.S index 3f07b95..baf8d09 100644 --- a/src/system/kernel/arch/x86/64/arch.S +++ b/src/system/kernel/arch/x86/64/arch.S @@ -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