[PATCH 10/20] powerpc/xmon: Factor out the oft-repeated setjmp logic

Michael Ellerman michael at ellerman.id.au
Wed Oct 10 11:59:51 EST 2012


On Wed, 2012-10-10 at 09:23 +1100, Paul Mackerras wrote:
> On Wed, Oct 10, 2012 at 01:20:37AM +1100, Michael Ellerman wrote:
> > We have over 15 routines that implement essentially the same logic
> > in terms of catching faults. Pull the logic out into two helper
> > routines.
> > 
> > The pattern becomes:
> > 
> > 	if (start_bus_error_jump() == 0) {
> > 		<do potentially faulting things>
> > 
> > 		end_bus_error_jump();
> > 	} else {
> > 		printf("Faulting thing faulted!\n");
> > 	}
> 
> NAK...  think about how setjmp() works.  You can't return from the
> function that called setjmp() while there is any possibility that
> longjmp() could be called for the same jmp_buf.

Sigh, yeah. Somehow I'd convinced myself that it worked in this case,
but after a night's sleep I'm not sure what my logic was.

cheers



More information about the Linuxppc-dev mailing list