当前位置: 首页>>代码示例>>C++>>正文


C++ BX_DEBUG函数代码示例

本文整理汇总了C++中BX_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ BX_DEBUG函数的具体用法?C++ BX_DEBUG怎么用?C++ BX_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BX_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: defined

void bx_tap_pktmover_c::rx_timer()
{
  int nbytes;
  Bit8u buf[BX_PACKET_BUFSIZE];
  Bit8u *rxbuf;
  if (fd<0) return;
#if defined(__sun__)
  struct strbuf sbuf;
  int f = 0;
  sbuf.maxlen = sizeof(buf);
  sbuf.buf = (char *)buf;
  nbytes = getmsg(fd, NULL, &sbuf, &f) >=0 ? sbuf.len : -1;
#else
  nbytes = read (fd, buf, sizeof(buf));
#endif

  // hack: discard first two bytes
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__sun__) // Should be fixed for other *BSD
  rxbuf = buf;
#else
  rxbuf = buf+2;
  nbytes-=2;
#endif

#if defined(__linux__)
  // hack: TAP device likes to create an ethernet header which has
  // the same source and destination address FE:FD:00:00:00:00.
  // Change the dest address to FE:FD:00:00:00:01.
  if (!memcmp(&rxbuf[0], &rxbuf[6], 6)) {
    rxbuf[5] = guest_macaddr[5];
  }
#endif

  if (nbytes>0)
    BX_DEBUG(("tap read returned %d bytes", nbytes));
  if (nbytes<0) {
    if (errno != EAGAIN)
      BX_ERROR(("tap read error: %s", strerror(errno)));
    return;
  }
#if BX_ETH_TAP_LOGGING
  if (nbytes > 0) {
    BX_DEBUG(("receive packet length %u", nbytes));
    // dump raw bytes to a file, eventually dump in pcap format so that
    // tcpdump -r FILE can interpret them for us.
    int n = fwrite(rxbuf, nbytes, 1, rxlog);
    if (n != 1) BX_ERROR(("fwrite to rxlog failed, nbytes = %d", nbytes));
    // dump packet in hex into an ascii log file
    write_pktlog_txt(rxlog_txt, rxbuf, nbytes, 1);
    // flush log so that we see the packets as they arrive w/o buffering
    fflush(rxlog);
  }
#endif
  BX_DEBUG(("eth_tap: got packet: %d bytes, dst=%x:%x:%x:%x:%x:%x, src=%x:%x:%x:%x:%x:%x\n", nbytes, rxbuf[0], rxbuf[1], rxbuf[2], rxbuf[3], rxbuf[4], rxbuf[5], rxbuf[6], rxbuf[7], rxbuf[8], rxbuf[9], rxbuf[10], rxbuf[11]));
  if (nbytes < 60) {
    BX_INFO(("packet too short (%d), padding to 60", nbytes));
    nbytes = 60;
  }
  (*rxh)(netdev, rxbuf, nbytes);
}
开发者ID:iver6,项目名称:BA,代码行数:60,代码来源:eth_tap.cpp

示例2: BX_DEBUG

BX_CPU_C::load_cs(bx_selector_t *selector, bx_descriptor_t *descriptor, Bit8u cpl)
{
  BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector = *selector;
  BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache    = *descriptor;

  /* caller may request different CPL then in selector */
  BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl = cpl;
  BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid  = 1;
  // Added cpl to the selector value.
  BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value =
    (0xfffc & BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value) | cpl;

#if BX_SUPPORT_X86_64
  if (BX_CPU_THIS_PTR efer.lma) {
    if (descriptor->u.segment.l) {
      BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_64;
      BX_DEBUG(("Long Mode Activated"));
      loadSRegLMNominal(BX_SEG_REG_CS, selector->value, cpl);
    }
    else {
      BX_DEBUG(("Compatibility Mode Activated"));
      BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_COMPAT;
    }
  }
#endif

#if BX_SUPPORT_ICACHE
  BX_CPU_THIS_PTR updateFetchModeMask();
#endif

  // Loading CS will invalidate the EIP fetch window.
  invalidate_prefetch_q();
}
开发者ID:ralvaradoc,项目名称:libsf,代码行数:33,代码来源:ctrl_xfer_pro.cpp

示例3: setup_port

int serial_raw::receive()
{
#ifdef WIN32
  int data;
#endif

  if (present) {
#ifdef WIN32
    if (DCBchanged) {
      setup_port();
    }
    data = rxdata_buffer[0];
    if (rxdata_count > 0) {
      memcpy(&rxdata_buffer[0], &rxdata_buffer[1], sizeof(Bit16s)*(RX_BUFSIZE-1));
      rxdata_count--;
    }
    if (data < 0) {
      switch (data) {
        case RAW_EVENT_CTS_ON:
          MSR_value |= 0x10;
          break;
        case RAW_EVENT_CTS_OFF:
          MSR_value &= ~0x10;
          break;
        case RAW_EVENT_DSR_ON:
          MSR_value |= 0x20;
          break;
        case RAW_EVENT_DSR_OFF:
          MSR_value &= ~0x20;
          break;
        case RAW_EVENT_RING_ON:
          MSR_value |= 0x40;
          break;
        case RAW_EVENT_RING_OFF:
          MSR_value &= ~0x40;
          break;
        case RAW_EVENT_RLSD_ON:
          MSR_value |= 0x80;
          break;
        case RAW_EVENT_RLSD_OFF:
          MSR_value &= ~0x80;
          break;
      }
    }
    return data;
#else
    BX_DEBUG (("receive returning 'A'"));
    return (int)'A';
#endif
  } else {
    BX_DEBUG (("receive returning 'A'"));
    return (int)'A';
  }
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:54,代码来源:serial_raw.cpp

示例4: BX_DEBUG

BXKeyEntry *bx_keymap_c::findHostKey(Bit32u key)
{
  // We look through the keymap table to find the searched key
  for (Bit16u i=0; i<keymapCount; i++) {
    if (keymapTable[i].hostKey == key) {
      BX_DEBUG (("key 0x%02x matches hostKey for entry #%d", key, i));
      return &keymapTable[i];
    }
  }
  BX_DEBUG(("key %02x matches no entries", key));

  // Return default
  return NULL;
}
开发者ID:ralvaradoc,项目名称:libsf,代码行数:14,代码来源:keymap.cpp

示例5: BX_DEBUG

void bx_pit_c::handle_timer()
{
  Bit64u my_time_usec = bx_virt_timer.time_usec();
  Bit64u time_passed = my_time_usec-BX_PIT_THIS s.last_usec;
  Bit32u time_passed32 = (Bit32u)time_passed;

  BX_DEBUG(("entering timer handler"));

  if(time_passed32) {
    periodic(time_passed32);
  }
  BX_PIT_THIS s.last_usec = BX_PIT_THIS s.last_usec + time_passed;
  if (time_passed || (BX_PIT_THIS s.last_next_event_time != BX_PIT_THIS s.timer.get_next_event_time())) {
    BX_DEBUG(("RESETting timer"));
    bx_virt_timer.deactivate_timer(BX_PIT_THIS s.timer_handle[0]);
    BX_DEBUG(("deactivated timer"));
    if(BX_PIT_THIS s.timer.get_next_event_time()) {
      bx_virt_timer.activate_timer(BX_PIT_THIS s.timer_handle[0],
                                   (Bit32u)BX_MAX(1,TICKS_TO_USEC(BX_PIT_THIS s.timer.get_next_event_time())),
                                   0);
      BX_DEBUG(("activated timer"));
    }
    BX_PIT_THIS s.last_next_event_time = BX_PIT_THIS s.timer.get_next_event_time();
  }
  BX_DEBUG(("s.last_usec="FMT_LL"d", BX_PIT_THIS s.last_usec));
  BX_DEBUG(("s.timer_id=%d", BX_PIT_THIS s.timer_handle[0]));
  BX_DEBUG(("s.timer.get_next_event_time=%x", BX_PIT_THIS s.timer.get_next_event_time()));
  BX_DEBUG(("s.last_next_event_time=%d", BX_PIT_THIS s.last_next_event_time));
}
开发者ID:iver6,项目名称:BA,代码行数:29,代码来源:pit_wrap.cpp

示例6: BX_DEBUG

off_t vmware3_image_t::perform_seek()
{
    if(requested_offset < current->min_offset || requested_offset >= current->max_offset)
    {
        if(!sync())
        {
            BX_DEBUG(("could not sync before switching vmware3 COW files"));
            return INVALID_OFFSET;
        }

        while(requested_offset < current->min_offset)
            current = &images[current->header.chain_id - 1];

        while(requested_offset >= current->max_offset)
            current = &images[current->header.chain_id + 1];
    }

    if(current->offset != INVALID_OFFSET && requested_offset >= current->offset
            && requested_offset < current->offset + tlb_size)
        return (requested_offset - current->offset);

    if(!sync())
    {
        BX_DEBUG(("could not sync before seeking vmware3 COW file"));
        return INVALID_OFFSET;
    }

    unsigned relative_offset = (unsigned)(requested_offset - current->min_offset);
    unsigned i = relative_offset >> FL_SHIFT;
    unsigned j = (relative_offset & ~FL_MASK) / tlb_size;

    if(current->slb[i][j])
    {
        if(::lseek(current->fd, current->slb[i][j] * 512, SEEK_SET) < 0)
        {
            BX_DEBUG(("could not seek vmware3 COW to sector slb[%d][%d]", i, j));
            return INVALID_OFFSET;
        }
        if(::read(current->fd, current->tlb, tlb_size) < 0)
        {
            BX_DEBUG(("could not read %d bytes from vmware3 COW image", tlb_size));
            return INVALID_OFFSET;
        }
    }
    else memset(current->tlb, 0, tlb_size);

    current->offset = (requested_offset / tlb_size) * tlb_size;
    return (requested_offset - current->offset);
}
开发者ID:iver6,项目名称:BA,代码行数:49,代码来源:vmware3.cpp

示例7: BX_DEBUG

void serial_raw::set_parity_mode(int mode)
{
  BX_DEBUG (("set parity mode %d", mode));
#ifdef WIN32
  switch (mode) {
    case 0:
      dcb.fParity = FALSE;
      dcb.Parity = NOPARITY;
      break;
    case 1:
      dcb.fParity = TRUE;
      dcb.Parity = ODDPARITY;
      break;
    case 2:
      dcb.fParity = TRUE;
      dcb.Parity = EVENPARITY;
      break;
    case 3:
      dcb.fParity = TRUE;
      dcb.Parity = MARKPARITY;
      break;
    case 4:
      dcb.fParity = TRUE;
      dcb.Parity = SPACEPARITY;
      break;
  }
  DCBchanged = TRUE;
#endif
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:29,代码来源:serial_raw.cpp

示例8: BX_DEBUG

void BX_CPU_C::iret32_stack_return_from_v86(bxInstruction_c *i)
{
  if (BX_CPU_THIS_PTR get_IOPL() < 3) {
    // trap to virtual 8086 monitor
    BX_DEBUG(("IRET in vm86 with IOPL != 3, VME = 0"));
    exception(BX_GP_EXCEPTION, 0);
  }

  Bit32u eip, cs_raw, flags32;
  // Build a mask of the following bits:
  // ID,VIP,VIF,AC,VM,RF,x,NT,IOPL,OF,DF,IF,TF,SF,ZF,x,AF,x,PF,x,CF
  Bit32u change_mask = EFlagsOSZAPCMask | EFlagsTFMask | EFlagsIFMask
                         | EFlagsDFMask | EFlagsNTMask | EFlagsRFMask;

#if BX_CPU_LEVEL >= 4
  change_mask |= (EFlagsIDMask | EFlagsACMask);  // ID/AC
#endif

  eip     = pop_32();
  cs_raw  = pop_32();
  flags32 = pop_32();

  load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], (Bit16u) cs_raw);
  EIP = eip;
  // VIF, VIP, VM, IOPL unchanged
  writeEFlags(flags32, change_mask);
}
开发者ID:iver6,项目名称:BA,代码行数:27,代码来源:vm8086.cpp

示例9: while

ssize_t vmware3_image_t::write(const void * buf, size_t count)
{
    ssize_t total = 0;
    while(count > 0)
    {
        off_t offset = perform_seek();
        if(offset == INVALID_OFFSET)
            return -1;
        unsigned bytes_remaining = (unsigned)(tlb_size - offset);
        unsigned amount = 0;
        current->synced = false;
        if(bytes_remaining > count)
        {
            memcpy(current->tlb + offset, buf, count);
            amount = count;
        }
        else
        {
            memcpy(current->tlb + offset, buf, bytes_remaining);
            if(!sync())
            {
                BX_DEBUG(("failed to sync when writing %u bytes", (unsigned)count));
                return -1;
            }
            amount = bytes_remaining;
        }
        requested_offset += amount;
        total += amount;
        count -= amount;
    }
    return total;
}
开发者ID:iver6,项目名称:BA,代码行数:32,代码来源:vmware3.cpp

示例10: UNUSED

void BochsView::MouseUp(BPoint point)
{
  UNUSED(point);
  // currently a place holder function
  BX_DEBUG(("mouseup()"));
  BView::MouseUp(point);
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:7,代码来源:beos.cpp

示例11: invalidate_prefetch_q

  void
bx_cpu_c::RETnear32_Iw(BxInstruction_t *i)
{
  Bit16u imm16;
  Bit32u temp_ESP;
  Bit32u return_EIP;

#if BX_DEBUGGER
  bx_cpu. show_flag |= Flag_ret;
#endif

  if (bx_cpu. sregs[BX_SEG_REG_SS].cache.u.segment.d_b) /* 32bit stack */
    temp_ESP = ESP;
  else
    temp_ESP = SP;

  imm16 = i->Iw;

  invalidate_prefetch_q();


    if (protected_mode()) {
      if ( !can_pop(4) ) {
        BX_PANIC(("retnear_iw: can't pop EIP"));
        /* ??? #SS(0) -or #GP(0) */
        }

      access_linear(bx_cpu. sregs[BX_SEG_REG_SS].cache.u.segment.base + temp_ESP + 0,
        4, CPL==3, BX_READ, &return_EIP);

      if (protected_mode() &&
          (return_EIP > bx_cpu. sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) ) {
        BX_DEBUG(("retnear_iw: EIP > limit"));
        exception(BX_GP_EXCEPTION, 0, 0);
        }

      /* Pentium book says imm16 is number of words ??? */
      if ( !can_pop(4 + imm16) ) {
        BX_PANIC(("retnear_iw: can't release bytes from stack"));
        /* #GP(0) -or #SS(0) ??? */
        }

      bx_cpu. eip = return_EIP;
      if (bx_cpu. sregs[BX_SEG_REG_SS].cache.u.segment.d_b) /* 32bit stack */
        ESP += 4 + imm16; /* ??? should it be 2*imm16 ? */
      else
        SP  += 4 + imm16;
      }
    else {
      pop_32(&return_EIP);
      bx_cpu. eip = return_EIP;
      if (bx_cpu. sregs[BX_SEG_REG_SS].cache.u.segment.d_b) /* 32bit stack */
        ESP += imm16; /* ??? should it be 2*imm16 ? */
      else
        SP  += imm16;
      }

  BX_INSTR_UCNEAR_BRANCH(BX_INSTR_IS_RET, bx_cpu. eip);
}
开发者ID:uranix,项目名称:LiveDump,代码行数:59,代码来源:ctrl_xfer32.cpp

示例12: strcpy

// Dumps the contents of a buffer to the log file
void usb_device_c::usb_dump_packet(Bit8u *data, unsigned size)
{
  char the_packet[256], str[16];
  strcpy(the_packet, "Packet contents (in hex):");
  unsigned offset = 0;
  for (unsigned p=0; p<size; p++) {
    if (!(p & 0x0F)) {
      BX_DEBUG(("%s", the_packet));
      sprintf(the_packet, "  0x%04X ", offset);
      offset += 16;
    }
    sprintf(str, " %02X", data[p]);
    strcat(the_packet, str);
  }
  if (strlen(the_packet))
    BX_DEBUG(("%s", the_packet));
}
开发者ID:iver6,项目名称:BA,代码行数:18,代码来源:usb_common.cpp

示例13: DEV_register_irq

void bx_pit_c::init(void)
{
  DEV_register_irq(0, "8254 PIT");
  DEV_register_ioread_handler(this, read_handler, 0x0040, "8254 PIT", 1);
  DEV_register_ioread_handler(this, read_handler, 0x0041, "8254 PIT", 1);
  DEV_register_ioread_handler(this, read_handler, 0x0042, "8254 PIT", 1);
  DEV_register_ioread_handler(this, read_handler, 0x0043, "8254 PIT", 1);
  DEV_register_ioread_handler(this, read_handler, 0x0061, "8254 PIT", 1);

  DEV_register_iowrite_handler(this, write_handler, 0x0040, "8254 PIT", 1);
  DEV_register_iowrite_handler(this, write_handler, 0x0041, "8254 PIT", 1);
  DEV_register_iowrite_handler(this, write_handler, 0x0042, "8254 PIT", 1);
  DEV_register_iowrite_handler(this, write_handler, 0x0043, "8254 PIT", 1);
  DEV_register_iowrite_handler(this, write_handler, 0x0061, "8254 PIT", 1);

  BX_DEBUG(("starting init"));

  BX_PIT_THIS s.speaker_data_on = 0;
  BX_PIT_THIS s.refresh_clock_div2 = 0;

  BX_PIT_THIS s.timer.init();
  BX_PIT_THIS s.timer.set_OUT_handler(0, irq_handler);

  Bit64u my_time_usec = bx_virt_timer.time_usec();

  if (BX_PIT_THIS s.timer_handle[0] == BX_NULL_TIMER_HANDLE) {
    BX_PIT_THIS s.timer_handle[0] = bx_virt_timer.register_timer(this, timer_handler, (unsigned) 100 , 1, 1, "pit_wrap");
  }
  BX_DEBUG(("RESETting timer."));
  bx_virt_timer.deactivate_timer(BX_PIT_THIS s.timer_handle[0]);
  BX_DEBUG(("deactivated timer."));
  if (BX_PIT_THIS s.timer.get_next_event_time()) {
    bx_virt_timer.activate_timer(BX_PIT_THIS s.timer_handle[0],
                                 (Bit32u)BX_MAX(1,TICKS_TO_USEC(BX_PIT_THIS s.timer.get_next_event_time())),
                                 0);
    BX_DEBUG(("activated timer."));
  }
  BX_PIT_THIS s.last_next_event_time = BX_PIT_THIS s.timer.get_next_event_time();
  BX_PIT_THIS s.last_usec = my_time_usec;

  BX_PIT_THIS s.total_ticks = 0;
  BX_PIT_THIS s.total_usec = 0;

  BX_DEBUG(("finished init"));

  BX_DEBUG(("s.last_usec="FMT_LL"d",BX_PIT_THIS s.last_usec));
  BX_DEBUG(("s.timer_id=%d",BX_PIT_THIS s.timer_handle[0]));
  BX_DEBUG(("s.timer.get_next_event_time=%d", BX_PIT_THIS s.timer.get_next_event_time()));
  BX_DEBUG(("s.last_next_event_time=%d", BX_PIT_THIS s.last_next_event_time));
}
开发者ID:iver6,项目名称:BA,代码行数:50,代码来源:pit_wrap.cpp

示例14: defined

void bx_tap_pktmover_c::sendpkt(void *buf, unsigned io_len)
{
  Bit8u txbuf[BX_PACKET_BUFSIZE];
  txbuf[0] = 0;
  txbuf[1] = 0;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
   defined(__APPLE__)  || defined(__OpenBSD__) // Should be fixed for other *BSD
  memcpy(txbuf, buf, io_len);
  unsigned int size = write(fd, txbuf, io_len);
  if (size != io_len) {
#else
  memcpy(txbuf+2, buf, io_len);
  unsigned int size = write(fd, txbuf, io_len+2);
  if (size != io_len+2) {
#endif
    BX_PANIC(("write on tap device: %s", strerror(errno)));
  } else {
    BX_DEBUG(("wrote %d bytes + 2 byte pad on tap", io_len));
  }
#if BX_ETH_TAP_LOGGING
  BX_DEBUG(("sendpkt length %u", io_len));
  // dump raw bytes to a file, eventually dump in pcap format so that
  // tcpdump -r FILE can interpret them for us.
  int n = fwrite(buf, io_len, 1, txlog);
  if (n != 1) BX_ERROR(("fwrite to txlog failed, io_len = %u", io_len));
  // dump packet in hex into an ascii log file
  fprintf(txlog_txt, "NE2K transmitting a packet, length %u\n", io_len);
  Bit8u *charbuf = (Bit8u *)buf;
  for (n=0; n<(int)io_len; n++) {
    if (((n % 16) == 0) && n>0)
      fprintf(txlog_txt, "\n");
    fprintf(txlog_txt, "%02x ", charbuf[n]);
  }
  fprintf(txlog_txt, "\n--\n");
  // flush log so that we see the packets as they arrive w/o buffering
  fflush(txlog);
  fflush(txlog_txt);
#endif
}

void bx_tap_pktmover_c::rx_timer_handler(void *this_ptr)
{
  bx_tap_pktmover_c *class_ptr = (bx_tap_pktmover_c *) this_ptr;
  class_ptr->rx_timer();
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:45,代码来源:eth_tap.cpp

示例15: BX_DEBUG

void bx_arpback_pktmover_c::rx_timer_handler (void * this_ptr)
{
#if BX_ETH_NULL_LOGGING
  BX_DEBUG (("rx_timer_handler"));
#endif
  bx_arpback_pktmover_c *class_ptr = ((bx_arpback_pktmover_c *)this_ptr);

  class_ptr->rx_timer();
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:9,代码来源:eth_arpback.cpp


注:本文中的BX_DEBUG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。