• Victor Kamensky's avatar
    ARM: 8137/1: fix get_user BE behavior for target variable with size of 8 bytes · d9981380
    Victor Kamensky authored
    e38361d0 'ARM: 8091/2: add get_user() support for 8 byte types' commit
    broke V7 BE get_user call when target var size is 64 bit, but '*ptr' size
    is 32 bit or smaller. e38361d0 changed type of __r2 from 'register
    unsigned long' to 'register typeof(x) __r2 asm("r2")' i.e before the change
    even when target variable size was 64 bit, __r2 was still 32 bit.
    But after e38361d0 commit, for target var of 64 bit size, __r2 became 64
    bit and now it should occupy 2 registers r2, and r3. The issue in BE case
    that r3 register is least significant word of __r2 and r2 register is most
    significant word of __r2. But __get_user_4 still copies result into r2 (most
    significant word of __r2). Subsequent code copies from __r2 into x, but
    for situation described it will pick up only garbage from r3 register.
    
    Special __get_user_64t_(124) functions are introduced. They are similar to
    corresponding __get_user_(124) function but result stored in r3 register
    (lsw in case of 64 bit __r2 in BE image). Those function are used by
    get_user macro in case of BE and target var size is 64bit.
    
    Also changed __get_user_lo8 name into __get_user_32t_8 to get consistent
    naming accross all cases.
    Signed-off-by: default avatarVictor Kamensky <victor.kamensky@linaro.org>
    Suggested-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    d9981380
uaccess.h 14.7 KB