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

From: Davide Libenzi (davidel@xmailserver.org)
Date: Fri Feb 22 2002 - 16:28:48 EST


On 22 Feb 2002, Dan Aloni wrote:

> The attached patch implements C exceptions in the kernel, which *don't*
> depend on special support from the compiler. This is a 'request for
> comments'. The patch is very initial, should not be applied.
>
> I actually got this code to work in the kernel:
>
> try {
> printk("TEST: before throwing \n");
> throw(1000);
> printk("TEST: won't run\n");
> }
> catch(unsigned long, value) {
> printk("TEST: caught: %ld\n", value);
> } yrt;
>
> I know it would a *hugh* task to get all existing code in the kernel
> to use exceptions, but the design allows exceptions to be used locally
> within the local call branches in *new* code. Basically, exception
> handling needs to be added only to functions who call functions which
> already use exceptions.
>
> Although this patch is against 2.4, it should go to 2.5 (2.5.5-dj1
> currently breaks here, so I am temporarily developing it using 2.4)
>
> This patch implements only for i386 at the moment. Theoretically can be
> ported to other archs. Of course, the arch dependant functions in this
> code are separated for the ease of porting.
>
> I haven't written it with interrupts and SMP in mind. I wonder what
> are the race conditions and what should be protected there.
>
> For unhandled exceptions, there's a possibility to add a function that
> printk's the information about the unhandled exception (file, line
> number, etc), and optionally calls panic() or BUG().
>
> The code supports re-throwing from catches.
>
> Last thing: I must get rid of that yrt closer macro. Suggestions?

Is today the 1st of April ? You kidding, don't you ?

- Davide

-
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/



This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:46 EST