From patchwork Tue Apr 4 10:15:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 19819 Received: (qmail 52534 invoked by alias); 4 Apr 2017 10:16:01 -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 52513 invoked by uid 89); 4 Apr 2017 10:16:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-db5eur01on0069.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Apr 2017 10:15:59 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0103.eurprd08.prod.outlook.com (10.160.211.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Tue, 4 Apr 2017 10:15:57 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::5931:f431:f97d:943d]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::5931:f431:f97d:943d%16]) with mapi id 15.01.1005.018; Tue, 4 Apr 2017 10:15:57 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH 10/11] Add XTENSA_MAX_REGISTER_SIZE Date: Tue, 4 Apr 2017 10:15:57 +0000 Message-ID: authentication-results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-microsoft-exchange-diagnostics: 1; AM3PR08MB0103; 7:EslsA4iIf6cuAOG/zq1OZaeh1GpreCLQDaJdVjbVwzCMcrwjkWtq3+QdaIWFlZ/je0tNAW2IMgrjOqUHo4gfKVIM0DbRnoL6W61hfi8QM5xUBx0ePi1JCf05QROE68AWXzoJigHy5UQk7HE1SfEL9djehGz+Cq2iRWujUJT1xkwFPWSVnGiEhi4PgAbMXutAFTHiALx6yk72Z04mHPqWYQQlX59FGWzuDGwZEGspp9DqXpvDdNwwvOEp19NJld4AnW5n5dkadsEI8kuBYZD01C1TFwKiafPzI0Lv0XPjy9ybsVEjekLEQ733u4x8DIE7AblIOOPqqFvJf2lSiz1U2w==; 20:y1qHUJWHiGwiFz/OPvBtmiE2O4lRkmloNpoqAY/KflexZ2ANYTEFpcHKf2pAXGlkRqf6evwri3zj+Lk/CEL0Ae+xKdWVe+bvYH5tx6c63qcBe6GCpinxJTmaTIYGxLguBSoSG+DiNy1nmqIbVKFlAtFlzUsRhtlJnewfsp8bOQw= x-ms-office365-filtering-correlation-id: 137dd732-560d-4a38-c242-08d47b4395f7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM3PR08MB0103; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123564025)(20161123562025)(6072148); SRVR:AM3PR08MB0103; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0103; x-forefront-prvs: 0267E514F9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39840400002)(39860400002)(39850400002)(39400400002)(39450400003)(39410400002)(377424004)(2351001)(86362001)(36756003)(6506006)(6916009)(66066001)(189998001)(50986999)(6486002)(2900100001)(25786009)(54356999)(8676002)(6436002)(5250100002)(33656002)(2501003)(3280700002)(3660700001)(3846002)(82746002)(305945005)(8936002)(110136004)(102836003)(6512007)(6116002)(5660300001)(38730400002)(4326008)(99286003)(5640700003)(81166006)(2906002)(83716003)(53936002)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0103; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2017 10:15:57.4549 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0103 Max size set to 128bits, which I determined using xtensa_register_type() Tested on a --enable-targets=all build using make check with board files unix and native-gdbserver. I do not have a XTENSA machine to test on. Ok to commit? Alan. 2017-04-04 Alan Hayward * xtensa-tdep.c (xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE. (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise. (xtensa_pseudo_register_write): Likewise. * xtensa-tdep.h (XTENSA_MAX_REGISTER_SIZE): Add. diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h index 46aeecb35567930ac1497df3dae09d5ffe57e9e1..39abe1f8acb8fc508f48c7cf5bd81366e5f584be 100644 --- a/gdb/xtensa-tdep.h +++ b/gdb/xtensa-tdep.h @@ -222,6 +222,9 @@ struct gdbarch_tdep struct ctype_cache *type_entries; }; +/* Big enough to hold the size of the largest register in bytes. */ +#define XTENSA_MAX_REGISTER_SIZE 16 + /* Macro to instantiate a gdbarch_tdep structure. */ #define XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spillsz) \ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 376f4c7340c3292273d5b0912b23ff7166382e8b..655f884926dfad88cb03b582f608788c049d3bad 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -370,7 +370,7 @@ static void xtensa_register_write_masked (struct regcache *regcache, xtensa_register_t *reg, const gdb_byte *buffer) { - unsigned int value[(MAX_REGISTER_SIZE + 3) / 4]; + unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4]; const xtensa_mask_t *mask = reg->mask; int shift = 0; /* Shift for next mask (mod 32). */ @@ -454,7 +454,7 @@ static enum register_status xtensa_register_read_masked (struct regcache *regcache, xtensa_register_t *reg, gdb_byte *buffer) { - unsigned int value[(MAX_REGISTER_SIZE + 3) / 4]; + unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4]; const xtensa_mask_t *mask = reg->mask; int shift = 0; @@ -559,7 +559,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch, && (regnum >= gdbarch_tdep (gdbarch)->a0_base) && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); + gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE); enum register_status status; status = regcache_raw_read (regcache, @@ -655,7 +655,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, && (regnum >= gdbarch_tdep (gdbarch)->a0_base) && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)) { - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); + gdb_byte *buf = (gdb_byte *) alloca (XTENSA_MAX_REGISTER_SIZE); regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);