|
|
1.1 root 1:
2: #
3: # Demand paging fault with read modify instruction
4: #
5: # R10 = PC of instruction used to force fault
6: # R0 = error code
7: # 1 - Expected translation fault did not happen
8: # R2 = Virtual address that should cause fault
9: # 2 - Destination operand is modified after even fault is genearted
10: # R1 = actual, R2 = expected
11: # 3 - Too many parameters pushed on the stack
12: # R1 = actual SP, R2 = expected SP
13: # 4 - Fault virtual address pushed on the stack is not correct
14: # R1 = actual, R2 = expected
15: # 5 - PC pushed on the stack is not correct
16: # R1 = actual, R2 = expected
17: # 6 - PSL pushed on the stack is not correct
18: # R1 = actual, R2 = expected
19: #
20: .globl _trans_evt
21: _trans_evt:
22: .word 0x1fff
23:
24: mtpr $1,$TBIA /* Purge Translation buffer */
25: clrl lpcnt
26: movl $TRANS,r0 /* R0 = vector no of transl. fault */
27: movl _scb[r0],_savvec0 /* Save original trans. fault handler */
28: movab _Trans,_scb[r0] /* Set new trans. fault handler */
29: mtpr $512,$DCR /* Disable translation buffer */
30:
31: incl lpcnt /* Trying ANDL2 */
32: movl $0x55555555,_iob3 /* Set mask for andl2 */
33: movab _iob3,r7
34: andl3 r7,$0x3fffffff,r2 /* R2 = address of mask */
35: shar $PGSHIFT,r2,r2 /* PTE no of the mask (_iob3) */
36: andl2 $0x7fffffff,_Sysmap[r2] /* Invalidate this PTE */
37: movl $0xaaaaaaaa,r8
38:
39: movab _Ret0,Retadr /* Set return adr for fault handler */
40: movab (sp),exp_isp /* Set expected SP */
41: movl r8,exp_dop /* expected destination operand */
42: movl r7,exp_fva /* expected fault virtual adr */
43: movab _Etpc,exp_upc /* expected PC at fault */
44: movab _Etpc,r10
45: movpsl exp_upsl /* expected PSL at fault */
46:
47: _Etpc: andl2 (r7),r8 /* Should cause translation fault */
48: movl $1,r0
49: movl r7,r2
50: jmp *badrtn
51: _Ret0:
52: incl lpcnt /* Trying ORL2 */
53: movab _iob3,r7
54: movl $0xcccccccc,r8
55:
56: movab _Ret1,Retadr /* Set return adr for fault handler */
57: movab (sp),exp_isp /* Set expected SP */
58: movl r8,exp_dop /* expected destination operand */
59: movl r7,exp_fva /* expected fault virtual adr */
60: movab _Etpc1,exp_upc /* expected PC at fault */
61: movab _Etpc1,r10
62: movpsl exp_upsl /* expected PSL at fault */
63:
64: _Etpc1: orl2 (r7),r8 /* Should cause translation fault */
65: movl $1,r0
66: movl r7,r2
67: jmp *badrtn
68: _Ret1:
69: movl $TRANS,r0 /* R0 = vector no of transl. fault */
70: movl _savvec0,_scb[r0] /* Restore original handler */
71: movab _iob3,r7
72: andl3 r7,$0x3fffffff,r2 /* R2 = address of mask */
73: shar $PGSHIFT,r2,r2 /* PTE no of the mask (_iob3) */
74: orl2 $0x80000000,_Sysmap[r2] /* Validate this PTE */
75: mtpr $1,$TBIA /* Purge translation buffer */
76: mtpr $256,$DCR /* Disable translation buffer */
77: ret
78:
79: #
80: # Translation fault Handler
81: #
82: .align 2
83: _Trans:
84:
85: movl exp_dop,r2 /* Expected op2 after fault */
86: movl r8,r1 /* Actual op2 after fault */
87: cmpl r2,r1 /* Check if destination operand is modified */
88: jeql 1f
89: movl $2,r0
90: jmp *badrtn
91:
92: 1: movab (sp),r1 /* R1 = current ISP */
93: subl3 $0x10,exp_isp,r2 /* R2 = Expected ISP after exception */
94: cmpl r1,r2
95: beql 1f
96: movl $3,r0
97: jmp *badrtn /* Error : too many parameters pushed on ISP */
98: 1:
99: movl (sp)+,r1 /* 1st parameter of Trans. fault : don't care */
100:
101: movl exp_fva,r2 /* R2 = expected addr that cause fault */
102: movl (sp)+,r1 /* R1 = actual address */
103: cmpl r1,r2
104: beql 1f
105: movl $4,r0
106: jmp *badrtn
107: 1:
108: movl exp_upc,r2 /* R2 = expected PC at fault */
109: movl (sp),r1 /* R1 = actual PC pushed */
110: cmpl r1,r2
111: beql 1f
112: movl $5,r0
113: jmp *badrtn
114: 1:
115: movl Retadr,(sp) /* Modify PC on SP to return */
116:
117: andl3 $0xfffffff0,exp_upsl,r2 /* R2 = expected PSL */
118: andl3 $0xfffffff0,4(sp),r1 /* R1 = actual PSL pushed */
119: cmpl r1,r2 /* Check PSL pushed on the ISP */
120: beql 1f
121: movl $6,r0
122: jmp *badrtn
123: 1:
124: rei /* REI back ! */
125: #
126: # *********
127: # Data area
128: # *********
129: #
130: .align 2
131: exp_upc:
132: .long 0 /* Expected PC at fault */
133: exp_upsl:
134: .long 0 /* Expected PSL at fault */
135: exp_isp:
136: .long 0
137: exp_fva:
138: .long 0 /* Expected virtual addr that cause fault */
139: Retadr:
140: .long 0 /* Addr used by handler to return */
141: lpcnt:
142: .long 0
143: exp_dop:
144: .long 0 /* Expected destination operand */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.