Walter said:
I've just had a look at the kazlib code, and if I scan it properly,
the only kind of exceptions that can be caught are those thrown by
a call to the kazlib's except_throw().
I was talking about software generated "exceptions" here, so no reason
to be surprised that kazlib, don't handle hardware interrupts or
software "exceptions" generated from another exception library.
My reading of your earlier posting was that you were saying
that through use of setjmp() and longjmp(), the OP's requirement
to catch *all* exceptions could be met in standard C.
I said OP could catch the "exceptions" he defined, i.e. enabled and
installed a handler for. Words like *all*, *always* etc., are for others
to use.
<off-topic>
Under the Hood
If OP had understood his own question, he would know that on a
monolithic kernel, this require access to ring 0 (kernel mode). When you
have ring-based security, like e.g. Linux and Windows NT has, exceptions
at one level may destabilize higher levels, but typically not the other
way around. Of course, if you execute your program in Ring 3, you cannot
generally have access too the *all* exceptions at lower levels, this
would break the security.
Furthermore, the old interrupt model is been replaced by level-triggered
interrupts, where the device send a continuous signal down the wire,
until the interrupt service routine explicitly dismisses the interrupt.
If being at Ring 3, of course you cannot get *all* those interrupts
forwarded to you, the interrupt service routine at Ring 0 is the BOSS.
</off-topic>
The signal handling specified in C89 was not very sound, and pretty
worthless in C99 (most signals are undefined).
In a strictly conforming program you cannot longjmp out of an
asynchronous signal handler, since the jmp_buf may be in an invalid
state when the signal occur. To fix this, the programmer need to call
setjmp(), before installing the signal handler.
According to the C experts, a s.c. program can only handle synchronous
signals (SIGFPE, SIGILL and SIGSEGV). The fun part, is that in C99,
implementations don't need to generate any real signals (except after
call to raise). So, standard C is pretty useless when dealing with
hardware interrupts.