|
|
1.1 root 1: #
2: # trap and fault interfaces
3: # these are common to all (big) vaxes
4: # the microvaxes are elsewhere
5: #
6:
7: .comm _nofault,4 # where to go instead of death on some traps
8:
9: .text
10:
11: #
12: # machine check: the VAX catchall fault
13: #
14: .globl Xmachcheck
15: .align 2
16: Xmachcheck:
17: pushr $SAVREG
18: tstl _nofault # machine check expected?
19: jeql 1f
20: calls $0,_machreset # yes. clear fault indicators
21: popr $SAVREG
22: addl2 (sp)+,sp
23: jbr donofault
24: 1:
25: addl3 sp,NRS*4(sp),r0
26: addl2 $8+(NRS*4),r0
27: pushab NRS*4(sp) # machine check vector
28: pushl (r0) # saved ps
29: calls $2,_machinecheck
30: popr $SAVREG # returned -> recovered
31: addl2 (sp)+,sp
32: rei
33:
34: #
35: # kernel stack not valid. give up.
36: #
37: .globl Xkspnotval
38: .align 2
39: Xkspnotval:
40: pushr $SAVREG
41: mfpr $IPL,-(sp)
42: mtpr $HIGH,$IPL
43: pushab 1f
44: calls $1,_panic
45:
46: 1: .asciz "ksp invalid"
47:
48: #
49: # power failure
50: # eventually, do something smarter
51: #
52: .globl Xpowfail
53: .align 2
54: Xpowfail:
55: pushr $SAVREG # why not?
56: pushab 1f
57: calls $1,_printf # doubtless won't finish
58: 0: brb 0b # but if it does
59:
60: 1: .asciz "power\n"
61:
62: #
63: # mysterious change mode instructions
64: #
65: .globl Xchmx
66: .align 2
67: Xchmx: # chm[use]
68: pushr $SAVREG
69: pushab 1f
70: calls $1,_panic
71: 1:
72: .asciz "chm?"
73:
74: #
75: # `soft' clock interrupt;
76: # software level 8
77: #
78: .globl Xsoftclock
79: .align 2
80: Xsoftclock:
81: pushr $SAVREG
82: pushl 4+NRS*4(sp)
83: pushl 4+NRS*4(sp)
84: calls $2,_softclock # softclock(pc,psl)
85: popr $SAVREG
86: rei
87:
88: #
89: # console device interrupts
90: # should perhaps be better hidden
91: #
92:
93: .globl Xcnrint
94: .align 2
95: Xcnrint:
96: pushr $SAVREG
97: clrl -(sp)
98: calls $1,_cnrint
99: popr $SAVREG
100: rei
101:
102: .globl Xcnxint
103: .align 2
104: Xcnxint:
105: pushr $SAVREG
106: clrl -(sp)
107: calls $1,_cnxint
108: popr $SAVREG
109: rei
110:
111: #
112: # various traps that go through trap.c
113: # identified by a trap type, stored here,
114: # and sometimes by a code
115: #
116:
117: #
118: # software level 2:
119: # reschedule trap, profiling
120: #
121: .globl Xastflt
122: .align 2
123: Xastflt:
124: pushl $0
125: pushl $ASTFLT
126: jbr alltraps
127:
128: #
129: # software level 3:
130: # stream queue scheduling
131: #
132: .globl Xqsched
133: .align 2
134: Xqsched:
135: pushr $SAVREG
136: calls $0,_queuerun
137: popr $SAVREG
138: rei
139:
140: #
141: # privileged instruction fault
142: #
143: .globl Xprivinflt
144: .align 2
145: Xprivinflt:
146: pushl $0
147: pushl $PRIVINFLT
148: jbr alltraps
149:
150: #
151: # xfc instruction fault
152: #
153: .globl Xxfcflt
154: .align 2
155: Xxfcflt:
156: pushl $0
157: pushl $XFCFLT
158: jbr alltraps
159:
160: #
161: # reserved operand fault
162: # references to I/O space sometimes cause this,
163: # hence the nofault
164: #
165: .globl Xresopflt
166: .align 2
167: Xresopflt:
168: tstl _nofault
169: jneq donofault
170: pushl $0
171: pushl $RESOPFLT
172: jbr alltraps
173:
174: #
175: # reserved addressing mode fault
176: #
177: .globl Xresadflt
178: .align 2
179: Xresadflt:
180: pushl $0
181: pushl $RESADFLT
182: jbr alltraps
183:
184: #
185: # breakpoint instruction
186: #
187: .globl Xbptflt
188: .align 2
189: Xbptflt:
190: pushl $0
191: pushl $BPTFLT
192: jbr alltraps
193:
194: #
195: # compatibility mode fault
196: # code is some fault type
197: #
198: .globl Xcompatflt
199: .align 2
200: Xcompatflt:
201: pushl $COMPATFLT
202: jbr alltraps
203:
204: #
205: # trace bit in psl trap
206: #
207: .globl Xtracep
208: .align 2
209: Xtracep:
210: pushl $0
211: pushl $TRCTRAP
212: jbr alltraps
213:
214: #
215: # arithmetic exception
216: # code is some description of the fault
217: #
218: .globl Xarithtrap
219: .align 2
220: Xarithtrap:
221: pushl $ARITHTRAP
222: jbr alltraps
223:
224: #
225: # access violation trap
226: # code is the faulty address
227: # silly pdp-11 compatibility:
228: # distinguish between protection faults
229: # and segmentation violations
230: #
231: .globl Xprotflt
232: .align 2
233: Xprotflt:
234: tstl _nofault
235: beql 1f
236: addl2 $8,sp
237: jbr donofault
238: 1:
239: blbs (sp)+,segflt
240: pushl $PROTFLT
241: jbr alltraps
242:
243: segflt:
244: pushl $SEGFLT
245: jbr alltraps
246:
247: #
248: # translation not valid == page fault
249: # code is the invalid address
250: # distinguish between ordinary faults
251: # and page table not valid faults
252: #
253: .globl Xtransflt
254: .align 2
255: Xtransflt:
256: bitl $1,(sp)+
257: bnequ tableflt
258: pushl $PAGEFLT
259: jbr alltraps
260:
261: tableflt:
262: pushl $TABLEFLT
263: # jbr alltraps
264:
265: #
266: # here one way or another for any call to trap
267: # code, type already on the stack
268: #
269:
270: alltraps:
271: mfpr $USP,-(sp)
272: calls $0,_trap
273: mtpr (sp)+,$USP
274: addl2 $8,sp # pop type, code
275: mtpr $HIGH,$IPL ## dont go to a higher IPL (GROT)
276: rei
277:
278: #
279: # here on chmk == syscall
280: # separate from ordinary trap code for speed
281: #
282: .globl Xsyscall
283: .align 2
284: Xsyscall:
285: tstl -(sp) # loathsome nonsense
286: mfpr $USP,-(sp)
287: calls $0,_syscall
288: mtpr (sp)+,$USP
289: addl2 $8,sp # pop code and loathsome nonsense
290: ## mtpr $HIGH,$IPL ## dont go to a higher IPL (GROT)
291: rei
292:
293: #
294: # here to return from a trap recovered by nofault
295: #
296: donofault:
297: movl _nofault,(sp)
298: bicl2 $PSL_FPD,4(sp)
299: rei
300:
301: #
302: # do the nofault trick from within a device interrupt
303: # this is a bit unhealthy
304: # from within xxNint (not from deeper in the call stack),
305: # cknofault()
306: # will arrange for the interrupt to return to the nofault location,
307: # and return nonzero if there was such a place
308: #
309: # assume caller's stack frame looks like
310: # fp/ 0
311: # 4 words of calls-saved junk
312: # unknown number of saved registers
313: # ap/ count
314: # count words of argument, probably just one
315: # NRS words of saved registers
316: # saved pc
317: # saved ps
318: #
319:
320: .globl _cknofault
321: _cknofault:
322: .word 0
323: movl _nofault,r0
324: beql 9f # no nofault in progress
325: movl 8(fp),r1 # arg pointer of caller
326: movzbl (r1),r2 # length of arg list
327: mull2 $4,r2 # in words
328: addl2 $(NRS+1)*4,r2 # + our saved regs + arg count word
329: addl2 r2,r1
330: movl r0,(r1) # overlay return PC
331: bicl2 $PSL_FPD,4(r1) # in case of restartable instr
332: 9: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.