vmcoreinfo.c (4bd797af6f5bc9f7114030695716d199dceafa6e) | vmcoreinfo.c (5be5df720e600502ff530cee51a7ac0622f62f6f) |
---|---|
1/* 2 * Virtual Machine coreinfo device 3 * 4 * Copyright (C) 2017 Red Hat, Inc. 5 * 6 * Authors: Marc-André Lureau <marcandre.lureau@redhat.com> 7 * 8 * This work is licensed under the terms of the GNU GPL, version 2 or later. --- 5 unchanged lines hidden (view full) --- 14#include "hw/nvram/fw_cfg.h" 15#include "hw/misc/vmcoreinfo.h" 16 17static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len) 18{ 19 VMCoreInfoState *s = VMCOREINFO(dev); 20 21 s->has_vmcoreinfo = offset == 0 && len == sizeof(s->vmcoreinfo) | 1/* 2 * Virtual Machine coreinfo device 3 * 4 * Copyright (C) 2017 Red Hat, Inc. 5 * 6 * Authors: Marc-André Lureau <marcandre.lureau@redhat.com> 7 * 8 * This work is licensed under the terms of the GNU GPL, version 2 or later. --- 5 unchanged lines hidden (view full) --- 14#include "hw/nvram/fw_cfg.h" 15#include "hw/misc/vmcoreinfo.h" 16 17static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len) 18{ 19 VMCoreInfoState *s = VMCOREINFO(dev); 20 21 s->has_vmcoreinfo = offset == 0 && len == sizeof(s->vmcoreinfo) |
22 && s->vmcoreinfo.guest_format != VMCOREINFO_FORMAT_NONE; | 22 && s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE; |
23} 24 25static void vmcoreinfo_reset(void *dev) 26{ 27 VMCoreInfoState *s = VMCOREINFO(dev); 28 29 s->has_vmcoreinfo = false; 30 memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo)); | 23} 24 25static void vmcoreinfo_reset(void *dev) 26{ 27 VMCoreInfoState *s = VMCOREINFO(dev); 28 29 s->has_vmcoreinfo = false; 30 memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo)); |
31 s->vmcoreinfo.host_format = cpu_to_le16(VMCOREINFO_FORMAT_ELF); | 31 s->vmcoreinfo.host_format = cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); |
32} 33 34static void vmcoreinfo_realize(DeviceState *dev, Error **errp) 35{ 36 VMCoreInfoState *s = VMCOREINFO(dev); 37 FWCfgState *fw_cfg = fw_cfg_find(); 38 /* for gdb script dump-guest-memory.py */ 39 static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; --- 8 unchanged lines hidden (view full) --- 48 } 49 50 if (!fw_cfg || !fw_cfg->dma_enabled) { 51 error_setg(errp, "%s device requires fw_cfg with DMA", 52 VMCOREINFO_DEVICE); 53 return; 54 } 55 | 32} 33 34static void vmcoreinfo_realize(DeviceState *dev, Error **errp) 35{ 36 VMCoreInfoState *s = VMCOREINFO(dev); 37 FWCfgState *fw_cfg = fw_cfg_find(); 38 /* for gdb script dump-guest-memory.py */ 39 static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; --- 8 unchanged lines hidden (view full) --- 48 } 49 50 if (!fw_cfg || !fw_cfg->dma_enabled) { 51 error_setg(errp, "%s device requires fw_cfg with DMA", 52 VMCOREINFO_DEVICE); 53 return; 54 } 55 |
56 fw_cfg_add_file_callback(fw_cfg, "etc/vmcoreinfo", | 56 fw_cfg_add_file_callback(fw_cfg, FW_CFG_VMCOREINFO_FILENAME, |
57 NULL, fw_cfg_vmci_write, s, 58 &s->vmcoreinfo, sizeof(s->vmcoreinfo), false); 59 60 qemu_register_reset(vmcoreinfo_reset, dev); 61 vmcoreinfo_state = s; 62} 63 64static const VMStateDescription vmstate_vmcoreinfo = { --- 36 unchanged lines hidden --- | 57 NULL, fw_cfg_vmci_write, s, 58 &s->vmcoreinfo, sizeof(s->vmcoreinfo), false); 59 60 qemu_register_reset(vmcoreinfo_reset, dev); 61 vmcoreinfo_state = s; 62} 63 64static const VMStateDescription vmstate_vmcoreinfo = { --- 36 unchanged lines hidden --- |