• David S. Miller's avatar
    [SPARC64]: Fix %tstate ASI handling in start_thread{,32}() · 0f05da6d
    David S. Miller authored
    Niagara helps us find a ancient bug in the sparc64 port :-)
    
    The ASI_* values are plain constant defines, thus signed 32-bit
    on sparc64.  To put shift this into the regs->tstate value we were
    doing or'ing "(ASI_PNF << 24)" into there.
    
    ASI_PNF is 0x82 and shifted left by 24 makes that topmost bit the
    sign bit in a 32-bit value.  This would get sign extended to 64-bits
    and thus corrupt the top-half of the reg->tstate value.
    
    This never caused problems in pre-Niagara cpus because the only thing
    up there were the condition code values.  But Niagara has the global
    register level field, and this all 1's value is illegal there so
    Niagara gives an illegal instruction trap due to this bug.
    
    I'm pretty sure this bug is about as old as the sparc64 port itself.
    
    This also points out that we weren't setting ASI_PNF for 32-bit tasks.
    We should, so fix that while we're here.
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0f05da6d
processor.h 6.51 KB