From owner-freebsd-hackers Fri Jan 16 23:15:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA09463 for hackers-outgoing; Fri, 16 Jan 1998 23:15:26 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA09450 for ; Fri, 16 Jan 1998 23:15:01 -0800 (PST) (envelope-from tlambert@usr01.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.8.8/8.8.8) id AAA15241; Sat, 17 Jan 1998 00:15:00 -0700 (MST) Received: from usr01.primenet.com(206.165.6.201) via SMTP by smtp04.primenet.com, id smtpd015206; Sat Jan 17 00:14:52 1998 Received: (from tlambert@localhost) by usr01.primenet.com (8.8.5/8.8.5) id AAA26193; Sat, 17 Jan 1998 00:14:47 -0700 (MST) From: Terry Lambert Message-Id: <199801170714.AAA26193@usr01.primenet.com> Subject: Re: Why no sys/setjmp.h? To: grog@lemis.com (Greg Lehey) Date: Sat, 17 Jan 1998 07:14:47 +0000 (GMT) Cc: tlambert@primenet.com, hackers@FreeBSD.ORG In-Reply-To: <19980116123904.45753@lemis.com> from "Greg Lehey" at Jan 16, 98 12:39:04 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk > > In general, setjmp()/longjmp() prevent all sorts of optimizations > > from being used. > > In the kernel? Anywhere. It means that register variables can't be reused. Specifically, I can't assume a variable in a register won't be reused. The best place to see the problem is in the gcc treatment of the comment "/* NOTREACHED*/". > I can't see a way of using them in this environment. I'm in the top > half of a driver, where things are more like in user space. You can't use them between top half and bottom half. That's the point. > > Finally, the purpose of these functions is to allow the throwing of > > exceptions, and the kernel has it's own exception mechanisms. > > Which are? That was my question. I thought I answered this... tsleep/wakeup. > So what are kernel setjmp and longjmp there for? Mostly, to annoy the compiler. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.