|
|
1.1 root 1:
2:
3: #
4: # *alignment exception event test
5: # *word,longword, & quadword alignment are checked
6: #
7: # R5 = PC that failed
8: # R0 = error code
9: # 1 : Expected alignment fault didnot happen
10: # 2 : Error in PC pushed on the stack
11: # R1 = actual, R2 = expected
12: # 3 : Error in PSL pushed on the stack
13: # R1 = actual, R2 = expected
14: # 4 : Too many parameters pushed on the stack
15: #
16:
17:
18: .globl _align_evt
19: _align_evt:
20: .word 0x1ff
21: mtpr $31,$IPL /* Set IPL to HIGH */
22: movab (sp),_savvec0 /* Save current SP */
23: mtpr _savvec0,$ISP /* Set ISP */
24: movl _scb+ALIGNVEC,_savvec2 /* Save alignment fault vector */
25: movab vecvec,_scb+ALIGNVEC /* Set new vector */
26: movl $-1,-(sp) /* Push marker on stack */
27: movab _pcb0,r1 /* Partially set PCB0 */
28: mtpr r1,$PCBB /* Set PCBB to PCB0 */
29: movab (sp),_pcb0 /* PCB_KSP = current SP */
30: movab (sp),_pcb0+4 /* PCB_USP = current SP */
31:
32: movpsl r1 /* If not kernel mode, then force */
33: bitl $0x01000000,r1 /* Kernel mode */
34: beql 1f
35: movl _scb+PINSTVEC,_savvec3
36: movab forckmd,_scb+PINSTVEC
37: halt /* Halt in user mode to force fault */
38: .align 2
39: forckmd:
40: movab (sp)+,tmp0 /*get rid of trash on the stack */
41: movab (sp)+,tmp0
42: movl _savvec3,_scb+PINSTVEC /*restore vector */
43: #
44: # We now in KERNEL MODE; IPL = 0x1f
45: # Try to store a word in an ODD address
46: 1:
47: movab epc1,r5 /* R5 = expected PC on stack */
48: movab spc2,r6 /* R6 = return from exception addr */
49: movpsl r7 /* R7 = Expected PSL to to checked */
50: epc1: movw $256,dtable+1 /* Should cause fault */
51: movl $1,r0 /* Error : NO fault happen */
52: jmp *badrtn
53: #
54: # We now in KERNEL MODE; IPL = 0x1f
55: # Try to store a word in an ODD address
56: spc2:
57: movab epc2,r5 /* R5 = expected PC on stack */
58: movab spc3,r6 /* R6 = return from exception addr */
59: movpsl r7 /* R7 = Expected PSL to to checked */
60: epc2: movw $256,dtable+3 /* Should cause fault */
61: movl $1,r0 /* Error : NO fault happen */
62: jmp *badrtn
63: #
64: # We now in KERNEL MODE; IPL = 0x1f
65: # Try to store a longword in an ODD address
66: spc3:
67: movab epc3,r5 /* R5 = expected PC on stack */
68: movab spc4,r6 /* R6 = return from exception addr */
69: movpsl r7 /* R7 = Expected PSL to to checked */
70: epc3: movl $666666,dtable+1 /* Should cause fault */
71: movl $1,r0
72: jmp *badrtn
73: #
74: # We now in KERNEL MODE; IPL = 0x1f
75: # Try to store a longword in an ODD address
76: spc4:
77: movab epc4,r5 /* R5 = expected PC on stack */
78: movab spc5,r6 /* R6 = return from exception addr */
79: movpsl r7 /* R7 = Expected PSL to to checked */
80: epc4: movl $666666,dtable+2 /* Should cause fault */
81: movl $1,r0 /* Error : NO fault happen */
82: jmp *badrtn
83: #
84: # We now in KERNEL MODE; IPL = 0x1f
85: # Try to store a longword in an ODD address
86: spc5:
87: movab epc5,r5 /* R5 = expected PC on stack */
88: movab spc6,r6 /* R6 = return from exception addr */
89: movpsl r1 /* R7 = Expected PSL to to checked */
90: epc5: movl $666666,dtable+3 /* Should cause fault */
91: movl $1,r0 /* Error : NO fault happen */
92: jmp *badrtn
93: #
94: # We now in KERNEL MODE; IPL = 0x1f
95: # Try to shift a quadword into an ODD address
96: spc6:
97: movab epc6,r5 /* R5 = expected PC on stack */
98: movab spc7,r6 /* R6 = return from exception addr */
99: movpsl r7 /* R7 = Expected PSL to to checked */
100: epc6: shrq $6,dtable+1,r0 /* Should cause fault */
101: movl $1,r0 /* Error : NO fault happen */
102: jmp *badrtn
103: #
104: # We now in KERNEL MODE; IPL = 0x1f
105: # Try to shift a quadword into an ODD address
106: spc7:
107: movab epc7,r5 /* R5 = expected PC on stack */
108: movab spc8,r6 /* R6 = return from exception addr */
109: movpsl r7 /* R7 = Expected PSL to to checked */
110: epc7: shrq $6,dtable+2,r0 /* Should cause fault */
111: movl $1,r0 /* Error : NO fault happen */
112: jmp *badrtn
113: #
114: # We now in KERNEL MODE; IPL = 0x1f
115: # Try to shift a quadword into an ODD address
116: spc8:
117: movab epc8,r5 /* R5 = expected PC on stack */
118: movab eee,r6 /* R6 = return from exception addr */
119: movpsl r7 /* R7 = Expected PSL to to checked */
120: epc8: shrq $6,dtable+3,r0 /* Should cause fault */
121: movl $1,r0 /* Error : NO fault happen */
122: jmp *badrtn
123: #
124: #
125: # Event handler for Data alignment fault
126: #
127: .align 2
128: vecvec:
129: movl (sp)+,r1 /* R1 = actual PC pop from stack */
130: movl r5,r2 /* R5 = expected PC */
131: cmpl r1,r2
132: beql 1f
133: movl $2,r0 /* Error : Wrong PC on stack */
134: jmp *badrtn /* R1 = actual; R2 = expected */
135:
136: 1: movl (sp)+,r1 /* R1 = actual PSL pop from stack */
137: movl r7,r2 /* R2 = expected PSL */
138: cmpl r2,r1
139: beql 1f
140: movl $3,r0 /* Error : wrong PSL on stack */
141: jmp *badrtn /* R1 = actual; R2 = expected */
142:
143: 1: cmpl $-1,(sp) /* Check if SP now point to marker */
144: beql 1f
145: movl $4,r0 /* Error : too many things push on SP */
146: jmp *badrtn
147:
148: 1: movl r1,-(sp) /* Set PSL & PC on the stack for return */
149: movl r6,-(sp) /* r6 contain return address */
150: rei
151: jmp *badrtn /* Should never come here */
152: #
153: # All done; get ready to return to monitor
154: #
155: eee:
156: mtpr $31,$IPL
157: movl _savvec0,sp /* Restore original vector */
158: movl _savvec2,_scb+ALIGNVEC
159: ret
160: #
161: #
162: .align 2
163: tmp0: .long 0
164: dtable: .byte 0x12
165: .byte 0x34
166: .byte 0x56
167: .byte 0x78
168: .byte 0x9a
169: .byte 0xbc
170: .byte 0xde
171: .byte 0xf0
172: .byte 0x12
173: .byte 0x34
174: .byte 0x56
175: .byte 0x78
176: .byte 0x9a
177: .byte 0xbc
178: .byte 0xde
179: .byte 0xf0
180:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.