From patchwork Mon Apr 28 10:01:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 718 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id D0655360075 for ; Mon, 28 Apr 2014 03:01:53 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 8156A13A5E66; Mon, 28 Apr 2014 03:01:53 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 5891F13931B4 for ; Mon, 28 Apr 2014 03:01:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=RQoOv wnuDyR860V9rF/WX/hup79gmWF2tJXlm6TrVmzl2lyZECuJZ6WmfMLPsOvclTKbM SLcaYcY4L/I6T98zQm+LETGPHHUncXMzKMf/sCjEJlvGK7j+/WQP5qpeu+XxGxcY DwwbUhBetNfeXuRcLxyiCefmLIRSd+T3ipcWp4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=YlzlK07sUNs YgUQN9mRgdhMrjlI=; b=Yas0as6mVXnuOqgxMI7DmgCI02mNlUlDibVKB2oboqX CYGm1PL0lBVF7mBVAed30Y2EVeQ1news6fPKDqINYNwiUlELARIYQMb5eL2nCs2L n7krtQeuOyVeaV4OOS70+GgRI7cuNhHKK8aVWFSeILGynBVoUd5CPOjd0LgNrHZA = Received: (qmail 18630 invoked by alias); 28 Apr 2014 10:01:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18619 invoked by uid 89); 28 Apr 2014 10:01:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp18.uk.ibm.com Received: from e06smtp18.uk.ibm.com (HELO e06smtp18.uk.ibm.com) (195.75.94.114) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 28 Apr 2014 10:01:50 +0000 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Apr 2014 11:01:47 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp18.uk.ibm.com (192.168.101.148) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Apr 2014 11:01:45 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D2E652190063 for ; Mon, 28 Apr 2014 11:01:36 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3SA1imh48562364 for ; Mon, 28 Apr 2014 10:01:44 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3SB1isT018828 for ; Mon, 28 Apr 2014 05:01:44 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3SB1hoq018797; Mon, 28 Apr 2014 05:01:44 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Andreas Schwab Subject: [RFC 22/23] M68K Linux: Define regset structures References: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> Date: Mon, 28 Apr 2014 12:01:43 +0200 In-Reply-To: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 28 Apr 2014 11:35:33 +0200") Message-ID: <87oazl22ns.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042810-6892-0000-0000-0000089938B9 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in gdb/ * m68klinux-tdep.c: Include "regset.h". (m68k_linux_gregmap, m68k_linux_fpregmap): New register maps. (M68K_LINUX_GREGS_SIZE, M68K_LINUX_FPREGS_SIZE): New macros. (m68k_linux_gregset, m68k_linux_fpregset): New regsets. (m68k_linux_regset_from_core_section): New function. (m68k_linux_init_abi): Set regset_from_core_section gdbarch method. --- gdb/m68klinux-tdep.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index f6fed38..8967d28 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -38,6 +38,7 @@ #include "observer.h" #include "elf/common.h" #include "linux-tdep.h" +#include "regset.h" /* Offsets (in target ints) into jmp_buf. */ @@ -327,6 +328,66 @@ static const struct frame_unwind m68k_linux_sigtramp_frame_unwind = m68k_linux_sigtramp_frame_sniffer }; +/* Register maps for supply/collect regset functions. */ + +static const struct regcache_map_entry m68k_linux_gregmap[] = + { + { 7, M68K_D1_REGNUM }, /* d1 ... d7 */ + { 7, M68K_A0_REGNUM }, /* a0 ... a6 */ + { 1, M68K_D0_REGNUM }, + { 1, M68K_SP_REGNUM }, + { 4, REGCACHE_MAP_SKIP_BYTES }, /* orig_d0 (skip) */ + { 1, M68K_PS_REGNUM }, + { 1, M68K_PC_REGNUM }, + { 0 } + }; + +#define M68K_LINUX_GREGS_SIZE (19 * 4) + +static const struct regcache_map_entry m68k_linux_fpregmap[] = + { + { 8, M68K_FP0_REGNUM }, /* fp0 ... fp7 */ + { 1, M68K_FPC_REGNUM }, + { 1, M68K_FPS_REGNUM }, + { 1, M68K_FPI_REGNUM }, + { 0 } + }; + +#define M68K_LINUX_FPREGS_SIZE (27 * 4) + +/* Register sets. */ + +static const struct regset m68k_linux_gregset = + { + m68k_linux_gregmap, + regcache_supply_regset, regcache_collect_regset + }; + +static const struct regset m68k_linux_fpregset = + { + m68k_linux_fpregmap, + regcache_supply_regset, regcache_collect_regset + }; + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +static const struct regset * +m68k_linux_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, + size_t sect_size) +{ + if (strcmp (sect_name, ".reg") == 0 + && sect_size >= M68K_LINUX_GREGS_SIZE) + return &m68k_linux_gregset; + + if (strcmp (sect_name, ".reg2") == 0 + && sect_size >= M68K_LINUX_FPREGS_SIZE) + return &m68k_linux_fpregset; + + return NULL; +} + static void m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -361,6 +422,10 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + /* Core file support. */ + set_gdbarch_regset_from_core_section + (gdbarch, m68k_linux_regset_from_core_section); + /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map);