Annotation of cci/d/entry/mneg.c, revision 1.1.1.2

1.1       root        1: /*     Global variables for mnegl test                                 */
                      2: /*                                                                     */
                      3: /*                                                                     */
                      4: 
                      5: 
                      6: /*     constants definition for mneg instructions test                 */
                      7: /*                                                                     */
                      8: /*                                                                     */
                      9: 
                     10: #define                FLAGS                   0xf
                     11: asm(".set FLAGS,0xf");
                     12: #define                MNEGB                   0xe8      /*opcodes             */
                     13: #define                MNEGW                   0xea
                     14: #define                MNEGL                   0xec
                     15: 
                     16: extern long scoplp;
                     17: extern long force_lp;
                     18: 
                     19: #define                MAX_PATTERNS            6          /*max test patterns  */
                     20: 
                     21: #define                INITIALB                0xffffff00 /*initialization     */
                     22: #define                INITIALW                0xffff0000 /*values for desti-  */
                     23: #define                INITIALL                0xaaaaaaaa /*nation             */
                     24: 
                     25: #define                SB1                     0x80       /* -128 */
                     26: #define                SW1                     0x8000
                     27: #define                SL1                     0x80000000
                     28: 
                     29: #define                SB2                     0x00       /* 0    */
                     30: #define                SW2                     0x0000
                     31: #define                SL2                     0x00000000
                     32: 
                     33: #define                SB3                     0x7f       /* +127 */
                     34: #define                SW3                     0x7fff
                     35: #define                SL3                     0x7fffffff
                     36: 
                     37: #define                SB4                     0x01       /* +1   */
                     38: #define                SW4                     0x0001
                     39: #define                SL4                     0x00000001
                     40: 
                     41: #define                SB5                     0x81       /* -127 */
                     42: #define                SW5                     0x8001
                     43: #define                SL5                     0x80000001
                     44: 
                     45: #define                SB6                     0xff       /* -1   */
                     46: #define                SW6                     0xffff
                     47: #define                SL6                     0xffffffff
                     48: 
                     49: #define                EB1                     0xffffff80 /*expected data*/
                     50: #define                EW1                     0xffff8000
                     51: #define                EL1                     0x80000000
                     52: #define                EB2                     0xffffff00
                     53: #define                EW2                     0xffff0000
                     54: #define                EL2                     0x00000000
                     55: #define                EB3                     0xffffff81
                     56: #define                EW3                     0xffff8001
                     57: #define                EL3                     0x80000001
                     58: #define                EB4                     0xffffffff
                     59: #define                EW4                     0xffffffff
                     60: #define                EL4                     0xffffffff
                     61: #define                EB5                     0xffffff7f
                     62: #define                EW5                     0xffff7fff
                     63: #define                EL5                     0x7fffffff
                     64: #define                EB6                     0xffffff01
                     65: #define                EW6                     0xffff0001
                     66: #define                EL6                     1
                     67: 
                     68: 
                     69:        
                     70: #define                FLG1                    4          /*initial flag val*/
                     71: #define                FLG2                    11
                     72: #define                FLG3                    6
                     73: #define                FLG4                    6
                     74: #define                FLG5                    14
                     75: #define                FLG6                    14
                     76: 
                     77: 
                     78: #define                EFLG1                   2         /* expected flag val */
                     79: /* #define     EFLG1                   10        old expected flag val */
                     80: #define                EFLG2                   5
                     81: #define                EFLG3                   8
                     82: #define                EFLG4                   8
                     83: #define                EFLG5                   0
                     84: #define                EFLG6                   0
                     85: 
                     86: #define                ERROR1                  1         /*error definitions   */
                     87: #define                ERROR2                  2
                     88: #define                ERROR3                  3
                     89: 
                     90:                                                  /*error messages      */
                     91: #define                EM1     "destination not equal to expected \n"
                     92: #define                EM2     "source altered by the instruction \n"
                     93: #define                EM3     "flags not equal to expected \n"
                     94: 
                     95: 
                     96: 
                     97: 
                     98: 
                     99: static long    dest = 0;       /*destination location                  */
                    100: static long    source = 0;     /*source location                       */
                    101: static long    error_count = 0;
                    102: static long    psw;            /*processor status word                 */
                    103: 
                    104: static long    index = 0;      /*array index                           */
                    105: 
                    106: static long    expl[MAX_PATTERNS] = {EL1,EL2,EL3,EL4,EL5,EL6};
                    107: static long    expw[MAX_PATTERNS] = {EW1,EW2,EW3,EW4,EW5,EW6};
                    108: static long    expb[MAX_PATTERNS] = {EB1,EB2,EB3,EB4,EB5,EB6};
                    109:                                /*expected values                       */
                    110: 
                    111: static long    flag_value[MAX_PATTERNS] = {FLG1,FLG2,FLG3,FLG4,FLG5,FLG6};
                    112:                                /*flag values for initialization        */
                    113: 
                    114: static long    exp_psw[MAX_PATTERNS] = {EFLG1,EFLG2,EFLG3,EFLG4,EFLG5,EFLG6};
                    115:                                /*expected psw                          */
                    116: 
                    117: static long    sourcel[MAX_PATTERNS] = {SL1,SL2,SL3,SL4,SL5,SL6};
                    118: static long    sourcew[MAX_PATTERNS] = {SW1,SW2,SW3,SW4,SW5,SW6};
                    119: static long    sourceb[MAX_PATTERNS] = {SB1,SB2,SB3,SB4,SB5,SB6};
                    120:                                /*source values                         */
                    121: static long savvec4;
                    122: static char *msg, *title;
                    123: static short init_flg;
                    124: 
                    125: mneg()
                    126: {
                    127:        asm("movl       $2,_no_opr");   /* two operands in use */
                    128:        title = "** MNEGL **\n";
                    129:        mnegl();
                    130: 
                    131:        title = "** MNEGW **\n";
                    132:        mnegw();
                    133: 
                    134:        title = "** MNEGB **\n";
                    135:        mnegb();
                    136:        asm("jmp *return");
                    137: }
                    138: 
                    139: static mnegl()                 /* move negated long test */
                    140: {
                    141:    for (index=0; index<MAX_PATTERNS; index++) t_mnegl ();
                    142: }
                    143: 
                    144: 
                    145: static t_mnegl()
                    146: {      long *lptr, op1, op2, exp_dest, exp_flg;
                    147: 
                    148:        for(;;)
                    149:          { 
                    150:           setjmp();
                    151:           asm("mn1:    movab   mn1,_stpc");
                    152:           op2 = dest = INITIALL;       /* Init destination, source, & psw */
                    153:           lptr = sourcel+index;
                    154:           op1 = source = *lptr;        /* do not use index */
                    155:           init_flg = (short)flag_value[index];
                    156: 
                    157:        if (index==0) {
                    158:           asm("movl    $0x1,_subtst");
                    159:           asm("bicpsw  $FLAGS");
                    160:           asm("bispsw  _init_flg");
                    161:           asm("mnegl   _source,_dest");/* memory to memory */
                    162:           asm("movpsl  _psw");         /* Save psw     */
                    163:                   }
                    164:        if (index==1) {
                    165:           asm("movl    $0x2,_subtst");
                    166:           asm("bicpsw  $FLAGS");
                    167:           asm("movl    _dest,r7");     /* load destination register */
                    168:           asm("bispsw  _init_flg");
                    169:           asm("mnegl   _source,r7");   /* memory to register */
                    170:           asm("movpsl  _psw");         /* Save psw     */
1.1.1.2 ! root      171:           asm("movl    r7,_dest");     /* restore check location */
1.1       root      172:                   }
                    173:        if (index==2) {
                    174:           asm("movl    $0x3,_subtst");
                    175:           asm("bicpsw  $FLAGS");
                    176:           asm("movl    _source,r6");   /* load source register */
                    177:           asm("bispsw  _init_flg");
                    178:           asm("mnegl   r6,_dest");     /* register to memory */
                    179:           asm("movpsl  _psw");         /* Save psw     */
                    180:                   }
                    181:        if (index==3) {
                    182:           asm("movl    $0x4,_subtst");
                    183:           asm("bicpsw  $FLAGS");
                    184:           asm("movl    _source,r6");   /* load source register */
                    185:           asm("movl    _dest,r7");
                    186:           asm("bispsw  _init_flg");
                    187:           asm("mnegl   r6,r7");        /* register to register */
                    188:           asm("movpsl  _psw");         /* Save psw     */
1.1.1.2 ! root      189:           asm("movl    r7,_dest");     /* load result into dest */
1.1       root      190:                   }
                    191:        if (index==4) {
                    192:           asm("movl    $0x5,_subtst");
                    193:           asm("bicpsw  $FLAGS");
                    194:           asm("bispsw  _init_flg");
                    195:           asm("mnegl   _source,_dest");/* memory to memory */
                    196:           asm("movpsl  _psw");         /* Save psw     */
                    197:                   }
                    198:        if (index==5) {
                    199:           asm("movl    $0x6,_subtst");
                    200:           asm("bicpsw  $FLAGS");
                    201:           asm("bispsw  _init_flg");
                    202:           asm("mnegl   _source,_dest");/* memory to memory */
                    203:           asm("movpsl  _psw");         /* Save psw     */
                    204:                   }
                    205:           psw &= FLAGS;                /* Get flags    */
                    206:           lptr = expl+index;
                    207:           exp_dest = *lptr;
                    208:           if (dest != exp_dest)
                    209:                {
                    210:                asm("movl       $1,_ercode");   /* error data miscompare */
                    211:                if (scoplp) longjmp();
                    212:                error(dest,exp_dest,op1,op2);
                    213:                } 
                    214:           if (source != op1)
                    215:                {
                    216:                asm("movl       $3,_ercode");   /* error operand miscompare */
                    217:                if (scoplp) longjmp();
                    218:                error(source,op1,op1,op2);
                    219:                }
                    220:           lptr = exp_psw+index;
                    221:           exp_flg = *lptr; 
                    222:           if (psw != exp_flg)
                    223:                {
                    224:                asm("movl       $2,_ercode");   /* error flag miscompare */
                    225:                if (scoplp) longjmp();
                    226:                error(psw,exp_flg,op1,op2);
                    227:                }
                    228:                if (force_lp) longjmp();
                    229:          break;
                    230:           }
                    231: }
                    232: 
                    233: 
                    234: 
                    235: static mnegw()                 /* move negated word test */
                    236: {
                    237:       for (index = 0; index < MAX_PATTERNS; index++) t_mnegw();
                    238: }
                    239: 
                    240: static t_mnegw()
                    241: {
                    242:        for (;;)
                    243:          { 
                    244:           setjmp();
                    245:           asm("mn2:    movab   mn2,_stpc");
                    246:           dest = INITIALW;     /*initialize destination, source, & psw */
                    247:           source = sourcew[index];
                    248:           asm("movw    _index,r11");
                    249:           asm("shll    $16,_flag_value[r11],_savvec4");
                    250: 
                    251:        if (index==0) {
                    252:           asm("movl    $0x7,_subtst");
                    253:           asm("bicpsw  $FLAGS");
                    254:           asm("bispsw  _savvec4");
                    255:           asm("mnegw   _source+2,_dest+2");    /* memory to memory     */
                    256:           asm("movpsl  _psw");                 /* Save psw             */
                    257:                   }
                    258:        if (index==1) {
                    259:           asm("movl    $0x8,_subtst");
                    260:           asm("bicpsw  $FLAGS");
                    261:           asm("bispsw  _savvec4");
                    262:           asm("movl    _source,r6");           /* load source register */
                    263:           asm("mnegw   r6,_dest+2");   /* register to memory   */
                    264:           asm("movpsl  _psw");                 /* Save psw             */
                    265:                   }
                    266:        if (index==2) {
                    267:           asm("movl    $0x9,_subtst");
                    268:           asm("bicpsw  $FLAGS");
                    269:           asm("bispsw  _savvec4");
                    270:           asm("movl    _dest,r7");     /* load dest register */
                    271:           asm("mnegw   _source+2,r7"); /* memory to register */
                    272:           asm("movpsl  _psw");                 /* Save psw             */
                    273:           asm("movw    r7,_dest+2");   /* load dest location */
                    274:                   }
                    275:        if (index==3) {
                    276:           asm("movl    $0xa,_subtst");
                    277:           asm("bicpsw  $FLAGS");
                    278:           asm("bispsw  _savvec4");
                    279:           asm("movl    _source,r6");           /* load source register */
                    280:           asm("movl    _dest,r7");     /* load dest register */
                    281:           asm("mnegw   r6,r7");        /* register to register */
                    282:           asm("movpsl  _psw");                 /* Save psw             */
                    283:           asm("movw    r7,_dest+2");   /* load dest location */
                    284:                   }
                    285:        if (index==4) {
                    286:           asm("movl    $0xb,_subtst");
                    287:           asm("bicpsw  $FLAGS");
                    288:           asm("bispsw  _savvec4");
                    289:           asm("movl    _dest,r7");     /* load dest register */
                    290:           asm("mnegw   _source+2,r7"); /* data to register */
                    291:           asm("movpsl  _psw");                 /* Save psw             */
                    292:           asm("movw    r7,_dest+2");   /* load dest location */
                    293:                   }
                    294:        if (index==5) {
                    295:           asm("movl    $0xc,_subtst");
                    296:           asm("bicpsw  $FLAGS");
                    297:           asm("bispsw  _savvec4");
1.1.1.2 ! root      298:           asm("mnegw   _source+2,_dest+2");    /* data to memory       */
1.1       root      299:           asm("movpsl  _psw");                 /* Save psw             */
                    300:                   }
                    301:           psw &= FLAGS;        /* Mask out all bits except flag bits   */
                    302:           if (dest != expw[index])
                    303:                {
                    304:                asm("movl       $1,_ercode");   /* error data miscompare */
                    305:                if (scoplp) longjmp();
                    306:                error(dest,expw[index],sourcew[index],INITIALW);
                    307:                } 
                    308:           if (source != sourcew[index])
                    309:                {
                    310:                asm("movl       $3,_ercode");   /* error operand miscompare */
                    311:                if (scoplp) longjmp();
                    312:                error(source,sourcew[index],sourcew[index],INITIALW);
                    313:                } 
                    314:           if (psw != exp_psw[index])
                    315:                {
                    316:                asm("movl       $2,_ercode");   /* error flag miscompare */
                    317:                if (scoplp) longjmp();
                    318:                error(psw,exp_psw[index],sourcew[index],INITIALW);
                    319:                }
                    320:                if (force_lp) longjmp();
                    321:          break;
                    322:          }
                    323: }
                    324: 
                    325: 
                    326: static mnegb()                 /* move negated byte test */
                    327: {
                    328:       for (index = 0; index < MAX_PATTERNS; index++) t_mnegb();
                    329: }
                    330: 
                    331: 
                    332: static t_mnegb ()
                    333: {
                    334:        for (;;)
                    335:          { 
                    336:           setjmp();
                    337:           asm("mn3:    movab   mn3,_stpc");
                    338:           dest = INITIALB;     /*initialize destination, source, & psw */
                    339:           source = sourceb[index];
                    340:        if (index==0) {
                    341:           asm("movl    $0xd,_subtst");
                    342:           asm("movw    _index,r11");
                    343:           asm("shll    $16,_flag_value[r11],_savvec4");
                    344:           asm("bicpsw  $FLAGS");
                    345:           asm("bispsw  _savvec4");
                    346:           asm("mnegb   _source+3,_dest+3");    /* memory to memory */
                    347:           asm("movpsl  _psw"); /*save psw                              */
                    348:                   }
                    349:        if (index==1) {
                    350:           asm("movl    $0xe,_subtst");
                    351:           asm("movw    _index,r11");
                    352:           asm("shll    $16,_flag_value[r11],_savvec4");
                    353:           asm("movl    _dest,r7");             /* load dest register */
                    354:           asm("bicpsw  $FLAGS");
                    355:           asm("bispsw  _savvec4");
                    356:           asm("mnegb   _source+3,r7");         /* memory to register */
                    357:           asm("movpsl  _psw"); /*save psw                              */
                    358:           asm("movb    r7,_dest+3");           /* reload dest location */
                    359:                   }
                    360:        if (index==2) {
                    361:           asm("movl    $0xf,_subtst");
                    362:           asm("movw    _index,r11");
                    363:           asm("shll    $16,_flag_value[r11],_savvec4");
                    364:           asm("movl    _source,r6");           /* load source register */
                    365:           asm("bicpsw  $FLAGS");
                    366:           asm("bispsw  _savvec4");
                    367:           asm("mnegb   r6,_dest+3");           /* register to memory */
                    368:           asm("movpsl  _psw"); /*save psw                              */
                    369:                   }
                    370:        if (index==3) {
                    371:           asm("movl    $0x10,_subtst");
                    372:           asm("movw    _index,r11");
                    373:           asm("shll    $16,_flag_value[r11],_savvec4");
                    374:           asm("movl    _dest,r7");             /* load dest register */
                    375:           asm("movl    _source,r6");           /* load source register */
                    376:           asm("bicpsw  $FLAGS");
                    377:           asm("bicpsw  $FLAGS");
                    378:           asm("bispsw  _savvec4");
                    379:           asm("mnegb   r6,r7");                /*  register to register */
                    380:           asm("movpsl  _psw"); /*save psw                              */
                    381:           asm("movb    r7,_dest+3");           /* reload dest location */
                    382:                   }
                    383:        if (index==4) {
                    384:           asm("movl    $0x11,_subtst");
                    385:           asm("movw    _index,r11");
                    386:           asm("shll    $16,_flag_value[r11],_savvec4");
                    387:           asm("movl    _dest,r7");             /* load dest register */
                    388:           asm("bicpsw  $FLAGS");
                    389:           asm("bispsw  _savvec4");
                    390:           asm("mnegb   _source+3,r7");         /* data to register */
                    391:           asm("movpsl  _psw"); /*save psw                              */
                    392:           asm("movb    r7,_dest+3");           /* reload dest location */
                    393:                   }
                    394:        if (index==5) {
                    395:           asm("movl    $0x12,_subtst");
                    396:           asm("movw    _index,r11");
                    397:           asm("shll    $16,_flag_value[r11],_savvec4");
                    398:           asm("bicpsw  $FLAGS");
                    399:           asm("bispsw  _savvec4");
                    400:           asm("mnegb   _source+3,_dest+3");            /* data to memory */
                    401:           asm("movpsl  _psw"); /*save psw                              */
                    402:                   }
                    403:           psw &= FLAGS;        /*mask out all bits except flag bits    */
                    404:           if (dest != expb[index])
                    405:                {
                    406:                asm("movl       $1,_ercode");   /* error data miscompare */
                    407:                if (scoplp) longjmp();
                    408:                error(dest,expb[index],sourceb[index],INITIALB);
                    409:                } 
                    410:           if (source != sourceb[index])
                    411:                {
                    412:                asm("movl       $3,_ercode");   /* error operand miscompare */
                    413:                if (scoplp) longjmp();
                    414:                error(source,sourceb[index],sourceb[index],INITIALB);
                    415:                } 
                    416:           if (psw != exp_psw[index])
                    417:                {
                    418:                asm("movl       $2,_ercode");   /* error flag miscompare */
                    419:                if (scoplp) longjmp();
                    420:                error(psw,exp_psw[index],sourceb[index],INITIALB);
                    421:                }
                    422:                if (force_lp) longjmp();
                    423:           break;
                    424:           }
                    425: }
                    426: 
                    427: 

unix.superglobalmegacorp.com

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