From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72710 invoked by alias); 25 Feb 2016 19:23:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72690 invoked by uid 89); 25 Feb 2016 19:23:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4263, agent, HContent-Transfer-Encoding:8bit X-HELO: xyzzy.0x04.net Received: from xyzzy.0x04.net (HELO xyzzy.0x04.net) (109.74.193.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Feb 2016 19:23:10 +0000 Received: from hogfather.0x04.net (89-65-66-135.dynamic.chello.pl [89.65.66.135]) by xyzzy.0x04.net (Postfix) with ESMTPS id 7AB953FED6 for ; Thu, 25 Feb 2016 20:24:02 +0100 (CET) Received: from [192.168.13.108] (unknown [192.168.13.108]) by hogfather.0x04.net (Postfix) with ESMTPSA id CC4B05800FC for ; Thu, 25 Feb 2016 20:23:07 +0100 (CET) Subject: Re: [PATCH 3/8] gdb/s390: Fill pseudo register agent expression hooks. To: gdb-patches@sourceware.org References: <1453637529-26972-4-git-send-email-koriakin@0x04.net> <1454853711-18349-1-git-send-email-koriakin@0x04.net> From: =?UTF-8?Q?Marcin_Ko=c5=9bcielnicki?= Message-ID: <56CF549B.9060904@0x04.net> Date: Thu, 25 Feb 2016 19:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1454853711-18349-1-git-send-email-koriakin@0x04.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00830.txt.bz2 Ping. On 07/02/16 15:01, Marcin Kościelnicki wrote: > gdb/ChangeLog: > > * s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function. > (s390_ax_pseudo_register_push_stack): New function. > (s390_gdbarch_init): Fill ax_pseudo_register_collect and > ax_pseudo_register_push_stack hooks. > --- > Added missing comments. > > gdb/ChangeLog | 7 +++++ > gdb/s390-linux-tdep.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 91 insertions(+) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index d24cccd..6260040 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,5 +1,12 @@ > 2016-02-07 Marcin Kościelnicki > > + * s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function. > + (s390_ax_pseudo_register_push_stack): New function. > + (s390_gdbarch_init): Fill ax_pseudo_register_collect and > + ax_pseudo_register_push_stack hooks. > + > +2016-02-07 Marcin Kościelnicki > + > * s390-linux-tdep.c (s390_supply_pseudo_pc): New function. > (s390_gdbarch_init): Fill supply_pseudo_pc hook. > > diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c > index 144365c..97bd564 100644 > --- a/gdb/s390-linux-tdep.c > +++ b/gdb/s390-linux-tdep.c > @@ -547,6 +547,86 @@ s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, > return default_register_reggroup_p (gdbarch, regnum, group); > } > > +/* The "ax_pseudo_register_collect" gdbarch method. */ > + > +static int > +s390_ax_pseudo_register_collect (struct gdbarch *gdbarch, > + struct agent_expr *ax, int regnum) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + if (regnum == tdep->pc_regnum) > + { > + ax_reg_mask (ax, S390_PSWA_REGNUM); > + } > + else if (regnum == tdep->cc_regnum) > + { > + ax_reg_mask (ax, S390_PSWM_REGNUM); > + } > + else if (regnum_is_gpr_full (tdep, regnum)) > + { > + regnum -= tdep->gpr_full_regnum; > + ax_reg_mask (ax, S390_R0_REGNUM + regnum); > + ax_reg_mask (ax, S390_R0_UPPER_REGNUM + regnum); > + } > + else if (regnum_is_vxr_full (tdep, regnum)) > + { > + regnum -= tdep->v0_full_regnum; > + ax_reg_mask (ax, S390_F0_REGNUM + regnum); > + ax_reg_mask (ax, S390_V0_LOWER_REGNUM + regnum); > + } > + else > + { > + internal_error (__FILE__, __LINE__, _("invalid regnum")); > + } > + return 0; > +} > + > +/* The "ax_pseudo_register_push_stack" gdbarch method. */ > + > +static int > +s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, > + struct agent_expr *ax, int regnum) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + if (regnum == tdep->pc_regnum) > + { > + ax_reg (ax, S390_PSWA_REGNUM); > + if (register_size (gdbarch, S390_PSWA_REGNUM) == 4) > + { > + ax_zero_ext (ax, 31); > + } > + } > + else if (regnum == tdep->cc_regnum) > + { > + ax_reg (ax, S390_PSWM_REGNUM); > + if (register_size (gdbarch, S390_PSWA_REGNUM) == 4) > + ax_const_l (ax, 12); > + else > + ax_const_l (ax, 44); > + ax_simple (ax, aop_rsh_unsigned); > + ax_zero_ext (ax, 2); > + } > + else if (regnum_is_gpr_full (tdep, regnum)) > + { > + regnum -= tdep->gpr_full_regnum; > + ax_reg (ax, S390_R0_REGNUM + regnum); > + ax_reg (ax, S390_R0_UPPER_REGNUM + regnum); > + ax_const_l (ax, 32); > + ax_simple (ax, aop_lsh); > + ax_simple (ax, aop_bit_or); > + } > + else if (regnum_is_vxr_full (tdep, regnum)) > + { > + /* Too large to stuff on the stack. */ > + return 1; > + } > + else > + { > + internal_error (__FILE__, __LINE__, _("invalid regnum")); > + } > + return 0; > +} > + > > /* A helper for s390_software_single_step, decides if an instruction > is a partial-execution instruction that needs to be executed until > @@ -7886,6 +7966,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > set_tdesc_pseudo_register_type (gdbarch, s390_pseudo_register_type); > set_tdesc_pseudo_register_reggroup_p (gdbarch, > s390_pseudo_register_reggroup_p); > + set_gdbarch_ax_pseudo_register_collect (gdbarch, > + s390_ax_pseudo_register_collect); > + set_gdbarch_ax_pseudo_register_push_stack > + (gdbarch, s390_ax_pseudo_register_push_stack); > tdesc_use_registers (gdbarch, tdesc, tdesc_data); > set_gdbarch_register_name (gdbarch, s390_register_name); > >