From patchwork Wed May 25 05:27:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9134737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42E12607D3 for ; Wed, 25 May 2016 05:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 382DA28166 for ; Wed, 25 May 2016 05:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D232282AF; Wed, 25 May 2016 05:33:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1BB028166 for ; Wed, 25 May 2016 05:33:34 +0000 (UTC) Received: from localhost ([::1]:57394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5RRl-0003M8-OZ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 May 2016 01:33:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5RN4-00087y-1d for qemu-devel@nongnu.org; Wed, 25 May 2016 01:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5RMx-0001QF-IQ for qemu-devel@nongnu.org; Wed, 25 May 2016 01:28:41 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5RMw-0001PV-NH for qemu-devel@nongnu.org; Wed, 25 May 2016 01:28:35 -0400 Received: by mail-lf0-x234.google.com with SMTP id k98so13737505lfi.1 for ; Tue, 24 May 2016 22:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mWv5kaO25SSfVlhG4G7czCYgDJ7nJg09wORBRWdOb0I=; b=MB0Wv9kQVxmzIfnAreVLfuWNNQnRih2rJMQmrvlqjVD2vG+phln4DQj4ocs8SiW1t8 /xJA/szwPPiGKBNWTpqS3xGoXDcwpIbqcH/+iRcqX4XWe9Qv3eBE+VEV0UhY+1L3dl3b Oqb+/ey8uYewNEMRf2jXaSmRfAR9XkCFOabHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mWv5kaO25SSfVlhG4G7czCYgDJ7nJg09wORBRWdOb0I=; b=E/IFogVCBJfuJw0j4X5L1QNIHbpAcu91kWpp1FmfjmOKVPRrJ5Wn5x12VbTtvSCfwS Ug+Xtyfs1F4cN8a3NBcEGYS1z8rWMuLmvwlYPoECeBn69VxLXMOR1croPbOoWH6CqOHH HaRH0rxULb5WfnXKO8RLQOf+OFXoIHHSMU87DjHOpKz+B25ruRZoze3bUKmhbwGeoNSF FjrxpYz5Y7ydj6L9/Zrjb9eHq243Q9P2B+zKqCeQafu9bkQKjrJxLUF5v4kFlv1UXyr9 iUWaMU06YFSlhBoErHz7/Cm9cV8gQZFDtygOIgKAvw0sSA/ZUxDSOv91z7WBL7l6V/C3 XhYQ== X-Gm-Message-State: ALyK8tIlvoUHV+vwhMhxNWsRaKMnWGOpBDscOMYq9AdjeqjDH3yblNB5XgQCQP0ESzWlNFm/ X-Received: by 10.25.19.161 with SMTP id 33mr327093lft.24.1464154113877; Tue, 24 May 2016 22:28:33 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id g10sm1136823lbc.43.2016.05.24.22.28.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 May 2016 22:28:32 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 25 May 2016 08:27:41 +0300 Message-Id: <2f0caea1c5321b9bc1ca488154e7046604db8814.1464153942.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 Subject: [Qemu-devel] [PULL 05/38] linux-user: Renumber TARGET_QEMU_ESIGRETURN, make it not arch-specific X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Timothy E Baldwin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Timothy E Baldwin Currently we define a QEMU-internal errno TARGET_QEMU_ESIGRETURN only on the MIPS and PPC targets; move this to errno_defs.h so it is available for all architectures, and renumber it to 513. We pick 513 because this is safe from future use as a system call return value: Linux uses it as ERESTART_NOINTR internally and never allows that errno to escape to userspace. Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-4-git-send-email-T.E.Baldwin99@members.leeds.ac.uk [PMM: TARGET_ERESTARTSYS split out into preceding patch, add comment] Reviewed-by: Peter Maydell Reviewed-by: Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/errno_defs.h | 9 +++++++++ linux-user/mips/target_syscall.h | 4 ---- linux-user/mips64/target_syscall.h | 4 ---- linux-user/ppc/target_syscall.h | 2 -- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/linux-user/errno_defs.h b/linux-user/errno_defs.h index b7a8c9f..65522c4 100644 --- a/linux-user/errno_defs.h +++ b/linux-user/errno_defs.h @@ -147,3 +147,12 @@ * kernel uses for the same purpose. */ #define TARGET_ERESTARTSYS 512 /* Restart system call (if SA_RESTART) */ + +/* QEMU internal, not visible to the guest. This is returned by the + * do_sigreturn() code after a successful sigreturn syscall, to indicate + * that it has correctly set the guest registers and so the main loop + * should not touch them. We use the value the guest would use for + * ERESTART_NOINTR (which is kernel internal) to guarantee that we won't + * clash with a valid guest errno now or in the future. + */ +#define TARGET_QEMU_ESIGRETURN 513 /* Return from signal */ diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_syscall.h index 68db160..e8e305c 100644 --- a/linux-user/mips/target_syscall.h +++ b/linux-user/mips/target_syscall.h @@ -222,10 +222,6 @@ struct target_pt_regs { #define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */ - -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 - #define UNAME_MACHINE "mips" #define UNAME_MINIMUM_RELEASE "2.6.32" diff --git a/linux-user/mips64/target_syscall.h b/linux-user/mips64/target_syscall.h index 0e0c2d2..5789e86 100644 --- a/linux-user/mips64/target_syscall.h +++ b/linux-user/mips64/target_syscall.h @@ -219,10 +219,6 @@ struct target_pt_regs { #define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */ - -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 - #define UNAME_MACHINE "mips64" #define UNAME_MINIMUM_RELEASE "2.6.32" diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h index 35cab59..7ca83c2 100644 --- a/linux-user/ppc/target_syscall.h +++ b/linux-user/ppc/target_syscall.h @@ -53,8 +53,6 @@ struct target_revectored_struct { abi_ulong __map[8]; /* 256 bits */ }; -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 /* * flags masks