Beispiel #1
0
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);
    }
}
static void virtio_audio_save(QEMUFile *f, void *opaque)
{
    VirtIOAudio *s = opaque;
    VirtIOAudioStream *stream;
    int i;
    int mode;

    virtio_save(&s->vdev, f);

    for (i = 0; i < NUM_STREAMS; i++) {
        stream = &s->stream[i];

        if (stream->in_voice) {
            mode = 2;
            if (AUD_is_active_in(stream->in_voice))
                mode |= 1;
        } else if (stream->out_voice) {
            mode = 4;
            if (AUD_is_active_out(stream->out_voice))
                mode |= 1;
        } else {
            mode = 0;
        }
        qemu_put_byte(f, mode);
        qemu_put_byte(f, stream->fmt.endianness);
        qemu_put_be16(f, stream->fmt.nchannels);
        qemu_put_be32(f, stream->fmt.fmt);
        qemu_put_be32(f, stream->fmt.freq);
    }
}
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;
}
Beispiel #4
0
static void rtc_save_td(QEMUFile *f, void *opaque)
{
    RTCState *s = opaque;

    qemu_put_be32(f, s->irq_coalesced);
    qemu_put_be32(f, s->period);
}
Beispiel #5
0
static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
{
    qemu_put_be32(f, dt->selector);
    qemu_put_betl(f, dt->base);
    qemu_put_be32(f, dt->limit);
    qemu_put_be32(f, dt->flags);
}
Beispiel #6
0
static void virtio_balloon_save_device(VirtIODevice *vdev, QEMUFile *f)
{
    VirtIOBalloon *s = VIRTIO_BALLOON(vdev);

    qemu_put_be32(f, s->num_pages);
    qemu_put_be32(f, s->actual);
}
/* 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;
}
Beispiel #8
0
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);
    }
}
static void
goldfish_pipe_save( QEMUFile* file, void* opaque )
{
    PipeDevice* dev = opaque;
    Pipe* pipe;

    qemu_put_be32(file, dev->address);
    qemu_put_be32(file, dev->size);
    qemu_put_be32(file, dev->status);
    qemu_put_be32(file, dev->channel);
    qemu_put_be32(file, dev->wakes);
    qemu_put_be64(file, dev->params_addr);

    
    int count = 0;
    for ( pipe = dev->pipes; pipe; pipe = pipe->next )
        count++;

    qemu_put_sbe32(file, count);

    
    for ( pipe = dev->pipes; pipe; pipe = pipe->next ) {
        pipe_save(pipe, file);
    }
}
Beispiel #10
0
static void pxa2xx_timer_save(QEMUFile *f, void *opaque)
{
    pxa2xx_timer_info *s = (pxa2xx_timer_info *) opaque;
    int i;

    qemu_put_be32s(f, &s->clock);
    qemu_put_be32s(f, &s->oldclock);
    qemu_put_be64s(f, &s->lastload);

    for (i = 0; i < 4; i ++) {
        qemu_put_be32s(f, &s->timer[i].value);
        qemu_put_be32(f, s->timer[i].level);
    }
    if (s->tm4)
        for (i = 0; i < 8; i ++) {
            qemu_put_be32s(f, &s->tm4[i].tm.value);
            qemu_put_be32(f, s->tm4[i].tm.level);
            qemu_put_be32s(f, &s->tm4[i].oldclock);
            qemu_put_be32s(f, &s->tm4[i].clock);
            qemu_put_be64s(f, &s->tm4[i].lastload);
            qemu_put_be32s(f, &s->tm4[i].freq);
            qemu_put_be32s(f, &s->tm4[i].control);
        }

    qemu_put_be32s(f, &s->events);
    qemu_put_be32s(f, &s->irq_enabled);
    qemu_put_be32s(f, &s->reset3);
    qemu_put_be32s(f, &s->snapshot);
}
Beispiel #11
0
static void virtio_mmio_save_config(DeviceState *opaque, QEMUFile *f)
{
    VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);

    qemu_put_be32(f, proxy->host_features_sel);
    qemu_put_be32(f, proxy->guest_features_sel);
    qemu_put_be32(f, proxy->guest_page_shift);
}
Beispiel #12
0
static void arm_timer_save(QEMUFile *f, void *opaque)
{
    arm_timer_state *s = (arm_timer_state *)opaque;
    qemu_put_be32(f, s->control);
    qemu_put_be32(f, s->limit);
    qemu_put_be32(f, s->int_level);
    qemu_put_ptimer(f, s->timer);
}
Beispiel #13
0
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 );
}
Beispiel #14
0
static void omap3_l4ta_save_state(QEMUFile *f, void *opaque)
{
    struct omap_target_agent_s *s = (struct omap_target_agent_s *)opaque;

    qemu_put_be32(f, s->control);
    qemu_put_be32(f, s->control_h);
    qemu_put_be32(f, s->status);
}
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));
}
Beispiel #16
0
static void ps2_kbd_save(QEMUFile* f, void* opaque)
{
    PS2KbdState *s = (PS2KbdState*)opaque;

    ps2_common_save (f, &s->common);
    qemu_put_be32(f, s->scan_enabled);
    qemu_put_be32(f, s->translate);
}
Beispiel #17
0
/* Saves sensor-specific client data to snapshot */
static void
_hwSensorClient_save( QEMUFile*  f, QemudClient*  client, void*  opaque  )
{
    HwSensorClient* sc = opaque;

    qemu_put_be32(f, sc->delay_ms);
    qemu_put_be32(f, sc->enabledMask);
    qemu_put_timer(f, sc->timer);
}
Beispiel #18
0
static void virtio_balloon_save(QEMUFile *f, void *opaque)
{
    VirtIOBalloon *s = opaque;

    virtio_save(&s->vdev, f);

    qemu_put_be32(f, s->num_pages);
    qemu_put_be32(f, s->actual);
}
Beispiel #19
0
static void  goldfish_tty_save(QEMUFile*  f, void*  opaque)
{
    struct tty_state*  s = opaque;

    qemu_put_be32( f, s->ptr );
    qemu_put_be32( f, s->ptr_len );
    qemu_put_byte( f, s->ready );
    qemu_put_byte( f, s->data_count );
    qemu_put_buffer( f, s->data, s->data_count );
}
Beispiel #20
0
static void virtio_balloon_save(QEMUFile *f, void *opaque)
{
    VirtIOBalloon *s = VIRTIO_BALLOON(opaque);
    VirtIODevice *vdev = VIRTIO_DEVICE(s);

    virtio_save(vdev, f);

    qemu_put_be32(f, s->num_pages);
    qemu_put_be32(f, s->actual);
}
Beispiel #21
0
static void  goldfish_tty_save(QEMUFile*  f, void*  opaque)
{
    struct tty_state*  s = opaque;

    qemu_put_be32( f, s->ptr );
    qemu_put_be32( f, s->ptr_len );
    qemu_put_byte( f, (s_tty.int_mask & DEV_MASK(s->dev.id)) ? 1 : 0 );
    qemu_put_byte( f, s->data_count );
    qemu_put_buffer( f, s->data, s->data_count );
}
Beispiel #22
0
static void syborg_int_save(QEMUFile *f, void *opaque)
{
    SyborgIntState *s = (SyborgIntState *)opaque;
    int i;

    qemu_put_be32(f, s->num_irqs);
    qemu_put_be32(f, s->pending_count);
    for (i = 0; i < s->num_irqs; i++) {
        qemu_put_be32(f, s->flags[i].enabled
                         | ((unsigned)s->flags[i].level << 1));
    }
}
Beispiel #23
0
static void slirp_sbuf_save(QEMUFile *f, struct sbuf *sbuf)
{
    uint32_t off;

    qemu_put_be32(f, sbuf->sb_cc);
    qemu_put_be32(f, sbuf->sb_datalen);
    off = (uint32_t)(sbuf->sb_wptr - sbuf->sb_data);
    qemu_put_sbe32(f, off);
    off = (uint32_t)(sbuf->sb_rptr - sbuf->sb_data);
    qemu_put_sbe32(f, off);
    qemu_put_buffer(f, (unsigned char*)sbuf->sb_data, sbuf->sb_datalen);
}
Beispiel #24
0
static void max111x_save(QEMUFile *f, void *opaque)
{
    struct max111x_s *s = (struct max111x_s *) opaque;
    int i;

    qemu_put_8s(f, &s->tb1);
    qemu_put_8s(f, &s->rb2);
    qemu_put_8s(f, &s->rb3);
    qemu_put_be32(f, s->inputs);
    qemu_put_be32(f, s->com);
    for (i = 0; i < s->inputs; i ++)
        qemu_put_byte(f, s->input[i]);
}
Beispiel #25
0
static void slirp_socket_save(QEMUFile *f, struct socket *so)
{
    qemu_put_be32(f, so->so_urgc);
    qemu_put_be32(f, so->so_faddr_ip);
    qemu_put_be32(f, so->so_laddr_ip);
    qemu_put_be16(f, so->so_faddr_port);
    qemu_put_be16(f, so->so_laddr_port);
    qemu_put_byte(f, so->so_iptos);
    qemu_put_byte(f, so->so_emu);
    qemu_put_byte(f, so->so_type);
    qemu_put_be32(f, so->so_state);
    slirp_sbuf_save(f, &so->so_rcv);
    slirp_sbuf_save(f, &so->so_snd);
    slirp_tcp_save(f, so->so_tcpcb);
}
Beispiel #26
0
static void ivshmem_save(QEMUFile* f, void *opaque)
{
    IVShmemState *proxy = opaque;

    IVSHMEM_DPRINTF("ivshmem_save\n");
    pci_device_save(&proxy->dev, f);

    if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) {
        msix_save(&proxy->dev, f);
    } else {
        qemu_put_be32(f, proxy->intrstatus);
        qemu_put_be32(f, proxy->intrmask);
    }

}
Beispiel #27
0
static void put_fpscr(QEMUFile *f, void *opaque, size_t size)
{
    ARMCPU *cpu = opaque;
    CPUARMState *env = &cpu->env;

    qemu_put_be32(f, vfp_get_fpscr(env));
}
Beispiel #28
0
static void put_cpsr(QEMUFile *f, void *opaque, size_t size)
{
    ARMCPU *cpu = opaque;
    CPUARMState *env = &cpu->env;

    qemu_put_be32(f, cpsr_read(env));
}
Beispiel #29
0
void cpu_save(QEMUFile * f, void * opaque)
{
	int i;
	CPUSRPState *env = (CPUSRPState *)opaque;

	for (i = 0; i < SRP_REGS; i++) {
		qemu_put_be32(f, env->regs[i]);
	}

	qemu_put_be32(f, env->irq);
	qemu_put_be32(f, env->psw);

	qemu_put_be32(f, env->sp);
	qemu_put_be32(f, env->pc);
	
}
Beispiel #30
0
static int put_vscr(QEMUFile *f, void *opaque, size_t size,
                    const VMStateField *field, QJSON *vmdesc)
{
    PowerPCCPU *cpu = opaque;
    qemu_put_be32(f, helper_mfvscr(&cpu->env));
    return 0;
}