qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Froyd <froydnj@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/7] linux-user: add core dump support for PPC
Date: Fri, 11 Dec 2009 09:04:48 -0800	[thread overview]
Message-ID: <1260551091-2890-5-git-send-email-froydnj@codesourcery.com> (raw)
In-Reply-To: <1260551091-2890-1-git-send-email-froydnj@codesourcery.com>


Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
 linux-user/elfload.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 3551d34..97dc3a7 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -539,6 +539,32 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
     _regs->gpr[5] = pos;
 }
 
+/* See linux kernel: arch/powerpc/include/asm/elf.h.  */
+#define ELF_NREG 48
+typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
+
+static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env)
+{
+    int i;
+    target_ulong ccr = 0;
+
+    for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
+        (*regs)[i] = tswapl(env->gpr[i]);
+    }
+
+    (*regs)[32] = tswapl(env->nip);
+    (*regs)[33] = tswapl(env->msr);
+    (*regs)[35] = tswapl(env->ctr);
+    (*regs)[36] = tswapl(env->lr);
+    (*regs)[37] = tswapl(env->xer);
+
+    for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
+        ccr |= env->crf[i] << (32 - ((i + 1) * 4));
+    }
+    (*regs)[38] = tswapl(ccr);
+}
+
+#define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE	4096
 
 #endif
-- 
1.6.3.2

  parent reply	other threads:[~2009-12-11 18:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 17:04 [Qemu-devel] [PATCH 0/7] linux-user: core dump enhancements Nathan Froyd
2009-12-11 17:04 ` [Qemu-devel] [PATCH 1/7] linux-user: fix ELF_USE_CORE_DUMP/USE_ELF_CORE_DUMP confusion Nathan Froyd
2009-12-11 17:04 ` [Qemu-devel] [PATCH 2/7] linux-user: commonify definitions of target typedefs Nathan Froyd
2009-12-11 17:04 ` [Qemu-devel] [PATCH 3/7] linux-user: fix ARM core dumps on opposite-endian hosts Nathan Froyd
2009-12-11 17:04 ` Nathan Froyd [this message]
2009-12-11 19:20   ` [Qemu-devel] [PATCH 4/7] linux-user: add core dump support for PPC malc
2009-12-11 17:04 ` [Qemu-devel] [PATCH 5/7] linux-user: add core dump support for MIPS Nathan Froyd
2009-12-11 17:04 ` [Qemu-devel] [PATCH 6/7] linux-user: add core dump support for M68K Nathan Froyd
2009-12-11 17:04 ` [Qemu-devel] [PATCH 7/7] linux-user: add core dump support for SH Nathan Froyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260551091-2890-5-git-send-email-froydnj@codesourcery.com \
    --to=froydnj@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).