• Keith Owens's avatar
    [IA64] unwind.c uses wrong unat from switch_stack · b833961b
    Keith Owens authored
    unwind.c can read the wrong unat bits from switch_stack.
    sw->caller_unat is the value of ar.unat when the task was blocked.
    sw->ar_unat is the value of ar.unat after doing st8.spill for r4-7.
    IOW, ar_unat is caller_unat with 4 bits changed.
    
    unw_access_gr() uses sw->ar_unat for r4-7 (correct), but it also uses
    sw->ar_unat for other scratch registers (incorrect).  sw->ar_unat
    should only be used for r4-7, everything else should use
    sw->caller_unat, unless modified by unwind info.  Using sw->ar_unat
    risks picking up the 4 bits that were overwritten when r4-7 were saved.
    
    Also this line is wrong
    	unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_UNAT);
    and should be
    	unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_PFS);
    Signed-off-by: default avatarKeith Owens <kaos@sgi.com>
    Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
    b833961b
unwind.c 62.3 KB