From patchwork Thu Feb 15 13:54:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 201496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp430583dyb; Thu, 15 Feb 2024 06:19:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXeqTg4Acw11h31ElzxVvtqGzMwAoO7z73lXhPbcWEBY8sAQHIA65H0GX5+wGoahxG9kxzMOS6qW9LZE0DurXoIieJGbA== X-Google-Smtp-Source: AGHT+IHObS2pHiqHQXuV8YHdnbHUbBQy5CfT2uSRgr52oUUfMziEWGsHZnVssHjrOvUVTzR2SFxP X-Received: by 2002:a17:903:41c5:b0:1d9:d444:313 with SMTP id u5-20020a17090341c500b001d9d4440313mr2074231ple.43.1708006767772; Thu, 15 Feb 2024 06:19:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708006767; cv=pass; d=google.com; s=arc-20160816; b=h9OcYAUy+UZUjEnL8zyasi0g2hZ2h9emOWzlarWydGDjEhqM+3GccGr7ixV72rENJd pYitXxe6KwKmiKsm72q4h3eIsSynahHvHMi0yzoA6SlC0Omh1Zip0tN2TO3e3OslZSoB kaz0zQQ85uur00B+dHQjTLYjS+kTy++FDJYSJczz2dx99T2fec+Ev6sGLaFfZdaQmfJ4 O6PwBHTuo8evCiU8Iy3ZAbXqe4RU8tzt2yudNPXpo9bBLRCQJbUAw6xAIiIiFtZvz4QK 5S5DM/SOBzNCGZ9uJ1fwW2OY9Oyi9vKb2E3FSYT0fifG4HoGvRpNwTEkrr1Iyu5FV7Jc T2uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=QdW2zAZOXZJx9OVgQJRX7RanDMp4FAD+bdgCbt1KIkM=; fh=4TgEE5rEJN/hMel8PgR7ADidRIXBg0Y0qDiWpKivi8Y=; b=nGZNzQiZSoYmDMxBJnSxh8K87uiMrO8my2ry7SyGIEcE3qZtIvd19mNElPSYSUhcsh XLUZffDcZTldH6JA+/cYsb4WxE53llI28lsHH8f/cTL+mDvg8S0ZWyYHSl5ya0BsgIqf q4YUJddLN/gahJvZoFNzHiAaqxrDXQjAWSsoZZT+l4J7SOVpRk5qg3iz6bu/Nj3ZM7nl Wx2sa6eA5K/VMhsZx7XrKyO1S5C5MHA7zj33EzqDWfRSJvvk8zcrxWk7mhgwZe3jUEj7 EEet1I6vDRX9zlB1eJsmhxSYbidl5tBiEzUeSzbvUimjA0R/NNqDMPNRi7kZiTEycwfc 7VWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67029-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w3-20020a1709027b8300b001d95ef48eddsi1144474pll.312.2024.02.15.06.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:19:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67029-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 43F1E290DE5 for ; Thu, 15 Feb 2024 13:56:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05ED0131E46; Thu, 15 Feb 2024 13:54:59 +0000 (UTC) Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289DE13175A for ; Thu, 15 Feb 2024 13:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708005297; cv=none; b=e1D3kft4CEKFKSjbXQdRLCBaQHLWb4Gt5y9NNu3Qhw1fFHOZItOAFuCWIJCyUYi4Ld5hGFA+vtZMga/wF05HXFJMikoHQHIde3uhUSfpXZ1DgQus7mkYdptEcHVifS/ISgJXckn9etmjebP5ZUyenPohY9oVT8UrDeXG4QtvWyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708005297; c=relaxed/simple; bh=kjVeQ0gnpy2r4nY0LxRCwKtkhl3CJTCOJ3DRKNTKLYw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Rqv3PCpasAw4lYTYLJvY2g+zx3p3aNvm2A8T5wEuKwEPWhXj8YIV7vJCBb5WTJnhNtBDnAdkvXXT7NtwE/vF6AoRCrPE+cIu2SnOR58V3ttW1yJJDPDMByxZjbuDyLkmq+xa2JqPb2Xb3Tnhg3Pr+7lvV3THXiKm8ELkf4I8G5Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:ac52:3a54:2a84:d65a]) by andre.telenet-ops.be with bizsmtp id nRus2B00J0LVNSS01Rusre; Thu, 15 Feb 2024 14:54:53 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1racCL-000hBv-8e; Thu, 15 Feb 2024 14:54:52 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1racCS-00Hacm-JG; Thu, 15 Feb 2024 14:54:52 +0100 From: Geert Uytterhoeven To: Oleg Nesterov , Russell King , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] ARM: ptrace: Use bitfield helpers Date: Thu, 15 Feb 2024 14:54:48 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790974904751820008 X-GMAIL-MSGID: 1790974904751820008 The isa_mode() macro extracts two fields, and recombines them into a single value. Make this more obvious by using the FIELD_GET() helper, and shifting the result into its final resting place. Signed-off-by: Geert Uytterhoeven Reviewed-by: Oleg Nesterov --- No changes in generated assembler code. v2: - Drop irrelevant comment about non-existing off-by-one error, - Remove unnecessary parens. --- arch/arm/include/asm/ptrace.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 7f44e88d1f25bcc5..14a38cc67e0bc966 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h @@ -10,6 +10,7 @@ #include #ifndef __ASSEMBLY__ +#include #include struct pt_regs { @@ -35,8 +36,8 @@ struct svc_pt_regs { #ifndef CONFIG_CPU_V7M #define isa_mode(regs) \ - ((((regs)->ARM_cpsr & PSR_J_BIT) >> (__ffs(PSR_J_BIT) - 1)) | \ - (((regs)->ARM_cpsr & PSR_T_BIT) >> (__ffs(PSR_T_BIT)))) + (FIELD_GET(PSR_J_BIT, (regs)->ARM_cpsr) << 1 | \ + FIELD_GET(PSR_T_BIT, (regs)->ARM_cpsr)) #else #define isa_mode(regs) 1 /* Thumb */ #endif