From patchwork Tue Dec 14 00:25:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 523667 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp6830179imb; Mon, 13 Dec 2021 16:43:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoJ3Bhaciv5P7sASMR8U92WQ2pE617D7v0kFExEq1Pi/DY90jhQ/hT5bscaLy0FJd8vEaA X-Received: by 2002:a05:6102:e88:: with SMTP id l8mr2667177vst.55.1639442635186; Mon, 13 Dec 2021 16:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639442635; cv=none; d=google.com; s=arc-20160816; b=Js2xwDcHpQ18MZj1uKnDmtSs08TjA1RD6n2jBk0TGfZp2pEnVh0YNBQqOjviDZpGju NDijIc22KB5YhJTe/um7WD7YstjPhIEUJzlxO0vWPxCLs/kH7d5m19eMnKQO+wEzHTdX bet7UqdFcWCwVqD/obmLkwiRjSLbSMCd1yMR9kLqAuhaydAviRBa3ST0xZQjPlbiYO1p K/6LzKls5Hu8HhjmuW/WjIVPfNTugNBY/0S3P5GBgzroVlTLpEHT2YKa+75gWFtC0GkZ eQ8Vn6+JvkJIV0eawERk4J8UU1eLBIhYyHZnd1miRYSaUJcHZytZqFNlr4SlZaTMIe7V 74Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=Om7pDZ5EF8o0OJ6w0q+1c92IqMRspAEAzWuoo7jC20iMCuqkp7VkIaDejzQiJC2e5Y /feyMV81cDRzz6gxo0EeO/K3NpsCrPyA2R+6zlouE0knZKrT9TUY3t6jiFUpvVUdB0Ov ar0HONOr19Tk+HTvLl8yR5rEQCrvhfvoElbb7cGVYMRud7AEuMVg8+PMVSWxowAyGV8h VmVd9PshBwERvHIEvYiKQKzlgJ2viJD3AfGuQbW3LGIFoMfAc5yJJ4DfDKqH+g1x6eML 5LCic7my2bmtvqe+S8Ni7OTd/Y7F0WJC4XmkRQ1KPi15AzZn5wGXhSEzG9VmihxiMIKF Ad6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IKHleyWN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h2si12584565vsf.353.2021.12.13.16.43.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Dec 2021 16:43:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IKHleyWN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwvv8-0005v2-1T for patch@linaro.org; Mon, 13 Dec 2021 19:43:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwveC-0008Ig-6B for qemu-devel@nongnu.org; Mon, 13 Dec 2021 19:26:24 -0500 Received: from [2607:f8b0:4864:20::634] (port=40825 helo=mail-pl1-x634.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwve4-0005Sa-Ab for qemu-devel@nongnu.org; Mon, 13 Dec 2021 19:26:23 -0500 Received: by mail-pl1-x634.google.com with SMTP id v19so12369707plo.7 for ; Mon, 13 Dec 2021 16:26:15 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=IKHleyWNxJWW7tzS1wPb5hc40MjhQ/vEb6xQ7/7BjmkXBktVpeDXh8Nct5pq9qwG73 5l1J0gKhP1Z2ZHljN5xTapSuj9ygLeXZrFYja883nNfDWKYG7qKKdIPseiP27Fk6h6Xv aUXYIE3lU5wt7g2yBQpwyVB8W8i+mvL2RgS2tVEiWdr647S1moHH46gWBdbP61hn8VFb Y/NrwBtkzRD1at1R0dyjs6uA/8bJ1begPzd5/rpc1REe2KQS6FpONNlf61fD8C5db61Q /ga8QgNaYihQNT7PvzJOGXgj5TnphKQLm1rdFpV0+xfgqjgICNC8AFFrwPyEXhoKsSq9 imbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=hR6p6tq1WW3yHwU269UpuROCWlnti5bTnUC57mcZbFXkq6RHnE7q1tgp1ndSjZqCb7 NGfCA0YIf+EkQ9ESgs2IObJQmdxhqeYwRtu5f/yNDDkkAOhCm2bHH5e0Cm7jHIU4aKHP GsTyqNnNPaMb0vGzcWTUJyjUX+YHu2zTzW9eXoyPUQ1Pm2Txo5RpY9tQcfVi3/u1ptPL 2nR2y7lF5jZ3xcHFQc4hIwzv7bTFqoKTckVt2HulWP5sVK4bCyBzrH80FH/g+Xi49tqz ySXYXkhbtSk+9jE2h20riFIewR3V6Eu591ZbgZy1dovdFAVvb7m4oCjej+R2tSsyyjDD xPBA== X-Gm-Message-State: AOAM533Xe/e3+QPzwPZEFEwKVr4xIDWIXgx2tsZGFsGP5G2IBT/YDcSC OniX9OUbxe71I4/Yj7K2JUu3Gx/OrFmGyA== X-Received: by 2002:a17:90a:3e09:: with SMTP id j9mr1761672pjc.24.1639441574978; Mon, 13 Dec 2021 16:26:14 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id w7sm11320253pgo.56.2021.12.13.16.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 16:26:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 09/15] linux-user: Create special-errno.h Date: Mon, 13 Dec 2021 16:25:58 -0800 Message-Id: <20211214002604.161983-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214002604.161983-1-richard.henderson@linaro.org> References: <20211214002604.161983-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::634 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-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: git@xen0n.name, laurent@vivier.eu, Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Pull the two internal errno used by qemu internally into their own header file. This includes the one define required by safe-syscall.S. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 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 2867be4cd3..f5bf6d155c 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.