Skip to contentSkip to conversation

target-i386: Add API to write elf notes to core file

PATCH Superseded Wen Congyang 1 participant 1 message Mar 20, 2012 Kbuild

v10 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

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.

---
 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
index 85a6a0d..c3aa5d7 100644
@@ -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
index 8540bbb..c7d668c 100755
@@ -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
index 24c7f77..bc29b43 100644
@@ -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