diff options
author | Bharata B Rao <bharata@linux.vnet.ibm.com> | 2014-05-19 19:57:44 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-06-16 13:24:36 +0200 |
commit | acb0ef5801fc0caafdcfd34ae62e48d276866a1b (patch) | |
tree | b82e7cb819385df211aaeed9a5be137fde6aaf5d /include | |
parent | 85720d36676ef0b765a69f1e312b4c9d4ff6fa16 (diff) |
dump: Make DumpState and endian conversion routines available for arch-specific dump code
Make DumpState and endian conversion routines available for arch-specific dump
code by moving into dump.h. DumpState will be needed by arch-specific dump
code to access target endian information from DumpState->ArchDumpInfo. Also
break the dependency of dump.h from stubs/dump.c by creating a separate
dump-arch.h.
This patch doesn't change any functionality.
Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
[ rebased on top of current master branch,
renamed endian helpers to cpu_to_dump{16,32,64},
pass a DumpState * argument to endian helpers,
Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
[agraf: fix to apply]
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/sysemu/dump-arch.h | 28 | ||||
-rw-r--r-- | include/sysemu/dump.h | 45 |
2 files changed, 63 insertions, 10 deletions
diff --git a/include/sysemu/dump-arch.h b/include/sysemu/dump-arch.h new file mode 100644 index 0000000000..9c95cede3d --- /dev/null +++ b/include/sysemu/dump-arch.h @@ -0,0 +1,28 @@ +/* + * QEMU dump + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang <wency@cn.fujitsu.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef DUMP_ARCH_H +#define DUMP_ARCH_H + +typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ + int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ + int d_class; /* ELFCLASS32 or ELFCLASS64 */ +} ArchDumpInfo; + +struct GuestPhysBlockList; /* memory_mapping.h */ +int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); + +#endif diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h index 12af557b55..7e4ec5c7d9 100644 --- a/include/sysemu/dump.h +++ b/include/sysemu/dump.h @@ -43,11 +43,8 @@ #define PFN_BUFBITMAP (CHAR_BIT * BUFSIZE_BITMAP) #define BUFSIZE_DATA_CACHE (TARGET_PAGE_SIZE * 4) -typedef struct ArchDumpInfo { - int d_machine; /* Architecture */ - int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ - int d_class; /* ELFCLASS32 or ELFCLASS64 */ -} ArchDumpInfo; +#include "sysemu/dump-arch.h" +#include "sysemu/memory_mapping.h" typedef struct QEMU_PACKED MakedumpfileHeader { char signature[16]; /* = "makedumpfile" */ @@ -158,9 +155,37 @@ typedef struct QEMU_PACKED PageDescriptor { uint64_t page_flags; /* page flags */ } PageDescriptor; -struct GuestPhysBlockList; /* memory_mapping.h */ -int cpu_get_dump_info(ArchDumpInfo *info, - const struct GuestPhysBlockList *guest_phys_blocks); -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); - +typedef struct DumpState { + GuestPhysBlockList guest_phys_blocks; + ArchDumpInfo dump_info; + MemoryMappingList list; + uint16_t phdr_num; + uint32_t sh_info; + bool have_section; + bool resume; + ssize_t note_size; + hwaddr memory_offset; + int fd; + + GuestPhysBlock *next_block; + ram_addr_t start; + bool has_filter; + int64_t begin; + int64_t length; + + uint8_t *note_buf; /* buffer for notes */ + size_t note_buf_offset; /* the writing place in note_buf */ + uint32_t nr_cpus; /* number of guest's cpu */ + uint64_t max_mapnr; /* the biggest guest's phys-mem's number */ + size_t len_dump_bitmap; /* the size of the place used to store + dump_bitmap in vmcore */ + off_t offset_dump_bitmap; /* offset of dump_bitmap part in vmcore */ + off_t offset_page; /* offset of page part in vmcore */ + size_t num_dumpable; /* number of page that can be dumped */ + uint32_t flag_compress; /* indicate the compression format */ +} DumpState; + +uint16_t cpu_to_dump16(DumpState *s, uint16_t val); +uint32_t cpu_to_dump32(DumpState *s, uint32_t val); +uint64_t cpu_to_dump64(DumpState *s, uint64_t val); #endif |