|
|
1.1 ! root 1: #define error_hdl1s error ! 2: #define error_str error ! 3: #define error_str1 error ! 4: ! 5: extern long scoplp; ! 6: extern long force_lp; ! 7: ! 8: #define C 0x1 ! 9: #define V 0x2 ! 10: #define Z 0x4 ! 11: #define N 0x8 ! 12: ! 13: /* CMPS2, CMPS3 instruction */ ! 14: ! 15: #define MAXLINE 500 ! 16: #define NULL 0 ! 17: ! 18: /* Some global variables */ ! 19: static long flag_msk, psl, slen, r2; ! 20: static char *str1, *str2, *r0, *r1; ! 21: ! 22: cmpstr() ! 23: { ! 24: asm("movl $3,_no_opr"); ! 25: cmps2(); ! 26: cmps3(); ! 27: asm("jmp *return"); ! 28: } ! 29: ! 30: static cmps2() ! 31: { ! 32: long no_op, exp_psw, exp_r2; ! 33: char *exp_r0, *exp_r1; ! 34: ! 35: no_op = 2; ! 36: exp_r2 = 0; ! 37: ! 38: setjmp(); ! 39: asm("c1: movab c1,_stpc"); ! 40: asm("movl $1,_subtst"); ! 41: flag_msk = exp_psw = 0; ! 42: flag_msk = N|V|C; ! 43: exp_psw = Z | C; ! 44: str1 = "abcdefghejk"; ! 45: str2 = "abcdefghejk"; ! 46: exp_r0 = str1 + 11; ! 47: exp_r1 = str2 + 11; ! 48: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 49: ! 50: setjmp(); ! 51: asm("c2: movab c2,_stpc"); ! 52: asm("movl $2,_subtst"); ! 53: flag_msk = exp_psw = 0; ! 54: exp_psw = C; ! 55: flag_msk = Z|N|V|C; ! 56: str1 = "abcdefghejk1"; ! 57: str2 = "abcdefghejk"; ! 58: exp_r0 = str1 + 11; ! 59: exp_r1 = str2 + 11; ! 60: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 61: ! 62: setjmp(); ! 63: asm("c3: movab c3,_stpc"); ! 64: asm("movl $3,_subtst"); ! 65: flag_msk = exp_psw = 0; ! 66: exp_psw = N; ! 67: flag_msk = Z|N|V|C; ! 68: str1 = "12345678abcd"; ! 69: str2 = "12345678abce0"; ! 70: exp_r0 = str1 + 11; ! 71: exp_r1 = str2 + 11; ! 72: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 73: ! 74: setjmp(); ! 75: asm("c4: movab c4,_stpc"); ! 76: asm("movl $4,_subtst"); ! 77: flag_msk = exp_psw = 0; ! 78: exp_psw = N; ! 79: flag_msk = Z|N|V|C; ! 80: str1 = "12345678abcd"; ! 81: str2 = "12345678abcd0"; ! 82: exp_r0 = str1 + 12; ! 83: exp_r1 = str2 + 12; ! 84: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 85: ! 86: setjmp(); ! 87: asm("c5: movab c5,_stpc"); ! 88: asm("movl $5,_subtst"); ! 89: flag_msk = exp_psw = 0; ! 90: flag_msk = Z|V|C; ! 91: exp_psw = N; ! 92: str1 = "abcdefg1234567zz"; ! 93: str2 = "abcdefg123456z89"; ! 94: exp_r0 = str1 + 13; ! 95: exp_r1 = str2 + 13; ! 96: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 97: } ! 98: ! 99: static cmps3() ! 100: { ! 101: long no_op, exp_psw, exp_r2; ! 102: char *exp_r0, *exp_r1; ! 103: ! 104: no_op = 3; ! 105: ! 106: setjmp(); ! 107: asm("c6: movab c6,_stpc"); ! 108: asm("movl $6,_subtst"); ! 109: slen = 11; ! 110: flag_msk = exp_psw = 0; ! 111: flag_msk = N|V|C; ! 112: exp_psw = Z | C; ! 113: str1 = "abcdefghejk"; ! 114: str2 = "abcdefghejk"; ! 115: exp_r0 = str1 + slen; ! 116: exp_r1 = str2 + slen; ! 117: exp_r2 = 0; ! 118: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 119: ! 120: setjmp(); ! 121: asm("c7: movab c7,_stpc"); ! 122: asm("movl $7,_subtst"); ! 123: slen = 15; ! 124: flag_msk = exp_psw = 0; ! 125: flag_msk = Z|N|V|C; ! 126: exp_psw = N; ! 127: str1 = "abcdefghejk1"; ! 128: str2 = "abcdefghejk2"; ! 129: exp_r0 = str1 + 11; ! 130: exp_r1 = str2 + 11; ! 131: exp_r2 = 4; ! 132: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 133: ! 134: setjmp(); ! 135: asm("c8: movab c8,_stpc"); ! 136: asm("movl $8,_subtst"); ! 137: slen = 20; ! 138: flag_msk = exp_psw = 0; ! 139: flag_msk = Z|V|C; ! 140: exp_psw = N; ! 141: str1 = "abcd123456089"; ! 142: str2 = "abcd123456198"; ! 143: exp_r0 = str1 + 10; ! 144: exp_r1 = str2 + 10; ! 145: exp_r2 = 10; ! 146: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 147: ! 148: setjmp(); ! 149: asm("c9: movab c9,_stpc"); ! 150: asm("movl $9,_subtst"); ! 151: slen = 11; ! 152: flag_msk = exp_psw = 0; ! 153: flag_msk = Z|V|C; ! 154: exp_psw = C; ! 155: str1 = "abcd123456289"; ! 156: str2 = "abcd123456198"; ! 157: exp_r0 = str1 + 10; ! 158: exp_r1 = str2 + 10; ! 159: exp_r2 = 1; ! 160: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 161: ! 162: setjmp(); ! 163: asm("c10: movab c10,_stpc"); ! 164: asm("movl $10,_subtst"); ! 165: slen = 4; ! 166: flag_msk = exp_psw = 0; ! 167: flag_msk = Z|V|C; ! 168: exp_psw = Z | C; ! 169: str1 = "abcd1"; ! 170: str2 = "abcd2"; ! 171: exp_r0 = str1 + slen; ! 172: exp_r1 = str2 + slen; ! 173: exp_r2 = 0; ! 174: cmps(no_op,exp_r0,exp_r1,exp_r2,exp_psw); ! 175: ! 176: } ! 177: ! 178: /* THIS ROUTINE EXECUTE CMPS2, CMPS3 INSTRUCTIONS */ ! 179: ! 180: static cmps(no_op,exp_r0,exp_r1,exp_r2, exp_psw) ! 181: char *exp_r0, *exp_r1; ! 182: long exp_r2, exp_psw; ! 183: int no_op; ! 184: { ! 185: char *str, savs1[MAXLINE], savs2[MAXLINE]; ! 186: long op_len, len1 ,len2, ix, ierror, psw; ! 187: ! 188: flag_msk = flag_msk << 16; ! 189: op_len = slen; ! 190: for(;;) ! 191: { ! 192: slen = op_len; ! 193: ! 194: /* SAVE SOURCE STRINGS */ ! 195: ! 196: str = str1; ! 197: len1 = 0; ! 198: for(;;) ! 199: { ! 200: savs1[len1] = *str++; ! 201: if (savs1[len1] == NULL) break; ! 202: len1++; /* len of source string excluding NULL */ ! 203: } ! 204: str = str2; ! 205: len2 = 0; ! 206: for(;;) ! 207: { ! 208: savs2[len2] = *str++; ! 209: if (savs2[len2] == NULL) break; ! 210: len2++; /* len of source string excluding NULL */ ! 211: } ! 212: ! 213: ! 214: /* EXECUTE IT */ ! 215: if (no_op==2) ! 216: { ! 217: asm("movl _str1,r0"); /* R0 : source string */ ! 218: asm("movl _str2,r1"); /* R0 : source string */ ! 219: asm("bicpsw $0xf"); /* clear all flags */ ! 220: asm("bispsw _flag_msk"); ! 221: asm("cmps2"); ! 222: asm("movpsl _psl"); ! 223: asm("movl r0,_r0"); ! 224: asm("movl r1,_r1"); ! 225: } ! 226: else ! 227: { ! 228: asm("movl _str1,r0"); /* R0 : source string */ ! 229: asm("movl _str2,r1"); /* R1 : source string */ ! 230: asm("movl _slen,r2"); /* R2 : counter */ ! 231: asm("bicpsw $0xf"); /* clear all flags */ ! 232: asm("bispsw _flag_msk"); ! 233: asm("cmps3"); ! 234: asm("movpsl _psl"); ! 235: asm("movl r0,_r0"); ! 236: asm("movl r1,_r1"); ! 237: asm("movl r2,_r2"); ! 238: } ! 239: psw = psl & 0xf; ! 240: ! 241: /* check flags */ ! 242: if (psw != exp_psw) ! 243: { ! 244: asm("movl $2,_ercode"); ! 245: if (scoplp) longjmp(); ! 246: error_hdl1s(psw,exp_psw,str1,str2); ! 247: } ! 248: /* CHECK IF SOURCE GET CHANGED */ ! 249: ierror = 0; ! 250: for(ix=0;ix<len1;ix++) ! 251: { if (str1[ix] != savs1[ix]) ! 252: { ierror++; ! 253: break; ! 254: } ! 255: } ! 256: if (ierror) ! 257: { ! 258: asm("movl $3,_ercode"); ! 259: if (scoplp) longjmp(); ! 260: error_str(str1,savs1,str1,str2,slen); ! 261: } ! 262: ierror = 0; ! 263: for(ix=0;ix<len2;ix++) ! 264: { if (str2[ix] != savs2[ix]) ! 265: { ierror++; ! 266: break; ! 267: } ! 268: } ! 269: if (ierror) ! 270: { ! 271: asm("movl $3,_ercode"); ! 272: if (scoplp) longjmp(); ! 273: error_str(str2,savs2,str1,str2,slen); ! 274: } ! 275: /* CHECK R0, R1 */ ! 276: if (r0 != exp_r0) ! 277: { ! 278: asm("movl $3,_ercode"); ! 279: if (scoplp) longjmp(); ! 280: error_str1(r0,exp_r0,str1,str2,slen); ! 281: } ! 282: if (r1 != exp_r1) ! 283: { ! 284: asm("movl $3,_ercode"); ! 285: if (scoplp) longjmp(); ! 286: error_str1(r1,exp_r1,str1,str2,slen); ! 287: } ! 288: if (no_op==3) ! 289: { /* CMPS3 : check R2 */ ! 290: if (r2 != exp_r2) ! 291: { ! 292: asm("movl $3,_ercode"); ! 293: if (scoplp) longjmp(); ! 294: error_str1(r2,exp_r2,str1,str2,slen); ! 295: } ! 296: /* check if length operand get modified */ ! 297: if (slen != op_len) ! 298: { ! 299: asm("movl $3,_ercode"); ! 300: if (scoplp) longjmp(); ! 301: error_str1(slen,op_len,str1,str2,slen); ! 302: } ! 303: if (force_lp) longjmp(); ! 304: } ! 305: break; ! 306: } ! 307: } ! 308:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.