From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 1FEB6384D142 for ; Thu, 21 Jul 2022 14:53:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1FEB6384D142 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4LpbDH5lFXz3HjP for ; Thu, 21 Jul 2022 14:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LpbDH504kz47G1 for ; Thu, 21 Jul 2022 14:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658415215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zm/3XfJEQKDK2Ahe/2NIQ3NIWhTaG5O+zG17pq3pHc4=; b=FfVNs/+zY4WP2lIhJ1kPLl2/IUMT2m5Ht2x0YEHhvQwdJEJI9asEsVSv4AulvVAvch4/UW nOHSmUdK+kyX0TKRIDmjpYJobSJrXqWw65DoQVRzoAyyW+OPoGCxdozWXxG8Q/Z4mn2a9R 7YY4RJqtkNZv8Do45Q0gONJb1vRKSRqRbBR0MbFe7TaRuUv6427MT7lqOgtyPYcPFYGx8x S3nExSRvVzew098SHz3jk0etThlrQycuD/CvinkzujMuqFEaBzEqMQ41Ye+d6SA+NeZRNW 7qCjyV539daKtz6rYeaLyxyOeQTuByH7RoZb92NDYJr11/nTrF5Tcp+c8R4RMA== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4LpbDH2b2BzWr4 for ; Thu, 21 Jul 2022 14:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <099949c8-edc0-a7b9-cf5e-9eebdd13e759@FreeBSD.org> Date: Thu, 21 Jul 2022 07:53:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 0/5] Improve support for regcache_map_entry with variable register base Content-Language: en-US To: gdb-patches@sourceware.org References: <20220708005816.9408-1-jhb@FreeBSD.org> From: John Baldwin In-Reply-To: <20220708005816.9408-1-jhb@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658415215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zm/3XfJEQKDK2Ahe/2NIQ3NIWhTaG5O+zG17pq3pHc4=; b=ACS8u9bd1xq3VoZoh9hzVnrUHOE/lIG3FAlC/gC+CwFBlFnk3hS1gNAPHTPm8URuYzxlWG DPqn8lPQtLWQyHxoMXWbivY1GUCTRA5Vr486SeepLpw3mW8NWF0x02VJwXLxaTA80w7f+e Sg0RWp/9LZ6ZL9NogU3MAQegw4dirbOr5o3WOgD/k7Hp3xMp2D9dwb8QpBTqAtRfhANFDL NEMvVazSnMyfAOlWRDHuyLO+REx0eoYZVn00u5XOWKU830Nj3+7RggC9HDntCit3/amWBR KfgASHlUsVdX2OCxoDtBOBUivFyMtnP0a/zZiL225S7A9HVgYD/vSRHHAT3rYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658415215; a=rsa-sha256; cv=none; b=ygrhXjBJJcuAx+TfR3H2a87ApDHZkTYtmWKs+/8wKXfqt907P6awavYG78mlBMLN3Xcq7G MNS832ht0Ev8zcuPjPd+k3Wi7dl3JdZHoveESVtznvvtahH7/IWuMgdV5qM1cFArIy1Axi 5F4C2swhwENumXYmaKy2DgzW0a7I3PGt/lD558B6EAIxh5IFBRbFcu3IdWRYXtCZhs6+2d UjQi1uNRyeH7A7GOBDCC8IOQDPdSsJDKTSTFGxyHcC5jlpg2oHY6k7yayHlfJSt/B9l0Ee WvPVxa+n1reTMtYwrfy89Tvfs6qpO6AydMjsdIyzSVd0uI0kJMf0QVcda5oVBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2022 14:53:38 -0000 On 7/7/22 5:58 PM, John Baldwin wrote: > When I added support for TLS to the ARM and AArch64 architectures on > FreeBSD, I had to construct register maps and associated register sets > on the fly in both the callback for processing register core dump > notes and in the native target routines to fetch and store registers. > > The reason I had to create these on the fly is that the register > number was not known at compile time, so the register map and register > set could not be constant structures shared among the -tdep and -nat > code the way other register sets were. > > This series aims to rectify that. The first patch adds new variants > of regcache::collect_regset and regcache::supply_regset that accept an > additional 'regbase' argument. When these functions iterate over > regcache map entries, the effective register number for the entry is > computed by adding the value in the entry to 'regbase' permittting the > regcache map entries to hold relative register numbers for a block of > registers. > > The rest of the series then makes use of this to use a single, shared > register map and register set for TLS on FreeBSD/ARM and > FreeBSD/AArch64. Using this requires custom supply and collect regset > routines for the TLS regsets that extract the base register number > from the gdbarch's tdep and invoke the new regcache class methods, so > patch 2 updates the wrappers for dealing with regsets in fbsd-nat to > always invoke the regset routines from the regset instead of directly > calling the default functions. Patch 3 is another change to fbsd-nat > to cope with the fact that regcache_map_supplies() needs to pass in > the relative register number in the wrapper routines rather than the > absolute register number. > > Patches 4 and 5 are the updates to the ARM and AArch64 FreeBSD > architectures and targets. > > I have not done the work to make use of this in the Linux AArch64 > architecture, though I think it would apply to at least the TLS and > MTE register sets there in a similar fashion. SVE is harder because > the register sizes change (though SVE might be able to make use of > this if register_size() returns the right value by using a register > size of 0 in the relevant register cache map entries). > > John Baldwin (5): > regcache: Add collect/supply_regset variants that accept a register > base. > fbsd-nat: Use regset supply/collect methods. > fbsd-nat: Pass an optional register base to the register set helpers. > arm-fbsd: Use a static regset for the TLS register set. > aarch64-fbsd: Use a static regset for the TLS register set. > > gdb/aarch64-fbsd-nat.c | 36 +++------------------------ > gdb/aarch64-fbsd-tdep.c | 54 ++++++++++++++++++++++++++++------------- > gdb/aarch64-fbsd-tdep.h | 1 + > gdb/arm-fbsd-nat.c | 34 +++----------------------- > gdb/arm-fbsd-tdep.c | 52 +++++++++++++++++++++++++++------------ > gdb/arm-fbsd-tdep.h | 1 + > gdb/fbsd-nat.c | 42 +++++++++++++++++--------------- > gdb/fbsd-nat.h | 49 +++++++++++++++++++++---------------- > gdb/regcache.c | 28 ++++++++++++++++++--- > gdb/regcache.h | 24 ++++++++++++++++-- > 10 files changed, 181 insertions(+), 140 deletions(-) Ping. -- John Baldwin