This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug string/22353] sysdeps/i386/i586/strcpy.S isn't maintainable


https://sourceware.org/bugzilla/show_bug.cgi?id=22353

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22353/master has been created
        at  75588c0e4cd27ad868256d094b5f7646bc404ca8 (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=75588c0e4cd27ad868256d094b5f7646bc404ca8

commit 75588c0e4cd27ad868256d094b5f7646bc404ca8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 27 06:31:57 2017 -0700

    Add strcpy-stosb.S

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2fa584ae979326fd9cb33e6df9c50976643cbd84

commit 2fa584ae979326fd9cb33e6df9c50976643cbd84
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 27 03:09:12 2017 -0700

    Add i386 strcpy.S

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d78abd26b8c8da5b9d67773343824606f9c96a6a

commit d78abd26b8c8da5b9d67773343824606f9c96a6a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 27 02:31:13 2017 -0700

    i586: Use a jump table in strcpy.S [BZ #22353]

    i586 strcpy.S used a clever trick with LEA to avoid jump table:

    /* ECX has the last 2 bits of the address of source - 1.  */
        andl    $3, %ecx

            call    2f
    2:      popl    %edx
        /* 0xb is the distance between 2: and 1:.  */
            leal    0xb(%edx,%ecx,8), %ecx
            jmp     *%ecx

            .align 8
    1:  /* ECX == 0 */
            orb     (%esi), %al
            jz      L(end)
            stosb
            xorl    %eax, %eax
            incl    %esi
        /* ECX == 1 */
            orb     (%esi), %al
            jz      L(end)
            stosb
            xorl    %eax, %eax
            incl    %esi
        /* ECX == 2 */
            orb     (%esi), %al
            jz      L(end)
            stosb
            xorl    %eax, %eax
            incl    %esi
        /* ECX == 3 */
    L(1):   movl    (%esi), %ecx
            leal    4(%esi),%esi

    This may fail if there are instruction changes before L(1):.  This patch
    replaces it with a jump table which works with any instruction changes.

    Tested on i586 and i686 with and without --disable-multi-arch.

        [BZ #22353]
        * sysdeps/i386/i586/strcpy.S (JMPTBL): New.
        (BRANCH_TO_JMPTBL_ENTRY): Likewise.
        (STRCPY): Use it.
        (1): Renamed to ...
        (L(Src0)): This.
        (L(Src1)): New.
        (L(Src2)): Likewise.
        (L(1)): Renamed to ...
        (L(Src3)): This.
        (L(SrcTable)): New.

-----------------------------------------------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]