From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GHg8OIN+YWYlUygAWB0awg (envelope-from ) for ; Thu, 06 Jun 2024 05:16:51 -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=bempAA8F; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E1D051E0C0; Thu, 6 Jun 2024 05:16:51 -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 CF00D1E0BB for ; Thu, 6 Jun 2024 05:16:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A08A38F9836 for ; Thu, 6 Jun 2024 09:16:49 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8EC7138F9808 for ; Thu, 6 Jun 2024 09:16:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EC7138F9808 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 8EC7138F9808 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717665379; cv=none; b=cesm8dnAiladAAOwrM0sxs00M2lUg022JBYnXDlEuqlerA+k+5mlxXuVgiDEb9KEIlKe+l7fS2u/H8WFRr3A3FBNE9YpQdcHqn9HPba4+gF0aUkzftajj++sqorJ49ni81+jhTIOjam4Yye0msKtDrrI2M1v4Yio6ermDIxoOmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717665379; c=relaxed/simple; bh=5Y9PSUVforz4BLmMbTrrt8YKPD4as050r2cByA0tXIc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=AGkB+Gccocs+qwdZRunP1+/RFEZ0nqtsKUby2M7rGAJczLx8VWEsoM++xgv8ZWMG78S6dP/6Di2tmpr9rKlN4dAackEoTx06S39ENWv8yduOlj95BnA1UV0usYZ1BTBz2gHXe4JbIZEIvcDLERHTOI/7DN15LQQorOHYS2n6nN8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717665377; 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=hocNIUxR0fvxLrV49+tg7LKoOh/JA3kk9vmMDD5k8eo=; b=bempAA8FhIaSCUOkgOJ3RIFdSPkWJEqWFmN5jiUImuQKemnnlxdH1Jy8dxARs2+gkolqDo nvpU3jVwJq8kH/30dfK8bEfVM4a6G1KZ5tVVFCRcsWoHY8/60qffiDbhkO3kZpLr8XRdrA PEXVK9nIzeF+CxYrm8l63q/dnN+IFEM= 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-534-Uck-Ob-9NLmfhp0KkaVyUw-1; Thu, 06 Jun 2024 05:16:16 -0400 X-MC-Unique: Uck-Ob-9NLmfhp0KkaVyUw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4215e83d26bso3187335e9.2 for ; Thu, 06 Jun 2024 02:16:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717665372; x=1718270172; 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=2lQ87tPQQIbOqF1OMYg2i/duuBDkXwFbOIKl0VMRBKY=; b=EO55yZvAaVRLUvwSnewByVkIrnBhh4BC4f2c9OYn/1Z056G4IRMWU02hgK9tuFME2u rMQX14PPpCbRlKv+U34+E1qBs77SHxoME4CDiEPW8IPXnwM2nEOPCZn8ZeRY090TSdR+ jF4XDvHXkWM7xe+BtdEhSAjT3zTvGBk693mhb/bSN7iMwcR/UUHGPXeMhrMNhgp7yiEz fFW6al5oAViJuqcmo5DfJVjG0YcX3zvuY0B3TIAfZTyJ5xBgZRiVf9MqrjycJbhiuTTw wAPIaq84lkkTc2QAoFQrnZmDGrt2fp5/Wu9rhFP007wAqd1rwx8PsNw/TOqvZ5KlzQO3 /LrQ== X-Gm-Message-State: AOJu0YxhkOr72oEnl++Wpx0xIvCuCcixmAnLeCbj0ciS8V1WEhpjr9aR ABLKXBP+IkBawjOrVjJctIxLPhHIsSX93mJKunvoFyTHbRe8MRiaZFabWlUzdf/at9DzN/VsBb5 6UGPZhMAUfLR5HqQvx3K7NVHkQS8PkK2C7Ncns0XPaiXQuw6DTE3pVzQzHrGaUhtblpnDEMSbuF TM+pp+Sssnoanpkm8VUuKapy687ckZLrMk7zLqIFypr1I= X-Received: by 2002:a05:600c:4695:b0:421:3464:dc7a with SMTP id 5b1f17b1804b1-4215635875bmr39627515e9.39.1717665372119; Thu, 06 Jun 2024 02:16:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1qY/v4E+rkC/Y8gc+1A6dR5pW+8hrGjpDhkl21MbA0T75p/n5PKlgsi3YYYKS3EZLlQrTkQ== X-Received: by 2002:a05:600c:4695:b0:421:3464:dc7a with SMTP id 5b1f17b1804b1-4215635875bmr39627345e9.39.1717665371670; Thu, 06 Jun 2024 02:16:11 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c2c7e25sm15101645e9.37.2024.06.06.02.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:16:11 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com Subject: [PATCHv8 1/9] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Date: Thu, 6 Jun 2024 10:15:57 +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.5 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, T_SCC_BODY_TEXT_LINE 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 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. Approved-By: Felix Willgerodt --- 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 2603fb2ac5d..6de44aeb2d9 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 - /* Does the current host support the GETFPXREGS request? The header file may or may not define it, and even if it is defined, the kernel will return EIO if it's running on a pre-SSE processor. */ 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