From patchwork Wed Mar 3 15:55:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1446944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=fwB6qH2T; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DrV254866z9rx6 for ; Thu, 4 Mar 2021 10:04:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3uvzFDKCC5PK9SsLlfpik5ggbEQ4C3AQqjOCe61NzZw=; b=fwB6qH2TMipuiBwSQUO429ocC CUL89vefl56QUbZtQX3DhQ78cwxvvrgMDM3KCzNB0zKHMwi+cQ5B+nkpeiXNehyGOLKHyGtp4/GbF mYV3ZUZc1/iQJveuBRgyol+XO0cyU1dais0gpO6Q/9drDzTpkCZWBks0sk7k+bMvIyVT3RN50LtCi hKtaqSTzLm556Yv4HgQLvnpJb9rlBaaoffmFxd7To31GXjR6Nw3pFQi3kbNilp1WRpirptlvCMaRU MgTrjYvrxYw6NvLFfa999KTsDuWr3/CyoVlsCYUgqklFJumXQU/5zttItW5GKSfG3YJ/ove5L/4oi tcBpr8zLg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHaXV-006raa-FN; Wed, 03 Mar 2021 23:04:21 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHTvu-005VSr-8h for linux-um@lists.infradead.org; Wed, 03 Mar 2021 16:01:08 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lHTqy-00BFLI-Ar; Wed, 03 Mar 2021 16:56:00 +0100 From: Benjamin Berg To: linux-um@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 15/27] um: Add generic stub_syscall6 function Date: Wed, 3 Mar 2021 16:55:11 +0100 Message-Id: <20210303155523.124277-16-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210303155523.124277-1-benjamin@sipsolutions.net> References: <20210303155523.124277-1-benjamin@sipsolutions.net> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This function will be used by the new syscall handling code. Signed-off-by: Benjamin Berg --- arch/x86/um/shared/sysdep/stub_32.h | 22 ++++++++++++++++++++++ arch/x86/um/shared/sysdep/stub_64.h | 16 ++++++++++++++++ 2 files changed, [...] Content analysis details: (0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This function will be used by the new syscall handling code. Signed-off-by: Benjamin Berg --- arch/x86/um/shared/sysdep/stub_32.h | 22 ++++++++++++++++++++++ arch/x86/um/shared/sysdep/stub_64.h | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arch/x86/um/shared/sysdep/stub_32.h b/arch/x86/um/shared/sysdep/stub_32.h index d7284dd4a850..3fb8559fe994 100644 --- a/arch/x86/um/shared/sysdep/stub_32.h +++ b/arch/x86/um/shared/sysdep/stub_32.h @@ -79,6 +79,28 @@ static __always_inline long stub_syscall5(long syscall, long arg1, long arg2, return ret; } +static __always_inline long stub_syscall6(long syscall, long arg1, long arg2, + long arg3, long arg4, long arg5, + long arg6) +{ + struct syscall_args { + int ebx, ebp; + } args = { arg1, arg6 }; + long ret; + + __asm__ volatile ("pushl %%ebp;" + "movl 0x4(%%ebx),%%ebp;" + "movl (%%ebx),%%ebx;" + "int $0x80;" + "popl %%ebp" + : "=a" (ret) + : "0" (syscall), "b" (&args), + "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) + : "memory"); + + return ret; +} + static __always_inline void trap_myself(void) { __asm("int3"); diff --git a/arch/x86/um/shared/sysdep/stub_64.h b/arch/x86/um/shared/sysdep/stub_64.h index 871c770fc44b..c41ae0462c8f 100644 --- a/arch/x86/um/shared/sysdep/stub_64.h +++ b/arch/x86/um/shared/sysdep/stub_64.h @@ -78,6 +78,22 @@ static __always_inline long stub_syscall5(long syscall, long arg1, long arg2, return ret; } +static __always_inline long stub_syscall6(long syscall, long arg1, long arg2, + long arg3, long arg4, long arg5, + long arg6) +{ + long ret; + + __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " + __syscall + : "=a" (ret) + : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3), + "g" (arg4), "g" (arg5), "g" (arg6) + : __syscall_clobber, "r10", "r8", "r9"); + + return ret; +} + static __always_inline void trap_myself(void) { __asm("int3");