BSD 4 development
[unix-history] / .ref-BSD-3 / usr / src / cmd / px / 34err.s
CommitLineData
b202b2da
CH
1#\f
2# 34err.s
3#
4 .set ECHR,1
5 .set ESYSTEM,2
6 .set EBUILTIN,3
7 .set EHALT,4
8 .set ENILPTR,5
9 .set EPASTEOF,6
10 .set ESQRT,7
11 .set ESTKNEMP,8
12 .set ESUBSCR,9
13 .set EREFINAF,10
14 .set EWRITE,11
15 .set ENAMESIZE,12
16 .set ELN,13
17 .set EBADOP,14
18 .set EBADINUM,15
19 .set EGOTO,16
20 .set ECASE,17
21 .set ESEEK,18
22 .set ECREATE,19
23 .set EOUTOFMEM,20
24 .set ECTTOT,21
25 .set ESTLIM,22
26 .set ESTKOVFLO,23
27 .set EBADFNUM,24
28 .set EREMOVE,25
29 .set ECLOSE,26
30 .set EOPEN,27
31 .set EARGV,28
32 .set EPACK,29
33 .set EUNPACK,30
34 .set ERANGE,31
35 .set EASRT,32
36 .set EREADIT,33
37 .set EWRITEIT,34
38 .set EINTR,35
39 .set EASSIGN,36
40 .set EFIXADD,37
41 .set EFLTADD,38
42 .set EFIXSUB,39
43 .set EFLTSUB,40
44 .set EFIXMUL,41
45 .set EFLTMUL,42
46 .set EFIXDIV,43
47 .set EFLTDIV,44
48 .set EMODDIV,45
49 .set EFIXNEG,46
50 .set ELLIMIT,47
51 .set EFRAMESIZE,48
52 .set ETRASHHEAP,49
53#
54# Fielding interrupts and processing errors
55#
56# Process interpreter detected errors
57#
58error:
59 movzwl _perrno,-(sp)
60 calls $1,_error
61 jmp (r8)
62
63_endinterpret:
64 .byte 'e,'n,'d, 0
65
66#
67# Keyboard interrupts
68#
69 .align 1
70 .globl _intr
71_intr:
72 .word 0
73 pushal _intr #reset interrupt signal
74 pushl $SIGINT
75 calls $2,_signal
76 pushl $EINTR
77 calls $1,_error
78 ret
79#
80# Segmentation Violations => No more memory available for the stack
81#
82 .align 1
83 .globl _memsize
84_memsize:
85 .word 0
86 pushl $ESTKOVFLO
87 calls $1,_error
88 ret
89#
90# Process computational errors
91#
92 .align 1
93 .globl _except
94_except:
95 .word 0
96 pushal _except #reset signal
97 pushl $SIGFPE
98 calls $2,_signal
99 movl PC(fp),r0 #r0 has PC at point following error
100 moval errtbl-4,r1 #r1 points to error offset table
101l3404:
102 addl2 $4,r1 #determine cause of error
103 cmpl r0,(r1)+
104 blssu l3405 #not in table => system error
105 cmpl r0,(r1)+
106 bgtru l3404
107 movzwl (r1),-(sp) #select error message
108 brb l3406
109l3405:
110 pushl $ESYSTEM
111l3406:
112 calls $1,_error
113 ret
114#
115# Table of offsets and their associated errors
116#
117 .align 1
118errtbl:
119 .long _AS2, _OFF, EASSIGN
120 .long _INX2, _NIL, ESUBSCR
121 .long _ADD2, _ADD28, EFIXADD
122 .long _ADD28, _SUB2, EFLTADD
123 .long _SUB2, _SUB28, EFIXSUB
124 .long _SUB28, _SQR2, EFLTSUB
125 .long _SQR2, _MUL28, EFIXMUL
126 .long _MUL28, _DIV2, EFLTMUL
127 .long _DIV2, _MOD2, EFIXDIV
128 .long _MOD2, _ABS2, EMODDIV
129 .long _ABS2, _ABS8, EFIXNEG
130 .long _DVD2, _IND1, EFLTDIV
131 .long _RANG2, _CASE1OP, ERANGE
132 .long _STOI, _UNDEF, EBUILTIN
133 .long _PACK, _UNPACK, EPACK
134 .long _UNPACK, _GET, EUNPACK
135 .long 0xffffffff
136#
137# recover values of dp and lino from the stack
138#
139 .globl _fetchdp
140
141_fetchdp:
142 .word R2|R3|R4|R5|R6|R7|R8|R9|R10|R11
143 pushl fp #sift through the stack to get the
144 movl sp,oldsp # values of dp and lino
145l3401:
146 bicw3 $0xf000,MASK(fp),mask #register save mask
147 moval REGS(fp),sp #point to saved registers
148 popr mask #pop them
149 cmpl PC(fp),$_interpret #check for interpreter frame
150 blss l3402 #not found
151 cmpl PC(fp),$_endinterpret #check for end of interpreter
152 blss l3403 #found
153l3402:
154 movl FP(fp),fp #get next frames registers
155 jbr l3401
156l3403:
157 movl oldsp,sp #restore current frame
158 movl (sp)+,fp
159 movl r9,*4(ap) #return dp
160 movl r11,*8(ap) #return lino
161 ret
162 .data
163oldsp: .space 4 #old value of sp
164mask: .space 2 #register pop mask
165 .text