From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbbGOHjD (ORCPT ); Wed, 15 Jul 2015 03:39:03 -0400 Received: from ozlabs.org ([103.22.144.67]:35723 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbbGOHh0 (ORCPT ); Wed, 15 Jul 2015 03:37:26 -0400 From: Michael Ellerman To: Cc: , keescook@chromium.org, luto@amacapital.net, wad@chromium.org, strosake@linux.vnet.ibm.com, bogdan.purcareata@freescale.com Subject: [RFC PATCH 06/12] powerpc: Rework syscall_get_arguments() so there is only one loop Date: Wed, 15 Jul 2015 17:37:08 +1000 Message-Id: <1436945834-26660-6-git-send-email-mpe@ellerman.id.au> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436945834-26660-1-git-send-email-mpe@ellerman.id.au> References: <1436945834-26660-1-git-send-email-mpe@ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently syscall_get_arguments() has two loops, one for compat and one for regular tasks. In prepartion for the next patch, which changes which registers we use, switch it to only have one loop, so we only have one place to update. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/syscall.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index cabe90133e69..403e2303fe18 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -64,19 +64,16 @@ static inline void syscall_get_arguments(struct task_struct *task, unsigned int i, unsigned int n, unsigned long *args) { + unsigned long mask = -1UL; + BUG_ON(i + n > 6); -#ifdef CONFIG_PPC64 - if (test_tsk_thread_flag(task, TIF_32BIT)) { - /* - * Zero-extend 32-bit argument values. The high bits are - * garbage ignored by the actual syscall dispatch. - */ - while (n-- > 0) - args[n] = (u32) regs->gpr[3 + i + n]; - return; - } + +#ifdef CONFIG_COMPAT + if (test_tsk_thread_flag(task, TIF_32BIT)) + mask = 0xffffffff; #endif - memcpy(args, ®s->gpr[3 + i], n * sizeof(args[0])); + while (n--) + args[n] = regs->gpr[3 + i + n] & mask; } static inline void syscall_set_arguments(struct task_struct *task, -- 2.1.0