X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/7c78c5292a74d7cc20fc03e02fbfc976e072f928..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/i386/string/strncpy.s diff --git a/i386/string/strncpy.s b/i386/string/strncpy.s index dced178..9b1799d 100644 --- a/i386/string/strncpy.s +++ b/i386/string/strncpy.s @@ -177,11 +177,15 @@ LFound0: // %ecx = buffer length remaining LZeroBuffer: - pushl %ecx // remaining buffer size - pushl %edi // ptr to 1st unstored byte - movl $(_COMM_PAGE_BZERO),%eax - call %eax - addl $8,%esp // pop off the arguments +// The stack currently is aligned to 4 mod 16 (it was 0 mod 16 at the time of +// the call, and the return address, edi, and esi have been pushed). It needs +// to aligned 0 mod 16 when we call bzero, so we subtract 20 from esp (not 4 +// because we need to have 8 bytes for the arguments to bzero). + subl $20,%esp + movl %ecx,4(%esp) // remaining buffer size + movl %edi, (%esp) // pointer to first unstored byte + call _bzero + addl $20,%esp LDone: movl 12(%esp),%eax // original dest ptr is return value