|
|
1.1 root 1:
2: #
3: # Break point instruction event test
4: #
5: # R0 = error code
6: # 1 - Break point instruction did not generate exception
7: # R1 : address of break point instruction
8: # 2 - Error in PC pushed on the stack
9: # R1 : actual PC; R2 = expected PC
10: # 3 - PSL is not pushed on the stack
11: # 4 - Too many parameters pushed on the stack
12:
13: .globl _bpt_evt
14: _bpt_evt:
15: .word 0x1fff
16: mtpr $31,$IPL
17: movab (sp),_savvec0 /* Save sp */
18: mtpr _savvec0,$ISP
19: movl _scb+BPTVEC,_savvec2 /* Save vector of Break point */
20: movab vecvec7,_scb+BPTVEC /* Set new vector */
21: movl $-1,-(sp) /* Set marker on SP to be checked */
22: /* after taken exception */
23: movab _pcb0,r1 /* Partially set PCB0 */
24: mtpr r1,$PCBB
25: movab (sp),_pcb0 /*ksp in pcb0 */
26: movab (sp),_pcb0+4 /*usp in pcb0 */
27:
28: movpsl r1 /*if not kernel mode, then force*/
29: bitl $0x01000000,r1 /*kernel mode */
30: beql 1f
31: movl _scb+PINSTVEC,_savvec3
32: movab forckmd,_scb+PINSTVEC
33: halt /*halt in USER mode to force */
34: /*K mode in psl */
35: .align 2
36: forckmd:
37: addl2 $8,sp /*get rid of trash on the stack */
38: movl _savvec3,_scb+PINSTVEC /*restore vector */
39:
40: 1: movab eee,r6 /* R6 = return address from event handler*/
41: movab epc1,r5 /* R5 = expected PC after taken break */
42: epc1: bpt /* break point exception */
43: movl $1,r0
44: movl r5,r1
45: jmp *badrtn /* Error- BPT did not generate exception*/
46:
47: .align 2 /* Break point exception handler */
48: vecvec7:
49: movl (sp)+,r1 /*pop pc */
50: movl r5,r2 /*r5 = expected pc */
51: cmpl r1,r2
52: beql 1f
53: movl $2,r0 /*pc saved on stack not equal to exp */
54: jmp *badrtn
55:
56: 1:
57: movl (sp)+,r1 /*pop psl */
58: cmpl $-1,r1 /*if -1, then it is not psl */
59: bneq 1f
60: movl $3,r0
61: jmp *badrtn /* error - psl not saved on the stack */
62: 1:
63: cmpl $-1,(sp) /*sp now should be pointing at the marker*/
64: beql 1f
65: movl $4,r0
66: jmp *badrtn /*too many longwords pushed on the stack */
67: 1:
68: movl r1,-(sp)
69: movl r6,-(sp) /*r6 must have been loaded previously */
70: rei
71: halt /*should never come here */
72:
73: /* Restore original state of SP, PSL & vectors */
74: eee:
75: mtpr $31,$IPL
76: movl _savvec0,sp
77: movl _savvec2,_scb+BPTVEC
78: ret
79:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.