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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF84BC433EF for ; Wed, 17 Nov 2021 17:23:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3FCC061BFB for ; Wed, 17 Nov 2021 17:23:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3FCC061BFB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnOeY-0005n2-WC for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 12:23:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnOdF-0003oq-Re for qemu-devel@nongnu.org; Wed, 17 Nov 2021 12:22:03 -0500 Received: from [2607:f8b0:4864:20::92a] (port=41542 helo=mail-ua1-x92a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnOdC-0007BK-GY for qemu-devel@nongnu.org; Wed, 17 Nov 2021 12:22:00 -0500 Received: by mail-ua1-x92a.google.com with SMTP id p37so7502413uae.8 for ; Wed, 17 Nov 2021 09:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k1ZFxCEQB2AcA/tIvHdh+M4Bo+shzCF6XY4aE+mD34Y=; b=h/A/VrJydCv4fxdncRRSU8EwGFQVU5KQknm8eiO39bpGaAN8rMAP/gm4sp9boKRcSd MDp/pFzJKTbgrKxzlxcfimL8yDHo9I+bni+mk6/uYOga7kFJvgxpNurluUvwh/pgT58X tM34fsTl9x14+VNGBSfaeTwd9xSPb2a96A1KvE7jjniX3cR7li7F+TRTEtfhTKqVg4mB Sm2ROqli+ZoWXXbZfdEepHaqSmpRecBcLb0usQiacjSmOAlP20D5mdXJLcVF8K1644Wi v7Tq3t5YFBW9OB7oAcLn0tf0x3VxT446zPAzzF+QPUGfdIcfaOO2XLnDh1lWhvSHrHXR 123Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k1ZFxCEQB2AcA/tIvHdh+M4Bo+shzCF6XY4aE+mD34Y=; b=6NQh9UAm8+sTBJsOXaQi5PkfUIOwdC+aDgHD5qvi/ObqSQAvsI+N4kg/FBYJo1F0Sp sZ/ZHEQymHtSpcAQyVBDDyxS/rvt4eXFLc3AjyuSTG9UmD+uQSXp2L8pkpEDbuq0Mq4U F6J7OrvblJH9ctAyVTziQINwOta7nTx0FFHl1h66x+d481Wdc+ovKxZj2M5Xilq7fHwF 9ueoPCI958LS6dsyipN/ygitQj+qxeNTck313nquqn7tmcO8HEKFtEb0BQLsVOdoGisG yEYoUqmKqh+KxbkeZ1WosXJYVcAQQDEIOEN48sqUCBX5+A8PxEUIk2fzwZotHeVqsNs5 UFFQ== X-Gm-Message-State: AOAM5305LFpAXBK1XJjSQIZNAcwT+8tSWKZKBzl+HJP0PJzPI7ene770 hUCWU+PS7FtU7jG/BULUIQNsykiKV4oy5TAde16bAw== X-Google-Smtp-Source: ABdhPJxihlPWToXRTw1d3lonvztDe+3gAb0f1LhFTDYxd2BSprrWEHd6JRh0+oPfrYfLMIGRxuLLNX/z2nlH1mbaQBA= X-Received: by 2002:a67:e050:: with SMTP id n16mr70380758vsl.44.1637169717524; Wed, 17 Nov 2021 09:21:57 -0800 (PST) MIME-Version: 1.0 References: <20211117160412.71563-1-richard.henderson@linaro.org> <20211117160412.71563-13-richard.henderson@linaro.org> In-Reply-To: <20211117160412.71563-13-richard.henderson@linaro.org> From: Warner Losh Date: Wed, 17 Nov 2021 10:21:47 -0700 Message-ID: Subject: Re: [PATCH v5 12/17] linux-user: Create special-errno.h To: Richard Henderson Content-Type: multipart/alternative; boundary="0000000000007350d305d0ff4745" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::92a (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::92a; envelope-from=wlosh@bsdimp.com; helo=mail-ua1-x92a.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Developers , Laurent Vivier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000007350d305d0ff4745 Content-Type: text/plain; charset="UTF-8" On Wed, Nov 17, 2021 at 9:04 AM Richard Henderson < richard.henderson@linaro.org> wrote: > Pull the two internal errno used by qemu internally into their own > header file. This includes the one define required by safe-syscall.S. > > Signed-off-by: Richard Henderson > --- > linux-user/cpu_loop-common.h | 1 + > linux-user/generic/target_errno_defs.h | 17 -------------- > linux-user/signal-common.h | 2 ++ > linux-user/special-errno.h | 32 ++++++++++++++++++++++++++ > linux-user/syscall.c | 1 + > linux-user/safe-syscall.S | 2 +- > 6 files changed, 37 insertions(+), 18 deletions(-) > create mode 100644 linux-user/special-errno.h > Reviewed-by: Warner Losh > diff --git a/linux-user/cpu_loop-common.h b/linux-user/cpu_loop-common.h > index 8828af28a4..dc0042e4de 100644 > --- a/linux-user/cpu_loop-common.h > +++ b/linux-user/cpu_loop-common.h > @@ -21,6 +21,7 @@ > #define CPU_LOOP_COMMON_H > > #include "exec/log.h" > +#include "special-errno.h" > > #define EXCP_DUMP(env, fmt, ...) \ > do { \ > diff --git a/linux-user/generic/target_errno_defs.h > b/linux-user/generic/target_errno_defs.h > index bb37d88be9..c2f9d403e7 100644 > --- a/linux-user/generic/target_errno_defs.h > +++ b/linux-user/generic/target_errno_defs.h > @@ -147,21 +147,4 @@ > #define TARGET_ERFKILL 132 /* Operation not possible due to > RF-kill */ > #define TARGET_EHWPOISON 133 /* Memory page has hardware error > */ > > -/* QEMU internal, not visible to the guest. This is returned when a > - * system call should be restarted, to tell the main loop that it > - * should wind the guest PC backwards so it will re-execute the syscall > - * after handling any pending signals. They match with the ones the guest > - * kernel uses for the same purpose. > - */ > -#define QEMU_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 QEMU_ESIGRETURN 513 /* Return from signal */ > - > #endif > diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h > index b9f33bb44f..42aa479080 100644 > --- a/linux-user/signal-common.h > +++ b/linux-user/signal-common.h > @@ -20,6 +20,8 @@ > #ifndef SIGNAL_COMMON_H > #define SIGNAL_COMMON_H > > +#include "special-errno.h" > + > /* Fallback addresses into sigtramp page. */ > extern abi_ulong default_sigreturn; > extern abi_ulong default_rt_sigreturn; > diff --git a/linux-user/special-errno.h b/linux-user/special-errno.h > new file mode 100644 > index 0000000000..4120455baa > --- /dev/null > +++ b/linux-user/special-errno.h > @@ -0,0 +1,32 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * QEMU internal errno values for implementing user-only POSIX. > + * > + * Copyright (c) 2003 Fabrice Bellard > + * Copyright (c) 2021 Linaro, Ltd. > + */ > + > +#ifndef SPECIAL_ERRNO_H > +#define SPECIAL_ERRNO_H > + > +/* > + * All of these are QEMU internal, not visible to the guest. > + * They should be chosen so as to not overlap with any host > + * or guest errno. > + */ > + > +/* > + * This is returned when a system call should be restarted, to tell the > + * main loop that it should wind the guest PC backwards so it will > + * re-execute the syscall after handling any pending signals. > + */ > +#define QEMU_ERESTARTSYS 512 > + > +/* > + * This is returned after a successful sigreturn syscall, to indicate > + * that it has correctly set the guest registers and so the main loop > + * should not touch them. > + */ > +#define QEMU_ESIGRETURN 513 > + > +#endif /* SPECIAL_ERRNO_H */ > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 1ef6abb776..33d342157d 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -136,6 +136,7 @@ > #include "qemu/guest-random.h" > #include "qemu/selfmap.h" > #include "user/syscall-trace.h" > +#include "special-errno.h" > #include "qapi/error.h" > #include "fd-trans.h" > #include "tcg/tcg.h" > diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S > index 7ddc997801..74f7e35694 100644 > --- a/linux-user/safe-syscall.S > +++ b/linux-user/safe-syscall.S > @@ -10,7 +10,7 @@ > * See the COPYING file in the top-level directory. > */ > > -#include "target_errno_defs.h" > +#include "special-errno.h" > > /* We have the correct host directory on our include path > * so that this will pull in the right fragment for the architecture. > -- > 2.25.1 > > --0000000000007350d305d0ff4745 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Nov 17, 2021 at 9:04 AM Richa= rd Henderson <richard.he= nderson@linaro.org> wrote:
Pull the two internal errno used by qemu internally into = their own
header file.=C2=A0 This includes the one define required by safe-syscall.S.=

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
=C2=A0linux-user/cpu_loop-common.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 1 +
=C2=A0linux-user/generic/target_errno_defs.h | 17 --------------
=C2=A0linux-user/signal-common.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 2 ++
=C2=A0linux-user/special-errno.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0| 32 ++++++++++++++++++++++++++
=C2=A0linux-user/syscall.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0|=C2=A0 1 +
=C2=A0linux-user/safe-syscall.S=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |=C2=A0 2 +-
=C2=A06 files changed, 37 insertions(+), 18 deletions(-)
=C2=A0create mode 100644 linux-user/special-errno.h
Reviewed-by: Warner Losh <imp@bsdimp.com>
=C2=A0
diff --git a/linux-user/cpu_loop-common.h b/linux-user/cpu_loop-common.h index 8828af28a4..dc0042e4de 100644
--- a/linux-user/cpu_loop-common.h
+++ b/linux-user/cpu_loop-common.h
@@ -21,6 +21,7 @@
=C2=A0#define CPU_LOOP_COMMON_H

=C2=A0#include "exec/log.h"
+#include "special-errno.h"

=C2=A0#define EXCP_DUMP(env, fmt, ...)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \
=C2=A0do {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \
diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/ta= rget_errno_defs.h
index bb37d88be9..c2f9d403e7 100644
--- a/linux-user/generic/target_errno_defs.h
+++ b/linux-user/generic/target_errno_defs.h
@@ -147,21 +147,4 @@
=C2=A0#define TARGET_ERFKILL=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0132=C2=A0 =C2= =A0 =C2=A0/* Operation not possible due to RF-kill */
=C2=A0#define TARGET_EHWPOISON=C2=A0 =C2=A0 =C2=A0 =C2=A0133=C2=A0 =C2=A0 = =C2=A0/* Memory page has hardware error */

-/* QEMU internal, not visible to the guest. This is returned when a
- * system call should be restarted, to tell the main loop that it
- * should wind the guest PC backwards so it will re-execute the syscall - * after handling any pending signals. They match with the ones the guest<= br> - * kernel uses for the same purpose.
- */
-#define QEMU_ERESTARTSYS=C2=A0 =C2=A0 =C2=A0512=C2=A0 =C2=A0 =C2=A0/* Rest= art 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 QEMU_ESIGRETURN 513=C2=A0 =C2=A0 =C2=A0/* Return from signal */ -
=C2=A0#endif
diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h
index b9f33bb44f..42aa479080 100644
--- a/linux-user/signal-common.h
+++ b/linux-user/signal-common.h
@@ -20,6 +20,8 @@
=C2=A0#ifndef SIGNAL_COMMON_H
=C2=A0#define SIGNAL_COMMON_H

+#include "special-errno.h"
+
=C2=A0/* Fallback addresses into sigtramp page. */
=C2=A0extern abi_ulong default_sigreturn;
=C2=A0extern abi_ulong default_rt_sigreturn;
diff --git a/linux-user/special-errno.h b/linux-user/special-errno.h
new file mode 100644
index 0000000000..4120455baa
--- /dev/null
+++ b/linux-user/special-errno.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * QEMU internal errno values for implementing user-only POSIX.
+ *
+ *=C2=A0 Copyright (c) 2003 Fabrice Bellard
+ *=C2=A0 Copyright (c) 2021 Linaro, Ltd.
+ */
+
+#ifndef SPECIAL_ERRNO_H
+#define SPECIAL_ERRNO_H
+
+/*
+ * All of these are QEMU internal, not visible to the guest.
+ * They should be chosen so as to not overlap with any host
+ * or guest errno.
+ */
+
+/*
+ * This is returned when a system call should be restarted, to tell the + * main loop that it should wind the guest PC backwards so it will
+ * re-execute the syscall after handling any pending signals.
+ */
+#define QEMU_ERESTARTSYS=C2=A0 512
+
+/*
+ * This is returned after a successful sigreturn syscall, to indicate
+ * that it has correctly set the guest registers and so the main loop
+ * should not touch them.
+ */
+#define QEMU_ESIGRETURN=C2=A0 =C2=A0513
+
+#endif /* SPECIAL_ERRNO_H */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1ef6abb776..33d342157d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -136,6 +136,7 @@
=C2=A0#include "qemu/guest-random.h"
=C2=A0#include "qemu/selfmap.h"
=C2=A0#include "user/syscall-trace.h"
+#include "special-errno.h"
=C2=A0#include "qapi/error.h"
=C2=A0#include "fd-trans.h"
=C2=A0#include "tcg/tcg.h"
diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S
index 7ddc997801..74f7e35694 100644
--- a/linux-user/safe-syscall.S
+++ b/linux-user/safe-syscall.S
@@ -10,7 +10,7 @@
=C2=A0 * See the COPYING file in the top-level directory.
=C2=A0 */

-#include "target_errno_defs.h"
+#include "special-errno.h"

=C2=A0/* We have the correct host directory on our include path
=C2=A0 * so that this will pull in the right fragment for the architecture.=
--
2.25.1

--0000000000007350d305d0ff4745--