From patchwork Fri May 27 12:59:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9138329 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 893396075C for ; Fri, 27 May 2016 13:12:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76D5C2094F for ; Fri, 27 May 2016 13:12:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6811C27CB1; Fri, 27 May 2016 13:12:50 +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 2E9832094F for ; Fri, 27 May 2016 13:12:49 +0000 (UTC) Received: from localhost ([::1]:45746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HZH-0001ru-NS for patchwork-qemu-devel@patchwork.kernel.org; Fri, 27 May 2016 09:12:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNh-0007JR-JT for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6HNc-000196-8P for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:48 -0400 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:36617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNc-00018g-0j for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:44 -0400 Received: by mail-lf0-x230.google.com with SMTP id b73so23102181lfb.3 for ; Fri, 27 May 2016 06:00:43 -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=Hfr34aWMX2G8+j8rrVOs1fXAhhNLhOcYBsO+C0ed3RCk6t0U8wD6ONDVHwgFDtkIel wDkEtBoYNCSNaQjvVrVavaKT3cex4MS/4bu+S44CvQYyeVIJQKuDCU/f2ak6ySfaAYrG 0H6bPrGNpy/kFXfy+QA8zZ0twjlwyeuFyQNdg= 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=h84goOHYbOLBRLL6hE/BQrjjLqQJ15KHv4Pnldtn2wHLqJfJAdIU/6lFGXxt2VTHwV qh5frmwWYOnFrirzC3efMA2rK3mF6xtlKsMiQJ/1K9Ft9rOwfX/YC8IJmaJ7DIyM+gXQ pPYTB3xeffS+SHzLWtLturvQDysMfCkm3qBxcMC7yn3kC7ogWm+IUeEFZvKqToomPLOl 1sPaY6b5m5B8HtxT6l0EnDNPrJDYjpMIyXBXEkymoKZuefC28z8f+EjJJ0NRO4bxMVGZ gMdB632c5sqljXZPYOi//n3+1z1fJ1NGCuA+9008MwPGrIZP4YDfEjhDqluQ+verLeA2 m+jQ== X-Gm-Message-State: ALyK8tL5jIuFExZxs2tMmmrMtbJqp7CVAb732loVj/vmbIQlZnkobxchDdExl7xCUTn0mf0y X-Received: by 10.25.214.135 with SMTP id p7mr4246666lfi.92.1464354038849; Fri, 27 May 2016 06:00:38 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id n16sm2281066lfg.31.2016.05.27.06.00.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:00:38 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 May 2016 15:59:56 +0300 Message-Id: <499b5d176a77773cab5479264a3d5067176df21c.1464353863.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::230 Subject: [Qemu-devel] [PULL v2 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