--- cci/d/event/roprnd_evt.s 2019/07/28 12:24:19 1.1.1.1 +++ cci/d/event/roprnd_evt.s 2019/07/28 12:30:53 1.1.1.2 @@ -23,23 +23,21 @@ .globl _roprnd_evt _roprnd_evt: .word 0x1fff - mtpr $31,$IPL - movab (sp),_savvec0 /* Save current SP */ + mtpr $31,$IPL /* disable interrupts */ + movab (sp),_savvec0 /* Save current SP (ISP) */ mtpr _savvec0,$ISP /* Set ISP = current SP */ + mfpr $KSP,_savvec9 /* Save kernal stack pointer */ + mfpr $USP,_savveca /* Save user stack pointer */ movl _scb+ROVEC,_savvec2 /* Save vector of Resr. oprd fault */ movab ropflt1,_scb+ROVEC /* Set new vector */ movl $-1,-(sp) /* Push marker on stack */ - movab _pcb0,r1 /* Partially set PCBB */ - mtpr r1,$PCBB /* Set PCBB to PCB_0 */ - movab (sp),_pcb0 /* Set PCB_KSP = current SP */ - movab (sp),_pcb0+4 /* Set PCB_USP = current SP */ + movl _scb+PINSTVEC,_savvec3 movpsl r1 /* If PSL_MODE != Kernel then */ bitl $0x01000000,r1 /* change to Kernel mode by */ beql 1f /* executing a privilege inst. */ - movl _scb+PINSTVEC,_savvec3 /* as HALT */ - movab tempvec,_scb+PINSTVEC + movab tempvec,_scb+PINSTVEC /* as HALT */ halt .align 2 @@ -81,7 +79,7 @@ ropflt1: 1: cmpl $1,r11 /* Is fault caused by REI or MTPR ? */ bneq 1f /* Skip this part if come here from MTPR */ - movl (sp)+,r10 /* REI fault : get rid off PC,PSL on the */ + movl (sp)+,r10 /* REI fault : get rid of PC,PSL on the */ movl (sp)+,r10 /* stack then check for marker */ 1: @@ -163,10 +161,11 @@ reit3: jmp *badrtn # -# REI with illegal PSL on the stack : PSL_IS on; Try to switch +# REI with illegal PSL on the stack : PSL_IS is off ; Try to switch # to Interrupt stack by REI # 1: /* Current PSL_IS is OFF */ + movl $-1,-(sp) /* push marker on stack (kernal stack) */ movab reit4,r6 /* R6 = return address after exception */ movab reit3a,r5 /* R5 = expected PC on stack */ movl r5,r3 @@ -224,10 +223,13 @@ reit6: movl _savvec2,_scb+ROVEC pushl $0 /* Push dummy PSL,PC on stack */ pushl $0 + mtpr $31,$IPL /* Reset IPL to HIGH */ svpctx /* Switch to ISP */ btisp: - mtpr $31,$IPL /* Reset IPL to HIGH */ movl _savvec0,sp /* Restore SP */ + mtpr _savvec0,$ISP /* Restore ISP */ + mtpr _savvec9,$KSP /* Restore KSP */ + mtpr _savveca,$USP /* Restore USP */ ret # #