Branch: Tag:

2002-11-07

2002-11-07 17:27:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved disassembler.

Rev: src/code/sparc.c:1.23

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: sparc.c,v 1.22 2002/11/07 17:19:51 grubba Exp $ + || $Id: sparc.c,v 1.23 2002/11/07 17:27:25 grubba Exp $   */      /*
376:    0x80100000|(SPARC_REG_O0<<25),   };    + static void sparc_disass_rd_reg(int reg_no) + { +  switch(reg_no & 0x1f) { +  case SPARC_RD_REG_CCR: fprintf(stderr, "%%ccr"); break; +  case SPARC_RD_REG_PC: fprintf(stderr, "%%pc"); break; +  default: fprintf(stderr, "%%sr(%d)", reg_no & 0x1f); break; +  } + } +    static void sparc_disass_reg(int reg_no)   {    fprintf(stderr, "%%%c%1x", "goli"[(reg_no>>3)&3], reg_no & 7);
441:    case SPARC_OP3_SLL: mnemonic = "sll"; break;    case SPARC_OP3_SRL: mnemonic = "srl"; break;    case SPARC_OP3_SRA: mnemonic = "sra"; break; +  case SPARC_OP3_RD: mnemonic = "rd"; break;    case SPARC_OP3_SAVE: mnemonic = "save"; break;    default:    sprintf(buf, "op3(0x%02x)", op3);
449:    }    fprintf(stderr, "%s ", mnemonic);    } +  if (op3 == SPARC_OP3_RD) { +  sparc_disass_rd_reg(opcode>>14); +  fprintf(stderr, ", "); +  } else {    sparc_disass_reg(opcode>>14);    fprintf(stderr, ", ");    if (opcode & 0x00002000) {
457:    sparc_disass_reg(opcode);    fprintf(stderr, ", ");    } +  }    sparc_disass_reg(opcode >> 25);    fprintf(stderr, "\n");    }