Re: [PATCH] fix backtrace on PA-RISC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


> @@ -305,18 +310,16 @@ static void unwind_frame_regs(struct unw
>  
>  			insn = *(unsigned int *)npc;
>  
> -			if ((insn & 0xffffc000) == 0x37de0000 ||
> -			    (insn & 0xffe00000) == 0x6fc00000) {
> +			if ((insn & 0xffffc001) == 0x37de0000 ||
> +			    (insn & 0xffe00001) == 0x6fc00000) {
>  				/* ldo X(sp), sp, or stwm X,D(sp) */
> -				frame_size += (insn & 0x1 ? -1 << 13 : 0) | 
> -					((insn & 0x3fff) >> 1);
> +				frame_size += (insn & 0x3fff) >> 1;

This doesn't look correct to me.  Look at the disassembly code
in binutils.  In wide mode, an extract_16 operation needs to be
used for ldo.  In non wide mode and for stwm, extract_14 needs
to be used.  extract_14 is a simple 14-bit extraction followed 
low sign extension.

I believe the problem with the original code is that it doesn't
handle wide mode (64-bit kernels) for ldo.

>  				dbg("analyzing func @ %lx, insn=%08x @ "
>  				    "%lx, frame_size = %ld\n", info->ip,
>  				    insn, npc, frame_size);
> -			} else if ((insn & 0xffe00008) == 0x73c00008) {
> +			} else if ((insn & 0xffe00009) == 0x73c00008) {
>  				/* std,ma X,D(sp) */
> -				frame_size += (insn & 0x1 ? -1 << 13 : 0) | 
> -					(((insn >> 4) & 0x3ff) << 3);
> +				frame_size += ((insn >> 4) & 0x3ff) << 3;

I believe the original code is correct for this case.

>  				dbg("analyzing func @ %lx, insn=%08x @ "
>  				    "%lx, frame_size = %ld\n", info->ip,
>  				    insn, npc, frame_size);
> @@ -335,6 +338,9 @@ static void unwind_frame_regs(struct unw
>  			}
>  		}
>  
> +		if (frame_size > e->Total_frame_size << 3)
> +			frame_size = e->Total_frame_size << 3;
> +

??? I don't believe this should happen in frames with a fixed size.
The code probably doesn't handle cases where alloca is used.  The
are some flags for this in the unwind data.

>  		if (!unwind_special(info, e->region_start, frame_size)) {
>  			info->prev_sp = info->sp - frame_size;
>  			if (e->Millicode)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
J. David Anglin                                  dave.anglin@xxxxxxxxxxxxxx
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux