Re: [RFC] [PATCH] C exceptions in kernel

Keith Owens (kaos@ocs.com.au)
Sun, 24 Feb 2002 10:40:55 +1100


On 24 Feb 2002 00:07:13 +0100,
Jes Sorensen <jes@sunsite.dk> wrote:
>Pete Zaitcev <zaitcev@redhat.com> writes:
>
>> Personally, I have no problem handling current practices.
>> But I may see the point of the guy with the try/catch patch.
>> Do not make me to defend him though. I am trying to learn
>> is those exceptions are actually helpful. BTW, we all know
>> where they come from (all of Cutler's NT is written that way),
>> but let it not cloud our judgement.
>
>The problem here is that when using exceptions, you stop thinking
>about what is going on underneath at the low level which is really not
>what one wants in the kernel.
>
>After all, C is just and advanced assembly interface, which is exactly
>why it's such a great language ;-)

What is worse is that the exceptions patch has to use assembler to walk
the stack frames. Exceptions are being touted as a replacement for
goto in new driver code but the sample patch only works for i386. No
arch independent code can use exceptions until you have arch specific
code that does the equivalent of longjmp for _all_ architectures.

Doing longjmp in the kernel is _hard_, I know because I had to do it
for kdb on i386 and ia64. The kernel does things differently from user
space and sometimes the arch maintainers decide to change the internal
register usage. They are allowed to do this because it only affects
the kernel, but any change to kernel register usage will probably
require a corresponding change to setjmp/longjmp.

So you have arch dependent code which has to be done for all
architectures before any driver can use it and the code has to be kept
up to date by each arch maintainer. Tell me again why the existing
mechanisms are not working and why we need exceptions? IOW, what
existing problem justifies all the extra arch work and maintenance?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/