/* i80960 instruction disassembler for GDB.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
#include "frame.h"
#include "inferior.h"
-extern char *reg_names[];
-
static FILE *stream; /* Output goes here */
static void print_addr();
static void ctrl();
return;
}
- fputs( ctrl_tab[i].name, stream );
+ fputs_filtered( ctrl_tab[i].name, stream );
if ( word1 & 2 ){ /* Predicts branch not taken */
- fputs( ".f", stream );
+ fputs_filtered ( ".f", stream );
}
if ( ctrl_tab[i].numops == 1 ){
if ( word1 & 0x00800000 ){ /* Sign bit is set */
word1 |= (-1 & ~0xffffff); /* Sign extend */
}
- putc( '\t', stream );
+ fputs_filtered ( "\t", stream );
print_addr( word1 + memaddr );
}
}
fputs( cobr_tab[i].name, stream );
if ( word1 & 2 ){ /* Predicts branch not taken */
- fputs( ".f", stream );
+ fputs_filtered ( ".f", stream );
}
- putc( '\t', stream );
+ fputs_filtered ( "\t", stream, 0 );
src1 = (word1 >> 19) & 0x1f;
src2 = (word1 >> 14) & 0x1f;
if ( word1 & 0x02000 ){ /* M1 is 1 */
- fprintf( stream, "%d", src1 );
+ fprintf_filtered ( stream, "%d", src1 );
} else { /* M1 is 0 */
- fputs( reg_names[src1], stream );
+ fputs_filtered ( reg_names[src1], stream );
}
if ( cobr_tab[i].numops > 1 ){
if ( word1 & 1 ){ /* S2 is 1 */
- fprintf( stream, ",sf%d,", src2 );
+ fprintf_filtered ( stream, ",sf%d,", src2 );
} else { /* S1 is 0 */
- fprintf( stream, ",%s,", reg_names[src2] );
+ fprintf_filtered ( stream, ",%s,", reg_names[src2] );
}
/* Extract displacement and convert to address
int len;
int mode;
int offset;
- char *reg1, *reg2, *reg3;
+ const char *reg1, *reg2, *reg3;
/* This lookup table is too sparse to make it worth typing in, but not
* so large as to make a sparse array necessary. We allocate the
return len;
}
- fprintf( stream, "%s\t", mem_tab[i].name );
+ fprintf_filtered ( stream, "%s\t", mem_tab[i].name );
reg1 = reg_names[ (word1 >> 19) & 0x1f ]; /* MEMB only */
reg2 = reg_names[ (word1 >> 14) & 0x1f ];
case 2: /* LOAD INSTRUCTION */
if ( mode & 4 ){ /* MEMB FORMAT */
ea( memaddr, mode, reg2, reg3, word1, word2 );
- fprintf( stream, ",%s", reg1 );
+ fprintf_filtered ( stream, ",%s", reg1 );
} else { /* MEMA FORMAT */
fprintf( stream, "0x%x", offset );
if (mode & 8) {
- fprintf( stream, "(%s)", reg2 );
+ fprintf_filtered ( stream, "(%s)", reg2 );
}
- fprintf( stream, ",%s", reg1 );
+ fprintf_filtered ( stream, ",%s", reg1 );
}
break;
case -2: /* STORE INSTRUCTION */
if ( mode & 4 ){ /* MEMB FORMAT */
- fprintf( stream, "%s,", reg1 );
+ fprintf_filtered ( stream, "%s,", reg1 );
ea( memaddr, mode, reg2, reg3, word1, word2 );
} else { /* MEMA FORMAT */
- fprintf( stream, "%s,0x%x", reg1, offset );
+ fprintf_filtered ( stream, "%s,0x%x", reg1, offset );
if (mode & 8) {
- fprintf( stream, "(%s)", reg2 );
+ fprintf_filtered ( stream, "(%s)", reg2 );
}
}
break;
if ( mode & 4 ){ /* MEMB FORMAT */
ea( memaddr, mode, reg2, reg3, word1, word2 );
} else { /* MEMA FORMAT */
- fprintf( stream, "0x%x", offset );
+ fprintf_filtered ( stream, "0x%x", offset );
if (mode & 8) {
- fprintf( stream, "(%s)", reg2 );
+ fprintf_filtered( stream, "(%s)", reg2 );
}
}
break;
fp = 0;
}
- fputs( mnemp, stream );
+ fputs_filtered( mnemp, stream );
s1 = (word1 >> 5) & 1;
s2 = (word1 >> 6) & 1;
dst = (word1 >> 19) & 0x1f;
if ( reg_tab[i].numops != 0 ){
- putc( '\t', stream );
+ fputs_filtered( "\t", stream, 0 );
switch ( reg_tab[i].numops ){
case 1:
break;
case 2:
regop( m1, s1, src, fp );
- putc( ',', stream );
+ fputs_filtered( ",", stream );
regop( m2, s2, src2, fp );
break;
case -2:
regop( m1, s1, src, fp );
- putc( ',', stream );
+ fputs_filtered( ",", stream );
dstop( m3, dst, fp );
break;
case 3:
regop( m1, s1, src, fp );
- putc( ',', stream );
+ fputs_filtered( ",", stream );
regop( m2, s2, src2, fp );
- putc( ',', stream );
+ fputs_filtered( ",", stream );
dstop( m3, dst, fp );
break;
}
switch (mode) {
case 4: /* (reg) */
- fprintf( stream, "(%s)", reg2 );
+ fprintf_filtered( stream, "(%s)", reg2 );
break;
case 5: /* displ+8(ip) */
print_addr( word2+8+memaddr );
break;
case 7: /* (reg)[index*scale] */
if (scale == 1) {
- fprintf( stream, "(%s)[%s]", reg2, reg3 );
+ fprintf_filtered( stream, "(%s)[%s]", reg2, reg3 );
} else {
- fprintf( stream, "(%s)[%s*%d]",reg2,reg3,scale);
+ fprintf_filtered( stream, "(%s)[%s*%d]",reg2,reg3,scale);
}
break;
case 12: /* displacement */
break;
case 13: /* displ(reg) */
print_addr( word2 );
- fprintf( stream, "(%s)", reg2 );
+ fprintf_filtered( stream, "(%s)", reg2 );
break;
case 14: /* displ[index*scale] */
print_addr( word2 );
if (scale == 1) {
- fprintf( stream, "[%s]", reg3 );
+ fprintf_filtered( stream, "[%s]", reg3 );
} else {
- fprintf( stream, "[%s*%d]", reg3, scale );
+ fprintf_filtered( stream, "[%s*%d]", reg3, scale );
}
break;
case 15: /* displ(reg)[index*scale] */
print_addr( word2 );
if (scale == 1) {
- fprintf( stream, "(%s)[%s]", reg2, reg3 );
+ fprintf_filtered( stream, "(%s)[%s]", reg2, reg3 );
} else {
- fprintf( stream, "(%s)[%s*%d]",reg2,reg3,scale );
+ fprintf_filtered( stream, "(%s)[%s*%d]",reg2,reg3,scale );
}
break;
default:
if ( fp ){ /* FLOATING POINT INSTRUCTION */
if ( mode == 1 ){ /* FP operand */
switch ( reg ){
- case 0: fputs( "fp0", stream ); break;
- case 1: fputs( "fp1", stream ); break;
- case 2: fputs( "fp2", stream ); break;
- case 3: fputs( "fp3", stream ); break;
- case 16: fputs( "0f0.0", stream ); break;
- case 22: fputs( "0f1.0", stream ); break;
- default: putc( '?', stream ); break;
+ case 0: fputs_filtered( "fp0", stream ); break;
+ case 1: fputs_filtered( "fp1", stream ); break;
+ case 2: fputs_filtered( "fp2", stream ); break;
+ case 3: fputs_filtered( "fp3", stream ); break;
+ case 16: fputs_filtered( "0f0.0", stream ); break;
+ case 22: fputs_filtered( "0f1.0", stream ); break;
+ default: fputs_filtered( "?", stream ); break;
}
} else { /* Non-FP register */
- fputs( reg_names[reg], stream );
+ fputs_filtered( reg_names[reg], stream );
}
} else { /* NOT FLOATING POINT */
if ( mode == 1 ){ /* Literal */
- fprintf( stream, "%d", reg );
+ fprintf_filtered( stream, "%d", reg );
} else { /* Register */
if ( spec == 0 ){
- fputs( reg_names[reg], stream );
+ fputs_filtered( reg_names[reg], stream );
} else {
- fprintf( stream, "sf%d", reg );
+ fprintf_filtered( stream, "sf%d", reg );
}
}
}
invalid( word1 )
int word1;
{
- fprintf( stream, ".word\t0x%08x", word1 );
+ fprintf_filtered( stream, ".word\t0x%08x", word1 );
}
static void
print_addr(a)
{
- fprintf( stream, "0x%x", a );
+ print_address (a, stream);
}
static void
}
if ( len == 8 ){
- fprintf( stream, "%08x %08x\t", word1, word2 );
+ fprintf_filtered( stream, "%08x %08x\t", word1, word2 );
} else {
- fprintf( stream, "%08x \t", word1 );
+ fprintf_filtered( stream, "%08x \t", word1 );
}
;