From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9BBBC43381 for ; Thu, 28 Feb 2019 19:39:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE68E218B0 for ; Thu, 28 Feb 2019 19:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387817AbfB1Tjf (ORCPT ); Thu, 28 Feb 2019 14:39:35 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:34904 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729936AbfB1Tje (ORCPT ); Thu, 28 Feb 2019 14:39:34 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 9835D72CA65; Thu, 28 Feb 2019 22:39:31 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 8F8B37CC74D; Thu, 28 Feb 2019 22:39:31 +0300 (MSK) Date: Thu, 28 Feb 2019 22:39:31 +0300 From: "Dmitry V. Levin" To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org Cc: Elvira Khabirova , Eugene Syromyatnikov , Benjamin Herrenschmidt , Paul Mackerras , Oleg Nesterov , Andy Lutomirski , linux-kernel@vger.kernel.org Subject: [PATCH v7 16/22] powerpc: define syscall_get_error() Message-ID: <20190228193930.GB13217@altlinux.org> References: <20190107025101.GA1182@altlinux.org> <20190107025417.GP1207@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190107025417.GP1207@altlinux.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syscall_get_error() is required to be implemented on this architecture in addition to already implemented syscall_get_nr(), syscall_get_arguments(), syscall_get_return_value(), and syscall_get_arch() functions in order to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Oleg Nesterov Cc: Andy Lutomirski Cc: Elvira Khabirova Cc: Eugene Syromyatnikov Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Dmitry V. Levin --- This is just a gentle ping, the patch is unchanged. Notes: v7: unchanged v6: unchanged v5: This change has been tested with tools/testing/selftests/ptrace/get_syscall_info.c and strace, so it's correct from PTRACE_GET_SYSCALL_INFO point of view. This cast doubts on commit v4.3-rc1~86^2~81 that changed syscall_set_return_value() in a way that doesn't quite match syscall_get_error(), but syscall_set_return_value() is out of scope of this series, so I'll just let you know my concerns. arch/powerpc/include/asm/syscall.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index 1a0e7a8b1c81..b522781ad7c0 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -38,6 +38,16 @@ static inline void syscall_rollback(struct task_struct *task, regs->gpr[3] = regs->orig_gpr3; } +static inline long syscall_get_error(struct task_struct *task, + struct pt_regs *regs) +{ + /* + * If the system call failed, + * regs->gpr[3] contains a positive ERRORCODE. + */ + return (regs->ccr & 0x10000000UL) ? -regs->gpr[3] : 0; +} + static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { -- ldv