|
|
1.1 ! root 1: /* ! 2: * n2/i386/unasm.c ! 3: * The unassembler. ! 4: * This routine converts the internal form of a machine instruction ! 5: * into an intermediate form printable by cc3. ! 6: * The output can be made to look a lot like ! 7: * any assembler format by rewriting cc3. ! 8: * i386. ! 9: */ ! 10: ! 11: #ifdef vax ! 12: #include "INC$LIB:cc2.h" ! 13: #else ! 14: #include "cc2.h" ! 15: #endif ! 16: ! 17: unassemble(ip1) ! 18: register INS *ip1; ! 19: { ! 20: register int rel, i; ! 21: ! 22: switch (ip1->i_type) { ! 23: ! 24: case LLLINK: ! 25: genone(ZLPTR, A_LID|A_DIR, ip1->i_labno); ! 26: break; ! 27: ! 28: case ENTER: ! 29: genseg(ip1->i_seg); ! 30: break; ! 31: ! 32: case ALIGN: ! 33: bput(ALIGN); bput(ip1->i_align); ! 34: break; ! 35: ! 36: case BLOCK: ! 37: bput(BLOCK); zput(ip1->i_len); ! 38: break; ! 39: ! 40: case LLABEL: ! 41: bput(LLABEL); iput((ival_t)ip1->i_labno); ! 42: break; ! 43: ! 44: case JUMP: ! 45: genone(ip1->i_rel, A_LID|A_DIR, ip1->i_labno); ! 46: break; ! 47: ! 48: case LINE: ! 49: bput(LINE), iput((ival_t)ip1->i_line); ! 50: break; ! 51: ! 52: case CODE: ! 53: #if 0 ! 54: if (isvariant(VEMU87)) { ! 55: /* ! 56: * Under the VEMU87 emulation option, the assembler ! 57: * precedes 8087 opcodes with emulator calls. ! 58: */ ! 59: i = opinfo[ip1->i_op].op_style; ! 60: if (is8087op(i)) ! 61: genone(ZCALL, A_GID|A_DIR, "emu87"); ! 62: } ! 63: #endif ! 64: bput(CODE); bput(ip1->i_op); ! 65: for (i=0; i<ip1->i_naddr; ++i) ! 66: genfield(&ip1->i_af[i]); ! 67: break; ! 68: } ! 69: } ! 70: ! 71: static short revtab[] = { ! 72: ZJBE, ! 73: ZJB, ! 74: ZJAE, ! 75: ZJA, ! 76: -1, ! 77: ZJNE, ! 78: ZJLE, ! 79: ZJL, ! 80: ZJGE, ! 81: ZJG, ! 82: -1, ! 83: ZJE, ! 84: ZJO, ! 85: ZJS, ! 86: ZJNO, ! 87: ZJPO, ! 88: ZJPE, ! 89: ZJNS ! 90: }; ! 91: ! 92: revrel(rel) ! 93: register rel; ! 94: { ! 95: if (rel<ZJA || rel>ZJS || (rel=revtab[rel-ZJA])<0) ! 96: cbotch("bad rev"); ! 97: return rel; ! 98: } ! 99: ! 100: /* end of n2/i386/unasm.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.