From patchwork Fri Dec 11 17:04:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 40919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E6695B6F04 for ; Sat, 12 Dec 2009 04:54:43 +1100 (EST) Received: from localhost ([127.0.0.1]:36564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ9hR-0001T7-09 for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2009 12:54:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJ91t-0003xj-Vc for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:11:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJ91o-0003tS-SN for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:11:45 -0500 Received: from [199.232.76.173] (port=46081 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ91o-0003tH-KX for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:11:40 -0500 Received: from mx20.gnu.org ([199.232.41.8]:41337) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJ91m-00065u-Gs for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:11:39 -0500 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJ91l-0007LE-DS for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:11:37 -0500 Received: (qmail 10242 invoked from network); 11 Dec 2009 17:04:55 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Dec 2009 17:04:55 -0000 From: Nathan Froyd To: qemu-devel@nongnu.org Date: Fri, 11 Dec 2009 09:04:51 -0800 Message-Id: <1260551091-2890-8-git-send-email-froydnj@codesourcery.com> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <1260551091-2890-1-git-send-email-froydnj@codesourcery.com> References: <1260551091-2890-1-git-send-email-froydnj@codesourcery.com> X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH 7/7] linux-user: add core dump support for SH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Nathan Froyd --- linux-user/elfload.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 53851d9..e210956 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -682,6 +682,39 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i regs->regs[15] = infop->start_stack; } +/* See linux kernel: arch/sh/include/asm/elf.h. */ +#define ELF_NREG 23 +typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; + +/* See linux kernel: arch/sh/include/asm/ptrace.h. */ +enum { + TARGET_REG_PC = 16, + TARGET_REG_PR = 17, + TARGET_REG_SR = 18, + TARGET_REG_GBR = 19, + TARGET_REG_MACH = 20, + TARGET_REG_MACL = 21, + TARGET_REG_SYSCALL = 22 +}; + +static inline void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) +{ + int i; + + for (i = 0; i < 16; i++) { + (*regs[i]) = tswapl(env->gregs[i]); + } + + (*regs)[TARGET_REG_PC] = tswapl(env->pc); + (*regs)[TARGET_REG_PR] = tswapl(env->pr); + (*regs)[TARGET_REG_SR] = tswapl(env->sr); + (*regs)[TARGET_REG_GBR] = tswapl(env->gbr); + (*regs)[TARGET_REG_MACH] = tswapl(env->mach); + (*regs)[TARGET_REG_MACL] = tswapl(env->macl); + (*regs)[TARGET_REG_SYSCALL] = 0; /* FIXME */ +} + +#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 #endif