Annotation of cci/d/event/vprobe_evt.s, revision 1.1

1.1     ! root        1: 
        !             2:  #
        !             3:  #     *probe read & write events test (virtual)
        !             4:  #
        !             5:  #     R12 = Which space is probing
        !             6:  #           0 - Probe in P0 space
        !             7:  #           1 - Probe in P2 space
        !             8:  #     R0  = PC of Probe instruction that failed
        !             9:  #     R5  = PSL after Probe
        !            10:  #
        !            11: 
        !            12:        .set   LAST_VPGNO,0xfffff
        !            13:        .set   TEST_P2PTE,LAST_VPGNO
        !            14:        .set   P2ADDR,0x80000000
        !            15:        .set   P0ADDR,0
        !            16:        .set   KERNEL,0
        !            17:        .set   USER,1
        !            18:        .set   READ,1
        !            19:        .set   WRITE,2
        !            20: 
        !            21:        .globl  _probe_evt
        !            22: _probe_evt:
        !            23:        .word   0x1fff
        !            24: 
        !            25:  #     Set up P0PT, P2PT 
        !            26:  #
        !            27:  #     u0p0pt :
        !            28:  #     virtual page 0  = Valid, UW, physical page of _iob0
        !            29:  #     virtual page 1  = NO_ACCESS, physical page of _iob1 
        !            30:  #
        !            31:  #     u0p2pt :
        !            32:  #     virtual page 0xffffe = Valid, UW, physical pages _iob4
        !            33:  #     virtual page 0xfffff = NO_ACCESS, physical pages _iob5
        !            34:  #
        !            35:  #
        !            36:        movab   _u0p2pt,r10             /* Virtual address of P2PT */
        !            37:        andl3   $0x3fffffff,$_iob4,r9   /* Physical address of _iob4 */
        !            38:        shrl    $PGSHIFT,r9,r9          /* Physical page no of _iob4 */
        !            39:        orl3    $PG_V|PG_UW,r9,(r10)    /* Valid, UW */
        !            40:        andl3   $0x3fffffff,$_iob5,r9   /* Physical page no. of _iob5 */
        !            41:        shrl    $PGSHIFT,r9,r9          /* Physical page no of _iob5 */
        !            42:        orl3    $PG_NOACC,r9,4(r10)     /* No access */
        !            43:        subl3   $((LAST_VPGNO-1) << 2),r10,r11
        !            44:                                        /* Address to initialize P2BR */
        !            45: 
        !            46:        clrl    r2                      /* Set up P0PT */
        !            47:        andl3   $0x3fffffff,$_iob0,r3   /* Physical address of _iob0 */
        !            48:        shrl    $PGSHIFT,r3,r3          /* Physical page no of _iob0 */
        !            49:        orl3    $PG_V|PG_UW,r3,_u0p0pt[r2]
        !            50:        incl    r2
        !            51:        andl3   $0x3fffffff,$_iob1,r3   /* Physical address of _iob1 */
        !            52:        shrl    $PGSHIFT,r3,r3          /* Physical page no of _iob1 */
        !            53:        orl3    $PG_NOACC,r3,_u0p0pt[r2]
        !            54: 
        !            55:        andl3   $_pcb0,$0x3fffffff,r1
        !            56:        mtpr    r1,$PCBB
        !            57:        mtpr    $((LAST_VPGNO<<PGSHIFT)|0x400|P2ADDR),$KSP
        !            58:        mtpr    $0,$TBIA
        !            59:        
        !            60:        mtpr    $_u0p0pt,$P0BR
        !            61:        mtpr    $4,$P0LR                /* Four PTEs in P0BR  */
        !            62:        mtpr    r11,$P2BR
        !            63:        mtpr    $0xffffd,$P2LR          /* Two PTEs in P2BR  */
        !            64:        calls   $4,probe_tst            /* Do test ... */
        !            65:        ret                             /* Done ... */
        !            66: 
        !            67: 
        !            68:  #
        !            69:  #     Routine to do PROBE test
        !            70:  #
        !            71: probe_tst:
        !            72:        .word   0x1ff
        !            73: 
        !            74:        movl    $1,r12                  /* r12 = 1 ; PROBE in P2 space  */
        !            75:                                        /* r12 = 0 ; PROBE in P0 space  */
        !            76:        movl    $(LAST_VPGNO << PGSHIFT)|P2ADDR,r2
        !            77:                                /* R2 : base address of NO_ACCESS page */
        !            78:        movl    $((LAST_VPGNO-1) << PGSHIFT)|P2ADDR,r4
        !            79:                                /* R4 : base address of accessible page */
        !            80: tstart:
        !            81: #      PROBE read in User mode
        !            82: #
        !            83:        movl    $USER,r1                /* R1 : Mode used in PROBE      */
        !            84:        movl    $NBPG-4,r3              /* R3 : PROBE less than 1 page */
        !            85:        movl    $NBPG+0xf0,r6           /* R6 : PROBE more than 1 page */
        !            86:        movl    $READ,r7                /* R7 : type of access          */
        !            87: 
        !            88:        movab   _prb1,r0                /* R0 : PC of probe instruction */
        !            89:        movl    r2,Cache
        !            90:        bicpsw  $Z
        !            91: _prb1:
        !            92:        prober  r1,*Cache,r3    /* Z flag should be 1 : not accessible  */
        !            93:        beql    1f
        !            94: error0:        movpsl  r5                      /* R5 : PSL after PROBE         */
        !            95:        jmp     *badrtn                 /* Error in Z flag              */
        !            96:        
        !            97: 1:     mtpr    $0,$TBIA
        !            98:        movab   _prb2,r0
        !            99:        movl    r4,Cache
        !           100:        bispsw  $Z
        !           101: _prb2:
        !           102:        prober  $1,*Cache,r3            /* Z flag should be 0 : accessible  */
        !           103:        bneq    1f
        !           104:        brw     error0
        !           105: 
        !           106: 1:     mtpr    $0,$TBIA
        !           107:        movab   _prb3,r0
        !           108:        movl    r6,Cache
        !           109:        bicpsw  $Z
        !           110: _prb3:
        !           111:        prober  r1,(r4),Cache   /* Z flag should be 1 : not accessible  */
        !           112:        beql    1f
        !           113:        brw     error0
        !           114: 
        !           115: /*     PROBE read in Kernel mode               */
        !           116: 
        !           117: 1:     mtpr    $0,$TBIA
        !           118:        movb    $KERNEL,Cache
        !           119:        movab   _prb4,r0
        !           120:        bispsw  $Z
        !           121: _prb4:
        !           122:        prober  Cache,(r4),r3           /* Z flag should be 0 : accessible  */
        !           123:        bneq    1f
        !           124:        brw     error0
        !           125: 
        !           126: 1:     mtpr    $0,$TBIA
        !           127:        movab   _prb5,r0
        !           128:        bicpsw  $Z
        !           129: _prb5:
        !           130:        prober  r1,(r2),r3      /* Z flag should be 1 : not accessible  */
        !           131:        beql    1f
        !           132:        brw     error0
        !           133: 
        !           134: 1:     mtpr    $0,$TBIA
        !           135:        movab   _prb6,r0
        !           136:        bicpsw  $Z
        !           137: _prb6:
        !           138:        prober  $0,(r4),r6      /* Z flag should be 1 : not accessible  */
        !           139:        beql    1f
        !           140:        brw     error0
        !           141: 
        !           142: 
        !           143: /*     PROBE write in User mode        */
        !           144: 
        !           145: 1:     mtpr    $0,$TBIA
        !           146:        movl    $USER,r1                /* R1 : Mode used in PROBE      */
        !           147:        movl    $WRITE,r7               /* R7 : type of access          */
        !           148: 
        !           149:        movab   _prb7,r0
        !           150:        movl    r2,Cache
        !           151:        bicpsw  $Z
        !           152: _prb7:
        !           153:        probew  r1,*Cache,r3    /* Z flag should be 1 : not accessible  */
        !           154:        beql    1f
        !           155: error1:
        !           156:        movpsl  r5                      /* R5 : PSL after PROBE         */
        !           157:        jmp     *badrtn                 /* Error in Z flag              */
        !           158: 1:
        !           159:        mtpr    $0,$TBIA
        !           160:        movab   _prb8,r0
        !           161:        movl    r4,Cache
        !           162:        bispsw  $Z
        !           163: _prb8:
        !           164:        probew  $1,*Cache,r3            /* Z flag should be 0 : accessible  */
        !           165:        mtpr    $0,$TBIA
        !           166:        bneq    1f
        !           167:        brw     error1
        !           168: 
        !           169: 1:     mtpr    $0,$TBIA
        !           170:        movab   _prb9,r0
        !           171:        movl    r6,Cache
        !           172:        bicpsw  $Z
        !           173: _prb9:
        !           174:        probew  r1,(r4),Cache   /* Z flag should be 1 : not accessible  */
        !           175:        beql    1f
        !           176:        brw     error1
        !           177: 
        !           178: /*     PROBE write in Kernel mode              */
        !           179: 
        !           180: 1:     mtpr    $0,$TBIA
        !           181:        movb    $KERNEL,Cache
        !           182:        movab   _prb10,r0
        !           183:        bispsw  $Z
        !           184: _prb10:
        !           185:        probew  Cache,(r4),r3           /* Z flag should be 0 : accessible  */
        !           186:        bneq    1f
        !           187:        brw     error0
        !           188: 
        !           189: 1:     mtpr    $0,$TBIA
        !           190:        movab   _prb11,r0
        !           191:        bicpsw  $Z
        !           192: _prb11:
        !           193:        probew  $0,(r2),r3      /* Z flag should be 1 : not accessible  */
        !           194:        beql    1f
        !           195:        brw     error0
        !           196: 
        !           197: 1:     mtpr    $0,$TBIA
        !           198:        movab   _prb12,r0
        !           199:        bicpsw  $Z
        !           200: _prb12:
        !           201:        probew  r1,(r4),r6      /* Z flag should be 1 : not accessible  */
        !           202:        beql    1f
        !           203:        brw     error0
        !           204: 
        !           205: 1:     mtpr    $0,$TBIA
        !           206:        decl    r12             /* Decrement loop count */
        !           207:        blss    endt
        !           208:        
        !           209:        movl    $(1 << PGSHIFT)|P0ADDR,r2
        !           210:                                /* R2 : base address of NO_ACCESS page */
        !           211:        movl    $(0 << PGSHIFT)|P0ADDR,r4
        !           212:                                /* R4 : base address of accessible page */ 
        !           213:        jmp     tstart                  /* Test again but in P0 space */
        !           214: endt:
        !           215:        clrl    r0
        !           216:        ret
        !           217: 
        !           218:        .align  2
        !           219: Cache:
        !           220:        .long   0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.