From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UNXBCX3CK2Zj5TwAWB0awg (envelope-from ) for ; Fri, 26 Apr 2024 11:04:29 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RSdjZqUG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 223EB1E0CE; Fri, 26 Apr 2024 11:04:29 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 04B4D1E0C0 for ; Fri, 26 Apr 2024 11:04:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B37833861001 for ; Fri, 26 Apr 2024 15:04:26 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 99623384AB4E for ; Fri, 26 Apr 2024 15:02:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99623384AB4E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 99623384AB4E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143743; cv=none; b=Zv5wJM05WYMayHAMqY39BsRYeagsW2HeW3DRYo7PKM1ttbOJ4ElmRAHhDomRlKZpnysLSZ2dA0wLiDDmDvsSXZZbxrrHw7AC1OsCG+wosFYAJLdl4pi4aauDEFFvAqd+mgvTpyViyDNsGrt0lMUWxyUyKQjhckSK8O/TqC0ApT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143743; c=relaxed/simple; bh=RFgbMTygR88+k3VtDJPxX6wWsrAS/9q2asYRp6m0n/w=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=hWzuxxYG4IZn0cT1uYmiPMuxUi/jFn6OQgJqwXAm+crUKPPktZuUeXkcQtxk0vtPhOZC0sgICEL+63cho/6SqxduA4Cu0lC89ELBKzWOUVwkKX3qZd6Xwlpz2UFgUwYCYhnyH2jmk9gHhZrj02IsZQE6MLOH+GEKstD7Oe6g8Jw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714143741; 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=/fzA5kEB0quocRQO9ypXpBHmBNB6TiVcVv60bzH5snw=; b=RSdjZqUGEb51V4UDS/zkDKc7moevWkzkgm0vmhbgUKbzGddoQlp1JTI+QzsYGpRJ2m07Uc OG8Zq/m3070tYczjOsiwQNunVOT5T83r9X3Duc5hjqYphslP49QoQHOOtoMIGS/M2OUrsc eUFWlxMCluT78Bvpk3DvFjnzsWJKlDY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-T53pGlmuMNKocwEtUX4StA-1; Fri, 26 Apr 2024 11:02:19 -0400 X-MC-Unique: T53pGlmuMNKocwEtUX4StA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-41a1eb33994so9240145e9.1 for ; Fri, 26 Apr 2024 08:02:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714143738; x=1714748538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kQ57I5pkPVGHJS5eDU7I9WejEYo3x1NgfL3QpxX6qCk=; b=mfnEpyapi06nj8SGkhnlFNbbl5oseuWCZiNUB5QJh4Qod480PSM7emM5cWzw+GJXx2 qAyFpfX21kwJP+ltxinirD3Q4otnec2toh3Sn1o+lxgfnjtkQFpg+UFPiD+oB1TZci+L HXpLlS6VaAJOJ108cZmrBvekmi84wFKqBeRyrVvGQfsDajsfK2pazJtY7dLMDuXImnZU fRVyEGzo4KzDCu+xcPuCvZnpR73y/DROvzNZpnsaX24rvUvkiSITOI9ifuir2NEa6I2P dGubCRgLE4y5wYEkT+CCmBTHK+x/sy1aLt+mQTIFGQ1nZWjzmzwcPycXWRWwd1vyi3Nt ynvA== X-Gm-Message-State: AOJu0YwAtK9Kwgy7/t+obgIYetUP7CEbJPyM9QPNWjV1uRpGIpPPYOVi KvLEKih2SiyeTwkQDXDQcGrBqhgqFWMDiXsqEH9Eu4juWMnMkyYpUulllFYhqQOMD12Gz3L1ksA slrmkpzboZp4wOX3sWzsz9h5l1gK4XpM3BxSgUipCXRdbQM41se/vApNmHm8o7Zd9ZCNnM76Amd 5iyJ6qs+bzzVLa/IxoRW/NujNdard67Kc5sUMrz0A+dzM= X-Received: by 2002:a05:600c:45c4:b0:417:e00c:fdb8 with SMTP id s4-20020a05600c45c400b00417e00cfdb8mr2453591wmo.1.1714143737528; Fri, 26 Apr 2024 08:02:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFawO891NtPcK1YuVT+1ORZen8NOy0GnQX6dzgodopp7buWbQbGTtOR3r5l4YhQ+I/PYd33IQ== X-Received: by 2002:a05:600c:45c4:b0:417:e00c:fdb8 with SMTP id s4-20020a05600c45c400b00417e00cfdb8mr2453557wmo.1.1714143736720; Fri, 26 Apr 2024 08:02:16 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c19d100b00416b163e52bsm34682832wmq.14.2024.04.26.08.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:02:15 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, John Baldwin Subject: [PATCHv5 06/11] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Date: Fri, 26 Apr 2024 16:01:50 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Share the definition of I386_LINUX_XSAVE_XCR0_OFFSET between GDB and gdbserver. This commit is part of a series that aims to share more of the x86 target description creation code between GDB and gdbserver. The I386_LINUX_XSAVE_XCR0_OFFSET #define is used as part of the target description creation, and I noticed that this constant is defined separately for GDB and gdbserver. This commit moves the definition into gdbsupport/x86-xstate.h, which allows the #define to be shared. There should be no user visible changes after this commit. --- gdb/i386-linux-tdep.h | 20 -------------------- gdbserver/linux-x86-low.cc | 21 --------------------- gdbsupport/x86-xstate.h | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index 5891747572b..07593c6a8ec 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -58,26 +58,6 @@ extern void i386_linux_report_signal_info (struct gdbarch *gdbarch, /* Return the target description according to XCR0. */ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); -/* Format of XSAVE extended state is: - struct - { - fxsave_bytes[0..463] - sw_usable_bytes[464..511] - xstate_hdr_bytes[512..575] - extended state regions (AVX, MPX, AVX512, PKRU, etc.) - }; - - Same memory layout will be used for the coredump NT_X86_XSTATE - representing the XSAVE extended state registers. - - The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled - extended state mask, which is the same as the extended control register - 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask - together with the mask saved in the xstate_hdr_bytes to determine what - states the processor/OS supports and what state, used or initialized, - the process/thread is in. */ -#define I386_LINUX_XSAVE_XCR0_OFFSET 464 - extern int i386_linux_gregset_reg_offset[]; /* Return x86 siginfo type. */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index ffb2a90731d..62612773a87 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -831,27 +831,6 @@ x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) static int use_xml; -/* Format of XSAVE extended state is: - struct - { - fxsave_bytes[0..463] - sw_usable_bytes[464..511] - xstate_hdr_bytes[512..575] - avx_bytes[576..831] - future_state etc - }; - - Same memory layout will be used for the coredump NT_X86_XSTATE - representing the XSAVE extended state registers. - - The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled - extended state mask, which is the same as the extended control register - 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask - together with the mask saved in the xstate_hdr_bytes to determine what - states the processor/OS supports and what state, used or initialized, - the process/thread is in. */ -#define I386_LINUX_XSAVE_XCR0_OFFSET 464 - /* Get Linux/x86 target description from running target. */ static const struct target_desc * diff --git a/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h index 89c1143fbe1..11b37544aa3 100644 --- a/gdbsupport/x86-xstate.h +++ b/gdbsupport/x86-xstate.h @@ -120,4 +120,24 @@ constexpr bool operator!= (const x86_xsave_layout &lhs, #define I387_MXCSR_INIT_VAL 0x1f80 +/* Format of XSAVE extended state is: + struct + { + fxsave_bytes[0..463] + sw_usable_bytes[464..511] + xstate_hdr_bytes[512..575] + extended state regions (AVX, MPX, AVX512, PKRU, etc.) + }; + + Same memory layout will be used for the coredump NT_X86_XSTATE + representing the XSAVE extended state registers. + + The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled + extended state mask, which is the same as the extended control register + 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask + together with the mask saved in the xstate_hdr_bytes to determine what + states the processor/OS supports and what state, used or initialized, + the process/thread is in. */ +#define I386_LINUX_XSAVE_XCR0_OFFSET 464 + #endif /* COMMON_X86_XSTATE_H */ -- 2.25.4