dump: remove dumping stuff from cpu-all.h
This simplifies things, because they will only be included for softmmu targets and because the stubs are taken out-of-line in separate files, which in the future could even be compiled only once. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4720bd0506
commit
5f86146fb3
@ -3,6 +3,8 @@
|
||||
CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
|
||||
CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
|
||||
CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
|
||||
CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
|
||||
CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
|
||||
|
||||
include ../config-host.mak
|
||||
include config-devices.mak
|
||||
@ -144,10 +146,10 @@ obj-$(CONFIG_KVM) += kvm.o kvm-all.o
|
||||
obj-$(CONFIG_NO_KVM) += kvm-stub.o
|
||||
obj-$(CONFIG_VGA) += vga.o
|
||||
obj-y += memory.o savevm.o cputlb.o
|
||||
obj-y += memory_mapping.o
|
||||
obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o
|
||||
obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o
|
||||
obj-y += dump.o
|
||||
obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o arch_memory_mapping.o
|
||||
obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o arch_dump.o
|
||||
obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
|
||||
obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
|
||||
LIBS+=-lz
|
||||
|
||||
QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
|
||||
|
70
cpu-all.h
70
cpu-all.h
@ -22,8 +22,6 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-tls.h"
|
||||
#include "cpu-common.h"
|
||||
#include "memory_mapping.h"
|
||||
#include "dump.h"
|
||||
|
||||
/* some important defines:
|
||||
*
|
||||
@ -525,72 +523,4 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
|
||||
int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr,
|
||||
uint8_t *buf, int len, int is_write);
|
||||
|
||||
#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING)
|
||||
int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env);
|
||||
bool cpu_paging_enabled(CPUArchState *env);
|
||||
#else
|
||||
static inline int cpu_get_memory_mapping(MemoryMappingList *list,
|
||||
CPUArchState *env)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline bool cpu_paging_enabled(CPUArchState *env)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque);
|
||||
#if defined(CONFIG_HAVE_CORE_DUMP)
|
||||
int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env,
|
||||
int cpuid, void *opaque);
|
||||
int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env,
|
||||
int cpuid, void *opaque);
|
||||
int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env,
|
||||
void *opaque);
|
||||
int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env,
|
||||
void *opaque);
|
||||
int cpu_get_dump_info(ArchDumpInfo *info);
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus);
|
||||
#else
|
||||
static inline int cpu_write_elf64_note(write_core_dump_function f,
|
||||
CPUArchState *env, int cpuid,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int cpu_write_elf32_note(write_core_dump_function f,
|
||||
CPUArchState *env, int cpuid,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int cpu_write_elf64_qemunote(write_core_dump_function f,
|
||||
CPUArchState *env,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int cpu_write_elf32_qemunote(write_core_dump_function f,
|
||||
CPUArchState *env,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int cpu_get_dump_info(ArchDumpInfo *info)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CPU_ALL_H */
|
||||
|
77
dump-stub.c
Normal file
77
dump-stub.c
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include <unistd.h>
|
||||
#include "elf.h"
|
||||
#include <sys/procfs.h>
|
||||
#include <glib.h>
|
||||
#include "cpu.h"
|
||||
#include "cpu-all.h"
|
||||
#include "targphys.h"
|
||||
#include "monitor.h"
|
||||
#include "kvm.h"
|
||||
#include "dump.h"
|
||||
#include "sysemu.h"
|
||||
#include "bswap.h"
|
||||
#include "memory_mapping.h"
|
||||
#include "error.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "gdbstub.h"
|
||||
|
||||
/* we need this function in hmp.c */
|
||||
void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
int64_t begin, bool has_length, int64_t length,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int cpu_write_elf64_note(write_core_dump_function f,
|
||||
CPUArchState *env, int cpuid,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cpu_write_elf32_note(write_core_dump_function f,
|
||||
CPUArchState *env, int cpuid,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cpu_write_elf64_qemunote(write_core_dump_function f,
|
||||
CPUArchState *env,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cpu_write_elf32_qemunote(write_core_dump_function f,
|
||||
CPUArchState *env,
|
||||
void *opaque)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cpu_get_dump_info(ArchDumpInfo *info)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
11
dump.c
11
dump.c
@ -29,7 +29,6 @@
|
||||
#include "qmp-commands.h"
|
||||
#include "gdbstub.h"
|
||||
|
||||
#if defined(CONFIG_HAVE_CORE_DUMP)
|
||||
static uint16_t cpu_convert_to_target16(uint16_t val, int endian)
|
||||
{
|
||||
if (endian == ELFDATA2LSB) {
|
||||
@ -876,13 +875,3 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
#else
|
||||
/* we need this function in hmp.c */
|
||||
void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
int64_t begin, bool has_length, int64_t length,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
#endif
|
||||
|
12
dump.h
12
dump.h
@ -20,4 +20,16 @@ typedef struct ArchDumpInfo {
|
||||
int d_class; /* ELFCLASS32 or ELFCLASS64 */
|
||||
} ArchDumpInfo;
|
||||
|
||||
typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque);
|
||||
int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env,
|
||||
int cpuid, void *opaque);
|
||||
int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env,
|
||||
int cpuid, void *opaque);
|
||||
int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env,
|
||||
void *opaque);
|
||||
int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env,
|
||||
void *opaque);
|
||||
int cpu_get_dump_info(ArchDumpInfo *info);
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus);
|
||||
|
||||
#endif
|
||||
|
33
memory_mapping-stub.c
Normal file
33
memory_mapping-stub.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* QEMU memory mapping
|
||||
*
|
||||
* 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. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
#include "cpu-all.h"
|
||||
#include "memory_mapping.h"
|
||||
|
||||
int qemu_get_guest_memory_mapping(MemoryMappingList *list)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
int cpu_get_memory_mapping(MemoryMappingList *list,
|
||||
CPUArchState *env)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool cpu_paging_enabled(CPUArchState *env)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -165,8 +165,6 @@ void memory_mapping_list_init(MemoryMappingList *list)
|
||||
QTAILQ_INIT(&list->head);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING)
|
||||
|
||||
static CPUArchState *find_paging_enabled_cpu(CPUArchState *start_cpu)
|
||||
{
|
||||
CPUArchState *env;
|
||||
@ -210,7 +208,6 @@ int qemu_get_guest_memory_mapping(MemoryMappingList *list)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "qemu-queue.h"
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* The physical and virtual address in the memory mapping are contiguous. */
|
||||
typedef struct MemoryMapping {
|
||||
target_phys_addr_t phys_addr;
|
||||
@ -31,6 +30,9 @@ typedef struct MemoryMappingList {
|
||||
QTAILQ_HEAD(, MemoryMapping) head;
|
||||
} MemoryMappingList;
|
||||
|
||||
int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env);
|
||||
bool cpu_paging_enabled(CPUArchState *env);
|
||||
|
||||
/*
|
||||
* add or merge the memory region [phys_addr, phys_addr + length) into the
|
||||
* memory mapping's list. The region's virtual address starts with virt_addr,
|
||||
@ -51,14 +53,7 @@ void memory_mapping_list_init(MemoryMappingList *list);
|
||||
* -1: failed
|
||||
* -2: unsupported
|
||||
*/
|
||||
#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING)
|
||||
int qemu_get_guest_memory_mapping(MemoryMappingList *list);
|
||||
#else
|
||||
static inline int qemu_get_guest_memory_mapping(MemoryMappingList *list)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get guest's memory mapping without do paging(virtual address is 0). */
|
||||
void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list);
|
||||
@ -66,9 +61,4 @@ void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list);
|
||||
void memory_mapping_filter(MemoryMappingList *list, int64_t begin,
|
||||
int64_t length);
|
||||
|
||||
#else
|
||||
|
||||
/* We use MemoryMappingList* in cpu-all.h */
|
||||
typedef struct MemoryMappingList MemoryMappingList;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "cpu.h"
|
||||
#include "cpu-all.h"
|
||||
#include "memory_mapping.h"
|
||||
|
||||
/* PAE Paging or IA-32e Paging */
|
||||
static void walk_pte(MemoryMappingList *list, target_phys_addr_t pte_start_addr,
|
||||
|
Loading…
Reference in New Issue
Block a user