• Linus Torvalds's avatar
    x86: improve on the non-rep 'copy_user' function · 427fda2c
    Linus Torvalds authored
    The old 'copy_user_generic_unrolled' function was oddly implemented for
    largely historical reasons: it had been largely based on the uncached
    copy case, which has some other concerns.
    
    For example, the __copy_user_nocache() function uses 'movnti' for the
    destination stores, and those want the destination to be aligned.  In
    contrast, the regular copy function doesn't really care, and trying to
    align things only complicates matters.
    
    Also, like the clear_user function, the copy function had some odd
    handling of the repeat counts, complicating the exception handling for
    no really good reason.  So as with clear_user, just write it to keep all
    the byte counts in the %rcx register, exactly like the 'rep movs'
    functionality that this replaces.
    
    Unlike a real 'rep movs', we do allow for this to trash a few temporary
    registers to not have to unnecessarily save/restore registers on the
    stack.
    
    And like the clearing case, rename this to what it now clearly is:
    'rep_movs_alternative', and make it one coherent function, so that it
    shows up as such in profiles (instead of the odd split between
    "copy_user_generic_unrolled" and "copy_user_short_string", the latter of
    which was not about strings at all, and which was shared with the
    uncached case).
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    427fda2c
check.c 108 KB