本文整理汇总了C++中qemu_get_be64函数的典型用法代码示例。如果您正苦于以下问题:C++ qemu_get_be64函数的具体用法?C++ qemu_get_be64怎么用?C++ qemu_get_be64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qemu_get_be64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rtc_load
static int rtc_load(QEMUFile *f, void *opaque, int version_id)
{
RTCState *s = opaque;
if (version_id != 1)
return -EINVAL;
qemu_get_buffer(f, s->cmos_data, 128);
qemu_get_8s(f, &s->cmos_index);
s->current_tm.tm_sec=qemu_get_be32(f);
s->current_tm.tm_min=qemu_get_be32(f);
s->current_tm.tm_hour=qemu_get_be32(f);
s->current_tm.tm_wday=qemu_get_be32(f);
s->current_tm.tm_mday=qemu_get_be32(f);
s->current_tm.tm_mon=qemu_get_be32(f);
s->current_tm.tm_year=qemu_get_be32(f);
qemu_get_timer(f, s->periodic_timer);
s->next_periodic_time=qemu_get_be64(f);
s->next_second_time=qemu_get_be64(f);
qemu_get_timer(f, s->second_timer);
qemu_get_timer(f, s->second_timer2);
return 0;
}
开发者ID:ddk50,项目名称:ibkvm,代码行数:26,代码来源:mc146818rtc.c
示例2: s390_storage_keys_load
static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
{
S390SKeysState *ss = S390_SKEYS(opaque);
S390SKeysClass *skeyclass = S390_SKEYS_GET_CLASS(ss);
int ret = 0;
while (!ret) {
ram_addr_t addr;
int flags;
addr = qemu_get_be64(f);
flags = addr & ~TARGET_PAGE_MASK;
addr &= TARGET_PAGE_MASK;
switch (flags) {
case S390_SKEYS_SAVE_FLAG_SKEYS: {
const uint64_t total_count = qemu_get_be64(f);
uint64_t handled_count = 0, cur_count;
uint64_t cur_gfn = addr / TARGET_PAGE_SIZE;
uint8_t *buf = g_try_malloc(S390_SKEYS_BUFFER_SIZE);
if (!buf) {
error_report("storage key load could not allocate memory\n");
ret = -ENOMEM;
break;
}
while (handled_count < total_count) {
cur_count = MIN(total_count - handled_count,
S390_SKEYS_BUFFER_SIZE);
qemu_get_buffer(f, buf, cur_count);
ret = skeyclass->set_skeys(ss, cur_gfn, cur_count, buf);
if (ret < 0) {
error_report("S390_SET_KEYS error %d\n", ret);
break;
}
handled_count += cur_count;
cur_gfn += cur_count;
}
g_free(buf);
break;
}
case S390_SKEYS_SAVE_FLAG_ERROR: {
error_report("Storage key data is incomplete");
ret = -EINVAL;
break;
}
case S390_SKEYS_SAVE_FLAG_EOS:
/* normal exit */
return 0;
default:
error_report("Unexpected storage key flag data: %#x", flags);
ret = -EINVAL;
}
}
return ret;
}
开发者ID:32bitmicro,项目名称:riscv-qemu,代码行数:59,代码来源:s390-skeys.c
示例3: cmma_load
static int cmma_load(QEMUFile *f, void *opaque, int version_id)
{
S390StAttribState *sas = S390_STATTRIB(opaque);
S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
uint64_t count, cur_gfn;
int flags, ret = 0;
ram_addr_t addr;
uint8_t *buf;
while (!ret) {
addr = qemu_get_be64(f);
flags = addr & ~TARGET_PAGE_MASK;
addr &= TARGET_PAGE_MASK;
switch (flags) {
case STATTR_FLAG_MORE: {
cur_gfn = addr / TARGET_PAGE_SIZE;
count = qemu_get_be64(f);
buf = g_try_malloc(count);
if (!buf) {
error_report("cmma_load could not allocate memory");
ret = -ENOMEM;
break;
}
qemu_get_buffer(f, buf, count);
ret = sac->set_stattr(sas, cur_gfn, count, buf);
if (ret < 0) {
error_report("Error %d while setting storage attributes", ret);
}
g_free(buf);
break;
}
case STATTR_FLAG_ERROR: {
error_report("Storage attributes data is incomplete");
ret = -EINVAL;
break;
}
case STATTR_FLAG_DONE:
/* This is after the last pre-copied value has been sent, nothing
* more will be sent after this. Pre-copy has finished, and we
* are done flushing all the remaining values. Now the target
* system is about to take over. We synchronize the buffer to
* apply the actual correct values where needed.
*/
sac->synchronize(sas);
break;
case STATTR_FLAG_EOS:
/* Normal exit */
return 0;
default:
error_report("Unexpected storage attribute flag data: %#x", flags);
ret = -EINVAL;
}
}
return ret;
}
开发者ID:Biamp-Systems,项目名称:mb-qemu,代码行数:58,代码来源:s390-stattrib.c
示例4: get_slbe
static int get_slbe(QEMUFile *f, void *pv, size_t size)
{
ppc_slb_t *v = pv;
v->esid = qemu_get_be64(f);
v->vsid = qemu_get_be64(f);
return 0;
}
开发者ID:01org,项目名称:qemu-lite,代码行数:9,代码来源:machine.c
示例5: get_avr
static int get_avr(QEMUFile *f, void *pv, size_t size)
{
ppc_avr_t *v = pv;
v->u64[0] = qemu_get_be64(f);
v->u64[1] = qemu_get_be64(f);
return 0;
}
开发者ID:01org,项目名称:qemu-lite,代码行数:9,代码来源:machine.c
示例6: get_slbe
static int get_slbe(QEMUFile *f, void *pv, size_t size,
const VMStateField *field)
{
ppc_slb_t *v = pv;
v->esid = qemu_get_be64(f);
v->vsid = qemu_get_be64(f);
return 0;
}
开发者ID:cminyard,项目名称:qemu,代码行数:10,代码来源:machine.c
示例7: get_avr
static int get_avr(QEMUFile *f, void *pv, size_t size,
const VMStateField *field)
{
ppc_avr_t *v = pv;
v->u64[0] = qemu_get_be64(f);
v->u64[1] = qemu_get_be64(f);
return 0;
}
开发者ID:cminyard,项目名称:qemu,代码行数:10,代码来源:machine.c
示例8: syborg_rtc_load
static int syborg_rtc_load(QEMUFile *f, void *opaque, int version_id)
{
SyborgRTCState *s = opaque;
if (version_id != 1)
return -EINVAL;
s->offset = qemu_get_be64(f);
s->data = qemu_get_be64(f);
return 0;
}
开发者ID:TheLoneRanger14,项目名称:vmxray,代码行数:12,代码来源:syborg_rtc.c
示例9: get_float64
static int get_float64(QEMUFile *f, void *pv, size_t size)
{
float64 *v = pv;
*v = make_float64(qemu_get_be64(f));
return 0;
}
开发者ID:Bludge0n,项目名称:qemu,代码行数:7,代码来源:vmstate.c
示例10: apic_load_old
/* This function is only used for old state version 1 and 2 */
static int apic_load_old(QEMUFile *f, void *opaque, int version_id)
{
APICCommonState *s = opaque;
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
int i;
if (version_id > 2) {
return -EINVAL;
}
/* XXX: what if the base changes? (registered memory regions) */
qemu_get_be32s(f, &s->apicbase);
qemu_get_8s(f, &s->id);
qemu_get_8s(f, &s->arb_id);
qemu_get_8s(f, &s->tpr);
qemu_get_be32s(f, &s->spurious_vec);
qemu_get_8s(f, &s->log_dest);
qemu_get_8s(f, &s->dest_mode);
for (i = 0; i < 8; i++) {
qemu_get_be32s(f, &s->isr[i]);
qemu_get_be32s(f, &s->tmr[i]);
qemu_get_be32s(f, &s->irr[i]);
}
for (i = 0; i < APIC_LVT_NB; i++) {
qemu_get_be32s(f, &s->lvt[i]);
}
qemu_get_be32s(f, &s->esr);
qemu_get_be32s(f, &s->icr[0]);
qemu_get_be32s(f, &s->icr[1]);
qemu_get_be32s(f, &s->divide_conf);
s->count_shift = qemu_get_be32(f);
qemu_get_be32s(f, &s->initial_count);
s->initial_count_load_time = qemu_get_be64(f);
s->next_time = qemu_get_be64(f);
if (version_id >= 2) {
s->timer_expiry = qemu_get_be64(f);
}
if (info->post_load) {
info->post_load(s);
}
return 0;
}
开发者ID:32bitmicro,项目名称:riscv-qemu,代码行数:45,代码来源:apic_common.c
示例11: timer_get
void timer_get(QEMUFile *f, QEMUTimer *ts)
{
uint64_t expire_time;
expire_time = qemu_get_be64(f);
if (expire_time != -1) {
timer_mod_ns(ts, expire_time);
} else {
timer_del(ts);
}
}
开发者ID:bowlofstew,项目名称:qemu,代码行数:11,代码来源:savevm.c
示例12: goldfish_rtc_load
static int goldfish_rtc_load(QEMUFile* f, void* opaque, int version_id)
{
struct rtc_state* s = opaque;
if (version_id != GOLDFISH_RTC_SAVE_VERSION)
return -1;
/* this is an old value that is not correct. but that's ok anyway */
s->now = qemu_get_be64(f);
return 0;
}
开发者ID:Andproject,项目名称:platform_external_qemu,代码行数:11,代码来源:goldfish_timer.c
示例13: qemu_get_timer
void qemu_get_timer(QEMUFile *f, QEMUTimer *ts)
{
uint64_t expire_time;
expire_time = qemu_get_be64(f);
if (expire_time != -1) {
qemu_mod_timer_ns(ts, expire_time);
} else {
qemu_del_timer(ts);
}
}
开发者ID:16aug,项目名称:nvmeqemu,代码行数:11,代码来源:qemu-timer.c
示例14: get_bitmap
static int get_bitmap(QEMUFile *f, void *pv, size_t size)
{
unsigned long *bmp = pv;
int i, idx = 0;
for (i = 0; i < BITS_TO_U64S(size); i++) {
uint64_t w = qemu_get_be64(f);
bmp[idx++] = w;
if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
bmp[idx++] = w >> 32;
}
}
开发者ID:Bludge0n,项目名称:qemu,代码行数:11,代码来源:vmstate.c
示例15: nand_dev_load_disk_state
/**
* Overwrites the contents of the disk image managed by this device with the
* contents as they were at the point the snapshot was made.
*/
static int nand_dev_load_disk_state(QEMUFile *f, nand_dev *dev)
{
#ifndef ANDROID_QCOW
int buf_size = NAND_DEV_SAVE_DISK_BUF_SIZE;
uint8_t buffer[NAND_DEV_SAVE_DISK_BUF_SIZE] = {0};
int ret;
/* File size for restore and truncate */
uint64_t total_size = qemu_get_be64(f);
if (total_size > dev->max_size) {
XLOG("%s, restore failed: size required (%lld) exceeds device limit (%lld)\n",
__FUNCTION__, total_size, dev->max_size);
return -EIO;
}
/* overwrite disk contents with snapshot contents */
uint64_t next_offset = 0;
ret = do_lseek(dev->fd, 0, SEEK_SET);
if (ret < 0) {
XLOG("%s seek failed: %s\n", __FUNCTION__, strerror(errno));
return -EIO;
}
while (next_offset < total_size) {
/* snapshot buffer may not be an exact multiple of buf_size
* if necessary, adjust buffer size for last copy operation */
if (total_size - next_offset < buf_size) {
buf_size = total_size - next_offset;
}
ret = qemu_get_buffer(f, buffer, buf_size);
if (ret != buf_size) {
XLOG("%s read failed: expected %d bytes but got %d\n",
__FUNCTION__, buf_size, ret);
return -EIO;
}
ret = do_write(dev->fd, buffer, buf_size);
if (ret != buf_size) {
XLOG("%s, write failed: %s\n", __FUNCTION__, strerror(errno));
return -EIO;
}
next_offset += buf_size;
}
ret = do_ftruncate(dev->fd, total_size);
if (ret < 0) {
XLOG("%s ftruncate failed: %s\n", __FUNCTION__, strerror(errno));
return -EIO;
}
#endif
return 0;
}
开发者ID:KurSh,项目名称:panda,代码行数:57,代码来源:goldfish_nand.c
示例16: pipe_load
static Pipe*
pipe_load( PipeDevice* dev, QEMUFile* file, int version_id )
{
Pipe* pipe;
const PipeService* service = NULL;
int state = qemu_get_byte(file);
uint64_t channel;
if (state != 0) {
/* Pipe is associated with a service. */
char* name = qemu_get_string(file);
if (name == NULL)
return NULL;
service = goldfish_pipe_find_type(name);
if (service == NULL) {
D("No QEMU pipe service named '%s'", name);
AFREE(name);
return NULL;
}
}
if (version_id == GOLDFISH_PIPE_SAVE_VERSION_LEGACY) {
channel = qemu_get_be32(file);
} else {
channel = qemu_get_be64(file);
}
pipe = pipe_new(channel, dev);
pipe->wanted = qemu_get_byte(file);
pipe->closed = qemu_get_byte(file);
if (qemu_get_byte(file) != 0) {
pipe->args = qemu_get_string(file);
}
pipe->service = service;
if (service != NULL) {
pipe->funcs = &service->funcs;
}
if (pipe->funcs->load) {
pipe->opaque = pipe->funcs->load(pipe, service ? service->opaque : NULL, pipe->args, file);
if (pipe->opaque == NULL) {
AFREE(pipe);
return NULL;
}
} else {
/* Force-close the pipe on load */
pipe->closed = 1;
}
return pipe;
}
开发者ID:pras710,项目名称:qemu,代码行数:51,代码来源:pipe.c
示例17: goldfish_mmc_load
static int goldfish_mmc_load(QEMUFile* f, void* opaque, int version_id)
{
struct goldfish_mmc_state* s = opaque;
if (version_id == GOLDFISH_MMC_SAVE_VERSION) {
s->buffer_address = qemu_get_be64(f);
} else if (version_id == GOLDFISH_MMC_SAVE_VERSION_LEGACY) {
s->buffer_address = qemu_get_be32(f);
} else {
// Unsupported version!
return -1;
}
return qemu_get_struct(f, goldfish_mmc_fields, s);
}
开发者ID:pras710,项目名称:qemu,代码行数:14,代码来源:mmc.c
示例18: goldfish_timer_load
static int goldfish_timer_load(QEMUFile* f, void* opaque, int version_id)
{
struct timer_state* s = opaque;
if (version_id != GOLDFISH_TIMER_SAVE_VERSION)
return -1;
s->now = qemu_get_be64(f);
s->armed = qemu_get_byte(f);
if (s->armed) {
int64_t now = qemu_get_clock(vm_clock);
int64_t diff = qemu_get_be64(f);
int64_t alarm = now + diff;
if (alarm <= now) {
goldfish_device_set_irq(&s->dev, 0, 1);
s->armed = 0;
} else {
qemu_mod_timer(s->timer, alarm);
}
}
return 0;
}
开发者ID:hongjiujing,项目名称:Opensource,代码行数:23,代码来源:goldfish_timer.c
示例19: virtio_load
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
{
int num, i, ret;
uint32_t features;
uint32_t supported_features =
vdev->binding->get_features(vdev->binding_opaque);
if (vdev->binding->load_config) {
ret = vdev->binding->load_config(vdev->binding_opaque, f);
if (ret)
return ret;
}
qemu_get_8s(f, &vdev->status);
qemu_get_8s(f, &vdev->isr);
qemu_get_be16s(f, &vdev->queue_sel);
qemu_get_be32s(f, &features);
if (features & ~supported_features) {
fprintf(stderr, "Features 0x%x unsupported. Allowed features: 0x%x\n",
features, supported_features);
return -1;
}
vdev->guest_features = features;
vdev->config_len = qemu_get_be32(f);
qemu_get_buffer(f, vdev->config, vdev->config_len);
num = qemu_get_be32(f);
for (i = 0; i < num; i++) {
vdev->vq[i].vring.num = qemu_get_be32(f);
vdev->vq[i].pa = qemu_get_be64(f);
qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
if (vdev->vq[i].pa) {
virtqueue_init(&vdev->vq[i]);
}
if (vdev->binding->load_queue) {
ret = vdev->binding->load_queue(vdev->binding_opaque, i, f);
if (ret)
return ret;
}
}
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
return 0;
}
开发者ID:iggy,项目名称:qemu,代码行数:46,代码来源:virtio.c
示例20: kvm_flic_load
/**
* kvm_flic_load - Load pending floating interrupts
* @f: QEMUFile containing migration state
* @opaque: pointer to flic device state
* @version_id: version id for migration
*
* Returns: value of flic_enqueue_irqs, -EINVAL on error
* Note: Do nothing when no interrupts where stored
* in QEMUFile
*/
static int kvm_flic_load(QEMUFile *f, void *opaque, int version_id)
{
uint64_t len = 0;
uint64_t count = 0;
void *buf = NULL;
int r = 0;
if (version_id != FLIC_SAVEVM_VERSION) {
r = -EINVAL;
goto out;
}
flic_enable_pfault((struct KVMS390FLICState *) opaque);
count = qemu_get_be64(f);
len = count * sizeof(struct kvm_s390_irq);
if (count == FLIC_FAILED) {
r = -EINVAL;
goto out;
}
if (count == 0) {
r = 0;
goto out;
}
buf = g_try_malloc0(len);
if (!buf) {
r = -ENOMEM;
goto out;
}
if (qemu_get_buffer(f, (uint8_t *) buf, len) != len) {
r = -EINVAL;
goto out_free;
}
r = flic_enqueue_irqs(buf, len, (struct KVMS390FLICState *) opaque);
out_free:
g_free(buf);
out:
return r;
}
开发者ID:GamerSource,项目名称:qemu,代码行数:51,代码来源:s390_flic_kvm.c
注:本文中的qemu_get_be64函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论