Annotation of cci/d/entry/mcom.c, revision 1.1

1.1     ! root        1: 
        !             2: /*             standard definition file                                */
        !             3: /*             for 'C' diagnostic porgrams.                            */
        !             4: /*                                                                     */
        !             5: /*                                                                     */
        !             6: #define                HIGH            31
        !             7: #define                IPL             18
        !             8: #define                PSWMASK         255
        !             9: #define                T               16
        !            10: #define                IV              32
        !            11: #define                FU              64
        !            12: #define                DV              128
        !            13: #define                FLAGS           0x0000000f
        !            14: 
        !            15: extern long scoplp;
        !            16: extern long force_lp;
        !            17: 
        !            18: asm(".set PSWMASK,0xf");
        !            19: 
        !            20: /*     constants definition for mcomplemented instructions test        */
        !            21: /*                                                                     */
        !            22: /*                                                                     */
        !            23: 
        !            24: #define                MCOMB                   0x29      /*opcodes             */ 
        !            25: #define                MCOMW                   0x2b
        !            26: #define                MCOML                   0x2d
        !            27: 
        !            28: #define                MAX_PATTERNS            4          /*max test patterns  */
        !            29: 
        !            30: #define                IDEST                   0x11111111/*initialization      */
        !            31:                                                  /*for destination     */
        !            32: 
        !            33: #define                S1                      0         /*source values       */
        !            34: #define                S2                      0x55555555
        !            35: #define                S3                      0xaaaaaaaa
        !            36: #define                S4                      -1
        !            37: 
        !            38: #define                EB1                     0x111111ff/*expected data*/
        !            39: #define                EW1                     0x1111ffff
        !            40: #define                EL1                     0xffffffff
        !            41: #define                EB2                     0x111111aa
        !            42: #define                EW2                     0x1111aaaa
        !            43: #define                EL2                     0xaaaaaaaa
        !            44: #define                EB3                     0x11111155
        !            45: #define                EW3                     0x11115555
        !            46: #define                EL3                     0x55555555
        !            47: #define                EB4                     0x11111100
        !            48: #define                EW4                     0x11110000
        !            49: #define                EL4                     0
        !            50: 
        !            51: #define                EB11                    0x000000ff
        !            52: #define                EW11                    0x0000ffff
        !            53: #define                EL11                    0xffffffff
        !            54: #define                EB22                    0x555555aa
        !            55: #define                EW22                    0x5555aaaa
        !            56: #define                EL22                    0xaaaaaaaa
        !            57: #define                EB33                    0xaaaaaa55
        !            58: #define                EW33                    0xaaaa5555
        !            59: #define                EL33                    0x55555555
        !            60: #define                EB44                    0xffffff00
        !            61: #define                EW44                    0xffff0000
        !            62: #define                EL44                    0
        !            63: 
        !            64:        
        !            65: #define                FLG1                    6          /*initial flag val*/
        !            66: #define                FLG2                    6
        !            67: #define                FLG3                    15
        !            68: #define                FLG4                    11
        !            69: 
        !            70: 
        !            71: #define                EFLG1                   9          /*expected flag val*/
        !            72: #define                EFLG2                   9
        !            73: #define                EFLG3                   1
        !            74: #define                EFLG4                   5
        !            75: 
        !            76: #define                ERROR1                  1         /*error definitions   */
        !            77: #define                ERROR2                  2
        !            78: #define                ERROR3                  3
        !            79: #define                ERROR4                  4
        !            80: #define                ERROR5                  5
        !            81:                                                  /*error messages      */
        !            82: #define                EM1     "destination not equal to expected \n"
        !            83: #define                EM2     "source altered by the instruction \n"
        !            84: #define                EM3     "flags not equal to expected \n"
        !            85: 
        !            86: 
        !            87: 
        !            88: /*     Global variables for mcom test                                  */
        !            89: /*                                                                     */
        !            90: /*                                                                     */
        !            91: 
        !            92: static short   index = 0;
        !            93: static long    dest = 0;       /*destination location                  */
        !            94: static long    source = 0;     /*source location                       */
        !            95: static long    psw;            /*processor status word                 */
        !            96: 
        !            97: static short   flag_value[MAX_PATTERNS] = {FLG1,FLG2,FLG3,FLG4};
        !            98:                                /*flag values for initialization        */
        !            99: 
        !           100: static long    error_count = 0;
        !           101: 
        !           102: 
        !           103: static long    expb[MAX_PATTERNS] = {EB1,EB2,EB3,EB4};
        !           104:                                /*expected values                       */
        !           105: 
        !           106: static long    expb1[MAX_PATTERNS] = {EB11,EB22,EB33,EB44};
        !           107: 
        !           108: static long    expw[MAX_PATTERNS] = {EW1,EW2,EW3,EW4};
        !           109: static long    expw1[MAX_PATTERNS] = {EW11,EW22,EW33,EW44};
        !           110: 
        !           111: static long    expl[MAX_PATTERNS] = {EL1,EL2,EL3,EL4};
        !           112: static long    expl1[MAX_PATTERNS] = {EL11,EL22,EL33,EL44};
        !           113: 
        !           114: static short   exp_psw[MAX_PATTERNS] = {EFLG1,EFLG2,EFLG3,EFLG4};
        !           115:                                /*expected psw                          */
        !           116: 
        !           117: static long    src[MAX_PATTERNS] = {S1,S2,S3,S4};
        !           118:                                /*source values                         */
        !           119: 
        !           120: 
        !           121: static char *title;
        !           122: static char *msg;
        !           123: static long op1, op2, *lptr, exp_dest;
        !           124: static short init_flg;
        !           125: 
        !           126: mcom()
        !           127: {
        !           128:        asm("movl       $2,_no_opr");   /* two operands in use */
        !           129:        title = "** MCOM_L **\n";
        !           130:        mcoml();
        !           131:        title = "** MCOM_W **\n";
        !           132:        mcomw();
        !           133:        title = "** MCOM_B **\n";
        !           134:        mcomb();
        !           135:        asm("jmp *return");
        !           136: }
        !           137: 
        !           138: 
        !           139: static mcoml()
        !           140: {
        !           141:       for (index = 0; index < MAX_PATTERNS; index++)
        !           142:          {
        !           143:            t_mcoml ();
        !           144:           t_mcoml1();          /*one more test where                   */
        !           145:                                /* dest address = source address        */
        !           146:           }
        !           147: }
        !           148: 
        !           149: 
        !           150: static t_mcoml()
        !           151: {
        !           152: 
        !           153:        for (;;)
        !           154:          { 
        !           155:           setjmp();
        !           156:           asm("mc1:    movab   mc1,_stpc");
        !           157:           op2 = dest = IDEST;          /* Init destination, source, & psw */
        !           158:           lptr = src + index;
        !           159:           op1 = source = *lptr;        /* do not use index */
        !           160:           init_flg = (short)flag_value[index];
        !           161: 
        !           162:           asm("movl    $0x1,_subtst");
        !           163:           asm("bicpsw  $PSWMASK");
        !           164:           asm("bispsw  _init_flg");
        !           165:           asm("mcoml   _source,_dest");
        !           166:           asm("movpsl  _psw"); /*save psw                              */
        !           167:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           168:           lptr = expl + index;
        !           169:           exp_dest = *lptr;
        !           170:           if (dest != exp_dest)
        !           171:                {
        !           172:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           173:                if (scoplp) longjmp();
        !           174:                error(dest,exp_dest,op1,op2);
        !           175:                }
        !           176:           if (source != op1)
        !           177:                {
        !           178:                asm("movl       $3,_ercode");   /* error operand miscompare */
        !           179:                if (scoplp) longjmp();
        !           180:                error(source,op1,op1,op2);
        !           181:                }
        !           182:           if (psw != exp_psw[index])
        !           183:                {
        !           184:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           185:                if (scoplp) longjmp();
        !           186:                error(psw,exp_psw[index],op1,op2);
        !           187:                }
        !           188:           else
        !           189:                if (force_lp) longjmp();
        !           190:                return(0);
        !           191:           }
        !           192: }
        !           193: 
        !           194: 
        !           195: static t_mcoml1()
        !           196: {
        !           197:        for (;;)
        !           198:          { 
        !           199:           setjmp();
        !           200:           asm("mc2:    movab   mc2,_stpc");
        !           201:                                /*initialize  source, & psw     */
        !           202:           lptr = src + index;
        !           203:           op1 = source = *lptr;        /* do not use index */
        !           204:           init_flg = (short)flag_value[index];
        !           205: 
        !           206:        if (index==0) {
        !           207:           asm("movl    $0x2,_subtst");
        !           208:           asm("bicpsw  $PSWMASK")
        !           209:           asm("bispsw  _init_flg")
        !           210:           asm("mcoml   _source,_source")       /* memory to memory */
        !           211:           asm("movpsl  _psw")  /*save psw                              */
        !           212:                   }
        !           213:        if (index==1) {
        !           214:           asm("movl    $0x3,_subtst");
        !           215:           asm("bicpsw  $PSWMASK")
        !           216:           asm("movl    _source,r7")    /* load register */
        !           217:           asm("bispsw  _init_flg")
        !           218:           asm("mcoml   _source,r7")    /* memory to register */
        !           219:           asm("movl    r7,_source")    /* reload target address */
        !           220:           asm("movpsl  _psw")  /*save psw                              */
        !           221:                   }
        !           222:        if (index==2) {
        !           223:           asm("movl    $0x4,_subtst");
        !           224:           asm("bicpsw  $PSWMASK")
        !           225:           asm("movl    _source,r6")    /* load register */
        !           226:           asm("bispsw  _init_flg")
        !           227:           asm("mcoml   r6,_source")    /* register to memory */
        !           228:           asm("movpsl  _psw")  /*save psw                              */
        !           229:                   }
        !           230:        if (index==3) {
        !           231:           asm("movl    $0x5,_subtst");
        !           232:           asm("bicpsw  $PSWMASK")
        !           233:           asm("movl    _source,r6")    /* load register */
        !           234:           asm("movl    _source,r7")    /* load register */
        !           235:           asm("bispsw  _init_flg")
        !           236:           asm("mcoml   r6,r7")         /* register to register */
        !           237:           asm("movl    r7,_source")    /* reload target address */
        !           238:           asm("movpsl  _psw")  /*save psw                              */
        !           239:                   }
        !           240:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           241:           lptr = expl1 + index;
        !           242:           exp_dest = *lptr;
        !           243:           if (source != exp_dest)
        !           244:                {
        !           245:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           246:                if (scoplp) longjmp();
        !           247:                error(source,exp_dest,op1,op1);
        !           248:                }
        !           249:           if (psw != exp_psw[index])
        !           250:                {
        !           251:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           252:                if (scoplp) longjmp();
        !           253:                error(psw,exp_psw[index],op1,op1);
        !           254:                }
        !           255:           else
        !           256:                if (force_lp) longjmp();
        !           257:                return(0);
        !           258:           }
        !           259: }
        !           260: 
        !           261: 
        !           262: 
        !           263: static mcomw()
        !           264: {
        !           265:       for (index = 0; index < MAX_PATTERNS; index++)
        !           266:          {
        !           267:            t_mcomw();
        !           268:           t_mcomw1();          /*one more test where                   */
        !           269:                                /* dest address = source address        */
        !           270:           }
        !           271: }
        !           272: 
        !           273: static t_mcomw()
        !           274: {
        !           275: 
        !           276:        for (;;)
        !           277:          { 
        !           278:           setjmp();
        !           279:           asm("mc3:    movab   mc3,_stpc");
        !           280:           op2 = dest = IDEST;          /* Init destination, source, & psw */
        !           281:           lptr = src + index;
        !           282:           op1 = source = *lptr;        /* do not use index */
        !           283:           init_flg = (short)flag_value[index];
        !           284: 
        !           285:        if (index==0) {
        !           286:           asm("movl    $0x6,_subtst");
        !           287:           asm("bicpsw  $PSWMASK")
        !           288:           asm("bispsw  _init_flg")
        !           289:           asm("mcomw   _source+2,_dest+2")     /* memory to memory */
        !           290:           asm("movpsl  _psw")  /*save psw                              */
        !           291:                      }
        !           292:        if (index==1) {
        !           293:           asm("movl    $0x7,_subtst");
        !           294:           asm("bicpsw  $PSWMASK")
        !           295:           asm("movl    _source,r6")    /* load register */
        !           296:           asm("movl    _dest,r7")      /* load register */
        !           297:           asm("bispsw  _init_flg")
        !           298:           asm("mcomw   r6,r7")         /* register to register */
        !           299:           asm("movpsl  _psw")  /*save psw                              */
        !           300:           asm("movw    r7,_dest+2")    /* reload memory location for check */
        !           301:                      }
        !           302:        if (index==2) {
        !           303:           asm("movl    $0x8,_subtst");
        !           304:           asm("bicpsw  $PSWMASK")
        !           305:           asm("movl    _source,r6")    /* load register */
        !           306:           asm("bispsw  _init_flg")
        !           307:           asm("mcomw   r6,_dest+2")    /* register to memory */
        !           308:           asm("movpsl  _psw")  /*save psw                              */
        !           309:                      }
        !           310:        if (index==3) {
        !           311:           asm("movl    $0x9,_subtst");
        !           312:           asm("bicpsw  $PSWMASK")
        !           313:           asm("movl    _dest,r7")      /* load register */
        !           314:           asm("bispsw  _init_flg")
        !           315:           asm("mcomw   _source+2,r7")  /* memory to register */
        !           316:           asm("movw    r7,_dest+2")    /* reload compare location */
        !           317:           asm("movpsl  _psw")  /*save psw                              */
        !           318:                      }
        !           319:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           320:           lptr = expw + index;
        !           321:           exp_dest = *lptr;
        !           322:           if (dest != exp_dest)
        !           323:                {
        !           324:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           325:                if (scoplp) longjmp();
        !           326:                error(dest,exp_dest,op1,op2);
        !           327:                }
        !           328:           if (source != op1)
        !           329:                {
        !           330:                asm("movl       $3,_ercode");   /* error operand miscompare */
        !           331:                if (scoplp) longjmp();
        !           332:                error(source,op1,op1,op2);
        !           333:                }
        !           334:           if (psw != exp_psw[index])
        !           335:                {
        !           336:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           337:                if (scoplp) longjmp();
        !           338:                error(psw,exp_psw[index],op1,op2);
        !           339:                }
        !           340:           else
        !           341:                if (force_lp) longjmp();
        !           342:                return(0);
        !           343:           }
        !           344: }
        !           345: 
        !           346: static t_mcomw1()
        !           347: {
        !           348:        for ( ; ; )
        !           349:          { 
        !           350:                                /*initialize  source, & psw     */
        !           351:           setjmp();
        !           352:           asm("mc4:    movab   mc4,_stpc");
        !           353:           lptr = src + index;
        !           354:           op1 = source = *lptr;        /* do not use index */
        !           355:           init_flg = (short)flag_value[index];
        !           356:           asm("movl    $0xa,_subtst");
        !           357:           asm("bicpsw  $PSWMASK")
        !           358:           asm("bispsw  _init_flg")
        !           359:           asm("mcomw   _source+2,_source+2")
        !           360:           asm("movpsl  _psw")  /*save psw                              */
        !           361:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           362:           lptr = expw1 + index;
        !           363:           exp_dest = *lptr;
        !           364:           if (source != exp_dest)
        !           365:                {
        !           366:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           367:                if (scoplp) longjmp();
        !           368:                error(source,exp_dest,op1,op1);
        !           369:                }
        !           370:           if (psw != exp_psw[index])
        !           371:                {
        !           372:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           373:                if (scoplp) longjmp();
        !           374:                error(psw,exp_psw[index],op1,op1);
        !           375:                }
        !           376:           else
        !           377:                if (force_lp) longjmp();
        !           378:                return(0);
        !           379:           }
        !           380: }
        !           381: 
        !           382: 
        !           383: static mcomb()
        !           384: {
        !           385:       for (index = 0; index < MAX_PATTERNS; index++)
        !           386:          {
        !           387:            t_mcomb();
        !           388:           t_mcomb1();          /*one more test where                   */
        !           389:                                /* dest address = source address        */
        !           390:           }
        !           391: }
        !           392: 
        !           393: static t_mcomb()
        !           394: {
        !           395:        for ( ; ; )
        !           396:          { 
        !           397:           setjmp();
        !           398:           asm("mc5:    movab   mc5,_stpc");
        !           399:           op2 = dest = IDEST;          /* Init destination, source, & psw */
        !           400:           lptr = src + index;
        !           401:           op1 = source = *lptr;        /* do not use index */
        !           402:           init_flg = (short)flag_value[index];
        !           403: 
        !           404:        if (index==0) {
        !           405:           asm("movl    $0xb,_subtst")
        !           406:           asm("bicpsw  $PSWMASK")
        !           407:           asm("bispsw  _init_flg")
        !           408:           asm("mcomb   _source+3,_dest+3")     /* memory to memory */
        !           409:           asm("movpsl  _psw")  /*save psw                              */
        !           410:                   }
        !           411:        if (index==1) {
        !           412:           asm("movl    $0xc,_subtst")
        !           413:           asm("bicpsw  $PSWMASK")
        !           414:           asm("bispsw  _init_flg")
        !           415:           asm("movl    _source,r6")            /* load data into reg */
        !           416:           asm("mcomb   r6,_dest+3")            /* register to memory */
        !           417:           asm("movpsl  _psw")  /*save psw                              */
        !           418:                   }
        !           419:        if (index==2) {
        !           420:           asm("movl    $0xd,_subtst")
        !           421:           asm("bicpsw  $PSWMASK")
        !           422:           asm("bispsw  _init_flg")
        !           423:           asm("movl    _dest,r7")              /* load dest register */
        !           424:           asm("mcomb   _source+3,r7")          /* memory to register */
        !           425:           asm("movpsl  _psw")  /*save psw                              */
        !           426:           asm("movb    r7,_dest+3")            /* reload memory */
        !           427:                   }
        !           428:        if (index==3) {
        !           429:           asm("movl    $0xe,_subtst")
        !           430:           asm("bicpsw  $PSWMASK")
        !           431:           asm("movl    _source,r6")            /* load data into reg */
        !           432:           asm("movl    _dest,r7")              /* load dest register */
        !           433:           asm("bispsw  _init_flg")
        !           434:           asm("mcomb   r6,r7")         /*  register to register */
        !           435:           asm("movpsl  _psw")  /*save psw                              */
        !           436:           asm("movb    r7,_dest+3")            /* reload memory */
        !           437:                   }
        !           438:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           439:           lptr = expb + index;
        !           440:           exp_dest = *lptr;
        !           441:           if (dest != exp_dest)
        !           442:                {
        !           443:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           444:                if (scoplp) longjmp();
        !           445:                error(dest,exp_dest,op1,op2);
        !           446:                }
        !           447:           if (source != op1)
        !           448:                {
        !           449:                asm("movl       $3,_ercode");   /* error operand miscompare */
        !           450:                if (scoplp) longjmp();
        !           451:                error(source,op1,op1,op2);
        !           452:                }
        !           453:           if (psw != exp_psw[index])
        !           454:                {
        !           455:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           456:                if (scoplp) longjmp();
        !           457:                error(psw,exp_psw[index],op1,op2);
        !           458:                }
        !           459:           else
        !           460:                if (force_lp) longjmp();
        !           461:                return(0);
        !           462:           }
        !           463: }
        !           464: 
        !           465: 
        !           466: 
        !           467: static t_mcomb1()
        !           468: {
        !           469:        for (;;)
        !           470:          { 
        !           471:           setjmp();
        !           472:           asm("mc6:    movab   mc6,_stpc");
        !           473:                                /*initialize  source, & psw     */
        !           474:           lptr = src + index;
        !           475:           op1 = source = *lptr;        /* do not use index */
        !           476:           init_flg = (short)flag_value[index];
        !           477:           asm("movl    $0xf,_subtst")
        !           478:           asm("bicpsw  $PSWMASK")
        !           479:           asm("bispsw  _init_flg")
        !           480:           asm("mcomb   _source+3,_source+3")
        !           481:           asm("movpsl  _psw")  /*save psw                              */
        !           482:           psw &= FLAGS;        /*mask out all bits except flag bits    */
        !           483:           lptr = expb1 + index;
        !           484:           exp_dest = *lptr;
        !           485:           if (source != exp_dest)
        !           486:                {
        !           487:                asm("movl       $1,_ercode");   /* error data miscompare */
        !           488:                if (scoplp) longjmp();
        !           489:                error(source,exp_dest,op1,op1);
        !           490:                }
        !           491:           if (psw != exp_psw[index])
        !           492:                {
        !           493:                asm("movl       $2,_ercode");   /* error flag miscompare */
        !           494:                if (scoplp) longjmp();
        !           495:                error(psw,exp_psw[index],op1,op1);
        !           496:                }
        !           497:           else
        !           498:                if (force_lp) longjmp();
        !           499:                return(0);
        !           500:           }
        !           501: }
        !           502: 
        !           503: 

unix.superglobalmegacorp.com

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