[comp.os.misc] Interrupts in user space; Lightweight Traps

seanf@sco.COM (Sean Fagan) (10/02/90)

In article <12824@encore.Encore.COM> jkenton@pinocchio.encore.com (Jeff Kenton) writes:
>On the 88000 this sort of fast trap is also possible, and various suppliers
>of 88000 boxes have made use of them (especially the real-time people). 

So can the '386.  The question is, is it a win, in the general case, to do it,
and how do you do it?  I can picture a system call

	void (*trap) (int trapno, void (*)(int)) (int);

similar to the unix signal() syscall.  (Obviously, you would then set it up
such that the trap would jump into user mode.)

And, of course, you would have a header file (<trap.h> or <sys/trap.h>),
which would define the trap numbers.  You would only want to allow certain
conditions to be trapped, such as overflow, divide by zero, fp exception,
etc.

For languages such as Ada or PL/I, which want to be able to trap these
things, it would certainly be quicker (I guess 8-)) than having to go
through the kernel for the trap.  But I think the major speedup would be
from the fact that you could make a general function, which called a
function pointer, which you could change when you entered or left blocks
(instead of making a system call for each exception you wish to handle).

Note that I've moved this to comp.os.misc; I think it's more appropriate
there (or comp.lang.misc, if it comes to that, but I think c.o.m is still
correct).

-- 
-----------------+
Sean Eric Fagan  | "Never knock on Death's door:  ring the bell and 
seanf@sco.COM    |   run away!  Death really hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.