From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id E6A163858D39 for ; Wed, 12 Apr 2023 21:08:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6A163858D39 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 [IPv6:2610:1c1:1:606c::19:1]) (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 4Pxb020B3mz455Y; Wed, 12 Apr 2023 21:08:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4Pxb016LYTz41D0; Wed, 12 Apr 2023 21:08:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681333681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2b05NSvohfk2+dE1UR/m9ibiLgoEMPsmASEpupa+Th4=; b=MaqACjaBVNN83LD6YEIGvmruUJgku0rxAOBzoUjk8WjOxjYPuiBA1IQA5haOJC6exEEY0+ zzWIbySi7WX1nGMjn5pXuHx+etp7aHE3NVxPC2xV5YtqQfwqHyHMeW3ZXgSDetShC9ozrp SmXE2bxF12GhBf4PAnOaA8O9mA6syCrWInXqHPVzetfB/SiOkAqeHI+lYzBUepH7cUdWgh Fo6HSIooG+LlCjmRAstuqR8TlRzZgvOKpixIRz6Nc7vGjAAnIboTXkFGDeC1W0mOq3Hch4 NRpqVRCktTZA8Whm/E4Bl1DI72Hgq0yHdxWTUKOEijgSbMCzg/240RiKCySPgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681333681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2b05NSvohfk2+dE1UR/m9ibiLgoEMPsmASEpupa+Th4=; b=JzU5tKEb4ElTJBbalm24Oy7Lr9K7RCSpzPId0yAJKU1+e+ECVnbq8BhE/LPsYfHZeivwDZ 7dn6/1z4B+lw77/zq7LgySN0UqrNOVNGb6VdjbnzP/L9rXn/tKIqRo1iMf0dcr3trRwfkV HWaTOT/X+NPOcniAM/mi2/3PSN41ZB+/vKslb1yaonFz/nUmKT0Nn0AWrl2jocgjttIza4 TUxAB8ol73KfT6W/mv3WTwfJ4GKzk4+wNLdGA42M0NznV9zUjAGJo+aVQNDFpjN3R4ROOG C5cMno3ywZmTJE2wUcrwMqa0G5IJ3gA3S+DMRcHuGU2z6gfBhiWYBkMAiJbxDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681333681; a=rsa-sha256; cv=none; b=b+I+1UW8AWdQpno6GL90JxVy8VtLGSyc8oRYronliBppokHodSctsY7LHsHusU++cLlehu 8dNGLMkkgYHVkPVxf1+V7UVrWqhX3jw6dXZ3o+sL9nCj5sNy2D8SVmEz3gcZ8RvLbfrACw 8LH0fJ633GKygEdDhSLgRAqd7RdDPmj5ehjBlO0BA9S2U4HDS54EZASQC/iMBPvDmwb2YW 0+IJ/8LLUvU8LawXOk/qTktoOFyhJKrdY5PGBCKQhGZn1dJmp23pnmMBFJDALS7LnT2wsH pR+xCWSvGcP1Y3ga17Fspkn9pyIZrFjdw4GKk95b+1JAbfbnW06QU0ArQD+Dvw== Received: from [IPV6:2601:648:8680:16b0:a8be:33ea:cc54:376c] (unknown [IPv6:2601:648:8680:16b0:a8be:33ea:cc54:376c]) (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 4Pxb012rYCzMq3; Wed, 12 Apr 2023 21:08:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <80ddaec3-f871-d318-57e6-22669a4f3887@FreeBSD.org> Date: Wed, 12 Apr 2023 14:07:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org Cc: Aleksandar Paunovic References: <20230318010905.14294-1-jhb@FreeBSD.org> <20230318010905.14294-13-jhb@FreeBSD.org> From: John Baldwin Subject: Re: [PATCH v4 12/13] gdbserver: Read offsets of the XSAVE extended region via CPUID In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 List-Id: On 4/12/23 12:11 PM, Simon Marchi wrote: > On 3/17/23 21:09, John Baldwin wrote: >> From: Aleksandar Paunovic > Finally, do you think this class could eventually be shared with GDB, > and could help simplify the implementation there? The i387_xsave could > take a reference to an existing x86_xsave_layout object to take the > offsets from, rather than referring to the global instance as it does > currently. What I would really like to do (and planned to try as a followup after this series) is try to use regcache_map_entry arrays to describe the various XSAVE regions. Those arrays could be shared between GDB and gdbserver (might need to make some of the regcache_map_entry stuff be shared instead of GDB-only). I want to do this for eventual FreeBSD support in gdbserver as well where I want to share the regcache maps used in the foo-fbsd-tdep.c files with the equivalent low.cc file over in gdbserver to describe the register sets available via ptrace. But using regcache_map_entry would mean you would do something like this for the AVX region: /* The AVX region includes the YMMH registers. */ const struct regcache_map_entry xsave_avx_regmap[] = { { 16, 0, 16 }, /* ymmh0 ... ymmh15 */ }; const struct regset xsave_avx_regset = { xsave_avx_regmap, regcache_collect_regset, regcache_supply_regset }; Similar to how aarch64_fbsd_tls_regset is handled in aarch64-fbsd-tdep.c, but using I387_YMMH0_REGNUM (tdep) instead of tdep->tls_base_regnum as the base register number. Just as in the case of aarch64-fbsd I share the same regset for TLS between both the tdep.c and nat.c, the regsets for XSAVE regions could be shared between GDB and gdbserver. The gdbserver patches here I have only modified lightly from Aleksandar's original work. I can work on them further, but I think if I want to unify them (probably using regcache maps) I'd like to do that as a followup series. -- John Baldwin