From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116263 invoked by alias); 28 Sep 2015 18:29:54 -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 116254 invoked by uid 89); 28 Sep 2015 18:29:53 -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_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp-out6.electric.net Received: from smtp-out6.electric.net (HELO smtp-out6.electric.net) (192.162.217.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 28 Sep 2015 18:29:52 +0000 Received: from 1ZgdBN-0005Yc-U1 by out6b.electric.net with emc1-ok (Exim 4.85) (envelope-from ) id 1ZgdBN-0005ZI-Uq for gdb-patches@sourceware.org; Mon, 28 Sep 2015 11:29:49 -0700 Received: by emcmailer; Mon, 28 Sep 2015 11:29:49 -0700 Received: from [188.39.184.227] (helo=GLAEXCH1.ftdi.local) by out6b.electric.net with esmtps (TLSv1:AES128-SHA:128) (Exim 4.85) (envelope-from ) id 1ZgdBN-0005Yc-U1 for gdb-patches@sourceware.org; Mon, 28 Sep 2015 11:29:49 -0700 Received: from GLAEXCH3.ftdi.local ([172.16.0.161]) by glaexch1 ([172.16.0.121]) with mapi id 14.01.0438.000; Mon, 28 Sep 2015 19:28:39 +0100 From: James Bowman To: "gdb-patches@sourceware.org" Subject: [PATCH, FT32] Replace hard-coded instruction patterns with macros Date: Mon, 28 Sep 2015 18:29:00 -0000 Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Outbound-IP: 188.39.184.227 X-Env-From: james.bowman@ftdichip.com X-PolicySMART: 3094660 X-SW-Source: 2015-09/txt/msg00606.txt.bz2 The stack unwinder can now use FT32_*() macros to interpet binary instructions instead of local definitions. OK to apply? 2015-09-28 James Bowman * ft32-tdep.c: #include "opcode/ft32.h" Delete local macro definitions (ft32_analyze_prologue): Use FT32_* macros =09 diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index e834279..00cf847 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -37,6 +37,8 @@ #include "dis-asm.h" #include "record.h" =20 +#include "opcode/ft32.h" + #include "ft32-tdep.h" #include "gdb/sim-ft32.h" =20 @@ -153,11 +155,6 @@ ft32_store_return_value (struct type *type, struct reg= cache *regcache, =20 Returns the address of the first instruction after the prologue. */ =20 -#define IS_PUSH(inst) (((inst) & 0xfff00000) =3D=3D 0x84000000) -#define PUSH_REG(inst) (FT32_R0_REGNUM + (((inst) >> 15) & 0x1f)) -#define IS_LINK(inst) (((inst) & 0xffff0000) =3D=3D 0x95d00000) -#define LINK_SIZE(inst) ((inst) & 0xffff) - static CORE_ADDR ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, struct ft32_frame_cache *cache, @@ -180,9 +177,9 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR = end_addr, { inst =3D read_memory_unsigned_integer (next_addr, 4, byte_order); =20 - if (IS_PUSH (inst)) + if (FT32_IS_PUSH (inst)) { - regnum =3D PUSH_REG (inst); + regnum =3D FT32_R0_REGNUM + FT32_PUSH_REG (inst); cache->framesize +=3D 4; cache->saved_regs[regnum] =3D cache->framesize; next_addr +=3D 4; @@ -201,7 +198,7 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR = end_addr, if (next_addr < end_addr) { inst =3D read_memory_unsigned_integer (next_addr, 4, byte_order); - if (IS_LINK (inst)) + if (FT32_IS_LINK (inst)) { cache->established =3D 1; for (regnum =3D FT32_R0_REGNUM; regnum < FT32_PC_REGNUM; regnum++) @@ -211,7 +208,7 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR = end_addr, } cache->saved_regs[FT32_PC_REGNUM] =3D cache->framesize + 4; cache->saved_regs[FT32_FP_REGNUM] =3D 0; - cache->framesize +=3D LINK_SIZE (inst); + cache->framesize +=3D FT32_LINK_SIZE (inst); next_addr +=3D 4; } }