Now uses -ms macros

This commit is contained in:
ceriel
1993-03-30 15:43:44 +00:00
parent e9a4337ccf
commit 5117853b1b
19 changed files with 647 additions and 667 deletions

View File

@@ -1,13 +1,12 @@
.SN 9
.VS 1 0
.BP
.S1 "TRAPS AND INTERRUPTS"
.bp
.P1 "TRAPS AND INTERRUPTS"
.PP
EM provides a means for the user program to catch all traps
generated by the program itself, the hardware, or external conditions.
This mechanism uses five instructions: LIM, SIM, SIG, TRP and RTT.
This section of the manual may be omitted on the first reading since it
presupposes knowledge of the EM instruction set.
.P
.PP
The action taken when a trap occurs is determined by the value
of an internal EM trap register.
This register contains a pointer to a procedure.
@@ -26,7 +25,7 @@ Two consecutive SIGs are a no-op.
When a trap occurs, the trap register is reset to its initial
condition, to prevent recursive traps from hanging the machine up,
e.g. stack overflow in the stack overflow handling procedure.
.P
.PP
The runtime systems for some languages need to ignore some EM
traps.
EM offers a feature called the ignore mask.
@@ -37,24 +36,24 @@ If a certain bit is 1 the corresponding trap never
occurs and processing simply continues.
The actions performed by the offending instruction are
described by the Pascal program in appendix A.
.N
.br
If the bit is 0, traps are not ignored.
The instructions LIM and SIM allow copying and replacement of
the ignore mask.~
.P
.PP
The TRP instruction generates a trap, the trap number being found on the
stack.
This is, among other things,
useful for library procedures and runtime systems.
It can also be used by a low level trap procedure to pass the trap to a
higher level one (see example below).
.P
.PP
The RTT instruction returns from the trap procedure and continues after the
trap.
In the list below all traps marked with an asterisk ('*') are
considered to be fatal and it is explicitly undefined what happens when
restarting after the trap.
.P
.PP
The way a trap procedure is called is completely compatible
with normal calling conventions. The only way a trap procedure
differs from normal procedures is the return. It has to use RTT instead
@@ -62,25 +61,20 @@ of RET. This is necessary because the complete runtime status is saved on the
stack before calling the procedure and all this status has to be reloaded.
Error numbers are in the range 0 to 252.
The trap numbers are divided into three categories:
.IS 4
.N 1
.PS - 10
.PT ~~0\-~63
.IP "\0\00\-\063" 12
EM machine errors, e.g. illegal instruction.
.PS - 8
.PT ~0\-15
.RS
.IP "\00\-15" 8
maskable
.PT 16\-63
.IP "16\-63" 8
not maskable
.PE
.PT ~64\-127
.RE
.IP "\064\-127" 12
Reserved for use by compilers, run time systems, etc.
.PT 128\-252
.IP "128\-252" 12
Available for user programs.
.PE 1
.IE
.LP
EM machine errors are numbered as follows:
.DS I 5
.TS
tab(@);
n l l.
@@ -108,15 +102,16 @@ n l l.
26@EBADLIN@Argument of LIN too high
27@EBADGTO@GTO descriptor error
.TE
.DE 0
.P
.PP
As an example,
suppose a subprocedure has to be written to do a numeric
calculation.
When an overflow occurs the computation has to be stopped and
the higher level procedure must be resumed.
This can be programmed as follows using the mechanism described above:
.DS B
.LP
.KS
.nf
.ta 1n 24n
mes 2,2,2 ; set sizes
ersave
@@ -150,10 +145,12 @@ msave
jmpbuf
con *1,0,0
end
.DE 0
.VS
.DS
.KE
.KS
.LP
Example of catch procedure
.LP
.nf
.ta 1n 24n
pro $catch,0 ; Local procedure that must catch the overflow trap
lol 2 ; Load trap number
@@ -168,4 +165,5 @@ Example of catch procedure
trp ; call other trap procedure
rtt ; if other procedure returns, do the same
end
.DE
.KE
.fi