From patchwork Sun Mar 24 17:27:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 230472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 935E02C00A2 for ; Mon, 25 Mar 2013 04:30:18 +1100 (EST) Received: from localhost ([::1]:38527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJokK-0000Uv-Ps for incoming@patchwork.ozlabs.org; Sun, 24 Mar 2013 13:30:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJohj-0004jX-Rc for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJohi-000142-OR for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:35 -0400 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:60710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJohi-00013t-GD for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:34 -0400 Received: by mail-la0-f46.google.com with SMTP id fq12so10072159lab.33 for ; Sun, 24 Mar 2013 10:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=1iyHazG3qVjBpgYmHkPgeI0BCN5wBtp28oHXRDaSv8c=; b=uhJOZ/ZWv7gGRs1C1Ot4TNbgQ/LkMjk0wPJh7KMLvqA9S7zC2R1uLFvZ3ngPZJ5L2c IhpMJFB/oAstMzob4HnV/7sjtwh1aV8frAF2xEoU59rONcwV9otn2BGws7Sbd9fmqwLr p87K9Mep4VTD2WcnqCt4nLvvd9OxrRmSFtU7iFtmkpp8A3tHcZhMqX541HFjIhImjO7u mpzpN+2BH8Mle1GoMkVbVBYy5RVxmh0mipNHbogOBTybMbA6mnwTZfkvhFi8dkPPqD9J yxxqEqBcxfms82Wjxrhl9bLtUkHrUl3eZ/tEecN7JyN55Xc4IDDIWJlQrENU4AGVt5WG KSgw== X-Received: by 10.152.136.20 with SMTP id pw20mr4474832lab.16.1364146053448; Sun, 24 Mar 2013 10:27:33 -0700 (PDT) Received: from localhost.localdomain (c83-254-193-108.bredband.comhem.se. [83.254.193.108]) by mx.google.com with ESMTPS id jh4sm3877036lab.7.2013.03.24.10.27.31 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Mar 2013 10:27:32 -0700 (PDT) From: Rabin Vincent To: qemu-devel@nongnu.org Date: Sun, 24 Mar 2013 18:27:20 +0100 Message-Id: <1364146041-27041-6-git-send-email-rabin@rab.in> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364146041-27041-1-git-send-email-rabin@rab.in> References: <1364146041-27041-1-git-send-email-rabin@rab.in> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22e Cc: Rabin Vincent , Peter Maydell Subject: [Qemu-devel] [PATCHv2 5/6] target-arm: add dump-guest-memory support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Enable support for the dump-guest-memory monitor command for ARM. Cc: Peter Maydell Signed-off-by: Rabin Vincent --- configure | 2 +- target-arm/Makefile.objs | 2 +- target-arm/arch_dump.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 target-arm/arch_dump.c diff --git a/configure b/configure index 46a7594..f35786d 100755 --- a/configure +++ b/configure @@ -4184,7 +4184,7 @@ if test "$target_softmmu" = "yes" ; then echo "CONFIG_SOFTMMU=y" >> $config_target_mak echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak case "$target_arch2" in - i386|x86_64) + arm|i386|x86_64) echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak esac fi diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs index d89b57c..93baa12 100644 --- a/target-arm/Makefile.objs +++ b/target-arm/Makefile.objs @@ -1,5 +1,5 @@ obj-y += arm-semi.o -obj-$(CONFIG_SOFTMMU) += machine.o +obj-$(CONFIG_SOFTMMU) += machine.o arch_dump.o obj-$(CONFIG_KVM) += kvm.o obj-y += translate.o op_helper.o helper.o cpu.o obj-y += neon_helper.o iwmmxt_helper.o diff --git a/target-arm/arch_dump.c b/target-arm/arch_dump.c new file mode 100644 index 0000000..e568ffb --- /dev/null +++ b/target-arm/arch_dump.c @@ -0,0 +1,61 @@ +#include "cpu.h" +#include "sysemu/dump.h" +#include "elf.h" + +typedef struct { + char pad1[24]; + uint32_t pid; + char pad2[44]; + uint32_t regs[18]; + char pad3[4]; +} arm_elf_prstatus; + +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) +{ + arm_elf_prstatus prstatus = {.pid = cpuid}; + + memcpy(&(prstatus.regs), env->regs, sizeof(env->regs)); + prstatus.regs[16] = cpsr_read(env); + + return dump_write_elf_note(ELFCLASS32, "CORE", NT_PRSTATUS, + &prstatus, sizeof(prstatus), + f, opaque); +} + +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 0; +} + +int cpu_get_dump_info(ArchDumpInfo *info) +{ + info->d_machine = EM_ARM; +#ifdef TARGET_WORDS_BIGENDIAN + info->d_endian = ELFDATA2MSB; +#else + info->d_endian = ELFDATA2LSB; +#endif + info->d_class = ELFCLASS32; + + return 0; +} + +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +{ + return nr_cpus * dump_get_note_size(ELFCLASS32, "CORE", + sizeof(arm_elf_prstatus)); +}