target-i386: Add API to write elf notes to core file
PATCH v10 7/11 target-i386: Add API to write elf notes to core file
The core file contains register's value. These APIs write registers to core file, and them will be called in the following patch.
Signed-off-by Wen Congyang <[email protected]>
--- Makefile.target | 1 + configure | 4 + cpu-all.h | 23 +++++ target-i386/arch_dump.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 269 insertions(+), 0 deletions(-) create mode 100644 target-i386/arch_dump.c
Makefile.target +1 -0
@@ -219,6 +219,7 @@ obj-$(CONFIG_NO_KVM) += kvm-stub.o obj-$(CONFIG_VGA) += vga.o obj-y += memory.o savevm.o obj-y += memory_mapping.o +obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o LIBS+=-lz obj-i386-$(CONFIG_KVM) += hyperv.o
configure +4 -0
@@ -3678,6 +3678,10 @@ if test "$target_softmmu" = "yes" ; then if test "$smartcard_nss" = "yes" ; then echo "subdir-$target: subdir-libcacard" >> $config_host_mak fi + case "$target_arch2" in + i386|x86_64) + echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak + esac fi if test "$target_user_only" = "yes" ; then echo "CONFIG_USER_ONLY=y" >> $config_target_mak
cpu-all.h +23 -0
@@ -542,4 +542,27 @@ static inline bool cpu_paging_enabled(CPUArchState *env) }#endif +typedef int (*write_core_dump_function ) + (target_phys_addr_t offset,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,target_phys_addr_t *offset,void *opaque); +int cpu_write_elf32_note (write_core_dump_function f,CPUArchState *env, +int cpuid,target_phys_addr_t *offset,void *opaque); +#else +static inline int cpu_write_elf64_note (write_core_dump_function f, +CPUArchState *env,int cpuid, +target_phys_addr_t *offset,void *opaque) +{ +return -1 ; +} + +static inline int cpu_write_elf32_note (write_core_dump_function f, +CPUArchState *env,int cpuid, +target_phys_addr_t *offset,void *opaque) +{ +return -1 ; +} +#endif +#endif /* CPU_ALL_H */
target-i386/arch_dump.c new file +241 -0
241 lines not on this page · raw message
Signature · 1 line
1.7.1