From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Subject: [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features
Date: Thu, 8 Sep 2022 06:41:47 +0000 [thread overview]
Message-ID: <20220908064151.3959930-5-thiago.bauermann@linaro.org> (raw)
In-Reply-To: <20220908064151.3959930-1-thiago.bauermann@linaro.org>
It will be used in a subsequent commit. There's no functional change.
---
gdbserver/linux-aarch64-low.cc | 45 ++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 576925838f49..9b57be73818e 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -652,6 +652,28 @@ aarch64_target::low_delete_process (arch_process_info *info)
xfree (info);
}
+/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
+#define AARCH64_HWCAP_PACA (1 << 30)
+
+static gdb::optional<struct aarch64_features>
+aarch64_get_arch_features (const thread_info *thread)
+{
+ struct aarch64_features features;
+ int vq = aarch64_sve_get_vq (thread->id.lwp ());
+
+ if (vq < 0)
+ return {};
+
+ features.vq = vq;
+ /* A-profile PAC is 64-bit only. */
+ features.pauth = linux_get_hwcap (thread, 8) & AARCH64_HWCAP_PACA;
+ /* A-profile MTE is 64-bit only. */
+ features.mte = linux_get_hwcap2 (thread, 8) & HWCAP2_MTE;
+ features.tls = true;
+
+ return features;
+}
+
void
aarch64_target::low_new_thread (lwp_info *lwp)
{
@@ -804,9 +826,6 @@ aarch64_adjust_register_sets (const struct aarch64_features &features)
}
}
-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
-#define AARCH64_HWCAP_PACA (1 << 30)
-
/* Implementation of linux target ops method "low_arch_setup". */
void
@@ -822,24 +841,18 @@ aarch64_target::low_arch_setup ()
if (is_elf64)
{
- struct aarch64_features features;
- int vq = aarch64_sve_get_vq (tid);
+ gdb::optional<struct aarch64_features> features
+ = aarch64_get_arch_features (current_thread);
- /* If ptrace fails we can't determine vq, but the low_arch_setup method
- always succeeds so all we can do here is assert that vq is valid. */
- gdb_assert (vq >= 0);
- features.vq = vq;
- /* A-profile PAC is 64-bit only. */
- features.pauth = linux_get_hwcap (current_thread, 8) & AARCH64_HWCAP_PACA;
- /* A-profile MTE is 64-bit only. */
- features.mte = linux_get_hwcap2 (current_thread, 8) & HWCAP2_MTE;
- features.tls = true;
+ /* If ptrace fails we can't determine vq, but low_arch_setup always
+ succeeds so all we can do here is assert that features is valid. */
+ gdb_assert (features.has_value ());
- current_process ()->tdesc = aarch64_linux_read_description (features);
+ current_process ()->tdesc = aarch64_linux_read_description (*features);
/* Adjust the register sets we should use for this particular set of
features. */
- aarch64_adjust_register_sets (features);
+ aarch64_adjust_register_sets (*features);
}
else
current_process ()->tdesc = aarch32_linux_read_description ();
next prev parent reply other threads:[~2022-09-08 6:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 6:41 [PATCH 0/8] gdbserver improvements for AArch64 SVE support Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 1/8] gdbserver: Add asserts in register_size and register_data functions Thiago Jung Bauermann
2022-09-20 7:36 ` Luis Machado
2022-11-26 1:36 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap Thiago Jung Bauermann
2022-09-20 7:43 ` Luis Machado
2022-11-26 1:37 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 3/8] gdb, gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error Thiago Jung Bauermann
2022-09-20 8:07 ` Luis Machado
2022-11-26 1:42 ` Thiago Jung Bauermann
2022-09-08 6:41 ` Thiago Jung Bauermann [this message]
2022-09-20 8:08 ` [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Luis Machado
2022-11-26 1:44 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 5/8] gdbserver: Move target description from being per-process to being per-thread Thiago Jung Bauermann
2022-09-20 11:21 ` Luis Machado
2022-11-26 1:47 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 6/8] gdbserver/linux-aarch64: When inferior stops, update its target description Thiago Jung Bauermann
2022-09-20 8:48 ` Luis Machado
2022-11-26 1:49 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 7/8] gdb/aarch64: Factor out most of the thread_architecture method Thiago Jung Bauermann
2022-09-20 8:52 ` Luis Machado
2022-11-26 1:49 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 8/8] gdb/aarch64: When remote debugging detect changes in the target description Thiago Jung Bauermann
2022-09-20 8:59 ` Luis Machado
2022-11-26 1:50 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220908064151.3959930-5-thiago.bauermann@linaro.org \
--to=thiago.bauermann@linaro.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).