本文整理汇总了C++中qemu_put_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ qemu_put_buffer函数的具体用法?C++ qemu_put_buffer怎么用?C++ qemu_put_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qemu_put_buffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: boot_property_save_property
/* Saves a single BootProperty to file.
*/
static int
boot_property_save_property( QEMUFile *f, BootProperty *p )
{
/* split in key and value, so we can re-use boot_property_add (and its
* sanity checks) when loading
*/
char *split = strchr(p->property, '=');
if (split == NULL) {
D("%s: save failed: illegal key/value pair \"%s\" (missing '=')\n",
__FUNCTION__, p->property);
qemu_file_set_error(f, -EINVAL);
return -1;
}
*split = '\0'; /* p->property is now "<key>\0<value>\0" */
uint32_t key_buf_len = (split - p->property) + 1; // +1: '\0' terminator
qemu_put_be32(f, key_buf_len);
qemu_put_buffer(f, (uint8_t*) p->property, key_buf_len);
uint32_t value_buf_len = p->length - key_buf_len + 1; // +1: '\0' terminator
qemu_put_be32(f, value_buf_len);
qemu_put_buffer(f, (uint8_t*) split + 1, value_buf_len);
*split = '='; /* restore property to "<key>=<value>\0" */
return 0;
}
开发者ID:Dorahe,项目名称:platform_external_qemu,代码行数:31,代码来源:boot-properties.c
示例2: boot_property_save_property
static int
boot_property_save_property( QEMUFile *f, BootProperty *p )
{
char *split = strchr(p->property, '=');
if (split == NULL) {
D("%s: save failed: illegal key/value pair \"%s\" (missing '=')\n",
__FUNCTION__, p->property);
qemu_file_set_error(f);
return -1;
}
*split = '\0';
uint32_t key_buf_len = (split - p->property) + 1;
qemu_put_be32(f, key_buf_len);
qemu_put_buffer(f, (uint8_t*) p->property, key_buf_len);
uint32_t value_buf_len = p->length - key_buf_len + 1;
qemu_put_be32(f, value_buf_len);
qemu_put_buffer(f, (uint8_t*) split + 1, value_buf_len);
*split = '=';
return 0;
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:26,代码来源:boot-properties.c
示例3: smc91c111_save
static void smc91c111_save(QEMUFile *f, void *opaque)
{
smc91c111_state *s = opaque;
qemu_put_be16(f, s->tcr);
qemu_put_be16(f, s->rcr);
qemu_put_be16(f, s->cr);
qemu_put_be16(f, s->ctr);
qemu_put_be16(f, s->gpr);
qemu_put_be16(f, s->ptr);
qemu_put_be16(f, s->ercv);
qemu_put_be32(f, s->bank);
qemu_put_be32(f, s->packet_num);
qemu_put_be32(f, s->tx_alloc);
qemu_put_be32(f, s->allocated);
qemu_put_be32(f, s->tx_fifo_len);
qemu_put_buffer(f, (uint8_t*) s->tx_fifo, sizeof(s->tx_fifo));
qemu_put_be32(f, s->rx_fifo_len);
qemu_put_buffer(f, (uint8_t*) s->rx_fifo, sizeof(s->rx_fifo));
qemu_put_be32(f, s->tx_fifo_done_len);
qemu_put_buffer(f, (uint8_t*) s->tx_fifo_done, sizeof(s->tx_fifo_done));
qemu_put_buffer(f, (uint8_t*) s->data, sizeof(s->data));
qemu_put_byte(f, s->int_level);
qemu_put_byte(f, s->int_mask);
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:31,代码来源:smc91c111.c
示例4: msix_save
void msix_save(PCIDevice *dev, QEMUFile *f)
{
unsigned n = dev->msix_entries_nr;
if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {
return;
}
qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE);
qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8);
}
开发者ID:dariaphoebe,项目名称:qemu,代码行数:11,代码来源:msix.c
示例5: msix_save
void msix_save(PCIDevice *dev, QEMUFile *f)
{
unsigned n = dev->msix_entries_nr;
if (!msix_present(dev)) {
return;
}
qemu_put_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
qemu_put_buffer(f, dev->msix_pba, (n + 7) / 8);
}
开发者ID:anshulmakkar,项目名称:vhost_user,代码行数:11,代码来源:msix.c
示例6: mipsnet_save
static void mipsnet_save(QEMUFile *f, void *opaque)
{
MIPSnetState *s = opaque;
qemu_put_be32s(f, &s->busy);
qemu_put_be32s(f, &s->rx_count);
qemu_put_be32s(f, &s->rx_read);
qemu_put_be32s(f, &s->tx_count);
qemu_put_be32s(f, &s->tx_written);
qemu_put_be32s(f, &s->intctl);
qemu_put_buffer(f, s->rx_buffer, MAX_ETH_FRAME_SIZE);
qemu_put_buffer(f, s->tx_buffer, MAX_ETH_FRAME_SIZE);
}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:13,代码来源:mipsnet.c
示例7: slavio_serial_save_chn
static void slavio_serial_save_chn(QEMUFile *f, ChannelState *s)
{
qemu_put_be32s(f, &s->irq);
qemu_put_be32s(f, &s->reg);
qemu_put_be32s(f, &s->rxint);
qemu_put_be32s(f, &s->txint);
qemu_put_be32s(f, &s->rxint_under_svc);
qemu_put_be32s(f, &s->txint_under_svc);
qemu_put_8s(f, &s->rx);
qemu_put_8s(f, &s->tx);
qemu_put_buffer(f, s->wregs, 16);
qemu_put_buffer(f, s->rregs, 16);
}
开发者ID:AmesianX,项目名称:winkvm,代码行数:13,代码来源:slavio_serial.c
示例8: tcx_save
static void tcx_save(QEMUFile *f, void *opaque)
{
TCXState *s = opaque;
qemu_put_be16s(f, &s->height);
qemu_put_be16s(f, &s->width);
qemu_put_be16s(f, &s->depth);
qemu_put_buffer(f, s->r, 256);
qemu_put_buffer(f, s->g, 256);
qemu_put_buffer(f, s->b, 256);
qemu_put_8s(f, &s->dac_index);
qemu_put_8s(f, &s->dac_state);
}
开发者ID:BackupTheBerlios,项目名称:ar7-firmware-svn,代码行数:13,代码来源:tcx.c
示例9: slavio_serial_save_chn
static void slavio_serial_save_chn(QEMUFile *f, ChannelState *s)
{
int tmp;
tmp = 0;
qemu_put_be32s(f, &tmp); /* unused, was IRQ. */
qemu_put_be32s(f, &s->reg);
qemu_put_be32s(f, &s->rxint);
qemu_put_be32s(f, &s->txint);
qemu_put_be32s(f, &s->rxint_under_svc);
qemu_put_be32s(f, &s->txint_under_svc);
qemu_put_8s(f, &s->rx);
qemu_put_8s(f, &s->tx);
qemu_put_buffer(f, s->wregs, SERIAL_REGS);
qemu_put_buffer(f, s->rregs, SERIAL_REGS);
}
开发者ID:anhkgg,项目名称:temu,代码行数:15,代码来源:slavio_serial.c
示例10: save_xbzrle_page
static int save_xbzrle_page(QEMUFile *f, uint8_t **current_data,
ram_addr_t current_addr, RAMBlock *block,
ram_addr_t offset, int cont, bool last_stage)
{
int encoded_len = 0, bytes_sent = -1;
uint8_t *prev_cached_page;
if (!cache_is_cached(XBZRLE.cache, current_addr)) {
acct_info.xbzrle_cache_miss++;
if (!last_stage) {
if (cache_insert(XBZRLE.cache, current_addr, *current_data) == -1) {
return -1;
} else {
/* update *current_data when the page has been
inserted into cache */
*current_data = get_cached_data(XBZRLE.cache, current_addr);
}
}
return -1;
}
prev_cached_page = get_cached_data(XBZRLE.cache, current_addr);
/* save current buffer into memory */
memcpy(XBZRLE.current_buf, *current_data, TARGET_PAGE_SIZE);
/* XBZRLE encoding (if there is no overflow) */
encoded_len = xbzrle_encode_buffer(prev_cached_page, XBZRLE.current_buf,
TARGET_PAGE_SIZE, XBZRLE.encoded_buf,
TARGET_PAGE_SIZE);
if (encoded_len == 0) {
DPRINTF("Skipping unmodified page\n");
return 0;
} else if (encoded_len == -1) {
DPRINTF("Overflow\n");
acct_info.xbzrle_overflows++;
/* update data in the cache */
if (!last_stage) {
memcpy(prev_cached_page, *current_data, TARGET_PAGE_SIZE);
*current_data = prev_cached_page;
}
return -1;
}
/* we need to update the data in the cache, in order to get the same data */
if (!last_stage) {
memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
}
/* Send XBZRLE based compressed page */
bytes_sent = save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_XBZRLE);
qemu_put_byte(f, ENCODING_FLAG_XBZRLE);
qemu_put_be16(f, encoded_len);
qemu_put_buffer(f, XBZRLE.encoded_buf, encoded_len);
bytes_sent += encoded_len + 1 + 2;
acct_info.xbzrle_pages++;
acct_info.xbzrle_bytes += bytes_sent;
return bytes_sent;
}
开发者ID:DrCheadar,项目名称:orp,代码行数:60,代码来源:arch_init.c
示例11: put_buffer
static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *field,
QJSON *vmdesc)
{
uint8_t *v = pv;
qemu_put_buffer(f, v, size);
return 0;
}
开发者ID:mmuman,项目名称:qemu,代码行数:7,代码来源:vmstate.c
示例12: ram_save_block
static int ram_save_block(QEMUFile *f)
{
static ram_addr_t current_addr = 0;
ram_addr_t saved_addr = current_addr;
ram_addr_t addr = 0;
int found = 0;
while (addr < last_ram_offset) {
if (cpu_physical_memory_get_dirty(current_addr, MIGRATION_DIRTY_FLAG)) {
uint8_t *p;
cpu_physical_memory_reset_dirty(current_addr,
current_addr + TARGET_PAGE_SIZE,
MIGRATION_DIRTY_FLAG);
p = qemu_get_ram_ptr(current_addr);
if (is_dup_page(p, *p)) {
qemu_put_be64(f, current_addr | RAM_SAVE_FLAG_COMPRESS);
qemu_put_byte(f, *p);
} else {
qemu_put_be64(f, current_addr | RAM_SAVE_FLAG_PAGE);
qemu_put_buffer(f, p, TARGET_PAGE_SIZE);
}
found = 1;
break;
}
addr += TARGET_PAGE_SIZE;
current_addr = (saved_addr + addr) % last_ram_offset;
}
return found;
}
开发者ID:Ringdingcoder,项目名称:qemu,代码行数:34,代码来源:arch_init.c
示例13: qemu_mallocz
/* Initialisation routine */
void *ds1225y_init(target_phys_addr_t mem_base, const char *filename)
{
ds1225y_t *s;
int mem_indexRW, mem_indexRP;
QEMUFile *file;
s = qemu_mallocz(sizeof(ds1225y_t));
s->chip_size = 0x2000; /* Fixed for ds1225y chip: 8 KiB */
s->contents = qemu_mallocz(s->chip_size);
s->protection = 7;
/* Read current file */
file = qemu_fopen(filename, "rb");
if (file) {
/* Read nvram contents */
qemu_get_buffer(file, s->contents, s->chip_size);
qemu_fclose(file);
}
s->file = qemu_fopen(filename, "wb");
if (s->file) {
/* Write back contents, as 'wb' mode cleaned the file */
qemu_put_buffer(s->file, s->contents, s->chip_size);
qemu_fflush(s->file);
}
/* Read/write memory */
mem_indexRW = cpu_register_io_memory(nvram_read, nvram_write, s);
cpu_register_physical_memory(mem_base, s->chip_size, mem_indexRW);
/* Read/write protected memory */
mem_indexRP = cpu_register_io_memory(nvram_read, nvram_write_protected, s);
cpu_register_physical_memory(mem_base + s->chip_size, s->chip_size, mem_indexRP);
return s;
}
开发者ID:ESOS-Lab,项目名称:VSSIM,代码行数:34,代码来源:ds1225y.c
示例14: virtio_save
void virtio_save(VirtIODevice *vdev, QEMUFile *f)
{
int i;
if (vdev->binding->save_config)
vdev->binding->save_config(vdev->binding_opaque, f);
qemu_put_8s(f, &vdev->status);
qemu_put_8s(f, &vdev->isr);
qemu_put_be16s(f, &vdev->queue_sel);
qemu_put_be32s(f, &vdev->guest_features);
qemu_put_be32(f, vdev->config_len);
qemu_put_buffer(f, vdev->config, vdev->config_len);
for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
if (vdev->vq[i].vring.num == 0)
break;
}
qemu_put_be32(f, i);
for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
if (vdev->vq[i].vring.num == 0)
break;
qemu_put_be32(f, vdev->vq[i].vring.num);
qemu_put_be64(f, vdev->vq[i].pa);
qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
if (vdev->binding->save_queue)
vdev->binding->save_queue(vdev->binding_opaque, i, f);
}
}
开发者ID:iggy,项目名称:qemu,代码行数:32,代码来源:virtio.c
示例15: wav_capture
static void wav_capture (void *opaque, void *buf, int size)
{
WAVState *wav = opaque;
qemu_put_buffer (wav->f, buf, size);
wav->bytes += size;
}
开发者ID:AsherBond,项目名称:qemu-kvm,代码行数:7,代码来源:wavcapture.c
示例16: rtc_save
static void rtc_save(QEMUFile *f, void *opaque)
{
RTCState *s = opaque;
qemu_put_buffer(f, s->cmos_data, 128);
qemu_put_8s(f, &s->cmos_index);
}
开发者ID:CPFL,项目名称:gxen,代码行数:7,代码来源:rtc-dm.c
示例17: pxa2xx_lcdc_save
static void pxa2xx_lcdc_save(QEMUFile *f, void *opaque)
{
PXA2xxLCDState *s = (PXA2xxLCDState *) opaque;
int i;
qemu_put_be32(f, s->irqlevel);
qemu_put_be32(f, s->transp);
for (i = 0; i < 6; i ++)
qemu_put_be32s(f, &s->control[i]);
for (i = 0; i < 2; i ++)
qemu_put_be32s(f, &s->status[i]);
for (i = 0; i < 2; i ++)
qemu_put_be32s(f, &s->ovl1c[i]);
for (i = 0; i < 2; i ++)
qemu_put_be32s(f, &s->ovl2c[i]);
qemu_put_be32s(f, &s->ccr);
qemu_put_be32s(f, &s->cmdcr);
qemu_put_be32s(f, &s->trgbr);
qemu_put_be32s(f, &s->tcr);
qemu_put_be32s(f, &s->liidr);
qemu_put_8s(f, &s->bscntr);
for (i = 0; i < 7; i ++) {
qemu_put_betl(f, s->dma_ch[i].branch);
qemu_put_byte(f, s->dma_ch[i].up);
qemu_put_buffer(f, s->dma_ch[i].pbuffer, sizeof(s->dma_ch[i].pbuffer));
qemu_put_betl(f, s->dma_ch[i].descriptor);
qemu_put_betl(f, s->dma_ch[i].source);
qemu_put_be32s(f, &s->dma_ch[i].id);
qemu_put_be32s(f, &s->dma_ch[i].command);
}
}
开发者ID:ESOS-Lab,项目名称:VSSIM,代码行数:34,代码来源:pxa2xx_lcd.c
示例18: goldfish_audio_buff_put
static void
goldfish_audio_buff_put( struct goldfish_audio_buff* b, QEMUFile* f )
{
qemu_put_be32(f, b->address );
qemu_put_be32(f, b->length );
qemu_put_be32(f, b->offset );
qemu_put_buffer(f, b->data, b->length );
}
开发者ID:0-14N,项目名称:NDroid,代码行数:8,代码来源:goldfish_audio.c
示例19: ps2_common_save
static void ps2_common_save (QEMUFile *f, PS2State *s)
{
qemu_put_be32 (f, s->write_cmd);
qemu_put_be32 (f, s->queue.rptr);
qemu_put_be32 (f, s->queue.wptr);
qemu_put_be32 (f, s->queue.count);
qemu_put_buffer (f, s->queue.data, sizeof (s->queue.data));
}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:8,代码来源:ps2.c
示例20: shpc_save
static int shpc_save(QEMUFile *f, void *pv, size_t size,
const VMStateField *field, QJSON *vmdesc)
{
PCIDevice *d = container_of(pv, PCIDevice, shpc);
qemu_put_buffer(f, d->shpc->config, SHPC_SIZEOF(d));
return 0;
}
开发者ID:CTU-IIG,项目名称:qemu,代码行数:8,代码来源:shpc.c
注:本文中的qemu_put_buffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论