• Rob Gardner's avatar
    sparc64: Don't restrict fp regs for no-fault loads · cae9af6a
    Rob Gardner authored
    The function handle_ldf_stq() deals with no-fault ASI
    loads and stores, but restricts fp registers to quad
    word regs (ie, %f0, %f4 etc). This is valid for the
    STQ case, but unnecessarily restricts loads, which
    may be single precision, double, or quad. This results
    in SIGFPE being raised for this instruction when the
    source address is invalid:
    	ldda [%g1] ASI_PNF, %f2
    but not for this one:
    	ldda [%g1] ASI_PNF, %f4
    The validation check for quad register is moved to
    within the STQ block so that loads are not affected
    by the check.
    
    An additional problem is that the calculation for freg
    is incorrect when a single precision load is being
    handled. This causes %f1 to be seen as %f32 etc,
    and the incorrect register ends up being overwritten.
    This code sequence demonstrates the problem:
    	ldd [%g1], %f32		! g1 = valid address
    	lda [%i3] ASI_PNF, %f1  ! i3 = invalid address
    	std %f32, [%g1]
    This is corrected by basing the freg calculation on
    the load size.
    Signed-off-by: default avatarRob Gardner <rob.gardner@oracle.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cae9af6a
unaligned_64.c 17.6 KB