[coreboot] Patch merged into coreboot/master: ae57bd0 Fix issues with x86 memcpy

gerrit at coreboot.org gerrit at coreboot.org
Sat Mar 31 20:26:21 CEST 2012


the following patch was just integrated into master:
commit ae57bd02ee4fd5636db10dd180f5d5c622d7e4ed
Author: Mathias Krause <minipli at googlemail.com>
Date:   Sat Mar 31 17:23:53 2012 +0200

    Fix issues with x86 memcpy
    
    The x86 memcpy() implementation did not mention its implicit output
    registers ESI, EDI and ECX which might make this code miscompile when
    the compiler uses the value of EDI for the return value *after* the 'rep
    movsb' has completed. That would break the API of memcpy as this would
    return 'dst+len' instead of 'dst'.
    
    Fix this possible bug by removing the wrong comment and listing all
    output registers as such (using dummy stack variables that get optimized
    away).
    
    Also the leading 'cld' is superflous as the ABI mandates the direction
    flag to be cleared all the time when we're in C (see
    <http://gcc.gnu.org/gcc-4.3/changes.html>) and we have no ASM call sites
    that might require it to be cleared explicitly (SMM might come to mind,
    but it clears the DF itself before passing control to the C part of the
    SMI handler).
    
    Last but not least fix the prototype to match the one from <string.h>.
    
    Change-Id: I106422d41180c4ed876078cabb26b45e49f3fa93
    Signed-off-by: Mathias Krause <minipli at googlemail.com>

Build-Tested: build bot (Jenkins) at Sat Mar 31 18:09:56 2012, giving +1
Reviewed-By: Peter Stuge <peter at stuge.se> at Sat Mar 31 20:26:20 2012, giving +2
See http://review.coreboot.org/836 for details.

-gerrit




More information about the coreboot mailing list