From patchwork Mon Jan 30 04:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 63901 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 146323858024 for ; Mon, 30 Jan 2023 04:46:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 146323858024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675053995; bh=w9kXP2cLk5NPU9hKtelhqMdBZZQ/tAa4sSU+CQJPUWE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=lNQwxERpUHqgtaNgsIA4IEhg7pckdorioQ5luUGDzekamMkBZJxQaev3Ea49y1/wb czYZ6fkGWsQvGQVz8sdyRRgoPrRyGckd29Gqo8cXgASKVBdPP8Bx2C7IZi5IfpvjjK Rus7/tqHGMTRZX13x7NQ70M8VA8yQeArWG0Bg1VU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 36A943858436 for ; Mon, 30 Jan 2023 04:45:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36A943858436 Received: by mail-ot1-x335.google.com with SMTP id a1-20020a056830008100b006864df3b1f8so4228197oto.3 for ; Sun, 29 Jan 2023 20:45:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=w9kXP2cLk5NPU9hKtelhqMdBZZQ/tAa4sSU+CQJPUWE=; b=Acj1Uq1bTJtCzzxffZfFj7dFZLZoLvKSoeJ+X6Cvp8Tu2n/4CvYaKmqNSkWh9CXEEz SEcyVKxEEeqIXNjq37biBbdSq86jo0E4oGus4qyx4MV1VLfg6K2iDXahRolnYFtwV33u bCsitkxjCMCPNgy2EKUqDMKzBpjeG8UyKjSkoYzQwbzcC2MPSdg37ve1OuQOIhkAwHF5 tdu/7+2Pip/E+c8yBOGUmoN6Vt4Lg7gV61kyGmY9/joNhHiOGpmqnOybTCgoiVIAl2cI FbR1hVnZUM19Bq9hQZKWUIzICE6LmfV/Meg4dR3qxYEQKfEt2I4wC0DYY6SQWVeaHNYW mANw== X-Gm-Message-State: AO0yUKW7gYnBY36leYSP+BvSIoUJjXEmi3g6QvzjBOrtfeXnsC2WS+2A X/v7FN9CkrpUPZPiB0J6zDJyVCFVBcrtXfMk X-Google-Smtp-Source: AK7set9kuPxWHddkoJvp2ezrq9RaurZi/hMgwbuROGMW0zqygI43rBv1jMwoy8OthTFpez3MgM4Wng== X-Received: by 2002:a9d:6546:0:b0:68b:cc93:28b with SMTP id q6-20020a9d6546000000b0068bcc93028bmr1647254otl.29.1675053945598; Sun, 29 Jan 2023 20:45:45 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:df99:10bd:7dca:b2e9]) by smtp.gmail.com with ESMTPSA id v2-20020a0568301bc200b0068bbc9e7cc9sm2510067ota.53.2023.01.29.20.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Jan 2023 20:45:45 -0800 (PST) To: gdb-patches@sourceware.org Cc: Thiago Jung Bauermann , Luis Machado , Simon Marchi Subject: [PATCH v3 3/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Date: Mon, 30 Jan 2023 04:45:13 +0000 Message-Id: <20230130044518.3322695-4-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230130044518.3322695-1-thiago.bauermann@linaro.org> References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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-Patchwork-Original-From: Thiago Jung Bauermann via Gdb-patches From: Thiago Jung Bauermann Reply-To: Thiago Jung Bauermann Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" It will be used in a subsequent commit. There's no functional change. Reviewed-by: Luis Machado Approved-By: Simon Marchi --- gdbserver/linux-aarch64-low.cc | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 2ed6e95562c5..92c621e5548c 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -675,6 +675,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) + +/* Obtain the architectural features available in the given THREAD. */ + +static struct aarch64_features +aarch64_get_arch_features (const thread_info *thread) +{ + struct aarch64_features features; + int pid = thread->id.pid (); + int tid = thread->id.lwp (); + + features.vq = aarch64_sve_get_vq (tid); + /* A-profile PAC is 64-bit only. */ + features.pauth = linux_get_hwcap (pid, 8) & AARCH64_HWCAP_PACA; + /* A-profile MTE is 64-bit only. */ + features.mte = linux_get_hwcap2 (pid, 8) & HWCAP2_MTE; + features.tls = aarch64_tls_register_count (tid); + + return features; +} + void aarch64_target::low_new_thread (lwp_info *lwp) { @@ -827,9 +849,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 @@ -845,15 +864,8 @@ aarch64_target::low_arch_setup () if (is_elf64) { - struct aarch64_features features; - int pid = current_thread->id.pid (); - - features.vq = aarch64_sve_get_vq (tid); - /* A-profile PAC is 64-bit only. */ - features.pauth = linux_get_hwcap (pid, 8) & AARCH64_HWCAP_PACA; - /* A-profile MTE is 64-bit only. */ - features.mte = linux_get_hwcap2 (pid, 8) & HWCAP2_MTE; - features.tls = aarch64_tls_register_count (tid); + struct aarch64_features features + = aarch64_get_arch_features (current_thread); current_process ()->tdesc = aarch64_linux_read_description (features);