示例#1
0
/*
 * Interpret the status buffer returned
 */
void
status(struct mtget *bp)
{
	struct tape_desc *mt;

	for (mt = tapes;; mt++) {
		if (mt->t_type == 0) {
			(void)printf("%d: unknown tape drive type\n",
			    bp->mt_type);
			return;
		}
		if (mt->t_type == bp->mt_type)
			break;
	}
#if defined (__DragonFly__)
	if(mt->t_type == MT_ISAR)
		st_status(bp);
	else {
#endif /* defined (__DragonFly__) */
	(void)printf("%s tape drive, residual=%d\n", mt->t_name, bp->mt_resid);
	printreg("ds", (unsigned short)bp->mt_dsreg, mt->t_dsbits);
	printreg("\ner", (unsigned short)bp->mt_erreg, mt->t_erbits);
	(void)putchar('\n');
#if defined (__DragonFly__)
	}
#endif /* defined (__DragonFly__) */
}
示例#2
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype16(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE16_MASK){
  case OP_MOVW: printf("MOVW "); break;
  default: printf("Invalid Opcode "); break;
  }
  printreg(get_optype16_d(instr));
  printreg(get_optype16_r(instr));
  
  return 0;
}
示例#3
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype12(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE12_MASK){
  case OP_FMUL: printf("FMUL "); break;
  case OP_FMULS: printf("FMULS "); break;
  case OP_FMULSU: printf("FMULSU "); break;
  case OP_MULSU: printf("MULSU "); break;
  default: printf("Wrong Opcode "); break;
  }
  printreg(get_optype12_d(instr));
  printreg(get_optype12_r(instr));
  
  return 0;
}
示例#4
0
int main() 
{
  int i; 
  //reset the processor
  reset_proc();
  
  //load the program memory
  load_program_memory();
  print();
  
  
  
  //$$$$$$$$$$$$$$ set pc=0X0
  R[15]=0;
  ex_flag=0;
  //run the simulator  
  run_armsim();
  printreg();

  // $$$$$$$$$$$  printing the memory array
  MEM[w+1]=R[7]+48; 
 // printf("\n\n%d",R[7]);
  printf("\n\nPrinting the elements of MEM array\n\n");
    for(i=0;i<w+2;i++)
      printf("%d ",MEM[i]-48);
  printf("\n"); 
  swi_exit();
  
  return 0;
}
示例#5
0
文件: att21c498.c 项目: 99years/plan9
static void
dump(Vga*, Ctlr* ctlr)
{
	int i;

	printitem(ctlr->name, "");
	for(i = 0; i < Nir; i++)
		printreg(attdaci(i));
}
示例#6
0
文件: sc15025.c 项目: 99years/plan9
static void
dump(Vga*, Ctlr* ctlr)
{
	int i;
	uchar command;

	printitem(ctlr->name, "command");
	command = commandr();
	printreg(command);

	printitem(ctlr->name, "index08");
	commandw(command|0x10);
	for(i = 0x08; i < 0x11; i++){
		outportb(PaddrR, i);
		printreg(inportb(PaddrW));
	}
	commandw(command);
}
示例#7
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype18(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE18_MASK){
  case OP_SER: printf("SER "); break;
  default: printf("Invalid Opcode "); break;
  }
  printreg(get_optype18_d(instr));
  
  return 0;
}
示例#8
0
//-------------------------------------------------------------------
static void print_ptr_reg(ptr_reg_t* ptr)
{
  int i;
#ifdef DBGMODE
  printreg(ptr->reg);
#endif
  DEBUG(": \n");
  for (i = 0; i < ptr->num_ranges; i++)
    DEBUG("Ndx: %d  Min: %d  Max: %d\n", i, ptr->ranges[i].min, ptr->ranges[i].max);
  return;
}
示例#9
0
//writes the results back to register file
void write_back()
{
  if(control==3)
     R[d]=result_mem;

  if(control==1||control==2||control==0||control==5||control==6||control==7)
     { printf("\n\n\n hhhh\n");
        R[d]=result;
       printreg();
       
     }
}
示例#10
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype2(avr_instr_t* instr)
{
  switch(instr->rawVal & OP_TYPE2_MASK){
  case OP_ADIW: printf("ADIW "); break;
  case OP_SBIW: printf("SBIW "); break;
  default: printf("Wrong Opcode "); break;
  }
  printreg(get_optype2_dreg(instr));
  printf("%d ", get_optype2_k(instr));
  
  return 0;
}
示例#11
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype13(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE13_MASK){
  case OP_IN: printf("IN "); break;
  case OP_OUT: printf("OUT "); break;
  default: printf("Wrong Opcode "); break;
  }
  printreg(get_optype13_d(instr));
  printf("%x ", get_optype13_a(instr));
  
  return 0;
}
示例#12
0
文件: mt.c 项目: Bluerise/bitrig
/*
 * Interpret the status buffer returned
 */
void
status(struct mtget *bp)
{
	struct tape_desc *mt;

	for (mt = tapes;; mt++) {
		if (mt->t_type == 0) {
			(void)printf("%d: unknown tape drive type\n",
			    bp->mt_type);
			return;
		}
		if (mt->t_type == bp->mt_type)
			break;
	}
	(void)printf("%s tape drive, residual=%d\n", mt->t_name, bp->mt_resid);
	printreg("ds", bp->mt_dsreg, mt->t_dsbits);
	printreg("\ner", bp->mt_erreg, mt->t_erbits);
	(void)putchar('\n');
	(void)printf("blocksize: %d (%d)\n", bp->mt_blksiz, bp->mt_mblksiz);
	(void)printf("density: %d (%d)\n", bp->mt_density, bp->mt_mdensity);
}
示例#13
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype14(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE14_MASK){
  case OP_LDD_Y:
    { 
      printf("LDD "); 
      printreg(get_optype14_d(instr)); 
      printf("Y+");  
      printf("0x%x ", get_optype14_q(instr));
      break;
    }
  case OP_LDD_Z:
    { 
      printf("LDD "); 
      printreg(get_optype14_d(instr)); 
      printf("Z+");  
      printf("0x%x ", get_optype14_q(instr));
      break;
    }
  case OP_STD_Y:
    { 
      printf("STD "); 
      printf("Y+");  
      printf("0x%x,", get_optype14_q(instr));
      printreg(get_optype14_d(instr)); 
      break;
    }
  case OP_STD_Z:
    { 
      printf("STD "); 
      printf("Z+");  
      printf("0x%x,", get_optype14_q(instr));
      printreg(get_optype14_d(instr)); 
      break;
    }
  default: printf("Wrong Opcode "); break;
  }
  
  return 0;
}
示例#14
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype19(avr_instr_t* instr, avr_instr_t* nextinstr)
{
  switch (instr->rawVal & OP_TYPE19_MASK){
  case OP_LDS:
    {
      printf("LDS "); 
      printreg(get_optype19_d(instr)); 
      printf("0x%x", get_optype19_k(nextinstr));
      break;
    }
  case OP_STS: 
    {
      printf("STS "); 
      printf("0x%x ", get_optype19_k(nextinstr));
      printreg(get_optype19_d(instr)); 
      break;
    }
  default: printf("Wrong Opcode ");
  }
  
  return 0;
}
示例#15
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype1(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE1_MASK){
  case OP_ADC:  printf("ADC "); break;
  case OP_ADD:  printf("ADD "); break;
  case OP_AND:  printf("AND "); break;
  case OP_CP:   printf("CP ");  break;
  case OP_CPC:  printf("CPC "); break;
  case OP_CPSE: printf("CPSE ");break;
  case OP_EOR:  printf("EOR "); break;
  case OP_MOV:  printf("MOV "); break;
  case OP_MUL:  printf("MUL "); break;
  case OP_OR:   printf("OR ");  break;
  case OP_SBC:  printf("SBC "); break;
  case OP_SUB:  printf("SUB "); break;
  default:      printf("Wrong Opcode "); break;
  }
  printreg(get_optype1_dreg(instr));
  printreg(get_optype1_rreg(instr));
  
  return 0;
}
示例#16
0
文件: tvp3026.c 项目: 99years/plan9
static void
dump(Vga*, Ctlr* ctlr)
{
	int i;
	ulong clock[4], f;

	printitem(ctlr->name, "direct");
	for(i = 0; i < 16; i++)
		printreg(tvp3026i(i));

	printitem(ctlr->name, "index");
	for(i = 0; i < 64; i++)
		printreg(tvp3026xi(i));

	printitem(ctlr->name, "PCLK");
	for(i = 0; i < 3; i++){
		tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
		printreg(clock[i] = tvp3026xi(0x2D));
	}
	f = (RefFreq*(65-clock[1]))/(65-(clock[0] & 0x3F));
	f >>= clock[2] & 0x03;
	Bprint(&stdout, "%23ld", f);

	printitem(ctlr->name, "MCLK");
	for(i = 0; i < 3; i++){
		tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
		printreg(clock[i] = tvp3026xi(0x2E));
	}
	f = (RefFreq*(65-clock[1]))/(65-(clock[0] & 0x3F));
	f >>= clock[2] & 0x03;
	Bprint(&stdout, "%23ld", f);

	printitem(ctlr->name, "LCLK");
	for(i = 0; i < 3; i++){
		tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
		printreg(clock[i] = tvp3026xi(0x2F));
	}
	Bprint(&stdout, "\n");
}
示例#17
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype11(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE11_MASK){
  case OP_CBI: printf("CBI "); break;
  case OP_SBI: printf("SBI "); break;
  case OP_SBIC: printf("SBIC "); break;
  case OP_SBIS: printf("SBIS "); break;
  default: printf("Wrong Opcode ");
  }
  printreg(get_optype11_a(instr));
  printf(",0x%x ", get_optype11_b(instr));
  
  return 0;
}
示例#18
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype6(avr_instr_t* instr)
{
  switch (instr->rawVal & OP_TYPE6_MASK){
  case OP_BLD: printf("BLD "); break;
  case OP_BST: printf("BST "); break;
  case OP_SBRC: printf("SBRC "); break;
  case OP_SBRS: printf("SBRS "); break;
  default: printf("Wrong OpCode "); break;
  }
  printreg(get_optype6_dreg(instr));
  printf("%d ", get_optype6_b(instr));
  
  return 0;
}
示例#19
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype3(avr_instr_t* instr)
{
  switch(instr->rawVal & OP_TYPE3_MASK){
  case OP_ANDI:printf("ANDI "); break;
  case OP_CPI: printf("CPI ");  break;
  case OP_LDI: printf("LDI ");  break;
  case OP_ORI: printf("ORI ");  break;
  case OP_SBCI:printf("SBCI "); break;
    //  case OP_SBR: printf("SBR ");  break; // Same as ORI
  case OP_SUBI:printf("SUBI "); break;
  default: printf("Wrong Opcode "); break;
  }  
  printreg(get_optype3_dreg(instr));
  printf("0x%x ",get_optype3_k(instr));
  
  return 0;
}
示例#20
0
文件: dispinstr.c 项目: nesl/sos-2x
//-----------------------------------------------------------------------
int8_t print_optype4(avr_instr_t* instr)
{
  uint8_t reg;
  reg = get_optype4_dreg(instr);
  switch(instr->rawVal & OP_TYPE4_MASK){
  case OP_ASR: printf("ASR "); printreg(reg); break;
  case OP_COM: printf("COM "); printreg(reg); break;
  case OP_DEC: printf("DEC "); printreg(reg); break;
  case OP_INC: printf("INC "); printreg(reg); break;
  case OP_ELPM_Z: printf("ELPM "); printreg(reg); printf("Z"); break;
  case OP_ELPM_Z_INC: printf("ELPM "); printreg(reg); printf("Z+"); break; 
  case OP_LD_X: printf("LD "); printreg(reg); printf("X"); break;
  case OP_LD_X_INC: printf("LD "); printreg(reg); printf("X+"); break;
  case OP_LD_X_DEC: printf("LD "); printreg(reg); printf("-X"); break;
  case OP_LD_Y: printf("LD "); printreg(reg); printf("Y"); break;
  case OP_LD_Y_INC: printf("LD "); printreg(reg); printf("Y+"); break;
  case OP_LD_Y_DEC: printf("LD "); printreg(reg); printf("-Y");break;
  case OP_LD_Z: printf("LD "); printreg(reg); printf("Z");break;
  case OP_LD_Z_INC: printf("LD "); printreg(reg); printf("Z+"); break;
  case OP_LD_Z_DEC: printf("LD "); printreg(reg); printf("-Z");break;
  case OP_LPM_Z: printf("LPM "); printreg(reg); printf("Z"); break;
  case OP_LPM_Z_INC: printf("LPM "); printreg(reg); printf("Z+");break;
  case OP_LSR: printf("LSR "); printreg(reg); break;
  case OP_NEG: printf("NEG "); printreg(reg); break;
  case OP_POP: printf("POP "); printreg(reg); break;
  case OP_PUSH: printf("PUSH "); printreg(reg); break;
  case OP_ROR: printf("ROR "); printreg(reg); break;
  case OP_ST_X: printf("ST X "); printreg(reg); break;
  case OP_ST_X_INC: printf("ST X+ "); printreg(reg); break;
  case OP_ST_X_DEC: printf("ST -X "); printreg(reg); break;
  case OP_ST_Y: printf("ST Y "); printreg(reg); break;
  case OP_ST_Y_INC: printf("ST Y+ "); printreg(reg); break;
  case OP_ST_Y_DEC: printf("ST -Y "); printreg(reg); break;
  case OP_ST_Z: printf("ST Z "); printreg(reg); break;
  case OP_ST_Z_INC: printf("ST Z+ "); printreg(reg); break;
  case OP_ST_Z_DEC: printf("ST -Z "); printreg(reg); break;
  case OP_SWAP: printf("SWAP "); printreg(reg); break;    
  default: printf("Wrong Opcode "); printreg(reg); break;
  }  
  
  return 0;
}
示例#21
0
static void
dump(Vga* vga, Ctlr* ctlr)
{
	int i;

	printitem(ctlr->name, "misc");
	printreg(vga->misc);
	printitem(ctlr->name, "feature");
	printreg(vga->feature);

	printitem(ctlr->name, "sequencer");
	for(i = 0; i < NSeqx; i++)
		printreg(vga->sequencer[i]);

	printitem(ctlr->name, "crt");
	for(i = 0; i < NCrtx; i++)
		printreg(vga->crt[i]);

	printitem(ctlr->name, "graphics");
	for(i = 0; i < NGrx; i++)
		printreg(vga->graphics[i]);

	printitem(ctlr->name, "attribute");
	for(i = 0; i < NAttrx; i++)
		printreg(vga->attribute[i]);

	if(dflag)
		palette.dump(vga, ctlr);

	printitem(ctlr->name, "virtual");
	Bprint(&stdout, "%ld %ld\n", vga->virtx, vga->virty);
	printitem(ctlr->name, "panning");
	Bprint(&stdout, "%s\n", vga->panning ? "on" : "off");
	if(vga->f[0]){
		printitem(ctlr->name, "clock[0] f");
		Bprint(&stdout, "%9ld\n", vga->f[0]);
		printitem(ctlr->name, "clock[0] d i m");
		Bprint(&stdout, "%9ld %8ld       - %8ld\n",
			vga->d[0], vga->i[0], vga->m[0]);
		printitem(ctlr->name, "clock[0] n p q r");
		Bprint(&stdout, "%9ld %8ld       - %8ld %8ld\n",
			vga->n[0], vga->p[0], vga->q[0], vga->r[0]);
	}
	if(vga->f[1]){
		printitem(ctlr->name, "clock[1] f");
		Bprint(&stdout, "%9ld\n", vga->f[1]);
		printitem(ctlr->name, "clock[1] d i m");
		Bprint(&stdout, "%9ld %8ld       - %8ld\n",
			vga->d[1], vga->i[1], vga->m[1]);
		printitem(ctlr->name, "clock[1] n p q r");
		Bprint(&stdout, "%9ld %8ld       - %8ld %8ld\n",
			vga->n[1], vga->p[1], vga->q[1], vga->r[1]);
	}

	if(vga->vma || vga->vmb){
		printitem(ctlr->name, "vm a b");
		Bprint(&stdout, "%9lud %8lud\n", vga->vma, vga->vmb);
	}
	if(vga->vmz){
		printitem(ctlr->name, "vmz");
		Bprint(&stdout, "%9lud\n", vga->vmz);
	}
	printitem(ctlr->name, "apz");
	Bprint(&stdout, "%9lud\n", vga->apz);

	printitem(ctlr->name, "linear");
	Bprint(&stdout, "%9d\n", vga->linear);
}
示例#22
0
 /*ARGSUSED*/ void
print_frame_inst_bytes(Dwarf_Debug dbg,
		       Dwarf_Ptr cie_init_inst, Dwarf_Signed len,
		       Dwarf_Signed data_alignment_factor,
		       int code_alignment_factor, Dwarf_Half addr_size,
		       struct dwconf_s *config_data)
{
    unsigned char *instp = (unsigned char *) cie_init_inst;
    Dwarf_Unsigned uval;
    Dwarf_Unsigned uval2;
    unsigned int uleblen;
    unsigned int off = 0;
    unsigned int loff = 0;
    unsigned short u16;
    unsigned int u32;
    unsigned long long u64;

    for (; len > 0;) {
	unsigned char ibyte = *instp;
	int top = ibyte & 0xc0;
	int bottom = ibyte & 0x3f;
	int delta;
	int reg;

	switch (top) {
	case DW_CFA_advance_loc:
	    delta = ibyte & 0x3f;
	    printf("\t%2u DW_CFA_advance_loc %d", off,
		   (int) (delta * code_alignment_factor));
	    if (verbose) {
		printf("  (%d * %d)", (int) delta,
		       (int) code_alignment_factor);
	    }
	    printf("\n");
	    break;
	case DW_CFA_offset:
	    loff = off;
	    reg = ibyte & 0x3f;
	    uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
	    instp += uleblen;
	    len -= uleblen;
	    off += uleblen;
	    printf("\t%2u DW_CFA_offset ", loff);
	    printreg((Dwarf_Signed) reg, config_data);
	    printf(" %lld", (signed long long)
		   (((Dwarf_Signed) uval) * data_alignment_factor));
	    if (verbose) {
		printf("  (%llu * %d)", (unsigned long long) uval,
		       (int) data_alignment_factor);
	    }
	    printf("\n");
	    break;

	case DW_CFA_restore:
	    reg = ibyte & 0x3f;
	    printf("\t%2u DW_CFA_restore \n", off);
	    printreg((Dwarf_Signed) reg, config_data);
	    printf("\n");
	    break;

	default:
	    loff = off;
	    switch (bottom) {
	    case DW_CFA_set_loc:
		/* operand is address, so need address size */
		/* which will be 4 or 8. */
		switch (addr_size) {
		case 4:
		    {
			__uint32_t v32;

			memcpy(&v32, instp + 1, addr_size);
			uval = v32;
		    }
		    break;
		case 8:
		    {
			__uint64_t v64;

			memcpy(&v64, instp + 1, addr_size);
			uval = v64;
		    }
		    break;
		default:
		    printf
			("Error: Unexpected address size %d in DW_CFA_set_loc!\n",
			 addr_size);
		    uval = 0;
		}

		instp += addr_size;
		len -= (Dwarf_Signed) addr_size;
		off += addr_size;
		printf("\t%2u DW_CFA_set_loc %llu\n",
		       loff, (unsigned long long) uval);
		break;
	    case DW_CFA_advance_loc1:
		delta = (unsigned char) *(instp + 1);
		uval2 = delta;
		instp += 1;
		len -= 1;
		off += 1;
		printf("\t%2u DW_CFA_advance_loc1 %llu\n",
		       loff, (unsigned long long) uval2);
		break;
	    case DW_CFA_advance_loc2:
		memcpy(&u16, instp + 1, 2);
		uval2 = u16;
		instp += 2;
		len -= 2;
		off += 2;
		printf("\t%2u DW_CFA_advance_loc2 %llu\n",
		       loff, (unsigned long long) uval2);
		break;
	    case DW_CFA_advance_loc4:
		memcpy(&u32, instp + 1, 4);
		uval2 = u32;
		instp += 4;
		len -= 4;
		off += 4;
		printf("\t%2u DW_CFA_advance_loc4 %llu\n",
		       loff, (unsigned long long) uval2);
		break;
	    case DW_CFA_MIPS_advance_loc8:
		memcpy(&u64, instp + 1, 8);
		uval2 = u64;
		instp += 8;
		len -= 8;
		off += 8;
		printf("\t%2u DW_CFA_MIPS_advance_loc8 %llu\n",
		       loff, (unsigned long long) uval2);
		break;
	    case DW_CFA_offset_extended:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		uval2 =
		    local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_offset_extended ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf(" %lld", (signed long long)
		       (((Dwarf_Signed) uval2) *
			data_alignment_factor));
		if (verbose) {
		    printf("  (%llu * %d)", (unsigned long long) uval2,
			   (int) data_alignment_factor);
		}
		printf("\n");
		break;

	    case DW_CFA_restore_extended:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_restore_extended ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf("\n");
		break;
	    case DW_CFA_undefined:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_undefined ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf("\n");
		break;
	    case DW_CFA_same_value:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_same_value ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf("\n");
		break;
	    case DW_CFA_register:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		uval2 =
		    local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_register ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf(" = ");
		printreg((Dwarf_Signed) uval2, config_data);
		printf("\n");
		break;
	    case DW_CFA_remember_state:
		printf("\t%2u DW_CFA_remember_state\n", loff);
		break;
	    case DW_CFA_restore_state:
		printf("\t%2u DW_CFA_restore_state\n", loff);
		break;
	    case DW_CFA_def_cfa:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		uval2 =
		    local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_def_cfa ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf(" %llu", (unsigned long long) uval2);
		printf("\n");
		break;
	    case DW_CFA_def_cfa_register:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_def_cfa_register ", loff);
		printreg((Dwarf_Signed) uval, config_data);
		printf("\n");
		break;
	    case DW_CFA_def_cfa_offset:
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		printf("\t%2u DW_CFA_def_cfa_offset %llu\n",
		       loff, (unsigned long long) uval);
		break;

	    case DW_CFA_nop:
		printf("\t%2u DW_CFA_nop\n", loff);
		break;

	    case DW_CFA_def_cfa_expression:	/* DWARF3 */
		{
		    Dwarf_Unsigned block_len =
			local_dwarf_decode_u_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf
			("\t%2u DW_CFA_def_cfa_expression expr block len %lld\n",
			 loff, (unsigned long long)
			 block_len);
		    dump_block("\t\t", (char *) instp+1,
			       (Dwarf_Signed) block_len);
                    printf("\n");
                    if(verbose) {
                      struct esb_s exprstring;
                      esb_constructor(&exprstring);
                      get_string_from_locs(dbg,
			    instp+1,block_len,&exprstring);
                      printf("\t\t%s\n",esb_get_string(&exprstring));
                      esb_destructor(&exprstring);
                    }
		    instp += block_len;
		    len -= block_len;
		    off += block_len;
		}
		break;
	    case DW_CFA_expression:	/* DWARF3 */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		    Dwarf_Unsigned block_len =
			local_dwarf_decode_u_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf
			("\t%2u DW_CFA_expression %llu expr block len %lld\n",
			 loff, (unsigned long long) uval,
			 (unsigned long long)
			 block_len);
		    dump_block("\t\t", (char *) instp+1,
			       (Dwarf_Signed) block_len);
                    printf("\n");
                    if(verbose) {
                      struct esb_s exprstring;
                      esb_constructor(&exprstring);
                      get_string_from_locs(dbg,
			    instp+1,block_len,&exprstring);
                      printf("\t\t%s\n",esb_get_string(&exprstring));
                      esb_destructor(&exprstring);
                    }
		    instp += block_len;
		    len -= block_len;
		    off += block_len;
		}

		break;
	    case DW_CFA_cfa_offset_extended_sf:	/* DWARF3 */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		    Dwarf_Signed sval2 =
			local_dwarf_decode_s_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf("\t%2u DW_CFA_offset_extended_sf ", loff);
		    printreg((Dwarf_Signed) uval, config_data);
		    printf(" %lld", (signed long long)
			   ((sval2) * data_alignment_factor));
		    if (verbose) {
			printf("  (%lld * %d)", (long long) sval2,
			       (int) data_alignment_factor);
		    }
		}
		printf("\n");
		break;
	    case DW_CFA_def_cfa_sf:	/* DWARF3 */
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
		    Dwarf_Signed sval2 =
			local_dwarf_decode_s_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf("\t%2u DW_CFA_def_cfa_sf ", loff);
		    printreg((Dwarf_Signed) uval, config_data);
		    printf(" %lld", (long long) sval2); 
                    printf(" (*data alignment factor=>%lld)",
                     (long long)(sval2*data_alignment_factor));
		}
		printf("\n");
		break;
	    case DW_CFA_def_cfa_offset_sf:	/* DWARF3 */
		{
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		    Dwarf_Signed sval =
			local_dwarf_decode_s_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf("\t%2u DW_CFA_def_cfa_offset_sf %lld (*data alignment factor=> %lld)\n",
			   loff, (long long) sval,
                           (long long)(data_alignment_factor*sval));

		}
		break;
	    case DW_CFA_val_offset:	/* DWARF3 */
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
		    uval2 =
			local_dwarf_decode_s_leb128(instp + 1,
						    &uleblen);
		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf("\t%2u DW_CFA_val_offset ", loff);
		    printreg((Dwarf_Signed) uval, config_data);
		    printf(" %lld", (unsigned long long)
			   (((Dwarf_Signed) uval2) *
			    data_alignment_factor));
		    if (verbose) {
			printf("  (%lld * %d)", (long long) uval2,
			       (int) data_alignment_factor);
		    }
		}
		printf("\n");

		break;
	    case DW_CFA_val_offset_sf:	/* DWARF3 */
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
		    Dwarf_Signed sval2 =
			local_dwarf_decode_s_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf("\t%2u DW_CFA_val_offset_sf ", loff);
		    printreg((Dwarf_Signed) uval, config_data);
		    printf(" %lld", (signed long long)
			   ((sval2) * data_alignment_factor));
		    if (verbose) {
			printf("  (%lld * %d)", (long long) sval2,
			       (int) data_alignment_factor);
		    }
		}
		printf("\n");

		break;
	    case DW_CFA_val_expression:	/* DWARF3 */
                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		uval = local_dwarf_decode_u_leb128(instp + 1, &uleblen);
		instp += uleblen;
		len -= uleblen;
		off += uleblen;
		{
		    Dwarf_Unsigned block_len =
			local_dwarf_decode_u_leb128(instp + 1,
						    &uleblen);

		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;
		    printf
			("\t%2u DW_CFA_val_expression %llu expr block len %lld\n",
			 loff, (unsigned long long) uval,
			 (unsigned long long)
			 block_len);
		    dump_block("\t\t", (char *) instp+1,
			       (Dwarf_Signed) block_len);
                    printf("\n");
                    if(verbose) {
                      struct esb_s exprstring;
                      esb_constructor(&exprstring);
                      get_string_from_locs(dbg,
			    instp+1,block_len,&exprstring);
                      printf("\t\t%s\n",esb_get_string(&exprstring));
                      esb_destructor(&exprstring);
                    }
		    instp += block_len;
		    len -= block_len;
		    off += block_len;
		}


		break;


#ifdef DW_CFA_GNU_window_save
	    case DW_CFA_GNU_window_save:{
		    /* no information: this just tells unwinder to
		       restore the window registers from the previous
		       frame's window save area */
		    printf("\t%2u DW_CFA_GNU_window_save \n", loff);
		    break;
		}
#endif
#ifdef DW_CFA_GNU_negative_offset_extended
	    case DW_CFA_GNU_negative_offset_extended:{
		    printf
			("\t%2u DW_CFA_GNU_negative_offset_extended \n",
			 loff);
		}
#endif
#ifdef  DW_CFA_GNU_args_size
		/* single uleb128 is the current arg area size in
		   bytes. no register exists yet to save this in */
	    case DW_CFA_GNU_args_size:{
		    Dwarf_Unsigned lreg;

                    /* instp is always 1 byte back, so we need +1
			when we use it. See the final increment
                        of this for loop. */
		    lreg =
			local_dwarf_decode_u_leb128(instp + 1,
						    &uleblen);
		    printf
			("\t%2u DW_CFA_GNU_args_size arg size: %llu\n",
			 loff, (unsigned long long) lreg);
		    instp += uleblen;
		    len -= uleblen;
		    off += uleblen;

		    break;
		}
#endif

	    default:
		printf("\t%u Unexpected op 0x%x: \n",
		       loff, (unsigned int) bottom);
		len = 0;
		break;
	    }
	}
	instp++;
	len--;
	off++;
    }
}
示例#23
0
static void
print_one_frame_reg_col(Dwarf_Debug dbg,
                        Dwarf_Unsigned rule_id,
                        Dwarf_Small value_type,
                        Dwarf_Unsigned reg_used,
                        struct dwconf_s *config_data,
                        Dwarf_Signed offset_relevant,
                        Dwarf_Signed offset, 
                        Dwarf_Ptr block_ptr)
{
    char *type_title = "";
    int print_type_title = 1;

    if (config_data->cf_interface_number == 2)
	print_type_title = 0;

    switch (value_type) {
    case DW_EXPR_OFFSET:
	type_title = "off";
	goto preg2;
    case DW_EXPR_VAL_OFFSET:
	type_title = "valoff";
      preg2:
	if (reg_used == config_data->cf_initial_rule_value) {
	    break;
	}
	if (print_type_title)
	    printf("<%s ", type_title);
	printreg((Dwarf_Signed) rule_id, config_data);
	printf("=");
	if (offset_relevant == 0) {
	    printreg((Dwarf_Signed) reg_used, config_data);
	    printf(" ");
	} else {
	    printf("%02lld", offset);
	    printf("(");
	    printreg((Dwarf_Signed) reg_used, config_data);
	    printf(") ");
	}
	if (print_type_title)
	    printf("%s", "> ");
	break;
    case DW_EXPR_EXPRESSION:
	type_title = "expr";
	goto pexp2;
    case DW_EXPR_VAL_EXPRESSION:
	type_title = "valexpr";
      pexp2:
	if (print_type_title)
	    printf("<%s ", type_title);
	printreg((Dwarf_Signed) rule_id, config_data);
	printf("=");
	printf("expr-block-len=%lld", (long long) offset);
	if (print_type_title)
	    printf("%s", "> ");
	if (verbose) {
	    char pref[40];

	    strcpy(pref, "<");
	    strcat(pref, type_title);
	    strcat(pref, "bytes:");
	    dump_block(pref, block_ptr, offset);
	    printf("%s", "> ");
            if(verbose) {
                      struct esb_s exprstring;
                      esb_constructor(&exprstring);
                      get_string_from_locs(dbg,
			    block_ptr,offset,&exprstring);
                      printf("<expr:%s>",esb_get_string(&exprstring));
                      esb_destructor(&exprstring);
            }
	}
	break;
    default:
	printf("Internal error in libdwarf, value type %d\n",
	       value_type);
	exit(1);
    }
    return;
}