From patchwork Wed Nov 17 16:03:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519218 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1168070imj; Wed, 17 Nov 2021 08:08:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyarusj69xdtngpnpKwc9mgLxLGZ8Wbx5bM5c3B62M73i805STwJU6o2LPT+00j8zgxyB8p X-Received: by 2002:a5d:400e:: with SMTP id n14mr20878994wrp.368.1637165293481; Wed, 17 Nov 2021 08:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165293; cv=none; d=google.com; s=arc-20160816; b=pnMNMXZKUad8hVIGnAZSN2asLdj/ZUctWYHI53ecRIwXIwSCNGNla2sK2V8p99cNO7 Fpeu+9KQRS5CNApzFK7KpcW0aFyFW7ldqFpEyEpqttyhoQ/yTWYIFKW50l7PU2ltlz3C E0cXoUcsGW9EugLJlUDA05unGICKBfTngd6GW+YU4/oOl5EPx3V86P/zXYn1sCn9sov6 /fHh+D+kiKiI5v43w6rM480w/r6N5GsZwzBL5KT/Go1+CPZeFV3LWANMTFN22rmN8T3x xxWnHcdg0naLp5DVJsGCTJkAeLkjJ5w9TUFX54vTaAI2tfqw6ZaHqIQs7HPfGnT+gmxL jAMQ== 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=s/HEpXEnNBxz9iHZEfDzUaUwsQCc0aqYlTEzaPR5D7I=; b=rVY/vQnnVJsJQUKXszuz1AwlBGDiJjGrHHGTu6YZCZZvIXYx6BHKbeTHql0cNCKnPa Kt7HNThIxmGlviFDuzBGm9nyCZPxVCeWrvRSWW1dZAx2m0IdEegxhdDkD0g1yEEkelmc lIO/aqTHIpBWKUj6NbRVARbUwr72zStMvsCnijmJSagQbF86FtxCx/gjYWXtGKD34ikO IrkPCKx79FdQfK/4BLvDtGc1zxBW9W5tcs4GAYewnAhxBj0i1EukqaeBGm8woHlmp2Lg 4eRXMBkth0RIosZejDh5tY2ST42E8ZcWrs4PiR0SkhkjPO3+LrssnNtXAsav0OGgoq81 o1MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=k0r1jLkN; 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=fail (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 l4si136151wmi.152.2021.11.17.08.08.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:08:13 -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=fail header.i=@linaro.org header.s=google header.b=k0r1jLkN; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNTo-0005R3-9H for patch@linaro.org; Wed, 17 Nov 2021 11:08:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQ4-0008Mm-DY for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:20 -0500 Received: from [2a00:1450:4864:20::42b] (port=33285 helo=mail-wr1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQ2-00031D-03 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:19 -0500 Received: by mail-wr1-x42b.google.com with SMTP id d24so5746499wra.0 for ; Wed, 17 Nov 2021 08:04:17 -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=s/HEpXEnNBxz9iHZEfDzUaUwsQCc0aqYlTEzaPR5D7I=; b=k0r1jLkNCUeXc0BrIyQzIvpsbENgYWAqLcQMr33fihPO8v38MSUUd6G7YFg9qLRlnG x+nPK/X0UZPDnK+PKQkUjA3zK5+8Px5uFdqbx2Oi/qo9U9MhNWv58PNUPzWgtP7bRUin r2N3B0fJ39WJz/naLVt6LOH+P/D5XFFoxlVX5fZQRtco+nAazkfaS+jETJiyNOq5G5bF vismtE1y5gruPQ2NRZSslnb2ELMDB1MHaP/BYFApGbQvx+qDB48GW7pVI7y719bmn1dd FLEbzczbD/S/lrjo/wQ7y59VFa2A7L5F3ZRjK3blYv1kePq2yFGIgNVV8seB/ykxVl1A KG5Q== 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=s/HEpXEnNBxz9iHZEfDzUaUwsQCc0aqYlTEzaPR5D7I=; b=o3miaQzKDEj3yQjFNaZiXqL6qg1oMP08LbLYH/7tIdA78xTJk85uuQICAOucxwVl6r CvOe9crdHwPy5beN77OFTaeE9dH4iKdeBsW3HWyX92cEcEPImt89jRTfXCKiFlogT4/o UFRzSdjVdWpn4iP/qvAh+rbSBraJAMrj5fMO6FTN3kB6Ym56k2TD4mMQzojdTRrNGBVs 3afvjjeSeNAikJcrxmOrqh49TYGZAjZCAkSPY3xpfw+GYR3mfqCUEf9PJTH5Qr2DmCN3 sPgYuF+jUjk/EH/j8CPmVKoAo1ASM0KjvSJVG4sYV61QwXMGvrb6vdo9WCYaj2v/HEmR qf2w== X-Gm-Message-State: AOAM531+o1QWyp1CccGXZSN+UDSSYxms2aXg0ZOKt+QLQEraEgvKqway c0vxdDC5OOUowPPjp9ZlWB3uT/I6I+JzVkCAaC8= X-Received: by 2002:adf:dd0d:: with SMTP id a13mr20416061wrm.259.1637165056478; Wed, 17 Nov 2021 08:04:16 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/17] linux-user: Add host_signal_set_pc to set pc in mcontext Date: Wed, 17 Nov 2021 17:03:56 +0100 Message-Id: <20211117160412.71563-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Add a new function host_signal_set_pc to set the next pc in an mcontext. The caller should ensure this is a valid PC for execution. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211113045603.60391-2-imp@bsdimp.com> Signed-off-by: Richard Henderson Reviewed-by: Warner Losh Reviewed-by: Alex Bennée --- linux-user/host/aarch64/host-signal.h | 5 +++++ linux-user/host/alpha/host-signal.h | 5 +++++ linux-user/host/arm/host-signal.h | 5 +++++ linux-user/host/i386/host-signal.h | 5 +++++ linux-user/host/mips/host-signal.h | 5 +++++ linux-user/host/ppc/host-signal.h | 5 +++++ linux-user/host/riscv/host-signal.h | 5 +++++ linux-user/host/s390/host-signal.h | 5 +++++ linux-user/host/sparc/host-signal.h | 9 +++++++++ linux-user/host/x86_64/host-signal.h | 5 +++++ 10 files changed, 54 insertions(+) diff --git a/linux-user/host/aarch64/host-signal.h b/linux-user/host/aarch64/host-signal.h index 0c0b08383a..9770b36dc1 100644 --- a/linux-user/host/aarch64/host-signal.h +++ b/linux-user/host/aarch64/host-signal.h @@ -35,6 +35,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { struct _aarch64_ctx *hdr; diff --git a/linux-user/host/alpha/host-signal.h b/linux-user/host/alpha/host-signal.h index e080be412f..f4c942948a 100644 --- a/linux-user/host/alpha/host-signal.h +++ b/linux-user/host/alpha/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.sc_pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.sc_pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint32_t *pc = (uint32_t *)host_signal_pc(uc); diff --git a/linux-user/host/arm/host-signal.h b/linux-user/host/arm/host-signal.h index efb165c0c5..6c095773c0 100644 --- a/linux-user/host/arm/host-signal.h +++ b/linux-user/host/arm/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.arm_pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.arm_pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { /* diff --git a/linux-user/host/i386/host-signal.h b/linux-user/host/i386/host-signal.h index 4c8eef99ce..abe1ece5c9 100644 --- a/linux-user/host/i386/host-signal.h +++ b/linux-user/host/i386/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.gregs[REG_EIP]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.gregs[REG_EIP] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe diff --git a/linux-user/host/mips/host-signal.h b/linux-user/host/mips/host-signal.h index ef341f7c20..c666ed8c3f 100644 --- a/linux-user/host/mips/host-signal.h +++ b/linux-user/host/mips/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.pc = pc; +} + #if defined(__misp16) || defined(__mips_micromips) #error "Unsupported encoding" #endif diff --git a/linux-user/host/ppc/host-signal.h b/linux-user/host/ppc/host-signal.h index a491c413dc..1d8e658ff7 100644 --- a/linux-user/host/ppc/host-signal.h +++ b/linux-user/host/ppc/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.regs->nip; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.regs->nip = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.regs->trap != 0x400 diff --git a/linux-user/host/riscv/host-signal.h b/linux-user/host/riscv/host-signal.h index 3b168cb58b..a4f170efb0 100644 --- a/linux-user/host/riscv/host-signal.h +++ b/linux-user/host/riscv/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.__gregs[REG_PC]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.__gregs[REG_PC] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { /* diff --git a/linux-user/host/s390/host-signal.h b/linux-user/host/s390/host-signal.h index 26990e4893..a524f2ab00 100644 --- a/linux-user/host/s390/host-signal.h +++ b/linux-user/host/s390/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.psw.addr; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.psw.addr = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint16_t *pinsn = (uint16_t *)host_signal_pc(uc); diff --git a/linux-user/host/sparc/host-signal.h b/linux-user/host/sparc/host-signal.h index 5e71d33f8e..7342936071 100644 --- a/linux-user/host/sparc/host-signal.h +++ b/linux-user/host/sparc/host-signal.h @@ -20,6 +20,15 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) #endif } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ +#ifdef __arch64__ + uc->uc_mcontext.mc_gregs[MC_PC] = pc; +#else + uc->uc_mcontext.gregs[REG_PC] = pc; +#endif +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint32_t insn = *(uint32_t *)host_signal_pc(uc); diff --git a/linux-user/host/x86_64/host-signal.h b/linux-user/host/x86_64/host-signal.h index 883d2fcf65..c71d597eb2 100644 --- a/linux-user/host/x86_64/host-signal.h +++ b/linux-user/host/x86_64/host-signal.h @@ -15,6 +15,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.gregs[REG_RIP]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.gregs[REG_RIP] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe From patchwork Wed Nov 17 16:03:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519215 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1164329imj; Wed, 17 Nov 2021 08:05:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv+k+elFFRcuY0px2LXfrtngfLzk9sYMDaR1y3XbiF8SsYTe6P4vmUg04weUjp1tatUGtD X-Received: by 2002:adf:f7c2:: with SMTP id a2mr22104860wrq.71.1637165137293; Wed, 17 Nov 2021 08:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165137; cv=none; d=google.com; s=arc-20160816; b=g6QzLQByeMbzXp8c/bSIn+Ko4lMFEp8y8W59sV3R5g3aYmlsIt4L5aDfj+BlGkAigu YPMmSt1nrjS7xaBOeoR1dtHBHmTVybT8XKVOeGjx/Jt9k7STHEO0TE4x5idCEM67EJaL qz50xu8UvjuUuBNho1FpU8dtsVHMmSEBU6+stW7KubEmDjRD8KKU5a4Sxyw8lo3X5vr7 WqmHhKt6BCe/qLZuCzMAzqR7g2JICe92rofe6ioaAnTeYLcmVaPpy2TB978y3Hy9j6LJ Xiw6WEcj1R4mkEVP4au1kF58djPW4vovbUvGNNN9Hn+PYCVqPTf21XwHLqhavwkXtrFC 8+6A== 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=itLhZ0W/RxJYtFiacTtH89yYOTpt74xZSJ/OImafFPs=; b=JvWjjEMVoz/kTgl3HMTzTRw58d/1VGyljXj7vnjhrjTVlJYX75jvMxMDmdMAyOc0Fj 3zcfSg9gheMM+nTAmeQrQmoxbwYYWU0pFXQZRbqnsftE6de9IA9c/JY8pQBGL5gZz5tb f0JBS0NhXg5KlpwdrHjc69Ifzmn7N+ZM1wxWExbjDFicOg4/IwlraA9vgAGHnFlxlmy2 flG4nlJeAcErJrc2fwvV0dQKVbvVSoJZrE1/CO21CU93zEy7zxPpnh+u87Cd7mrzS7d3 RAVtXGSSc26vQ4QwrYudnREvWhicRUZRInbR6cheWem5JMihsEMBzrxSvbrOUQVx0dmR dxHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xUUPfgjz; 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=fail (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 j15si104222wmj.220.2021.11.17.08.05.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:05:37 -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=fail header.i=@linaro.org header.s=google header.b=xUUPfgjz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNRI-0008Rb-3u for patch@linaro.org; Wed, 17 Nov 2021 11:05:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQ7-0008Po-Oo for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:23 -0500 Received: from [2a00:1450:4864:20::42c] (port=35482 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQ4-00031L-8b for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:23 -0500 Received: by mail-wr1-x42c.google.com with SMTP id i5so5688881wrb.2 for ; Wed, 17 Nov 2021 08:04:19 -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=itLhZ0W/RxJYtFiacTtH89yYOTpt74xZSJ/OImafFPs=; b=xUUPfgjz2GPEASjrEu1FsCdh7GL/0jrukIewQNPGxDKL/ekmq2QgAz1ZhxWs6f8vTl 0lfIi/X4GXtmN+sf9gLE5NEFGhvhn8QWoXfEHZHPE2NkkH8t2AG9ZnfU3MV3o3j6fP2Y XHD7YFq04fSPPGa9pVlJoK1qTOpC72dCeljFUE4/3SX96dcfuKXEEPqVpTh7USuV1Wlq BW46TpBsK77yoeyLcTcBlDeWCh9JxIXQum8v3PX3enRR1SBERHQyQDyoz5NN3vsARY/C g/pU1qxEPKthoIWkb1hGW3fGTfCEYHz55ZwQUWbxzlALsDun8Jg3nPYlCSpBNto5fRC/ bkag== 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=itLhZ0W/RxJYtFiacTtH89yYOTpt74xZSJ/OImafFPs=; b=GHjnjlrjrSHQXSn2hI8N2Ler2bvhCxw9jbyPRSayUM3fRIcrXxbacGCEKqdZvDGepu dyZftlIGVba6weYvPQGMNrv8NApBkLqMech/GMtpcgzpqCT8K1fvegFBrt1N+9eGfbaX bwa9rHf7A8mVFwpwP/PR94lnedX2mSsBV4ojyc3BD4u3VgSw4QACWtRu3+dAoXhV+lF5 IPkw24mhaT4NJ0c5sx0dOrZQcOuWN4Wm4zGEJbmC4X/Ka/kiWvELsVEmb/d4BcJ7ihiJ ZqoWqHKZ83U+3Q6Vm1yjneaqP0Vh2aAIsWfOWAQoor7+N5qscjwRco81e2a5+LHmc1V3 88lA== X-Gm-Message-State: AOAM533hOyBRWT4f6Tm2XFn5oYyq8/D3kwTHkFiea34W5oiCel2RARNR NGDVra1dRoJh8EX/4AIxicFY/H8mUcsEQj50gng= X-Received: by 2002:a5d:650f:: with SMTP id x15mr22203313wru.201.1637165057865; Wed, 17 Nov 2021 08:04:17 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 02/17] linux-user/signal.c: Create a common rewind_if_in_safe_syscall Date: Wed, 17 Nov 2021 17:03:57 +0100 Message-Id: <20211117160412.71563-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh All instances of rewind_if_in_safe_syscall are the same, differing only in how the instruction point is fetched from the ucontext and the size of the registers. Use host_signal_pc and new host_signal_set_pc interfaces to fetch the pointer to the PC and adjust if needed. Delete all the old copies of rewind_if_in_safe_syscall. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211113045603.60391-3-imp@bsdimp.com> [rth: include safe-syscall.h, simplify ifdefs] Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- linux-user/host/aarch64/hostdep.h | 20 -------------------- linux-user/host/arm/hostdep.h | 20 -------------------- linux-user/host/i386/hostdep.h | 20 -------------------- linux-user/host/ppc64/hostdep.h | 20 -------------------- linux-user/host/riscv/hostdep.h | 20 -------------------- linux-user/host/s390x/hostdep.h | 20 -------------------- linux-user/host/x86_64/hostdep.h | 20 -------------------- linux-user/safe-syscall.h | 3 +++ linux-user/signal.c | 15 ++++++++++++--- 9 files changed, 15 insertions(+), 143 deletions(-) diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h index a8d41a21ad..39299d798a 100644 --- a/linux-user/host/aarch64/hostdep.h +++ b/linux-user/host/aarch64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - __u64 *pcreg = &uc->uc_mcontext.pc; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h index 9276fe6ceb..86b137875a 100644 --- a/linux-user/host/arm/hostdep.h +++ b/linux-user/host/arm/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.arm_pc; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h index 073be74d87..ce7136501f 100644 --- a/linux-user/host/i386/hostdep.h +++ b/linux-user/host/i386/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - greg_t *pcreg = &uc->uc_mcontext.gregs[REG_EIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h index 98979ad917..0c290dd904 100644 --- a/linux-user/host/ppc64/hostdep.h +++ b/linux-user/host/ppc64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/riscv/hostdep.h b/linux-user/host/riscv/hostdep.h index 2ba07456ae..7f67c22868 100644 --- a/linux-user/host/riscv/hostdep.h +++ b/linux-user/host/riscv/hostdep.h @@ -11,24 +11,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.__gregs[REG_PC]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h index 4f0171f36f..d801145854 100644 --- a/linux-user/host/s390x/hostdep.h +++ b/linux-user/host/s390x/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.psw.addr; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h index a4fefb5114..9c62bd26bd 100644 --- a/linux-user/host/x86_64/hostdep.h +++ b/linux-user/host/x86_64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index 6bc0390262..aaa9ffc0e2 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -127,6 +127,9 @@ #ifdef HAVE_SAFE_SYSCALL /* The core part of this function is implemented in assembly */ extern long safe_syscall_base(int *pending, long number, ...); +/* These are defined by the safe-syscall.inc.S file */ +extern char safe_syscall_start[]; +extern char safe_syscall_end[]; #define safe_syscall(...) \ ({ \ diff --git a/linux-user/signal.c b/linux-user/signal.c index 81c45bfce9..6d5e5b698c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -31,6 +31,7 @@ #include "trace.h" #include "signal-common.h" #include "host-signal.h" +#include "safe-syscall.h" static struct target_sigaction sigact_table[TARGET_NSIG]; @@ -793,12 +794,20 @@ int queue_signal(CPUArchState *env, int sig, int si_type, return 1; /* indicates that the signal was queued */ } -#ifndef HAVE_SAFE_SYSCALL + +/* Adjust the signal context to rewind out of safe-syscall if we're in it */ static inline void rewind_if_in_safe_syscall(void *puc) { - /* Default version: never rewind */ -} +#ifdef HAVE_SAFE_SYSCALL + ucontext_t *uc = (ucontext_t *)puc; + uintptr_t pcreg = host_signal_pc(uc); + + if (pcreg > (uintptr_t)safe_syscall_start + && pcreg < (uintptr_t)safe_syscall_end) { + host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); + } #endif +} static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) { From patchwork Wed Nov 17 16:03: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: 519221 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1169466imj; Wed, 17 Nov 2021 08:09:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO5F8peix8n3+pZ6t58L6U4CXMTXQfAfqI2ecvlSyJbhVn5KSjIqcxMxAGt7EOyzyQKbHP X-Received: by 2002:a05:600c:3516:: with SMTP id h22mr960553wmq.62.1637165354793; Wed, 17 Nov 2021 08:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165354; cv=none; d=google.com; s=arc-20160816; b=qwqq6zhOdOsTg87jWOpT8m1VfRjidj00SwlaHv9VP1L7nBsB4to3QrBmVYkITlbiEe SFIORtBViYjRuQPRfnJLpPmqOc7fJSCndAkWsC9SQl2f6ScyDLnzLf91+lc/ixzR+NPG lfffYL0J9N/V7OjGCVHGeUcmezhPGhlwd91HYl2qSjw/E0QIjsEjYxGkywXoSdPSp8Kq mUthssOrO+Uv7yh34Fo2d/XaSET32Zsz1sbc3hhrA1n6IDHoAjH7zbs9k+YgPT8DBWLH jj/f4KNgpzGB4+sRaBflpmow1OIfPN6L3wu7fpOAGrtuAr1pWDqVrVt0TpPsuIW+bhDA bF6w== 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=dYNbpTaiaVd2Z/SKkWoQWGZZQtH+SI9yqkf6sNwKdU8=; b=fHLFiSC3+slLJz+ufIWJFnlZQqaoo9lolftFZUPHnrCQ+6Ph8fEzfA9CL90wKKXfpu qY9xxT+P4wyBTmNZLfP5cWEJkSvRR3JUEqbkJ6cQKx6tUipw9Qb8vU3vtZniwIHt924L hsBc+yY6NugZfyAqDjvTI+iG6l/G02RfJDmekyZxPytFRBhIsWZRuwyfaQJMMdvnedjP y2kU06Jn7+s6ruJSngvzCTk2IVTUHGGYD4kvALHXTRf20539kBrE9vo6nSTpyqPaEt63 O32bo75N0p9mW85sFqBXykulwKUcWJ8lXM4wbeQYcK8agFvWIUzznsdF+AclWpzZxZg+ FEfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ej+iHCvK; 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=fail (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 r8si557121wrm.300.2021.11.17.08.09.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:09:14 -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=fail header.i=@linaro.org header.s=google header.b=Ej+iHCvK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNUn-0007gx-Lg for patch@linaro.org; Wed, 17 Nov 2021 11:09:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQA-0008T6-Fm for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:26 -0500 Received: from [2a00:1450:4864:20::336] (port=42768 helo=mail-wm1-x336.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQ7-00031r-Mn for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:26 -0500 Received: by mail-wm1-x336.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so2524015wmd.1 for ; Wed, 17 Nov 2021 08:04:23 -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=dYNbpTaiaVd2Z/SKkWoQWGZZQtH+SI9yqkf6sNwKdU8=; b=Ej+iHCvKyaNJmZN1e2iM9yPyAwXpv3gA6ebNn3tCwoxE0mVq3Wdgp/w2HJuuTJNiL7 o/f1EkNIt6EL7XJ4XGXqPqmPsnP3Cb/l/LMGk7MaT5UV4R4Wc2YA+MR10RsQ4yd34FA+ N1TdqGkYEkOkxodq49LGf79ZieaHdqabB+WMmbo6RJRfyzfP9ebZso7//OAm4xm4Lb+Z dNKZYuFunO1Wat9uSgO3qdxRqbIVU1QRZfVcuq8d9ttKrvzCoupu3AMntCXjZ28OJBE/ W7kkoHCzY4lgCFSHxryhCeKTZuDaiIJIwJNeRycSO+tyh+TcW3BWUT7wJ1vP9J05K5Ta Lhxg== 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=dYNbpTaiaVd2Z/SKkWoQWGZZQtH+SI9yqkf6sNwKdU8=; b=xyYzMki2qa7sp3yTQO4sWLSpuKZMvF0ZvzRe022R52vJakQh33S8HWD9U/xGnsJFmp ax/fR9MFTQlaCGdG2g+On4hqGqE/zDnuP08x8JMCZcbC/CL4VWRAti4n4FqdwI+6w1uT Xdfwc11OWyIm21liQEofQiSGD8OC2/2crzSwuJH9Sbb5eSzSx64Cb5szsN8uDMCqOQHG mR1Y28sS8WgvwXaCnT7TkzfYMMizy4SjBqKALbSAGFWWtAY4KvdgquFGa0YeeH5+7s0o hFRcfDFV7/yT6dz6p3xbxxRfHLjrpZMrRZn3oZTftY7LjlOt8eO1BiMh2i5e1sG1rG64 oNOQ== X-Gm-Message-State: AOAM531sYultgPiexRenIu4Z1c9s/O7f5if4BVvRXl/LArpd9/MdnV3C hrG1l/fUe2YzbiSBX59pB/RsjZTqnH1XIK4b8rY= X-Received: by 2002:a7b:c194:: with SMTP id y20mr905507wmi.61.1637165059312; Wed, 17 Nov 2021 08:04:19 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 03/17] linux-user/safe-syscall.inc.S: Move to common-user Date: Wed, 17 Nov 2021 17:03:58 +0100 Message-Id: <20211117160412.71563-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::336 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Move all the safe_syscall.inc.S files to common-user. They are almost identical between linux-user and bsd-user to re-use. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211113045603.60391-4-imp@bsdimp.com> Signed-off-by: Richard Henderson Reviewed-by: Warner Losh Reviewed-by: Alex Bennée --- meson.build | 2 ++ {linux-user => common-user}/host/aarch64/hostdep.h | 0 {linux-user => common-user}/host/arm/hostdep.h | 0 {linux-user => common-user}/host/i386/hostdep.h | 0 {linux-user => common-user}/host/ppc64/hostdep.h | 0 {linux-user => common-user}/host/riscv/hostdep.h | 0 {linux-user => common-user}/host/s390x/hostdep.h | 0 {linux-user => common-user}/host/x86_64/hostdep.h | 0 {linux-user => common-user}/host/aarch64/safe-syscall.inc.S | 0 {linux-user => common-user}/host/arm/safe-syscall.inc.S | 0 {linux-user => common-user}/host/i386/safe-syscall.inc.S | 0 {linux-user => common-user}/host/ppc64/safe-syscall.inc.S | 0 {linux-user => common-user}/host/riscv/safe-syscall.inc.S | 0 {linux-user => common-user}/host/s390x/safe-syscall.inc.S | 0 {linux-user => common-user}/host/x86_64/safe-syscall.inc.S | 0 15 files changed, 2 insertions(+) rename {linux-user => common-user}/host/aarch64/hostdep.h (100%) rename {linux-user => common-user}/host/arm/hostdep.h (100%) rename {linux-user => common-user}/host/i386/hostdep.h (100%) rename {linux-user => common-user}/host/ppc64/hostdep.h (100%) rename {linux-user => common-user}/host/riscv/hostdep.h (100%) rename {linux-user => common-user}/host/s390x/hostdep.h (100%) rename {linux-user => common-user}/host/x86_64/hostdep.h (100%) rename {linux-user => common-user}/host/aarch64/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/arm/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/i386/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/ppc64/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/riscv/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/s390x/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/x86_64/safe-syscall.inc.S (100%) diff --git a/meson.build b/meson.build index e2d38a43e6..c58abf0d0d 100644 --- a/meson.build +++ b/meson.build @@ -2878,10 +2878,12 @@ foreach target : target_dirs if 'CONFIG_LINUX_USER' in config_target base_dir = 'linux-user' target_inc += include_directories('linux-user/host/' / config_host['ARCH']) + target_inc += include_directories('common-user/host/' / config_host['ARCH']) endif if 'CONFIG_BSD_USER' in config_target base_dir = 'bsd-user' target_inc += include_directories('bsd-user/' / targetos) + target_inc += include_directories('common-user/host/' / config_host['ARCH']) dir = base_dir / abi arch_srcs += files(dir / 'target_arch_cpu.c') endif diff --git a/linux-user/host/aarch64/hostdep.h b/common-user/host/aarch64/hostdep.h similarity index 100% rename from linux-user/host/aarch64/hostdep.h rename to common-user/host/aarch64/hostdep.h diff --git a/linux-user/host/arm/hostdep.h b/common-user/host/arm/hostdep.h similarity index 100% rename from linux-user/host/arm/hostdep.h rename to common-user/host/arm/hostdep.h diff --git a/linux-user/host/i386/hostdep.h b/common-user/host/i386/hostdep.h similarity index 100% rename from linux-user/host/i386/hostdep.h rename to common-user/host/i386/hostdep.h diff --git a/linux-user/host/ppc64/hostdep.h b/common-user/host/ppc64/hostdep.h similarity index 100% rename from linux-user/host/ppc64/hostdep.h rename to common-user/host/ppc64/hostdep.h diff --git a/linux-user/host/riscv/hostdep.h b/common-user/host/riscv/hostdep.h similarity index 100% rename from linux-user/host/riscv/hostdep.h rename to common-user/host/riscv/hostdep.h diff --git a/linux-user/host/s390x/hostdep.h b/common-user/host/s390x/hostdep.h similarity index 100% rename from linux-user/host/s390x/hostdep.h rename to common-user/host/s390x/hostdep.h diff --git a/linux-user/host/x86_64/hostdep.h b/common-user/host/x86_64/hostdep.h similarity index 100% rename from linux-user/host/x86_64/hostdep.h rename to common-user/host/x86_64/hostdep.h diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/aarch64/safe-syscall.inc.S rename to common-user/host/aarch64/safe-syscall.inc.S diff --git a/linux-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S similarity index 100% rename from linux-user/host/arm/safe-syscall.inc.S rename to common-user/host/arm/safe-syscall.inc.S diff --git a/linux-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S similarity index 100% rename from linux-user/host/i386/safe-syscall.inc.S rename to common-user/host/i386/safe-syscall.inc.S diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/ppc64/safe-syscall.inc.S rename to common-user/host/ppc64/safe-syscall.inc.S diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S similarity index 100% rename from linux-user/host/riscv/safe-syscall.inc.S rename to common-user/host/riscv/safe-syscall.inc.S diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S similarity index 100% rename from linux-user/host/s390x/safe-syscall.inc.S rename to common-user/host/s390x/safe-syscall.inc.S diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/x86_64/safe-syscall.inc.S rename to common-user/host/x86_64/safe-syscall.inc.S From patchwork Wed Nov 17 16:03:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519222 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1171669imj; Wed, 17 Nov 2021 08:10:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWFoapvMc8NEK3mOy9y7NXSdr5TqDGXSnVqdmuwVTdELqfbo8+H8VGvlSRzUJMc/RXezVf X-Received: by 2002:adf:fd4c:: with SMTP id h12mr21186906wrs.429.1637165449704; Wed, 17 Nov 2021 08:10:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165449; cv=none; d=google.com; s=arc-20160816; b=0zfXx06mbIHUIdQ9tKAc0BiD/6H7f5/hymnvGmtAZdQci6XamxjE2DbC/nc0iHypgx OgD+MBWpOTJJoDXC1BHpiyFBul3P2ufyZHPQi4XkWCR0v+Qft61wSiihusgmA+ywJuU5 Ob/sYBCp9hZHaTQSdPZjAXjHOiOM+z7buiHeY3BYj6GFK+AzelEUdkszE16+xB/PW9MQ LLaM2YwFPaPsrT+qaOjqxUmtFKPlMI3NMFezu+2mdZBedh7g/xfuAptukxgkmmjsATFK fPC6AtN1911IQFSVK+vyK+Nou1mzv/e7wanqwFH50FN6dpm1fzwvbziqk1C1J1Znoj01 oSEA== 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=Xoq3219+S6QUhn6Pd7je4gi18GFwEZswxg82Ghhg8EE=; b=IFQ6GqifLaLYyJMyu4mLZKTDxRT3rIlLco/NomPvULcWplU8OvMtKbTo5jTqJFa6Y/ d5Uukw4aV3Mipj9vFXcgU9VOtW5L7JQ0IUB8QoFFyxEd3il0jAUPSOZ0eXec0r77yLa1 aP2aLLyYxh23tbc/RBwRf/GOLMdDppB+GZ5wNJJaWUk+ULQSHHH5FIo/IgxfnrFzsAVL Oz+yZCwwjJziHHNZ6E+2atntG/hlbGUCC792arChLZ3gHh5WyAr9UweZrH8iwMbFNDCN GV8L57fuzX5f+gqTQmNI1Xz6kwRZKCs4eq8Xya0dsvp6C8dzj3ZkxPUsleactC0XBXSD R19Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="P+l/XvCQ"; 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=fail (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 n15si542633wrj.489.2021.11.17.08.10.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:10:49 -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=fail header.i=@linaro.org header.s=google header.b="P+l/XvCQ"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNWK-0002r1-G1 for patch@linaro.org; Wed, 17 Nov 2021 11:10:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQF-0000EU-2F for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:31 -0500 Received: from [2a00:1450:4864:20::42a] (port=46639 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQ9-00032G-OI for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:30 -0500 Received: by mail-wr1-x42a.google.com with SMTP id u1so5618949wru.13 for ; Wed, 17 Nov 2021 08:04:25 -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=Xoq3219+S6QUhn6Pd7je4gi18GFwEZswxg82Ghhg8EE=; b=P+l/XvCQZrOVPxVIP0T98ZqQXKX2HBXCuqKKr5tmp/B4aI/5znCkGFXe9eUuxDYT3u Ao5zRc72h7WXTij8EDllmu/Ue6g8zxvbzG/NmmH8bKqpNgBfG3jsyTsjljyCn+ITfsfC UFK8tTivXlyp9xIIrPZoVzTAToPfyonq5CZ6n0hvHrozcsE137en5uixSy2sjsX7w67b 8x0UUaUx6tCPkxagYCM2WeCwwhALelOKog/j09CsG69EbJaMlUmdySN8lTpbqyx9FaVV smokeFd8oIpNgHQtc0im1P8X0M+yZVqFA0WUIExNu6Jgomt5k0b0nOiS6NCVuWavLTHB jEkA== 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=Xoq3219+S6QUhn6Pd7je4gi18GFwEZswxg82Ghhg8EE=; b=p0GX9a8hDL8BLq1TNmw28hLG+AQPvuL6K+rums1Ol27T+U0n1hWLDHXAVfvbFd3YQX hECMVb71BfpEMGEpiSE51jjtIxHe109Z3lHOh5b2twrSM12y6J558MfgFiARF/VukRhs ie7DBUP5UCZy/YCrvTmDHwqDkNSMPZePT2ssWbyN4iW1pCWrgNKne8WBAhEwZhJeaogv EIDsNkklbXHuBcI8OYLFq+CEl/h/1g78UIH7XIu1ndCHmM0dc6ROj6csHThi/b27IIzZ +9IHzvYmg+zntk5sYKFDjd1qeAso2wYyav8VQNLJ6xWW5+PK5i1cUmkszOrLxfYk2Aab HeJw== X-Gm-Message-State: AOAM530DGa+AiEEb399xtnoXAGre5FawCdfF1Mul2OjNuDpkXsJv1XCD rpgDdqWBFQzUmVza36ZNR5OLdB+YaxM0wCp2NDY= X-Received: by 2002:adf:e991:: with SMTP id h17mr20727232wrm.40.1637165064113; Wed, 17 Nov 2021 08:04:24 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 04/17] common-user: Move syscall error detection into safe_syscall_base Date: Wed, 17 Nov 2021 17:03:59 +0100 Message-Id: <20211117160412.71563-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The current api from safe_syscall_base() is to return -errno, which is the interface provided by *some* linux kernel abis. The wrapper macro, safe_syscall(), detects error, stores into errno, and returns -1, to match the api of the system syscall(). For those kernel abis that do not return -errno natively, this leads to double syscall error detection. E.g. Linux ppc64, which sets the SO flag for error. Simplify the usage from C by moving the error detection into assembly. Signed-off-by: Richard Henderson --- linux-user/safe-syscall.h | 20 +++--- common-user/host/aarch64/safe-syscall.inc.S | 55 +++++++++------- common-user/host/arm/safe-syscall.inc.S | 58 ++++++++++------- common-user/host/i386/safe-syscall.inc.S | 51 +++++++++------ common-user/host/ppc64/safe-syscall.inc.S | 63 +++++++++++-------- common-user/host/riscv/safe-syscall.inc.S | 50 +++++++++------ common-user/host/s390x/safe-syscall.inc.S | 50 +++++++++------ common-user/host/x86_64/safe-syscall.inc.S | 70 ++++++++++++--------- 8 files changed, 243 insertions(+), 174 deletions(-) diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index aaa9ffc0e2..ea0e8a8d24 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -125,23 +125,17 @@ * kinds of restartability. */ #ifdef HAVE_SAFE_SYSCALL -/* The core part of this function is implemented in assembly */ -extern long safe_syscall_base(int *pending, long number, ...); + +/* The core part of this function is implemented in assembly. */ +extern long safe_syscall_base(int *pending, int *errnop, long number, ...); + /* These are defined by the safe-syscall.inc.S file */ extern char safe_syscall_start[]; extern char safe_syscall_end[]; -#define safe_syscall(...) \ - ({ \ - long ret_; \ - int *psp_ = &((TaskState *)thread_cpu->opaque)->signal_pending; \ - ret_ = safe_syscall_base(psp_, __VA_ARGS__); \ - if (is_error(ret_)) { \ - errno = -ret_; \ - ret_ = -1; \ - } \ - ret_; \ - }) +#define safe_syscall(...) \ + safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ + &errno, __VA_ARGS__) #else diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index bc1f5a9792..95c60d8609 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -17,22 +17,21 @@ .type safe_syscall_start, #function .type safe_syscall_end, #function - /* This is the entry point for making a system call. The calling + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc - /* The syscall calling convention isn't the same as the - * C one: + /* + * The syscall calling convention isn't the same as the C one: * we enter with x0 == *signal_pending - * x1 == syscall number - * x2 ... x7, (stack) == syscall arguments + * x1 == errno + * x2 == syscall number + * x3 ... x7, (stack) == syscall arguments * and return the result in x0 * and the syscall instruction needs * x8 == syscall number @@ -40,17 +39,18 @@ safe_syscall_base: * and returns the result in x0 * Shuffle everything around appropriately. */ - mov x9, x0 /* signal_pending pointer */ - mov x8, x1 /* syscall number */ - mov x0, x2 /* syscall arguments */ - mov x1, x3 - mov x2, x4 - mov x3, x5 - mov x4, x6 - mov x5, x7 - ldr x6, [sp] + mov x10, x0 /* signal_pending pointer */ + mov x11, x1 /* errno pointer */ + mov x8, x2 /* syscall number */ + mov x0, x3 /* syscall arguments */ + mov x1, x4 + mov x2, x5 + mov x3, x6 + mov x4, x7 + ldp x5, x6, [sp] - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -59,17 +59,26 @@ safe_syscall_base: */ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ - ldr w10, [x9] - cbnz w10, 0f + ldr w9, [x10] + cbnz w9, 2f svc 0x0 safe_syscall_end: + /* code path for having successfully executed the syscall */ + cmn x0, #4095 + b.cs 1f ret -0: - /* code path when we didn't execute the syscall */ - mov x0, #-TARGET_ERESTARTSYS + /* code path setting errno */ +0: neg w0, w0 /* create positive errno */ +1: str w0, [x11] /* store errno */ + mov x0, #-1 ret + + /* code path when we didn't execute the syscall */ +2: mov w0, #TARGET_ERESTARTSYS + b 1b + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S index 88c4958504..17839c6486 100644 --- a/common-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -22,33 +22,35 @@ .arm .align 2 - /* This is the entry point for making a system call. The calling + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .fnstart .cfi_startproc mov r12, sp /* save entry stack */ - push { r4, r5, r6, r7, r8, lr } - .save { r4, r5, r6, r7, r8, lr } - .cfi_adjust_cfa_offset 24 + push { r4, r5, r6, r7, r8, r9, r10, lr } + .save { r4, r5, r6, r7, r8, r9, r10, lr } + .cfi_adjust_cfa_offset 32 .cfi_rel_offset r4, 0 .cfi_rel_offset r5, 4 .cfi_rel_offset r6, 8 .cfi_rel_offset r7, 12 .cfi_rel_offset r8, 16 - .cfi_rel_offset lr, 20 + .cfi_rel_offset r9, 20 + .cfi_rel_offset r10, 24 + .cfi_rel_offset lr, 28 - /* The syscall calling convention isn't the same as the C one: - * we enter with r0 == *signal_pending - * r1 == syscall number - * r2, r3, [sp+0] ... [sp+12] == syscall arguments + /* + * The syscall calling convention isn't the same as the C one: + * we enter with r0 == &signal_pending + * r1 == &errno + * r2 == syscall number + * r3, [sp+0] ... [sp+16] == syscall arguments * and return the result in r0 * and the syscall instruction needs * r7 == syscall number @@ -58,12 +60,13 @@ safe_syscall_base: * Note the 16 bytes that we pushed to save registers. */ mov r8, r0 /* copy signal_pending */ - mov r7, r1 /* syscall number */ - mov r0, r2 /* syscall args */ - mov r1, r3 - ldm r12, { r2, r3, r4, r5, r6 } + mov r9, r1 /* copy errnop */ + mov r7, r2 /* syscall number */ + mov r0, r3 /* syscall args */ + ldm r12, { r1, r2, r3, r4, r5, r6 } - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -74,16 +77,25 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ ldr r12, [r8] /* signal_pending */ tst r12, r12 - bne 1f + bne 2f swi 0 safe_syscall_end: - /* code path for having successfully executed the syscall */ - pop { r4, r5, r6, r7, r8, pc } -1: + /* code path for having successfully executed the syscall */ + cmp r0, #-4096 + bhi 0f +9: pop { r4, r5, r6, r7, r8, r9, r10, pc } + + /* code path setting errno */ +0: neg r0, r0 /* create positive errno */ +1: str r0, [r9] /* store errno */ + mov r0, #-1 + b 9b + /* code path when we didn't execute the syscall */ - ldr r0, =-TARGET_ERESTARTSYS - pop { r4, r5, r6, r7, r8, pc } +2: ldr r0, =TARGET_ERESTARTSYS + b 1b + .fnend .cfi_endproc diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index 9e58fc6504..ad89521783 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -15,14 +15,12 @@ .global safe_syscall_end .type safe_syscall_base, @function - /* This is the entry point for making a system call. The calling + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc @@ -41,9 +39,10 @@ safe_syscall_base: /* The syscall calling convention isn't the same as the C one: * we enter with 0(%esp) == return address - * 4(%esp) == *signal_pending - * 8(%esp) == syscall number - * 12(%esp) ... 32(%esp) == syscall arguments + * 4(%esp) == &signal_pending + * 8(%esp) == &errno + * 12(%esp) == syscall number + * 16(%esp) ... 36(%esp) == syscall arguments * and return the result in eax * and the syscall instruction needs * eax == syscall number @@ -52,14 +51,15 @@ safe_syscall_base: * Shuffle everything around appropriately. * Note the 16 bytes that we pushed to save registers. */ - mov 12+16(%esp), %ebx /* the syscall arguments */ - mov 16+16(%esp), %ecx - mov 20+16(%esp), %edx - mov 24+16(%esp), %esi - mov 28+16(%esp), %edi - mov 32+16(%esp), %ebp + mov 16+16(%esp), %ebx /* the syscall arguments */ + mov 20+16(%esp), %ecx + mov 24+16(%esp), %edx + mov 28+16(%esp), %esi + mov 32+16(%esp), %edi + mov 36+16(%esp), %ebp - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -70,12 +70,16 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ mov 4+16(%esp), %eax /* signal_pending */ cmpl $0, (%eax) - jnz 1f + jnz 2f mov 8+16(%esp), %eax /* syscall number */ int $0x80 safe_syscall_end: + /* code path for having successfully executed the syscall */ - pop %ebx + cmp $-4095, %eax + jae 0f + +9: pop %ebx .cfi_remember_state .cfi_adjust_cfa_offset -4 .cfi_restore ebx @@ -90,11 +94,18 @@ safe_syscall_end: .cfi_restore ebp ret -1: - /* code path when we didn't execute the syscall */ .cfi_restore_state - mov $-TARGET_ERESTARTSYS, %eax - jmp safe_syscall_end + + /* code path setting errno */ +0: neg %eax /* create positive errno */ +1: mov 8+16(%esp), %ebx /* load errno pointer */ + mov %eax, (%ebx) /* store errno */ + mov $-1, %eax + jmp 9b + + /* code path when we didn't execute the syscall */ +2: mov $TARGET_ERESTARTSYS, %eax + jmp 1b .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S index 875133173b..e35408c5fb 100644 --- a/common-user/host/ppc64/safe-syscall.inc.S +++ b/common-user/host/ppc64/safe-syscall.inc.S @@ -17,14 +17,19 @@ .text - /* This is the entry point for making a system call. The calling +#if _CALL_ELF == 2 +#define PARAM_OFS 32 +#else +#define PARAM_OFS 48 +#endif +#define PARAM(X) PARAM_OFS + X*8 + + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ #if _CALL_ELF == 2 safe_syscall_base: @@ -39,9 +44,11 @@ safe_syscall_base: .L.safe_syscall_base: .cfi_startproc #endif - /* We enter with r3 == *signal_pending - * r4 == syscall number - * r5 ... r10 == syscall arguments + /* + * We enter with r3 == &signal_pending + * r4 == &errno + * r5 == syscall number + * r6 ... r10, (stack) == syscall arguments * and return the result in r3 * and the syscall instruction needs * r0 == syscall number @@ -49,18 +56,18 @@ safe_syscall_base: * and returns the result in r3 * Shuffle everything around appropriately. */ - std 14, 16(1) /* Preserve r14 in SP+16 */ - .cfi_offset 14, 16 - mr 14, 3 /* signal_pending */ - mr 0, 4 /* syscall number */ - mr 3, 5 /* syscall arguments */ - mr 4, 6 - mr 5, 7 - mr 6, 8 - mr 7, 9 - mr 8, 10 + mr 11, 3 /* signal_pending pointer */ + std 4, PARAM(1)(1) /* save errno pointer in param slot */ + mr 0, 5 /* syscall number */ + mr 3, 6 /* syscall arguments */ + mr 4, 7 + mr 5, 8 + mr 6, 9 + mr 7, 10 + ld 8, PARAM(8)(1) - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -69,23 +76,25 @@ safe_syscall_base: */ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ - lwz 12, 0(14) + lwz 12, 0(11) cmpwi 0, 12, 0 bne- 0f sc safe_syscall_end: - /* code path when we did execute the syscall */ - ld 14, 16(1) /* restore r14 to its original value */ - bnslr+ - /* syscall failed; return negative errno */ - neg 3, 3 + /* code path for having successfully executed the syscall */ + bnslr+ /* SO set for syscall error */ + + /* code path setting errno */ +1: ld 11, PARAM(1)(1) /* restore errno pointer */ + stw 3, 0(11) /* store errno */ + li 3, -1 blr /* code path when we didn't execute the syscall */ -0: addi 3, 0, -TARGET_ERESTARTSYS - ld 14, 16(1) /* restore r14 to its original value */ - blr +0: li 3, TARGET_ERESTARTSYS + b 1b + .cfi_endproc #if _CALL_ELF == 2 diff --git a/common-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S index 9ca3fbfd1e..eddede702b 100644 --- a/common-user/host/riscv/safe-syscall.inc.S +++ b/common-user/host/riscv/safe-syscall.inc.S @@ -23,17 +23,15 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc /* * The syscall calling convention is nearly the same as C: - * we enter with a0 == *signal_pending - * a1 == syscall number - * a2 ... a7 == syscall arguments + * we enter with a0 == &signal_pending + * a1 == &errno + * a2 == syscall number + * a3 ... a7, [sp] == syscall arguments * and return the result in a0 * and the syscall instruction needs * a7 == syscall number @@ -42,14 +40,19 @@ safe_syscall_base: * Shuffle everything around appropriately. */ mv t0, a0 /* signal_pending pointer */ - mv t1, a1 /* syscall number */ - mv a0, a2 /* syscall arguments */ - mv a1, a3 - mv a2, a4 - mv a3, a5 - mv a4, a6 - mv a5, a7 - mv a7, t1 + mv t1, a1 /* errno pointer */ + mv t2, a2 /* syscall number */ + mv a0, a3 /* syscall arguments */ + mv a1, a4 + mv a2, a5 + mv a3, a6 + mv a4, a7 +#if __riscv_xlen == 32 + lw a5, 0(sp) +#else + ld a5, 0(sp) +#endif + mv a7, t2 /* * This next sequence of code works in conjunction with the @@ -61,17 +64,26 @@ safe_syscall_base: */ safe_syscall_start: /* If signal_pending is non-zero, don't do the call */ - lw t1, 0(t0) - bnez t1, 0f + lw t2, 0(t0) + bnez t2, 2f scall safe_syscall_end: + /* code path for having successfully executed the syscall */ + li t2, -4096 + bgtu a0, t2, 0f ret -0: - /* code path when we didn't execute the syscall */ - li a0, -TARGET_ERESTARTSYS + /* code path setting errno */ +0: neg a0, a0 /* create positive errno */ +1: sw a0, 0(t1) /* store errno */ + li a0, -1 ret + + /* code path when we didn't execute the syscall */ +2: li a0, TARGET_ERESTARTSYS + j 1b + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S index 414b44ad38..f2a3bccc13 100644 --- a/common-user/host/s390x/safe-syscall.inc.S +++ b/common-user/host/s390x/safe-syscall.inc.S @@ -15,14 +15,12 @@ .global safe_syscall_end .type safe_syscall_base, @function - /* This is the entry point for making a system call. The calling + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc @@ -44,11 +42,13 @@ safe_syscall_base: stg %r1,0(%r15) /* store back chain */ stg %r0,8(%r15) /* store eos */ - /* The syscall calling convention isn't the same as the + /* + * The syscall calling convention isn't the same as the * C one: - * we enter with r2 == *signal_pending - * r3 == syscall number - * r4, r5, r6, (stack) == syscall arguments + * we enter with r2 == &signal_pending + * r3 == &errno + * r4 == syscall number + * r5, r6, (stack) == syscall arguments * and return the result in r2 * and the syscall instruction needs * r1 == syscall number @@ -57,13 +57,14 @@ safe_syscall_base: * Shuffle everything around appropriately. */ lgr %r8,%r2 /* signal_pending pointer */ - lgr %r1,%r3 /* syscall number */ - lgr %r2,%r4 /* syscall args */ - lgr %r3,%r5 - lgr %r4,%r6 - lmg %r5,%r7,320(%r15) + lgr %r9,%r3 /* errno pointer */ + lgr %r1,%r4 /* syscall number */ + lgr %r2,%r5 /* syscall args */ + lgr %r3,%r6 + lmg %r4,%r7,320(%r15) - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -73,18 +74,31 @@ safe_syscall_base: safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ icm %r0,15,0(%r8) - jne 2f + jne 1f svc 0 safe_syscall_end: -1: lg %r15,0(%r15) /* load back chain */ + /* code path for having successfully executed the syscall */ + lghi %r0, -4095 /* check for syscall error */ + clgr %r2, %r0 + jgnl 0f + +9: lg %r15,0(%r15) /* load back chain */ .cfi_remember_state .cfi_adjust_cfa_offset -160 lmg %r6,%r15,48(%r15) /* load saved registers */ br %r14 .cfi_restore_state -2: lghi %r2, -TARGET_ERESTARTSYS - j 1b + + /* code path when we didn't execute the syscall */ +1: lghi %r2, -TARGET_ERESTARTSYS + + /* code path setting errno */ +0: lcr %r2, %r2 /* create positive errno */ + st %r2, 0(%r9) /* store errno */ + lghi %r2, -1 + j 9b + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index f36992daa3..9a0c4c93b4 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -14,18 +14,17 @@ .global safe_syscall_end .type safe_syscall_base, @function - /* This is the entry point for making a system call. The calling + /* + * This is the entry point for making a system call. The calling * convention here is that of a C varargs function with the * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc - /* This saves a frame pointer and aligns the stack for the syscall. + /* + * This saves a frame pointer and aligns the stack for the syscall. * (It's unclear if the syscall ABI has the same stack alignment * requirements as the userspace function call ABI, but better safe than * sorry. Appendix A2 of http://www.x86-64.org/documentation/abi.pdf @@ -35,11 +34,12 @@ safe_syscall_base: .cfi_adjust_cfa_offset 8 .cfi_rel_offset rbp, 0 - /* The syscall calling convention isn't the same as the - * C one: - * we enter with rdi == *signal_pending - * rsi == syscall number - * rdx, rcx, r8, r9, (stack), (stack) == syscall arguments + /* + * The syscall calling convention isn't the same as the C one: + * we enter with rdi == &signal_pending + * rsi == &errno + * rdx == syscall number + * rcx, r8, r9, (stack...) == syscall arguments * and return the result in rax * and the syscall instruction needs * rax == syscall number @@ -48,17 +48,19 @@ safe_syscall_base: * Shuffle everything around appropriately. * Note that syscall will trash rcx and r11. */ - mov %rsi, %rax /* syscall number */ - mov %rdi, %rbp /* signal_pending pointer */ + mov %rdi, %r11 /* signal_pending pointer */ + mov %rsi, %rbp /* errno pointer */ + mov %rdx, %rax /* syscall number */ /* and the syscall arguments */ - mov %rdx, %rdi - mov %rcx, %rsi - mov %r8, %rdx - mov %r9, %r10 - mov 16(%rsp), %r8 - mov 24(%rsp), %r9 + mov %rcx, %rdi + mov %r8, %rsi + mov %r9, %rdx + mov 16(%rsp), %r10 + mov 24(%rsp), %r8 + mov 32(%rsp), %r9 - /* This next sequence of code works in conjunction with the + /* + * This next sequence of code works in conjunction with the * rewind_if_safe_syscall_function(). If a signal is taken * and the interrupted PC is anywhere between 'safe_syscall_start' * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. @@ -67,25 +69,31 @@ safe_syscall_base: */ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ - cmpl $0, (%rbp) - jnz 1f + cmpl $0, (%r11) + jnz 2f syscall safe_syscall_end: + /* code path for having successfully executed the syscall */ - pop %rbp + cmp $-4095, %rax + jae 0f + +9: pop %rbp .cfi_remember_state .cfi_def_cfa_offset 8 .cfi_restore rbp ret - -1: - /* code path when we didn't execute the syscall */ .cfi_restore_state - mov $-TARGET_ERESTARTSYS, %rax - pop %rbp - .cfi_def_cfa_offset 8 - .cfi_restore rbp - ret - .cfi_endproc + /* code path setting errno */ +0: neg %eax /* create positive errno */ +1: mov %eax, (%rbp) /* store errno */ + mov $-1, %rax + jmp 9b + + /* code path when we didn't execute the syscall */ +2: mov $TARGET_ERESTARTSYS, %eax + jmp 1b + + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base From patchwork Wed Nov 17 16:04:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519217 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1164521imj; Wed, 17 Nov 2021 08:05:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCgsFNE+u3pbjt6U8DOUsXqPcgSUjCCZA6VZq25bZzRtP5dsLxnCRmbJt4awpL1iFY+Jlt X-Received: by 2002:a05:6808:20e:: with SMTP id l14mr686511oie.119.1637165144275; Wed, 17 Nov 2021 08:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165144; cv=none; d=google.com; s=arc-20160816; b=kdJmpi/XKioWghzAfVO6YIy4RnvfSYK1MdGCqbMTPrxbNsDtSKtr8YYtC1rUEDqXPG r7sqNPUXuNq72F42WGSj3t02ZF3Vu2BSWmxlVPzwiCEEJW+Ol7wd9lYsfdDyu2dKo7kT AISrdDR/zBl/Z4PZCpeF/fxKpfEUjM7bnfibe9R9TNdLytpdN5Qk05lzdL58jl37QC1n LR4kcZ/CJYGOzCFt3U7M309XdDJT3UwGlcK6nWY1CLXtDDggRJ7qpRpVdHnGoDXtEBpJ ElJDr2GqJy66ljSAVS+g0uhnytxCHjpl3BqvKdol7b4pQZrN35on+xVQQ88nG0j5wawW +Yqg== 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=2fImwBgyiUxW2cyko0HSyaGAM3opUFv591S/8+t1daM=; b=XS/A3Yla7J2haubVRYJ7xYelOtuAducQSxaOLw4tKDJ2PRZAhEMRqqcjs7GVMPgtkI frhDSqKyvJAb4VWlP7+/F3aoifcpWMnz7ntSX+Hcia+DYlo9/DgSAUge8dP6bUJRe+Ba f1yb9Y+5PJc14lihtnzIjW2Ct5bTlq+PTCDLmfrswzKci/NJPIHM4AKmQaP8kktqeCoV uONyWpnqNuir/9IXXEPmgg6wlM00Tqg1MzBUT0v1uvC1d+Z3dmGg68Mfxgvcrx92zSP1 PTM4jhaBcJRlly+lvxsKcKYk2ydVleMfHVjDdYZg5pd5CQIBregkISzSD7HAfv+m0L/M GivQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wu+5e7of; 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=fail (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 h12si228518vsj.198.2021.11.17.08.05.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:05:44 -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=fail header.i=@linaro.org header.s=google header.b=wu+5e7of; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNRP-0000Bd-LA for patch@linaro.org; Wed, 17 Nov 2021 11:05:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQD-000098-7V for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:29 -0500 Received: from [2a00:1450:4864:20::42d] (port=41875 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQB-00032b-72 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:28 -0500 Received: by mail-wr1-x42d.google.com with SMTP id a9so5652879wrr.8 for ; Wed, 17 Nov 2021 08:04:26 -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=2fImwBgyiUxW2cyko0HSyaGAM3opUFv591S/8+t1daM=; b=wu+5e7ofA/OOBEA95ehmKjeTVCVHPJzJhXMi5p9R+MD5kZ6NbsXRL0n7vLDTfMVxD5 rxHpdrVk8RUqf/IWVeSgLivxoKSKOZ/mb7C5V2A48MQl3Ldyju8LZ/6yJ3XOnFEJlQe4 kYFcx1IENd6tzZpXIHx7Of+IYPwqUtHUhnV6RZfySSwExdUfGS9I/CDrvnxJPxRSBVfl A6oLiWcynqL0sh5xx+y8ABOPGPp1sOFxiJS4a2koSIesTYEyc1CvIkzk9OIWHXcy5mdD E5gRUH2tRKdmCtyrq5sEkBuH3TmuixKoXZdqCraE9FXa9XteB17Fobc5onAvsSEY4WGd 66AA== 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=2fImwBgyiUxW2cyko0HSyaGAM3opUFv591S/8+t1daM=; b=OQPuw4hYCDpYAhMQkO/t3UZyU8ruWHNnpx8Os1vEe4CisKUKN/p2bYlktVsvb5R7fa lTn2b/PBMwJal1vu2nKZ/nyf/Ou8QCeDiH3MDbjl5GHMsTSBamWMn9CfdBWrQz/7FDBv vzl1WKL4bubHCZvMPTNeT2iGqczsnIgGAF63C4I5ZEglQCt2ZJxvWL50MKekZD9jQDgZ ss0YhmB2nMj602j0/58FSuMckbhENKvaAeis7YkVpI8VcckYERpRo4iRov3ZrBYWZTm2 rtC9DiI4HuISLop+q2l5HCpe/yPIoYhWpqDPMoxEAWL6qFTrfntY1xTCPELfOhtuOuYg W5PQ== X-Gm-Message-State: AOAM533Zll5vQTjJpbiCpYyEpLYt2FEPX50v4GzNeEMazW2rXhqqcK4x t7R03hXFgpvoCR3j+BjuOIdNj7uvzHatzb5KrdE= X-Received: by 2002:a5d:64cc:: with SMTP id f12mr21231356wri.322.1637165065751; Wed, 17 Nov 2021 08:04:25 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 05/17] common-user/host/mips: Add safe-syscall.inc.S Date: Wed, 17 Nov 2021 17:04:00 +0100 Message-Id: <20211117160412.71563-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- common-user/host/mips/hostdep.h | 2 + common-user/host/mips/safe-syscall.inc.S | 135 +++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 common-user/host/mips/hostdep.h create mode 100644 common-user/host/mips/safe-syscall.inc.S diff --git a/common-user/host/mips/hostdep.h b/common-user/host/mips/hostdep.h new file mode 100644 index 0000000000..b18aca1deb --- /dev/null +++ b/common-user/host/mips/hostdep.h @@ -0,0 +1,2 @@ +/* We have a safe-syscall.inc.S */ +#define HAVE_SAFE_SYSCALL diff --git a/common-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S new file mode 100644 index 0000000000..1e2f5a079c --- /dev/null +++ b/common-user/host/mips/safe-syscall.inc.S @@ -0,0 +1,135 @@ +/* + * safe-syscall.inc.S : host-specific assembly fragment + * to handle signals occurring at the same time as system calls. + * This is intended to be included by linux-user/safe-syscall.S + * + * Written by Richard Henderson + * Copyright (C) 2021 Linaro, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "sys/regdef.h" +#include "sys/asm.h" + + .text + .set nomips16 + .set noreorder + + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_start, @function + .type safe_syscall_end, @function + + /* + * This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + */ + +#if _MIPS_SIM == _ABIO32 +/* Do not allocate a stack frame and store into the parameter space. */ +#define FRAME 0 +#define ERRNOP 4 +#else +/* Allocate a stack frame and store into the first allocated slot. */ +#define FRAME 16 +#define ERRNOP 0 +#endif + +NESTED(safe_syscall_base, FRAME, ra) + .cfi_startproc +#if _MIPS_SIM == _ABIO32 + /* + * The syscall calling convention is nearly the same as C: + * we enter with a0 == &signal_pending + * a1 == &errno + * a2 == syscall number + * a3, stack == syscall arguments + * and return the result in a0 + * and the syscall instruction needs + * v0 == syscall number + * a0 ... a3, stack == syscall arguments + * and returns the result in v0 + * Shuffle everything around appropriately. + */ + move t0, a0 /* signal_pending pointer */ + sw a1, ERRNOP(sp) /* errno pointer */ + move v0, a2 /* syscall number */ + move a0, a3 /* syscall arguments */ + lw a1, 16(sp) + lw a2, 20(sp) + lw a3, 24(sp) + lw t4, 28(sp) + lw t5, 32(sp) + lw t6, 40(sp) + lw t7, 44(sp) + sw t4, 16(sp) + sw t5, 20(sp) + sw t6, 24(sp) + sw t7, 28(sp) +#else + PTR_ADDIU sp, sp, -FRAME + .cfi_adjust_cfa_offset FRAME + + /* + * The syscall calling convention is nearly the same as C: + * we enter with a0 == &signal_pending + * a1 == &errno + * a2 == syscall number + * a3 ... a7, stack == syscall arguments + * and return the result in a0 + * and the syscall instruction needs + * v0 == syscall number + * a0 ... a5 == syscall arguments + * and returns the result in v0 + * Shuffle everything around appropriately. + */ + move t0, a0 /* signal_pending pointer */ + PTR_S a1, ERRNOP(sp) /* save errno pointer */ + move v0, a2 /* syscall number */ + move a0, a3 /* syscall arguments */ + move a1, a4 + move a2, a5 + move a3, a6 + move a4, a7 + ld a5, 16(sp) +#endif + + /* + * This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ +safe_syscall_start: + /* If signal_pending is non-zero, don't do the call */ + lw t1, 0(t0) + bnez t1, 0f + nop + syscall +safe_syscall_end: + + /* code path for having successfully executed the syscall */ + bnez a3, 1f + nop + jr ra + PTR_ADDIU sp, sp, FRAME + + /* code path when we didn't execute the syscall */ +0: li v0, TARGET_ERESTARTSYS + + /* code path setting errno */ +1: PTR_L t0, ERRNOP(sp) + sw v0, 0(t0) /* store errno */ + li v0, -1 + jr ra + PTR_ADDIU sp, sp, FRAME + + .cfi_endproc +END(safe_syscall_base) From patchwork Wed Nov 17 16:04:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519216 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1164414imj; Wed, 17 Nov 2021 08:05:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHN7c52igRazgGqOtGYbIDO/lp2zncpqtAy0kas7u7pmmIsxQsz08W95BL4RRgbhPx6d1o X-Received: by 2002:a0c:e84b:: with SMTP id l11mr55988742qvo.25.1637165140535; Wed, 17 Nov 2021 08:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165140; cv=none; d=google.com; s=arc-20160816; b=lFzFBdyghTF6rNASFXEX+tpAHgOOKPqmWXqMxOD3W5fK11jOAD4MCrxGvb559X7fQI A6Py11VqD4xHhxrOZXUKiVweLhysCDOM0WwEe0GMiXlLCRes8/PL1vGBzB+ZqTtl54+k 7xH2mwEPgccycxqMKNWaQV0IFygC1sA8J3NbNJcQSK0jmfSDBZ8C/a7C9LKrcID4wZqW ybmxrGpegXUcTZ8BvTkNjaf0+onkyDKD0joFUZwuL+PC1FXCuFWiZMSSGC4c0HDA5wC+ kXtNqFqAOLHPkF/0W6vLUe6Q7osrc+y1tzmI1R54pEpc88rSFqbkn3FzAGeJ8c/ZbiX4 GavQ== 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=Si5w/xVL8tcePRB9XtTS7XLZl+YblTkzCMS4YZk/72Q=; b=x5c17teejKzWclQPcUzRIXr5DPJZZiMOvwgqv0dw6zpHlgJjVwNLAuyXHrUlDkb/iT ZbnuDkeg1Ft4n498U2lPOpWcaXDhPreUXt+ecILqQdOPhIdwJVbIckWTHeGVjlhxLSda zmprbYpnKqgKVhGs7ijo2hCnpusisGingr6+MX6tqNknTH7kzHFwKpBytS30yXKSTGyT b7pRzVSkrvEZhyS37x9YQ3G3vJx0Oje/qRqZTvuNi+c+TdZASOzv53plvpXDgJcrVZun HZ1GlXDYfkiUqhqroUOkOoDX5lFIpHWaYAZpQMsG2NwoSZUHqBalS7gYOGeoySCSem7M 0Ghw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YZR+tSRc; 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=fail (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 r14si124390qkp.382.2021.11.17.08.05.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:05:40 -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=fail header.i=@linaro.org header.s=google header.b=YZR+tSRc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNRL-0000FJ-Ur for patch@linaro.org; Wed, 17 Nov 2021 11:05:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQE-0000CZ-AS for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:30 -0500 Received: from [2a00:1450:4864:20::430] (port=46645 helo=mail-wr1-x430.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQC-00032p-MD for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:30 -0500 Received: by mail-wr1-x430.google.com with SMTP id u1so5619153wru.13 for ; Wed, 17 Nov 2021 08:04:28 -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=Si5w/xVL8tcePRB9XtTS7XLZl+YblTkzCMS4YZk/72Q=; b=YZR+tSRcjCXXQO/r+eXQrtqVq8pFznmlG2Y8TSTd+cNRsWIjd4e2RUmvsy01YrD+EU dTFGDMBXxSaPF+mZrpznJC/Ba8lKi+2LKCS65dM0I1cKGuUEmlxLuyvQx/QSdkLwRMii TdTCbAkWd/uu9pspGWsa/VdnTrRuVy+gASv8bOl0NEEjxqB31eU+9ZMG7ao7QaV+yi7Q v1vC1w6sbVeCaIwHG0B0Ct3h+FbQIdcRu2JR4rPwySQYWoSxLsa1yQQliYgkqIEs2+Uq u01Y0fTc6nsU+SHUFAuYd2cnUTOYmCbjTJs4J8lEOUyOtHMC3BaRNJ9T9Va8RH+D+C4J xHew== 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=Si5w/xVL8tcePRB9XtTS7XLZl+YblTkzCMS4YZk/72Q=; b=SlDevN+WZP6z9UGgV+/C0O/cq0nTEr6yXQfQuAsrnhXv5JsnF72PgAamYLgcqkMyZJ xuF4xdwDNLZZYrPRqZCPVMYqPEhmEHBKJe7m+Cgc2f7BKg6MIYghERJJfbbb7masZzsM JuLjTqj5r+94PN5/26AO//cXF7zbOhNwuS3Gc0xcpBs7OWpDT8eyqjlEKHyX0MdxWhJI ofPdtzMkMijbBnzSr9UUhc2bATL7ahz6WrrbDfDIlfnbX4zcQypA6Ajss7N7qBrNR6Tw oNj+p4yLBGt2H15g+jtJC8iT5wQszIjXp1d6HriGxdjHuQK3WYSJ96dQ3tYHGBOt5ZAl o6aQ== X-Gm-Message-State: AOAM530Vkyj9TXjtWdo0XpuPJwinFIvNZwcRUGPp9p+ek+UO7sRLEblB 9YqSxYbXsBjjjzF8j327/p6TSVenkV/vTpCEgp4= X-Received: by 2002:a5d:47a1:: with SMTP id 1mr20528072wrb.436.1637165067332; Wed, 17 Nov 2021 08:04:27 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 06/17] common-user/host/sparc64: Add safe-syscall.inc.S Date: Wed, 17 Nov 2021 17:04:01 +0100 Message-Id: <20211117160412.71563-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::430 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- common-user/host/sparc64/hostdep.h | 2 + common-user/host/sparc64/safe-syscall.inc.S | 91 +++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 common-user/host/sparc64/hostdep.h create mode 100644 common-user/host/sparc64/safe-syscall.inc.S diff --git a/common-user/host/sparc64/hostdep.h b/common-user/host/sparc64/hostdep.h new file mode 100644 index 0000000000..b18aca1deb --- /dev/null +++ b/common-user/host/sparc64/hostdep.h @@ -0,0 +1,2 @@ +/* We have a safe-syscall.inc.S */ +#define HAVE_SAFE_SYSCALL diff --git a/common-user/host/sparc64/safe-syscall.inc.S b/common-user/host/sparc64/safe-syscall.inc.S new file mode 100644 index 0000000000..2492fcbd9e --- /dev/null +++ b/common-user/host/sparc64/safe-syscall.inc.S @@ -0,0 +1,91 @@ +/* + * safe-syscall.inc.S : host-specific assembly fragment + * to handle signals occurring at the same time as system calls. + * This is intended to be included by linux-user/safe-syscall.S + * + * Written by Richard Henderson + * Copyright (C) 2021 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + + .text + .balign 4 + + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function + .type safe_syscall_start, @object + .type safe_syscall_end, @object + +#define STACK_BIAS 2047 +#define PARAM(N) STACK_BIAS + N*8 + + /* + * This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + */ +safe_syscall_base: + .cfi_startproc + /* + * The syscall calling convention isn't the same as the C one: + * we enter with o0 == *signal_pending + * o1 == errno + * o2 == syscall number + * o3 ... o5, (stack) == syscall arguments + * and return the result in x0 + * and the syscall instruction needs + * g1 == syscall number + * o0 ... o5 == syscall arguments + * and returns the result in o0 + * Shuffle everything around appropriately. + */ + mov %o0, %g2 /* signal_pending pointer */ + stx %o1, [%sp + PARAM(1)] /* save errno pointer */ + mov %o2, %g1 /* syscall number */ + mov %o3, %o0 /* syscall arguments */ + mov %o4, %o1 + mov %o5, %o2 + ldx [%sp + PARAM(6)], %o3 + ldx [%sp + PARAM(7)], %o4 + ldx [%sp + PARAM(8)], %o5 + + /* + * This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ +safe_syscall_start: + /* if signal_pending is non-zero, don't do the call */ + lduw [%g2], %g3 + brnz,pn %g3, 2f + nop + ta 0x6d +safe_syscall_end: + + /* code path for having successfully executed the syscall */ + bcc,pt %xcc, 9f + nop + + /* code path setting errno */ +1: ldx [%sp + PARAM(1)], %g2 + stw %o0, [%g2] /* store errno */ + set -1, %o0 + +9: ret + nop + + /* code path when we didn't execute the syscall */ +2: ba,pt %xcc, 1b + set TARGET_ERESTARTSYS, %o0 + + .cfi_endproc + .size safe_syscall_base, .-safe_syscall_base From patchwork Wed Nov 17 16:04:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519220 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1168331imj; Wed, 17 Nov 2021 08:08:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmwpfURRODTbDE0waG6zZmmbKdKMjTigb+ApwTwiiw0qwviB0MVPwBlpHE87rPKii2s2vX X-Received: by 2002:a1c:21d7:: with SMTP id h206mr926459wmh.60.1637165305353; Wed, 17 Nov 2021 08:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165305; cv=none; d=google.com; s=arc-20160816; b=Xnv0T+5rfHxZh7FSkU6yGI+LzdRWNgWe5vR4l/KFvAQf1ZEkHhy0UJCGuiuWsuB7iS sab7ynTTmMLhHsfO6Y+ZXXM8nZcWGXg2kXq7v7o9S8w53Nz3kNelC74hP9FoZxP57bJY v4Bt6pJRfL12k0IOqEEMkQ0+ca3dAFfXyOnNTpLAFzFqgVIf4vjO9p23QWT2UIxjwNpP EAzQkw81Zv2PZDe/mxMw+BMmiQVffAlkXvTgDiIHFBT8iXWbBJ8WaK6OT/yb5NkxgF3E QMkUe6vD+mli77DvK4JbO+UAXD0ul6xjth4CQIIYhAwOeMrKZK5GuSOcmC1BD2hp0bCw KzSQ== 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=AZfgAKkswGw5hwWFtxK4S1taRtK+cQrzozvut2eah7Q=; b=T5gf1RLmLG8aNFW8OdhFIbKpGsHc6o8f2WUnWlTaqfjoYwv4jscqqZ6IroXzc2AnMj knVqv+9tJYR5tc7WAuVCsRVMbz6mAzewuX4mXH5rhJYtHdain4REY1JxRqRKpSOQbrvN fHaqIaN9OV6BKFR4qvUGamrye/GidHM2uAUg3AkCueZtYJoGlYFRGeGJAy0w88BhLBQ8 Wn7k8BFMq7EKobDls2yMGg3nuXUSOyIAQjBjz6DUFBe4vOYNkVcG6xrohuiCDCxAk7GS 9hkviU9ndy3xB7NUH/sgukZpoH9ahIFlwug5+JlLjeDudejs4DRxa4/zJ5m9ew21mVkX Hnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ikKi5emq; 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=fail (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 n22si142263wmo.48.2021.11.17.08.08.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:08:25 -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=fail header.i=@linaro.org header.s=google header.b=ikKi5emq; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNU0-00067X-6i for patch@linaro.org; Wed, 17 Nov 2021 11:08:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQG-0000Hi-Mt for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:32 -0500 Received: from [2a00:1450:4864:20::432] (port=44696 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQE-000336-Bo for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:32 -0500 Received: by mail-wr1-x432.google.com with SMTP id n29so5629033wra.11 for ; Wed, 17 Nov 2021 08:04:29 -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=AZfgAKkswGw5hwWFtxK4S1taRtK+cQrzozvut2eah7Q=; b=ikKi5emqQM8kDm7Q92iixQwd/jEnJnVRPF7Ef6OPhCP+MaYhbYVCfu2k4EyDrTN4sd Dhdwe1JHIb5QDOeM7eps0DhyEVQmmTMNNk/pMuBAoKrbaWgqU0+cLiImQp+QL9ZbfHIM bT0xbBFUnYjCZjXt4jJ0p7RCLa1caPPaCdSbUncQbvnYl7wyrrZTsWpc4KTSm3NeX4ZR +n81Ygus3T8UepvYJjRXPKsA6Vs1LxvqJi2i6wTqk9r02a+l17j8iYNbzptS2IqAgP1B Fh2BRDBnlThDeluW49TaIa0Y5wovUIO37jdAhrRayWuXxWsBC5pzuudjqoIIHiLb2lzv HnMA== 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=AZfgAKkswGw5hwWFtxK4S1taRtK+cQrzozvut2eah7Q=; b=6QevYfM2R1sl90CDQI37dpICHAAhN3eYbPM060tsACtRq9hGG8Q3PmDZEtCIbbtSLM dHNnpGuMrFYJ0hFWjO0JYJHJSlKSn0XJLyNMhzTxYYqrEu/wuawbkofln+dNiYvcjdJg LsWOxaDCM7/+PH2f9OEXIRbzwfuULFu3Nq20e03+pf912HenPGqrQtFBPSWgr3Zv6qTs 3lvrdQ/hX0S6oCx6y+rJMpjkmY3ytlTfSmXg2YvtdiPCimap7XQFEy/7DmKP/tGazxrB HmV9bfSotP13c4uGjMkQYtjVG7rcG/0A3ezbKqAdfuIqjbv6uOXWaE4S2y4tIOrI+x50 UxBg== X-Gm-Message-State: AOAM532eAT959lWb4wf+WsxLXcscVRz8Lpa7TT8l03SBOkTxIyCC0Fcu pffVdEA2mGsGQY8GxU2YV4AMOPmdmwDAlve4SE0= X-Received: by 2002:adf:e747:: with SMTP id c7mr21874322wrn.38.1637165068845; Wed, 17 Nov 2021 08:04:28 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/17] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Date: Wed, 17 Nov 2021 17:04:02 +0100 Message-Id: <20211117160412.71563-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All supported hosts now define HAVE_SAFE_SYSCALL, so remove the ifdefs. This leaves hostdep.h empty, so remove it. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- common-user/host/aarch64/hostdep.h | 18 ------------------ common-user/host/arm/hostdep.h | 18 ------------------ common-user/host/i386/hostdep.h | 18 ------------------ common-user/host/mips/hostdep.h | 2 -- common-user/host/ppc64/hostdep.h | 18 ------------------ common-user/host/riscv/hostdep.h | 14 -------------- common-user/host/s390x/hostdep.h | 18 ------------------ common-user/host/sparc64/hostdep.h | 2 -- common-user/host/x86_64/hostdep.h | 18 ------------------ linux-user/host/ia64/hostdep.h | 15 --------------- linux-user/host/mips/hostdep.h | 15 --------------- linux-user/host/ppc/hostdep.h | 15 --------------- linux-user/host/s390/hostdep.h | 15 --------------- linux-user/host/sparc/hostdep.h | 15 --------------- linux-user/host/sparc64/hostdep.h | 15 --------------- linux-user/host/x32/hostdep.h | 15 --------------- linux-user/safe-syscall.h | 12 ------------ linux-user/user-internals.h | 1 - linux-user/signal.c | 2 -- linux-user/safe-syscall.S | 3 --- 20 files changed, 249 deletions(-) delete mode 100644 common-user/host/aarch64/hostdep.h delete mode 100644 common-user/host/arm/hostdep.h delete mode 100644 common-user/host/i386/hostdep.h delete mode 100644 common-user/host/mips/hostdep.h delete mode 100644 common-user/host/ppc64/hostdep.h delete mode 100644 common-user/host/riscv/hostdep.h delete mode 100644 common-user/host/s390x/hostdep.h delete mode 100644 common-user/host/sparc64/hostdep.h delete mode 100644 common-user/host/x86_64/hostdep.h delete mode 100644 linux-user/host/ia64/hostdep.h delete mode 100644 linux-user/host/mips/hostdep.h delete mode 100644 linux-user/host/ppc/hostdep.h delete mode 100644 linux-user/host/s390/hostdep.h delete mode 100644 linux-user/host/sparc/hostdep.h delete mode 100644 linux-user/host/sparc64/hostdep.h delete mode 100644 linux-user/host/x32/hostdep.h diff --git a/common-user/host/aarch64/hostdep.h b/common-user/host/aarch64/hostdep.h deleted file mode 100644 index 39299d798a..0000000000 --- a/common-user/host/aarch64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef AARCH64_HOSTDEP_H -#define AARCH64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/arm/hostdep.h b/common-user/host/arm/hostdep.h deleted file mode 100644 index 86b137875a..0000000000 --- a/common-user/host/arm/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef ARM_HOSTDEP_H -#define ARM_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/i386/hostdep.h b/common-user/host/i386/hostdep.h deleted file mode 100644 index ce7136501f..0000000000 --- a/common-user/host/i386/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef I386_HOSTDEP_H -#define I386_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/mips/hostdep.h b/common-user/host/mips/hostdep.h deleted file mode 100644 index b18aca1deb..0000000000 --- a/common-user/host/mips/hostdep.h +++ /dev/null @@ -1,2 +0,0 @@ -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL diff --git a/common-user/host/ppc64/hostdep.h b/common-user/host/ppc64/hostdep.h deleted file mode 100644 index 0c290dd904..0000000000 --- a/common-user/host/ppc64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef PPC64_HOSTDEP_H -#define PPC64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/riscv/hostdep.h b/common-user/host/riscv/hostdep.h deleted file mode 100644 index 7f67c22868..0000000000 --- a/common-user/host/riscv/hostdep.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef RISCV_HOSTDEP_H -#define RISCV_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/s390x/hostdep.h b/common-user/host/s390x/hostdep.h deleted file mode 100644 index d801145854..0000000000 --- a/common-user/host/s390x/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef S390X_HOSTDEP_H -#define S390X_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/common-user/host/sparc64/hostdep.h b/common-user/host/sparc64/hostdep.h deleted file mode 100644 index b18aca1deb..0000000000 --- a/common-user/host/sparc64/hostdep.h +++ /dev/null @@ -1,2 +0,0 @@ -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL diff --git a/common-user/host/x86_64/hostdep.h b/common-user/host/x86_64/hostdep.h deleted file mode 100644 index 9c62bd26bd..0000000000 --- a/common-user/host/x86_64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef X86_64_HOSTDEP_H -#define X86_64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/ia64/hostdep.h b/linux-user/host/ia64/hostdep.h deleted file mode 100644 index 263bf7658e..0000000000 --- a/linux-user/host/ia64/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef IA64_HOSTDEP_H -#define IA64_HOSTDEP_H - -#endif diff --git a/linux-user/host/mips/hostdep.h b/linux-user/host/mips/hostdep.h deleted file mode 100644 index ba111d75c3..0000000000 --- a/linux-user/host/mips/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef MIPS_HOSTDEP_H -#define MIPS_HOSTDEP_H - -#endif diff --git a/linux-user/host/ppc/hostdep.h b/linux-user/host/ppc/hostdep.h deleted file mode 100644 index 23d8bd9d47..0000000000 --- a/linux-user/host/ppc/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef PPC_HOSTDEP_H -#define PPC_HOSTDEP_H - -#endif diff --git a/linux-user/host/s390/hostdep.h b/linux-user/host/s390/hostdep.h deleted file mode 100644 index afcba5a16a..0000000000 --- a/linux-user/host/s390/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef S390_HOSTDEP_H -#define S390_HOSTDEP_H - -#endif diff --git a/linux-user/host/sparc/hostdep.h b/linux-user/host/sparc/hostdep.h deleted file mode 100644 index 391ad923cf..0000000000 --- a/linux-user/host/sparc/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef SPARC_HOSTDEP_H -#define SPARC_HOSTDEP_H - -#endif diff --git a/linux-user/host/sparc64/hostdep.h b/linux-user/host/sparc64/hostdep.h deleted file mode 100644 index ce3968fca0..0000000000 --- a/linux-user/host/sparc64/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef SPARC64_HOSTDEP_H -#define SPARC64_HOSTDEP_H - -#endif diff --git a/linux-user/host/x32/hostdep.h b/linux-user/host/x32/hostdep.h deleted file mode 100644 index 2c2d6d37da..0000000000 --- a/linux-user/host/x32/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef X32_HOSTDEP_H -#define X32_HOSTDEP_H - -#endif diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index ea0e8a8d24..0deb87e51a 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -124,7 +124,6 @@ * need to check SA_RESTART flags in QEMU or distinguish the various * kinds of restartability. */ -#ifdef HAVE_SAFE_SYSCALL /* The core part of this function is implemented in assembly. */ extern long safe_syscall_base(int *pending, int *errnop, long number, ...); @@ -137,15 +136,4 @@ extern char safe_syscall_end[]; safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ &errno, __VA_ARGS__) -#else - -/* - * Fallback for architectures which don't yet provide a safe-syscall assembly - * fragment; note that this is racy! - * This should go away when all host architectures have been updated. - */ -#define safe_syscall syscall - -#endif - #endif diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index 661612a088..f71f372829 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -18,7 +18,6 @@ #ifndef LINUX_USER_USER_INTERNALS_H #define LINUX_USER_USER_INTERNALS_H -#include "hostdep.h" #include "exec/user/thunk.h" #include "exec/exec-all.h" #include "qemu/log.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 6d5e5b698c..ca8f24b9ec 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -798,7 +798,6 @@ int queue_signal(CPUArchState *env, int sig, int si_type, /* Adjust the signal context to rewind out of safe-syscall if we're in it */ static inline void rewind_if_in_safe_syscall(void *puc) { -#ifdef HAVE_SAFE_SYSCALL ucontext_t *uc = (ucontext_t *)puc; uintptr_t pcreg = host_signal_pc(uc); @@ -806,7 +805,6 @@ static inline void rewind_if_in_safe_syscall(void *puc) && pcreg < (uintptr_t)safe_syscall_end) { host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); } -#endif } static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S index 42ea7c40ba..7ddc997801 100644 --- a/linux-user/safe-syscall.S +++ b/linux-user/safe-syscall.S @@ -10,15 +10,12 @@ * See the COPYING file in the top-level directory. */ -#include "hostdep.h" #include "target_errno_defs.h" /* We have the correct host directory on our include path * so that this will pull in the right fragment for the architecture. */ -#ifdef HAVE_SAFE_SYSCALL #include "safe-syscall.inc.S" -#endif /* We must specifically say that we're happy for the stack to not be * executable, otherwise the toolchain will default to assuming our From patchwork Wed Nov 17 16:04:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519225 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1172799imj; Wed, 17 Nov 2021 08:11:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtW5T0MUsk0lE+Gf+DqRor/L7hjVZk2PRzCofchopvWDSAoRvll8Q/T3td0xFkVesSjK+j X-Received: by 2002:ab0:6e92:: with SMTP id b18mr25708468uav.101.1637165497316; Wed, 17 Nov 2021 08:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165497; cv=none; d=google.com; s=arc-20160816; b=B1/lEffhBs3DIK0yW0qw6BQABf1mnuFPEbmEqP0poi7P/eXlSOip384nsUs/nS18ZD fofJiLYL3yard5JpaLjMB3eI9WZ5N8+9nRJM1GI+F5/KnVUBXmLW+C6M1DnjIripn8Oh YCfecKWihX1g4N8vP9dAwKuD6Jvu5cWpAaDwvVLHmS45SxYKF6xVmxKgfOjuAWtFcIKA A9O662/3hPKElvv+VtSgYYeNMTbcfK2aJEGyV5EzL7IW9wPlHE5smfjmb12PBadZzPDB RMGgWPApJCuTI3JlC47+Tl+70oU7a4zOJLW7wSqsOjsDcBQ1wfuxD0CWwyHynAGhdtJl 8Sbw== 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=IaZ8V/ONic8Ys5rmKynWN7qHC6dKp3nMuaxeyGdYyPo=; b=fpFYvbsndRyKylBoz5kHj0bZ0Kq9IhiuJkRyEfCtmisH2LBBSdVLkPnJFUv5EZO4PS lKDSP53BgkX8QqK4sWe3diILoTSj4E8nc6DMsU0Lp2ZyMnn581a4NQkOiQXZzEIh5C2r 60/Nf5CQi6kZhrCBRE+lroDDnKf0PNK7pYcMLYIoaJk0S7slyAVNDs1XQJ7XMiPfIJrX xqCLXrc5JT4kEuRI+K7tacoj/P+4UfQi8MTT1LFbRyxQ7erjkVheTFt7TOgW3gfR7XOj reYm7RO65CRExChN8Jb9Cb3coul7s5DmLEgLJoRP+v5DqqbTtMw94O50GrlUVB1FNkh6 x+WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uAcNK8WA; 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=fail (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 z5si294413vsi.360.2021.11.17.08.11.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:11:37 -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=fail header.i=@linaro.org header.s=google header.b=uAcNK8WA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNX6-0004ne-Nl for patch@linaro.org; Wed, 17 Nov 2021 11:11:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQH-0000Ln-IK for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:33 -0500 Received: from [2a00:1450:4864:20::429] (port=37393 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQF-00033J-Uu for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:33 -0500 Received: by mail-wr1-x429.google.com with SMTP id b12so5665041wrh.4 for ; Wed, 17 Nov 2021 08:04:31 -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=IaZ8V/ONic8Ys5rmKynWN7qHC6dKp3nMuaxeyGdYyPo=; b=uAcNK8WAD0lk6DL5AlXo7OICncTMRozM6r1JZ+EPw08mS8Ting6RvlPMqecR6i1B+1 JS8SCTFXdl7l58xyKQX27isaN3akfLCaJoJ5BNRp4GRigtgPTN0kiw/4stLlTviLkfZh X2RkLTZfL25vij4fFxZh9/9yfaBmSYd/a1cQdNShMVFD/5gCWmHcqjIPnudXAfovFF1U btZ8tcWCg6APsqsxKQF7yx/TWBZvhA3iA4W1qSTJHI0DfXc7YuWLvjNXWBAuf/ALxe+S LjBhHalROwanCvgUfIgC6BLnm2GlYm78OISKV6WlEKxGtQEpMG+BRgwltFvjI9ZdXd8k zK1g== 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=IaZ8V/ONic8Ys5rmKynWN7qHC6dKp3nMuaxeyGdYyPo=; b=5eP6SR4y4N/m/XkjieWI5p8d2UJGkXUSYPIea1u2ZJfYYCHuM5uycGuEV6okAnpn8P ddtSS8b4hLFD2UuKtd/iwdbL5v2o8+G+fyvy/HO/an1QiyQmA3EKdzOE+PP/fhQ/ceWi YB1yfJ7pI3Y+U+UuyKm184SbjOjgfstWT7ufOyABeU8yuqBizjenOnAaA3eMnP4tQI3t Ojh9cQH9dS49LbNXV5PLNZxpADChI4Lsr+6W98dV0T27LK1m3yVJw9k3j/x78qRJk+w8 nb/6mwbmEz2UBgyP9A0E3t6FC8TRj5zWO06yJhyEUb7sBKO4l07wXGY8nVJrQbIyHyYZ DUEw== X-Gm-Message-State: AOAM533X3UO8T4ww57tH7X9MY/Gxqfm2mCjKdEMnq5LAXTooBOGDHYie yg1gXzuiq0yJkjSND45G5Wn5NerKOTbOXjLgLls= X-Received: by 2002:adf:e78c:: with SMTP id n12mr21162458wrm.83.1637165070268; Wed, 17 Nov 2021 08:04:30 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 08/17] common-user: Adjust system call return on FreeBSD Date: Wed, 17 Nov 2021 17:04:03 +0100 Message-Id: <20211117160412.71563-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh FreeBSD system calls return positive errno. On the 4 hosts for which we have support, error is indicated by the C bit set or clear. Signed-off-by: Warner Losh [rth: Rebase on new safe_syscall_base api; add #error check.] Signed-off-by: Richard Henderson --- common-user/host/aarch64/safe-syscall.inc.S | 12 +++++++++++- common-user/host/arm/safe-syscall.inc.S | 11 +++++++++++ common-user/host/i386/safe-syscall.inc.S | 10 ++++++++++ common-user/host/x86_64/safe-syscall.inc.S | 10 ++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index 95c60d8609..d3f065cdef 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -65,12 +65,22 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ - cmn x0, #4095 +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ + cmn x0, #4096 + b.hi 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ b.cs 1f +#else +#error "unsupported os" +#endif ret /* code path setting errno */ +#ifdef __linux__ 0: neg w0, w0 /* create positive errno */ +#endif 1: str w0, [x11] /* store errno */ mov x0, #-1 ret diff --git a/common-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S index 17839c6486..328299021d 100644 --- a/common-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -82,12 +82,23 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp r0, #-4096 bhi 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + bcs 1f +#else +#error "unsupported os" +#endif + 9: pop { r4, r5, r6, r7, r8, r9, r10, pc } /* code path setting errno */ +#ifdef __linux__ 0: neg r0, r0 /* create positive errno */ +#endif 1: str r0, [r9] /* store errno */ mov r0, #-1 b 9b diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index ad89521783..c27207492a 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -76,8 +76,16 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp $-4095, %eax jae 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + jc 1f +#else +#error "unsupported os" +#endif 9: pop %ebx .cfi_remember_state @@ -97,7 +105,9 @@ safe_syscall_end: .cfi_restore_state /* code path setting errno */ +#ifdef __linux__ 0: neg %eax /* create positive errno */ +#endif 1: mov 8+16(%esp), %ebx /* load errno pointer */ mov %eax, (%ebx) /* store errno */ mov $-1, %eax diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index 9a0c4c93b4..e3f920fa5c 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -75,8 +75,16 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp $-4095, %rax jae 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + jc 1f +#else +#error "unsupported os" +#endif 9: pop %rbp .cfi_remember_state @@ -86,7 +94,9 @@ safe_syscall_end: .cfi_restore_state /* code path setting errno */ +#ifdef __linux__ 0: neg %eax /* create positive errno */ +#endif 1: mov %eax, (%rbp) /* store errno */ mov $-1, %rax jmp 9b From patchwork Wed Nov 17 16:04:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519219 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1168300imj; Wed, 17 Nov 2021 08:08:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxj+xqL2f7ciiHoVjwLSYYf7+ya9dBB0sxOngnL70tBWONOrHRjT9lOBFOgG/LWNENrlZtC X-Received: by 2002:a5d:6da5:: with SMTP id u5mr22161970wrs.374.1637165304052; Wed, 17 Nov 2021 08:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165304; cv=none; d=google.com; s=arc-20160816; b=e5f5DzF+egTxw41ud7t1m5LwABJqhiI4fes9qqKPGiBVwT/okwFBIJWYJ3ebUxkF/Y ydkGkLCQS2Wcj7qhDBOez2Ze5n/B8GNElbNyTOAbQT+TCItx36SmJUXlDav9T4qk7XI0 qYit4bvCr3ebYpgIUH7atF7pcnybS6iVC/oKVAXWVLWxwOsjYyV89NGhLQ+7+SQNr4RB HnTBre+VqXOBnojauOy1XdRIL6EdsynSs2w3XMFkmdC489Dvrl8D1BCejOk84dXalJ6m C8epNF1wYEDy/L4dmf2SmHWqJ6cgMR8ghg7RAuUdTbg1E79StXdx2oJjD7l6MqNSTtUf +PCA== 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=89Fa/Tur9qVyNBoDHh7CWeamjUn5Uv3GJaQJZqkaJN0=; b=fKtVeDcHwscYf4ODmAoVL5zcFEya8swPv1YQ3eL+04n5gX/jKpihsB6XCwvjRORTpj rJVlyNw0ew/EBE81fLTTPmJf6M6kV3Ls5hPXFxe09S+8vr3COVlFKwrLTSdvBAqvat6D g87E02NpzZJ3TpOR7oVk37hvDZxbfFVZ8ffnlChLfD5qhHWZFiblAqWJ0SuPw2rA1+ya 9bCJN/1g6UiffbLsjL1rrF0NqpCJ+JYlIIuKSyRw7WnPYBsUAfw+Dt8m86joS31x5lAq ewOThpyL8F6oQTVHO+GM6xebKH8t76/+suQNhQaKtgTxMEzMM8O1BCkgtvz5i/U1jssm UXtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qrXd8Pji; 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=fail (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 l5si961671wry.27.2021.11.17.08.08.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:08:24 -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=fail header.i=@linaro.org header.s=google header.b=qrXd8Pji; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNTy-00060m-Nx for patch@linaro.org; Wed, 17 Nov 2021 11:08:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQK-0000Ot-33 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:37 -0500 Received: from [2a00:1450:4864:20::435] (port=39826 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQH-00033f-9M for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:35 -0500 Received: by mail-wr1-x435.google.com with SMTP id d27so5661879wrb.6 for ; Wed, 17 Nov 2021 08:04:32 -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=89Fa/Tur9qVyNBoDHh7CWeamjUn5Uv3GJaQJZqkaJN0=; b=qrXd8PjiasFiLu/12b5Hr6jdl6ahH0DmZKgOl1KoQ7AuYsOplHu8td0ERaH+uzB/yC +9kb8iFtekU3mZCKmb3T0e2dbsyGd5vdtGk/PWldaaSE16ayA5STWeetukjRIryzABRx G3SvtB2iOpmVepWA5g9WElcZk2GAC9aAnK4k83PSNCM4v/+J1Tz+O6+Bve7NQ3CUAagI EcW9LX7S/C3Wlc93dQwHRtV8C0LIiWt0Vhb4DaGK9yfbyQ/DkyjueWwrXguk+VGUAoeH IQnN9B2Cdg4NcMlCiZkQv3386OMPr6/w0Usnw/Ru/Sbn7xHMJXtM7Ip76wpF6pMRBxqW BSMQ== 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=89Fa/Tur9qVyNBoDHh7CWeamjUn5Uv3GJaQJZqkaJN0=; b=CntGghYbEwjjXwj2UjZVf9ivJZP0pvvpRF2iDyUVdSTN2D5y3vqgugw+HZBc6nfjFL mOEc2E3PCHQ862ejct44JxW4NBCpmgdSXxCnWDkoUqhKiC5h8IRwYke0xAOz0rHiCJwB 7LIHp073JiOEiodbUdNWs2ha+cX+YxPUinGSgi9xe+L8yGARHchkkvs3BjG9TDytR8Yw a5kSj0gEcv82dasodTQW2ARRZZJJHgTDuD5GYb+IcXf/tu0e/w6oUHRQq74nMyc+h65g oMIE1qerxXmTrIkHw2BnS9IzUlT+BHCwtrhnJc55ok1aZk7mH+awORNVwI5ek87o1QXm hx6A== X-Gm-Message-State: AOAM531qVFeR62dyAEkLHFYzkIydQZMcdFRBj13xPC20iV9C/9pYTKEJ lyIC6Rtnj2azQ2ArPN/Qz+WFqeJu8GUUdJbBwLA= X-Received: by 2002:adf:d4c2:: with SMTP id w2mr21847721wrk.225.1637165071686; Wed, 17 Nov 2021 08:04:31 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 09/17] *-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Date: Wed, 17 Nov 2021 17:04:04 +0100 Message-Id: <20211117160412.71563-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::435 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is fully internal to qemu, and so is not a TARGET define. We use this as an extra marker for both host and target errno. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé --- bsd-user/errno_defs.h | 2 +- linux-user/generic/target_errno_defs.h | 2 +- linux-user/safe-syscall.h | 8 ++++---- linux-user/signal-common.h | 2 +- linux-user/aarch64/cpu_loop.c | 2 +- linux-user/alpha/cpu_loop.c | 2 +- linux-user/arm/cpu_loop.c | 2 +- linux-user/cris/cpu_loop.c | 2 +- linux-user/hexagon/cpu_loop.c | 2 +- linux-user/hppa/cpu_loop.c | 2 +- linux-user/i386/cpu_loop.c | 6 +++--- linux-user/m68k/cpu_loop.c | 2 +- linux-user/microblaze/cpu_loop.c | 2 +- linux-user/mips/cpu_loop.c | 2 +- linux-user/openrisc/cpu_loop.c | 2 +- linux-user/ppc/cpu_loop.c | 2 +- linux-user/riscv/cpu_loop.c | 2 +- linux-user/s390x/cpu_loop.c | 2 +- linux-user/sh4/cpu_loop.c | 2 +- linux-user/signal.c | 6 +++--- linux-user/sparc/cpu_loop.c | 2 +- linux-user/syscall.c | 16 ++++++++-------- linux-user/xtensa/cpu_loop.c | 2 +- common-user/host/aarch64/safe-syscall.inc.S | 2 +- common-user/host/arm/safe-syscall.inc.S | 2 +- common-user/host/i386/safe-syscall.inc.S | 2 +- common-user/host/mips/safe-syscall.inc.S | 2 +- common-user/host/ppc64/safe-syscall.inc.S | 2 +- common-user/host/riscv/safe-syscall.inc.S | 2 +- common-user/host/s390x/safe-syscall.inc.S | 2 +- common-user/host/sparc64/safe-syscall.inc.S | 2 +- common-user/host/x86_64/safe-syscall.inc.S | 2 +- 32 files changed, 46 insertions(+), 46 deletions(-) diff --git a/bsd-user/errno_defs.h b/bsd-user/errno_defs.h index 832671354f..583ebe8cee 100644 --- a/bsd-user/errno_defs.h +++ b/bsd-user/errno_defs.h @@ -151,6 +151,6 @@ /* Internal errors: */ #define TARGET_EJUSTRETURN 254 /* Just return without modifing regs */ #define TARGET_ERESTART 255 /* Restart syscall */ -#define TARGET_ERESTARTSYS TARGET_ERESTART /* Linux compat */ +#define QEMU_ERESTARTSYS TARGET_ERESTART /* compat */ #endif /* ! _ERRNO_DEFS_H_ */ diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/target_errno_defs.h index 17d85e0b61..58a06a10d6 100644 --- a/linux-user/generic/target_errno_defs.h +++ b/linux-user/generic/target_errno_defs.h @@ -153,7 +153,7 @@ * after handling any pending signals. They match with the ones the guest * kernel uses for the same purpose. */ -#define TARGET_ERESTARTSYS 512 /* Restart system call (if SA_RESTART) */ +#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 diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index 0deb87e51a..70c2dec408 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -25,10 +25,10 @@ * * Call a system call if guest signal not pending. * This has the same API as the libc syscall() function, except that it - * may return -1 with errno == TARGET_ERESTARTSYS if a signal was pending. + * may return -1 with errno == QEMU_ERESTARTSYS if a signal was pending. * * Returns: the system call result, or -1 with an error code in errno - * (Errnos are host errnos; we rely on TARGET_ERESTARTSYS not clashing + * (Errnos are host errnos; we rely on QEMU_ERESTARTSYS not clashing * with any of the host errno values.) */ @@ -81,7 +81,7 @@ * which are only technically blocking (ie which we know in practice won't * stay in the host kernel indefinitely) it's OK to use libc if necessary. * You must be able to cope with backing out correctly if some safe_syscall - * you make in the implementation returns either -TARGET_ERESTARTSYS or + * you make in the implementation returns either -QEMU_ERESTARTSYS or * EINTR though.) * * block_signals() cannot be used for interruptible syscalls. @@ -94,7 +94,7 @@ * handler checks the interrupted host PC against the addresse of that * known section. If the PC is before or at the address of the syscall * instruction then we change the PC to point at a "return - * -TARGET_ERESTARTSYS" code path instead, and then exit the signal handler + * -QEMU_ERESTARTSYS" code path instead, and then exit the signal handler * (causing the safe_syscall() call to immediately return that value). * Then in the main.c loop if we see this magic return value we adjust * the guest PC to wind it back to before the system call, and invoke diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 7457f8025c..b9f33bb44f 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -76,7 +76,7 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, * Block all signals, and arrange that the signal mask is returned to * its correct value for the guest before we resume execution of guest code. * If this function returns non-zero, then the caller should immediately - * return -TARGET_ERESTARTSYS to the main loop, which will take the pending + * return -QEMU_ERESTARTSYS to the main loop, which will take the pending * signal and restart execution of the syscall. * If block_signals() returns zero, then the caller can continue with * emulation of the system call knowing that no signals can be taken diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 97e0728b67..775ba43913 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -99,7 +99,7 @@ void cpu_loop(CPUARMState *env) env->xregs[4], env->xregs[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->xregs[0] = ret; diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 4029849d5c..ce9b251ce3 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -98,7 +98,7 @@ void cpu_loop(CPUAlphaState *env) env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4], env->ir[IR_A5], 0, 0); - if (sysret == -TARGET_ERESTARTSYS) { + if (sysret == -QEMU_ERESTARTSYS) { env->pc -= 4; break; } diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 01cb6eb534..1fcf19750e 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -407,7 +407,7 @@ void cpu_loop(CPUARMState *env) env->regs[4], env->regs[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->regs[15] -= env->thumb ? 2 : 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[0] = ret; diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 0d5d268609..f3e5b13f89 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUCRISState *env) env->pregs[7], env->pregs[11], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[10] = ret; diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 6b24cbaba9..1cacbf42f1 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -54,7 +54,7 @@ void cpu_loop(CPUHexagonState *env) env->gpr[4], env->gpr[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->gpr[HEX_REG_PC] -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gpr[0] = ret; diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 375576c8f0..5315224d12 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -133,7 +133,7 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_f = env->gr[31]; env->iaoq_b = env->gr[31] + 4; break; - case -TARGET_ERESTARTSYS: + case -QEMU_ERESTARTSYS: case -TARGET_QEMU_ESIGRETURN: break; } diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index f6a1cc632b..fbd9a353e5 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -180,7 +180,7 @@ static void emulate_vsyscall(CPUX86State *env) ret = do_syscall(env, syscall, env->regs[R_EDI], env->regs[R_ESI], env->regs[R_EDX], env->regs[10], env->regs[8], env->regs[9], 0, 0); - g_assert(ret != -TARGET_ERESTARTSYS); + g_assert(ret != -QEMU_ERESTARTSYS); g_assert(ret != -TARGET_QEMU_ESIGRETURN); if (ret == -TARGET_EFAULT) { goto sigsegv; @@ -223,7 +223,7 @@ void cpu_loop(CPUX86State *env) env->regs[R_EDI], env->regs[R_EBP], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; @@ -241,7 +241,7 @@ void cpu_loop(CPUX86State *env) env->regs[8], env->regs[9], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 790bd558c3..b03c21a3dc 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -80,7 +80,7 @@ void cpu_loop(CPUM68KState *env) env->dregs[5], env->aregs[0], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->dregs[0] = ret; diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index a94467dd2d..6e368f986e 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -53,7 +53,7 @@ void cpu_loop(CPUMBState *env) env->regs[9], env->regs[10], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { /* Wind back to before the syscall. */ env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index b735c99a24..64f308c6ad 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -141,7 +141,7 @@ done_syscall: env->active_tc.gpr[8], env->active_tc.gpr[9], env->active_tc.gpr[10], env->active_tc.gpr[11]); # endif /* O32 */ - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->active_tc.PC -= 4; break; } diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 3cfdbbf037..3147ab2b62 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -48,7 +48,7 @@ void cpu_loop(CPUOpenRISCState *env) cpu_get_gpr(env, 6), cpu_get_gpr(env, 7), cpu_get_gpr(env, 8), 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { cpu_set_gpr(env, 11, ret); diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 483e669300..5348641e9e 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -428,7 +428,7 @@ void cpu_loop(CPUPPCState *env) ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6], env->gpr[7], env->gpr[8], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->nip -= 4; break; } diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index b301dac802..20f8c48b1d 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -69,7 +69,7 @@ void cpu_loop(CPURISCVState *env) env->gpr[xA5], 0, 0); } - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gpr[xA0] = ret; diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index d089c8417e..043582ca7c 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -83,7 +83,7 @@ void cpu_loop(CPUS390XState *env) ret = do_syscall(env, n, env->regs[2], env->regs[3], env->regs[4], env->regs[5], env->regs[6], env->regs[7], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->psw.addr -= env->int_svc_ilen; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[2] = ret; diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index ac9b01840c..6c4ebfa969 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUSH4State *env) env->gregs[0], env->gregs[1], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gregs[0] = ret; diff --git a/linux-user/signal.c b/linux-user/signal.c index ca8f24b9ec..12b1705287 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -213,7 +213,7 @@ int block_signals(void) /* Wrapper for sigprocmask function * Emulates a sigprocmask in a safe way for the guest. Note that set and oldset - * are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if + * are host signal set, not guest ones. Returns -QEMU_ERESTARTSYS if * a signal was already pending and the syscall must be restarted, or * 0 on success. * If set is NULL, this is guaranteed not to fail. @@ -230,7 +230,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) int i; if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } switch (how) { @@ -985,7 +985,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, } if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } k = &sigact_table[sig - 1]; diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 0ba65e431c..529337c5e0 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -181,7 +181,7 @@ void cpu_loop (CPUSPARCState *env) env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 544f5b662f..3c0e341e45 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -545,7 +545,7 @@ static inline abi_long get_errno(abi_long ret) const char *target_strerror(int err) { - if (err == TARGET_ERESTARTSYS) { + if (err == QEMU_ERESTARTSYS) { return "To be restarted"; } if (err == TARGET_QEMU_ESIGRETURN) { @@ -6456,7 +6456,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, } if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } fork_start(); @@ -8173,7 +8173,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, Do thread termination if we have more then one thread. */ if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } pthread_mutex_lock(&clone_lock); @@ -9162,7 +9162,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #endif ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { + if (ret != -QEMU_ERESTARTSYS) { ts->in_sigsuspend = 1; } } @@ -9181,7 +9181,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, unlock_user(p, arg1, 0); ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { + if (ret != -QEMU_ERESTARTSYS) { ts->in_sigsuspend = 1; } } @@ -9297,13 +9297,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_sigreturn case TARGET_NR_sigreturn: if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } return do_sigreturn(cpu_env); #endif case TARGET_NR_rt_sigreturn: if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } return do_rt_sigreturn(cpu_env); case TARGET_NR_sethostname: @@ -13141,7 +13141,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, static bool flag; flag = !flag; if (flag) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } } #endif diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index a83490ab35..29cc6f3830 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -184,7 +184,7 @@ void cpu_loop(CPUXtensaState *env) env->regs[2] = ret; break; - case -TARGET_ERESTARTSYS: + case -QEMU_ERESTARTSYS: env->pc -= 3; break; diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index d3f065cdef..6b405be448 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -86,7 +86,7 @@ safe_syscall_end: ret /* code path when we didn't execute the syscall */ -2: mov w0, #TARGET_ERESTARTSYS +2: mov w0, #QEMU_ERESTARTSYS b 1b .cfi_endproc diff --git a/common-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S index 328299021d..e9b8d49d7c 100644 --- a/common-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -104,7 +104,7 @@ safe_syscall_end: b 9b /* code path when we didn't execute the syscall */ -2: ldr r0, =TARGET_ERESTARTSYS +2: ldr r0, =QEMU_ERESTARTSYS b 1b .fnend diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index c27207492a..3f928764db 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -114,7 +114,7 @@ safe_syscall_end: jmp 9b /* code path when we didn't execute the syscall */ -2: mov $TARGET_ERESTARTSYS, %eax +2: mov $QEMU_ERESTARTSYS, %eax jmp 1b .cfi_endproc diff --git a/common-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S index 1e2f5a079c..90bf3cc03e 100644 --- a/common-user/host/mips/safe-syscall.inc.S +++ b/common-user/host/mips/safe-syscall.inc.S @@ -122,7 +122,7 @@ safe_syscall_end: PTR_ADDIU sp, sp, FRAME /* code path when we didn't execute the syscall */ -0: li v0, TARGET_ERESTARTSYS +0: li v0, QEMU_ERESTARTSYS /* code path setting errno */ 1: PTR_L t0, ERRNOP(sp) diff --git a/common-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S index e35408c5fb..11c4672f71 100644 --- a/common-user/host/ppc64/safe-syscall.inc.S +++ b/common-user/host/ppc64/safe-syscall.inc.S @@ -92,7 +92,7 @@ safe_syscall_end: blr /* code path when we didn't execute the syscall */ -0: li 3, TARGET_ERESTARTSYS +0: li 3, QEMU_ERESTARTSYS b 1b .cfi_endproc diff --git a/common-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S index eddede702b..2f07c729c4 100644 --- a/common-user/host/riscv/safe-syscall.inc.S +++ b/common-user/host/riscv/safe-syscall.inc.S @@ -81,7 +81,7 @@ safe_syscall_end: ret /* code path when we didn't execute the syscall */ -2: li a0, TARGET_ERESTARTSYS +2: li a0, QEMU_ERESTARTSYS j 1b .cfi_endproc diff --git a/common-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S index f2a3bccc13..c1cc127e85 100644 --- a/common-user/host/s390x/safe-syscall.inc.S +++ b/common-user/host/s390x/safe-syscall.inc.S @@ -91,7 +91,7 @@ safe_syscall_end: .cfi_restore_state /* code path when we didn't execute the syscall */ -1: lghi %r2, -TARGET_ERESTARTSYS +1: lghi %r2, -QEMU_ERESTARTSYS /* code path setting errno */ 0: lcr %r2, %r2 /* create positive errno */ diff --git a/common-user/host/sparc64/safe-syscall.inc.S b/common-user/host/sparc64/safe-syscall.inc.S index 2492fcbd9e..55e32b30eb 100644 --- a/common-user/host/sparc64/safe-syscall.inc.S +++ b/common-user/host/sparc64/safe-syscall.inc.S @@ -85,7 +85,7 @@ safe_syscall_end: /* code path when we didn't execute the syscall */ 2: ba,pt %xcc, 1b - set TARGET_ERESTARTSYS, %o0 + set QEMU_ERESTARTSYS, %o0 .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index e3f920fa5c..b93d684e66 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -102,7 +102,7 @@ safe_syscall_end: jmp 9b /* code path when we didn't execute the syscall */ -2: mov $TARGET_ERESTARTSYS, %eax +2: mov $QEMU_ERESTARTSYS, %eax jmp 1b .cfi_endproc From patchwork Wed Nov 17 16:04:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519224 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1172147imj; Wed, 17 Nov 2021 08:11:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxx6OnW9/kfQdCwuLS9XsUpJt/GipLhv/kXbqO+mqEMNOxf6esKomQe95UasDAO0OLHXc/U X-Received: by 2002:a05:6102:3a6d:: with SMTP id bf13mr70143714vsb.3.1637165470809; Wed, 17 Nov 2021 08:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165470; cv=none; d=google.com; s=arc-20160816; b=XkoXbuTXAY4t/NgXG/FmTg04F68rxIY4uqZtsk9z3rKffUr2jR41tt5Deboi5vzpA9 19yn6IZ8An5hc11UzMSHENgM1rKH38QAuxjyjurZ3n32wPfOKuKWkmZNE6JqHeZu0RLK bDcKmNRHQ0CWsumYbqQcPmQyiY6xlk/k2h4h5F4s+x/S1JHZ2YmH3yrqWabEnzWPOgdS 2dzfvz7/ti6fnkcY2Jk6xe4gFllyDMXC9XIi6xVMAo66zCyIyqUcqnvz7Mo4zjVp7cCo FiNhSw1R+mywv/pUq/EotSLV471BLxB2kg/h1qLvX8N4OhoKW2O57Gu3TrxQC4pWYkPv 25dQ== 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=JAA0m8ZsMvqAC1fjouPXohgdHSfaCW9ruz0DFQVeg0Q=; b=JmPVObkYvv+beClvzpai2FK9YOceOOIH17OFSEVPIlx769mnI82BLov+w90Bl8wZi2 aiyn0L5ocLVi/4ISnWEFXYef8XHw4qrQMuIKWecxg3mxQi4H/AT/dibDyvnOr84APBlj sLbJmu+hspU3H0TpF2U8LomR91B7QEu1+5QtFSFq8CMffZya0wzcCxFyn+ndZT0F0yIH N0qsiSVY4aJILbNg6bygPyXQVM4yU9g0EQ0hQtYx/g9akEFAav8Vkh8d9n1R6waWmVFB 47f9C+vARXoyEOWcmku7VxZZQrujbVrQi2f+Kvo4hiGLyJhcPasW6YUuuHGSjsWLYEiw VfBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jSU3JBPI; 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=fail (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 h6si280822vsf.294.2021.11.17.08.11.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:11:10 -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=fail header.i=@linaro.org header.s=google header.b=jSU3JBPI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNWg-0003cJ-6A for patch@linaro.org; Wed, 17 Nov 2021 11:11:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQL-0000PV-EJ for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:37 -0500 Received: from [2a00:1450:4864:20::436] (port=43801 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQI-00033z-Rl for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:37 -0500 Received: by mail-wr1-x436.google.com with SMTP id t30so5631998wra.10 for ; Wed, 17 Nov 2021 08:04:34 -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=JAA0m8ZsMvqAC1fjouPXohgdHSfaCW9ruz0DFQVeg0Q=; b=jSU3JBPIQX508IK2UfNFdAZ08otiXTlu30FGL6sKCkyAzGyD+CFRAZdpQKGjB0SF3c NJUdph4RmEeVh3aGrbhWbEHjCrlo7VimCn7CEIeYoqVfm+hbVntWG2hADA7s8DTBb0rP crUkF5CwxuZD8oxBIkQhRg/OxMHPSRMF7FN2r89etPE8x/bx3IQRlP+T2TRFeqaaoG7/ t5kcKy0WzJ/ez/7yO5YK4ZIPvtAWIKZZvdgScrZ/I58R9eceQhRgR2fMWf4YbOgZ7Six uPR5FZiDWPatYpOIIfrWhKkABbsO1hfSoPunNxgvh7qJbHxXlRxG6EJiJGucwy2rROK2 iCAQ== 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=JAA0m8ZsMvqAC1fjouPXohgdHSfaCW9ruz0DFQVeg0Q=; b=4als8tDNCSTAfmSWdUOImAJWtyGu4rNaTuscsLTUaTZ+qqtQ3xw9Ko2FcPAl6dwPeq kF1cnmPRsd8qEHk7rKau0nWmrC4R/XtPFkoHlxX7Cyq7rAC4UscJUosTs8Ce5alEzZiv Rr6NB0569IbIy8XsZYydGCJKn3qeArJzlKUyVl2qg8h5GQ+s037EWjsr9ESoxSqSZM71 ZyVAaW9aAY/RvqB32xHaeF7eYrHyQNd6XDxNceH71QY+SBw+emo36QBNyvkLYf0xvSnp cDVIrYspoFzjKKMtuqi94mBVlK7OY95anipCzATswO72NwE1lq2tOCR+u0T47UQKjmTn 30GQ== X-Gm-Message-State: AOAM533I2hE4QJ3VisbmQ5UmF64DIFcIhJVYSty30LJog7+VEnRRTY75 VSAFIO9geeD/0STUOxt0SlXUV22X2w9uMALkOZk= X-Received: by 2002:adf:cc8d:: with SMTP id p13mr21057129wrj.274.1637165073348; Wed, 17 Nov 2021 08:04:33 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 10/17] linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN Date: Wed, 17 Nov 2021 17:04:05 +0100 Message-Id: <20211117160412.71563-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is fully internal to qemu, and so is not a TARGET define. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- linux-user/generic/target_errno_defs.h | 2 +- linux-user/aarch64/cpu_loop.c | 2 +- linux-user/aarch64/signal.c | 4 ++-- linux-user/alpha/cpu_loop.c | 2 +- linux-user/alpha/signal.c | 8 ++++---- linux-user/arm/cpu_loop.c | 2 +- linux-user/arm/signal.c | 8 ++++---- linux-user/cris/cpu_loop.c | 2 +- linux-user/cris/signal.c | 4 ++-- linux-user/hexagon/cpu_loop.c | 2 +- linux-user/hexagon/signal.c | 2 +- linux-user/hppa/cpu_loop.c | 2 +- linux-user/hppa/signal.c | 4 ++-- linux-user/i386/cpu_loop.c | 6 +++--- linux-user/i386/signal.c | 8 ++++---- linux-user/m68k/cpu_loop.c | 2 +- linux-user/m68k/signal.c | 8 ++++---- linux-user/microblaze/cpu_loop.c | 2 +- linux-user/microblaze/signal.c | 4 ++-- linux-user/mips/cpu_loop.c | 2 +- linux-user/mips/signal.c | 8 ++++---- linux-user/openrisc/cpu_loop.c | 2 +- linux-user/ppc/cpu_loop.c | 2 +- linux-user/ppc/signal.c | 10 +++++----- linux-user/riscv/cpu_loop.c | 2 +- linux-user/riscv/signal.c | 2 +- linux-user/s390x/cpu_loop.c | 2 +- linux-user/s390x/signal.c | 8 ++++---- linux-user/sh4/cpu_loop.c | 2 +- linux-user/sh4/signal.c | 8 ++++---- linux-user/sparc/cpu_loop.c | 2 +- linux-user/sparc/signal.c | 8 ++++---- linux-user/syscall.c | 2 +- linux-user/xtensa/cpu_loop.c | 2 +- linux-user/xtensa/signal.c | 4 ++-- 35 files changed, 70 insertions(+), 70 deletions(-) diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/target_errno_defs.h index 58a06a10d6..bb37d88be9 100644 --- a/linux-user/generic/target_errno_defs.h +++ b/linux-user/generic/target_errno_defs.h @@ -162,6 +162,6 @@ * 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 */ +#define QEMU_ESIGRETURN 513 /* Return from signal */ #endif diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 775ba43913..98b53962cd 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -101,7 +101,7 @@ void cpu_loop(CPUARMState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->xregs[0] = ret; } break; diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 29c52db3f1..df9e39a4ba 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -556,12 +556,12 @@ long do_rt_sigreturn(CPUARMState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_sigreturn(CPUARMState *env) diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index ce9b251ce3..37c33f0ccd 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -102,7 +102,7 @@ void cpu_loop(CPUAlphaState *env) env->pc -= 4; break; } - if (sysret == -TARGET_QEMU_ESIGRETURN) { + if (sysret == -QEMU_ESIGRETURN) { break; } /* Syscall writes 0 to V0 to bypass error check, similar diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index bbe3dd175a..4ec42994d4 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -225,11 +225,11 @@ long do_sigreturn(CPUAlphaState *env) restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUAlphaState *env) @@ -249,13 +249,13 @@ long do_rt_sigreturn(CPUAlphaState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 1fcf19750e..f153ab503a 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -409,7 +409,7 @@ void cpu_loop(CPUARMState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->regs[15] -= env->thumb ? 2 : 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[0] = ret; } } diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index df9f8e8eb2..cf99fd7b8a 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -511,12 +511,12 @@ long do_sigreturn(CPUARMState *env) } unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUARMState *env) @@ -546,12 +546,12 @@ long do_rt_sigreturn(CPUARMState *env) } unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index f3e5b13f89..5213aebf55 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -52,7 +52,7 @@ void cpu_loop(CPUCRISState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[10] = ret; } break; diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 7f6aca934e..4f532b2903 100644 --- a/linux-user/cris/signal.c +++ b/linux-user/cris/signal.c @@ -177,10 +177,10 @@ long do_sigreturn(CPUCRISState *env) restore_sigcontext(&frame->sc, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUCRISState *env) diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 1cacbf42f1..b84e25bf71 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -56,7 +56,7 @@ void cpu_loop(CPUHexagonState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->gpr[HEX_REG_PC] -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gpr[0] = ret; } break; diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 74e61739a0..ad4e3822d5 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -268,7 +268,7 @@ long do_rt_sigreturn(CPUHexagonState *env) target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 5315224d12..a47a63176b 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -134,7 +134,7 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_b = env->gr[31] + 4; break; case -QEMU_ERESTARTSYS: - case -TARGET_QEMU_ESIGRETURN: + case -QEMU_ESIGRETURN: break; } break; diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index c2fbc26ebb..962f551c04 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -191,9 +191,9 @@ long do_rt_sigreturn(CPUArchState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index fbd9a353e5..9aaae93e2f 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -181,7 +181,7 @@ static void emulate_vsyscall(CPUX86State *env) env->regs[R_EDX], env->regs[10], env->regs[8], env->regs[9], 0, 0); g_assert(ret != -QEMU_ERESTARTSYS); - g_assert(ret != -TARGET_QEMU_ESIGRETURN); + g_assert(ret != -QEMU_ESIGRETURN); if (ret == -TARGET_EFAULT) { goto sigsegv; } @@ -225,7 +225,7 @@ void cpu_loop(CPUX86State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; } break; @@ -243,7 +243,7 @@ void cpu_loop(CPUX86State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; } break; diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 433efa3d69..4372621a4d 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -559,12 +559,12 @@ long do_sigreturn(CPUX86State *env) if (restore_sigcontext(env, &frame->sc)) goto badframe; unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #endif @@ -588,12 +588,12 @@ long do_rt_sigreturn(CPUX86State *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #ifndef TARGET_X86_64 diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index b03c21a3dc..3181594414 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -82,7 +82,7 @@ void cpu_loop(CPUM68KState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->dregs[0] = ret; } } diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index ec33482e14..5f35354487 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -353,11 +353,11 @@ long do_sigreturn(CPUM68KState *env) restore_sigcontext(env, &frame->sc); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUM68KState *env) @@ -381,12 +381,12 @@ long do_rt_sigreturn(CPUM68KState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 6e368f986e..ff1fb26c8b 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -56,7 +56,7 @@ void cpu_loop(CPUMBState *env) if (ret == -QEMU_ERESTARTSYS) { /* Wind back to before the syscall. */ env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[3] = ret; } /* All syscall exits result in guest r14 being equal to the diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index 8ebb6a1b7d..5188d74025 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -207,12 +207,12 @@ long do_rt_sigreturn(CPUMBState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 64f308c6ad..32f9fc1c1c 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -145,7 +145,7 @@ done_syscall: env->active_tc.PC -= 4; break; } - if (ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ESIGRETURN) { /* Returning from a successful sigreturn syscall. Avoid clobbering register state. */ break; diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 8f79e405ec..58a9d7a8a3 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -281,11 +281,11 @@ long do_sigreturn(CPUMIPSState *regs) /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ regs->CP0_EPC = 0; - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } # endif /* O32 */ @@ -371,11 +371,11 @@ long do_rt_sigreturn(CPUMIPSState *env) /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ env->CP0_EPC = 0; - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 3147ab2b62..592901a68b 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUOpenRISCState *env) cpu_get_gpr(env, 8), 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { cpu_set_gpr(env, 11, ret); } break; diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 5348641e9e..30c82f2354 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -432,7 +432,7 @@ void cpu_loop(CPUPPCState *env) env->nip -= 4; break; } - if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) { + if (ret == (target_ulong)(-QEMU_ESIGRETURN)) { /* Returning from a successful sigreturn syscall. Avoid corrupting register state. */ break; diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index 90a0369632..176c9d8503 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -591,13 +591,13 @@ long do_sigreturn(CPUPPCState *env) unlock_user_struct(sr, sr_addr, 1); unlock_user_struct(sc, sc_addr, 1); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; sigsegv: unlock_user_struct(sr, sr_addr, 1); unlock_user_struct(sc, sc_addr, 1); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #endif /* !defined(TARGET_PPC64) */ @@ -646,12 +646,12 @@ long do_rt_sigreturn(CPUPPCState *env) target_restore_altstack(&rt_sf->uc.tuc_stack, env); unlock_user_struct(rt_sf, rt_sf_addr, 1); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; sigsegv: unlock_user_struct(rt_sf, rt_sf_addr, 1); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* This syscall implements {get,set,swap}context for userland. */ @@ -704,7 +704,7 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, /* We cannot return to a partially updated context. */ force_sig(TARGET_SIGSEGV); } - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } return 0; diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 20f8c48b1d..0cd8985cb8 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -71,7 +71,7 @@ void cpu_loop(CPURISCVState *env) } if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gpr[xA0] = ret; } if (cs->singlestep_enabled) { diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index a0f9542ce3..296e39fbf0 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -188,7 +188,7 @@ long do_rt_sigreturn(CPURISCVState *env) target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 043582ca7c..ad0c3cd263 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -85,7 +85,7 @@ void cpu_loop(CPUS390XState *env) env->regs[6], env->regs[7], 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->psw.addr -= env->int_svc_ilen; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[2] = ret; } break; diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 676b948147..f47713e04a 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -359,7 +359,7 @@ long do_sigreturn(CPUS390XState *env) trace_user_do_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* Make sure that we're initializing all of target_set. */ @@ -373,7 +373,7 @@ long do_sigreturn(CPUS390XState *env) restore_sigregs_ext(env, &frame->sregs_ext); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUS390XState *env) @@ -385,7 +385,7 @@ long do_rt_sigreturn(CPUS390XState *env) trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); @@ -397,7 +397,7 @@ long do_rt_sigreturn(CPUS390XState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 6c4ebfa969..3290f6445c 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -52,7 +52,7 @@ void cpu_loop(CPUSH4State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gregs[0] = ret; } break; diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index faa869fb19..f6a18bc6b5 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -286,12 +286,12 @@ long do_sigreturn(CPUSH4State *regs) restore_sigcontext(regs, &frame->sc); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUSH4State *regs) @@ -313,12 +313,12 @@ long do_rt_sigreturn(CPUSH4State *regs) target_restore_altstack(&frame->uc.tuc_stack, regs); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 529337c5e0..8765ab6020 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -181,7 +181,7 @@ void cpu_loop (CPUSPARCState *env) env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5], 0, 0); - if (ret == -QEMU_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ERESTARTSYS || ret == -QEMU_ESIGRETURN) { break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 23e1e761de..b501750fe0 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -431,12 +431,12 @@ long do_sigreturn(CPUSPARCState *env) set_sigmask(&host_set); unlock_user_struct(sf, sf_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; #else return -TARGET_ENOSYS; #endif @@ -495,12 +495,12 @@ long do_rt_sigreturn(CPUSPARCState *env) env->npc = tnpc; unlock_user_struct(sf, sf_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3c0e341e45..1ef6abb776 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -548,7 +548,7 @@ const char *target_strerror(int err) if (err == QEMU_ERESTARTSYS) { return "To be restarted"; } - if (err == TARGET_QEMU_ESIGRETURN) { + if (err == QEMU_ESIGRETURN) { return "Successful exit from sigreturn"; } diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 29cc6f3830..6bc6d6dee6 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -188,7 +188,7 @@ void cpu_loop(CPUXtensaState *env) env->pc -= 3; break; - case -TARGET_QEMU_ESIGRETURN: + case -QEMU_ESIGRETURN: break; } break; diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 81572a5fc7..06d91a37ec 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -263,12 +263,12 @@ long do_rt_sigreturn(CPUXtensaState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) From patchwork Wed Nov 17 16:04:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519226 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1175558imj; Wed, 17 Nov 2021 08:13:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcunqRwrGmRjcnu5oayzwB6hwCtXIaYOoz6yzmH1OgLA4glO5m04q6sVo3Si7ooXrLcDmE X-Received: by 2002:a67:cb0a:: with SMTP id b10mr20595161vsl.0.1637165622717; Wed, 17 Nov 2021 08:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165622; cv=none; d=google.com; s=arc-20160816; b=YoI+faWTq/i2yiOkWOGbBFfKRLTOaXLIlkysu947OLypQMypQKKBMPa3Pwm26LC9L3 A3U7T6oOigpx21XN0r2iLXfRUU3xHO7QWqaq3SqmdPVfEbtyyY8QIm3Iq8QXA1i+pySm nBQtXLOzOm9WlOCgmqeqhQjaA/FJ7dgYshOh/qtILh/eLOyrF/M8DZJTJF3Mp2M8RvaY EiPNcJLxe/An/ppllj2K9+nDlSrL6GlLmWeDgSYKKfU+aOkukQSHPfX3Vcaw0PFMEYXv 6fS2uzeaKkGELZJZxzZIWHX5lHIaKniZ5GRXXV3U9/lNatj8fthBHLNQtONQV9Iy2JZ6 TsEg== 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=lsz0dSeS3alNSK0Y33VjA4yL9Dqu5Jd7cft81LB0Bvs=; b=xDtElGuiiHiVszY3zl2G2lp26wXmhtG8XkCwSftzIYEl3zT1Yfk53klrBdl5MJo0Ha Legr+nDas0sjorYDVYBFP8Lhf6WcZ4m4bCHdVOTQI2YQ7AlYHuo4u1i+4Oe/rNVqcacx mHzqpz8hKjBcZfKmVnMqxkoW5DEr9NGbpIWC8WOfvLKM6n/aEozQwslVzq2epOC6ZAE2 KmsBSMIhhZY+Gvarzl9v8ZEeCL69+BCMZbNxB4yB4OYa6RHGB0M1xmMx/Nf9+EgovFeI LoR0caswpqBpP8pLS4BMVURQwndEVQRTW9cgozPEBIVJIhuvbpUQKwkBP5HePrCRvYnj r7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="NY/aLkbr"; 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=fail (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 s6si266659uap.230.2021.11.17.08.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:13:42 -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=fail header.i=@linaro.org header.s=google header.b="NY/aLkbr"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNZ7-0000a7-JP for patch@linaro.org; Wed, 17 Nov 2021 11:13:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQL-0000QM-Q5 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:37 -0500 Received: from [2a00:1450:4864:20::32c] (port=46628 helo=mail-wm1-x32c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQK-000344-CJ for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:37 -0500 Received: by mail-wm1-x32c.google.com with SMTP id b184-20020a1c1bc1000000b0033140bf8dd5so2496089wmb.5 for ; Wed, 17 Nov 2021 08:04:35 -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=lsz0dSeS3alNSK0Y33VjA4yL9Dqu5Jd7cft81LB0Bvs=; b=NY/aLkbrk5LYkJJaJOUy0lm3PB4Wg+KW8Uv5KDve0MKEH/QzBaoDbJm/z1wzR6soYW UycKIV4v+/tn7oknBI+UiFj4BtwkoIAu7E00FzKEj8qG2/RKkwXNsgaDmC61J2IKETK1 pvUEbma8GCD6a+UBE8lET8QLP/0kpjjG+87UwW04BP52EQMqu937p4qXUgevREjree6F /NXldAdx0AsyE/FM5r+vYH4o8ffnLPVZSKdi2xL0B5ixs1GP6vO28RJMF61cMiZn/VFr RqFnfBx8VRdtqk4QHg8Ic58q0qjxJypa7Qwn+yhJAZ6ne4RLCa2ZKQHVmgwH3KlX8lB3 UGvw== 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=lsz0dSeS3alNSK0Y33VjA4yL9Dqu5Jd7cft81LB0Bvs=; b=3AkbbVpSUmY8F3sBxuzk8ZTaGkmjOvKputfH4Z+dq2QXXTRftA2qYxe+DwyM2y22Hq Xgvnmc2kxMdz6IxomBA4s30+SjBrCMaUysVGZkpcOy/Upc9z0OQXhSnsVhSobNYNId9W zw5UnCvYwXdHATckL/rljd9Av8YQlZwnLeRwcJIYw9/ESc819k4pE/L8vesOBSyAsDcF u6ZalCn2UGxS6hAT3S5shmJRNAyZu/+FOXU0lbLvD75gLnM/7bxUyJMFX2Xrm6QPjb4L Lfwo44bD+tBwEjmg8L78GmqxzQNLxkm2mogH2pRjkDMftvEAUc1bElUPucAudFirD7hV eLqQ== X-Gm-Message-State: AOAM531AzaARSFu89StJeD1baFPiGWUKaTrwzF9sjQJMQQjXUzaVgTz8 NdD5+bFcqJjUEC3iyDbARHql5LuGqwuzwPasTgU= X-Received: by 2002:a05:600c:22d9:: with SMTP id 25mr843725wmg.71.1637165074548; Wed, 17 Nov 2021 08:04:34 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 11/17] bsd-user: Create special-errno.h Date: Wed, 17 Nov 2021 17:04:06 +0100 Message-Id: <20211117160412.71563-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Pull the internal errno used by qemu internally its own header file, for use by safe-syscall.S. Signed-off-by: Richard Henderson --- bsd-user/errno_defs.h | 6 +++++- bsd-user/special-errno.h | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 bsd-user/special-errno.h diff --git a/bsd-user/errno_defs.h b/bsd-user/errno_defs.h index 583ebe8cee..73cfa24b7f 100644 --- a/bsd-user/errno_defs.h +++ b/bsd-user/errno_defs.h @@ -151,6 +151,10 @@ /* Internal errors: */ #define TARGET_EJUSTRETURN 254 /* Just return without modifing regs */ #define TARGET_ERESTART 255 /* Restart syscall */ -#define QEMU_ERESTARTSYS TARGET_ERESTART /* compat */ + +#include "special-errno.h" + +_Static_assert(TARGET_ERESTART == QEMU_ERESTARTSYS, + "TARGET_ERESTART and QEMU_ERESTARTSYS expected to match"); #endif /* ! _ERRNO_DEFS_H_ */ diff --git a/bsd-user/special-errno.h b/bsd-user/special-errno.h new file mode 100644 index 0000000000..03599d9b5a --- /dev/null +++ b/bsd-user/special-errno.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * QEMU internal errno values for implementing user-only POSIX. + * + * 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 255 + +#endif /* SPECIAL_ERRNO_H */ From patchwork Wed Nov 17 16:04:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519228 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1178063imj; Wed, 17 Nov 2021 08:15:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxp3Yq/4orZfu2jWY4Va+DmVYu8azP4HOStR1tPzx176tegO7kskPoDoUBGSURsJ1I80CiS X-Received: by 2002:a05:620a:3181:: with SMTP id bi1mr14054912qkb.456.1637165733277; Wed, 17 Nov 2021 08:15:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165733; cv=none; d=google.com; s=arc-20160816; b=0Y0A4COll6h2NcaesPI3PYSxRVICCE3tE7IGHTUEVQMCxpxbd3zfusEzGm4GeGvaP2 71rS1NN4Cc5cEcWuoI0rDjw3fOx7Ws+p4e2xyMhXdZ1oBqIKAANu1dwqDqZqJ/OMSu4o qDXrDYsDH8+VHGqK9SBzD+9F9N83akha7EBcndPapoNmPWel39ONf12ox6ClEk5I4glM 4dCGB5vXdne5k+LFzdpGT97V4Ux2CJQ7GBGf8oNpnykLhsUy9g+N9r1/56fVSLcJF05u Jmv83wE8I4bGtkSseXC0wP4tRGUuL3H55eGfz3hjVrEw/8mzlSwDkF1PsBsNmpymWH1z Nrrw== 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=Wbb3ncUX0WysUh86/9pbKJFhgP0odAzb0iOBlu9YhRQ=; b=olfPYakcw6vH4cGO7qs3pcFcM1ruoUZK5IE6DBSpZUE0ST8ulnS/EudAk/I9hu4dIX GlqrUSuvaHfVtVadxmHqHfe0XICXcPbfWNAwCUaWFiCPYG9Em8LlJAvu2s2SPzckwR/v HtSjbpbhPEFkU8Vdm3Wqg0vff78yqkj2dnKcujvAo7hyDp38HHqRtlFDwHCk2QcqlPXX ac4Xjd1gxKq+3qCRp35jE/nKGf0us04CCIc6Ti/mt0mb8bGRyNgdza74NedjsX5Bv44w BYNMT1ueIbSQVROCcfZt6JIxgxZt9ahZkIi5zjSD5pdb2y0xMPPJvoHVus2KvEkLxfdt mV+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Y9ouor3Z; 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=fail (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 r2si367355qtw.44.2021.11.17.08.15.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:15:33 -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=fail header.i=@linaro.org header.s=google header.b=Y9ouor3Z; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNat-0002Jp-0y for patch@linaro.org; Wed, 17 Nov 2021 11:15:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQN-0000Rf-AZ for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:39 -0500 Received: from [2a00:1450:4864:20::335] (port=55038 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQL-00034E-Ec for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:39 -0500 Received: by mail-wm1-x335.google.com with SMTP id i12so2689834wmq.4 for ; Wed, 17 Nov 2021 08:04:37 -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=Wbb3ncUX0WysUh86/9pbKJFhgP0odAzb0iOBlu9YhRQ=; b=Y9ouor3Z+tHq5R/Dzg91eEQM0gojlx/R8p/dMoW7KPoDx9Jelti18DFeZx2d3Z7j00 DJyQ+Jlzv1MW245qfp04zQzZan/fmto4LTor6xbylQEip9Yw3a06BtJxf3hQK3VLpGIq t9vchfxhheTwJzDdF++xf8hz5emGr6iCdrJ9S1oY/zc1OM6uhukqhMKwGpv4jYfrd44G pZVnulWWP2FIliqwbwIJe8zTJlkZ8HlJp56LJE46uin3GiHds3+VLKAwCppeT0CRG6Qe CYFfG2iIc8+SQDZ+xwrXv5H2mo4RxlcUw3U3TNSImKHA93LvrdreUbtGT0fRIJoG4zR3 mF1w== 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=Wbb3ncUX0WysUh86/9pbKJFhgP0odAzb0iOBlu9YhRQ=; b=f0x5HJZ0Uz9I9jbtuCnARXzuNWB8FclDaIzDGACLdp8bZT4TIlHzoVPD60XdRWyiIz p2Rv4RV+lU1L1fjYaXk+GhABQJXgMLZeKMkrm9IFFQiy+JicA+PhorKFYAd7bpgic9pv sArRC31gFZzLXYKEZNHU10hIXBUnxESFWPgKOXxoZ0ZrKUli6kl4JP4xSDXsJYCob8sU bqCEZB7WINwHFJLEPK98qA3nu3dMlNcg3HpTXWd9fORPhIyOEMwpxsTdHwqowPXv2QCi C/SK0DxSfg+zfwsWSl18HQYUcmejSVJu9yHuhltVFhBa+VzJECDoB75jUVzITdN+c7kB u2nA== X-Gm-Message-State: AOAM531yuxVDf0+p0w2WwuGXn5q9JOtHFO3uwxE/TBGK3/CmHbDhKz20 59gVD6gMaZJqBkwx/5izdqs1FFkfEuhqoQxoDlc= X-Received: by 2002:a7b:c388:: with SMTP id s8mr891565wmj.170.1637165076084; Wed, 17 Nov 2021 08:04:36 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 12/17] linux-user: Create special-errno.h Date: Wed, 17 Nov 2021 17:04:07 +0100 Message-Id: <20211117160412.71563-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com 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. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- 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 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. From patchwork Wed Nov 17 16:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519227 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1176448imj; Wed, 17 Nov 2021 08:14:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyD3ZNPMOe2Kq7ys3aZwBzpU7RCzU2DyQxbLn2XKsZEOPqX2ng/SctHDMk9m+cxwzHfq2m X-Received: by 2002:a67:6684:: with SMTP id a126mr68805126vsc.22.1637165662736; Wed, 17 Nov 2021 08:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165662; cv=none; d=google.com; s=arc-20160816; b=rOCr4QOuBUWBrBRLXCuCwspxVKZz/DWrOMOttogWT5cXr6V3mHFro4jZXy9XXcNX19 mgAOWZ3MLjiTYVv/b335oWkw1We/QqtmXte+/ly+CwnspSIGQVnEjrFNFOSWEKmfpZIu 0A0SkbUqfh7y/Q3en5s/IkE5QEEqK8/D0Fts6AzxvnsHWCHpwdUQ33bfOLPN6sOx4Wvm 6AOrwnOBfQX5goc7PKObuFl53OqTPT/ievKvIu79eMrSS1zHY0w/qBgdTgMc9Mq8BRru h2FMbwGYdj/w+Q28p59Lhf4vmyszJTp+EskHH0dbNmWK7Z4n/97UdWArzZNTvDx5vCMp RCWA== 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=+C1KzH3n3AYinXGQ8uyvLlpcpSps+ImD5AtGxkQR3Ok=; b=I49EB+AP9Iu151WzARGoAG+TMPvjHBAyyPbOVh9YkbyHguIjXC9DXtuELopyPwQTT/ ys13r51CkPuN53Gj9wGsB0Bu99n8g1J19R24hnvr77fd+tYUqFgjriWpLLzWeVXowzeY c4eZR6f3mh9RltbvkPf/fc+VdRXTiuVComB5aH71KuakmyXI2TnU8UTa9ZvIfA6X76Vv +gPY2Pw3VTy5eTINVZsN9ju6FgCeqKk8RkavqNzb2wSPyTbnS8HSYyOZPhzZ18LzsuaM vg0rD3nYYDTXZJuq3lTSVhyd9L2E1y9LCr5vieuhW7PjPEcV8TZtKSHa7Dic/f612quX kTDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mfcQaHRM; 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=fail (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 v23si253312uat.92.2021.11.17.08.14.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:14:22 -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=fail header.i=@linaro.org header.s=google header.b=mfcQaHRM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNZm-0001D4-73 for patch@linaro.org; Wed, 17 Nov 2021 11:14:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQO-0000VH-Al for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:40 -0500 Received: from [2a00:1450:4864:20::333] (port=44620 helo=mail-wm1-x333.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQM-00034W-Rn for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:40 -0500 Received: by mail-wm1-x333.google.com with SMTP id c71-20020a1c9a4a000000b0032cdcc8cbafso2506713wme.3 for ; Wed, 17 Nov 2021 08:04:38 -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=+C1KzH3n3AYinXGQ8uyvLlpcpSps+ImD5AtGxkQR3Ok=; b=mfcQaHRMNZjyhnajgEM5vbJTySZgC8QpCz5igt8A29Htw3CGcOB/7+R3ll59QL4QxV O3Xog/DsAMGrsF1SLWNKb/Mk5bm07d9/fwIRFesN9t13evHQ5R3jeKTReqrn3mI86Dr7 WRb2APUGlzQV/2FgBgYbxrY1jxWLA/DcTqlk8oG6ecWW7HwaxlPoqFSzCVNczIZ+WQFD m4Z8osHwonwf3mTMUGItreEK8wrxjU+YOwwDt1aVuugFaZLGUTOKmK6nBFVIplNog9fm MNtkpnbLFlto5qOJNjXGwOrXT39E3EAfjDWPLoa8sgCv8/elAj44uOy/qQq4aQ2IdE2d nuzw== 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=+C1KzH3n3AYinXGQ8uyvLlpcpSps+ImD5AtGxkQR3Ok=; b=bA93aM1ZdmtMUNylp0ueLibewn+DOCa6exijwjO4T2g9YKUUq7Tl3D0Ppwrs+XURl/ K4vQTTeqFy6ecIVEswIpwcKift9l0wDSnNPdm7l9v3S2j609eR1RwQSpkDXcpyDYwcI8 O3NIqKcURfArHqCnAEBdULvz0BbeDlo0vNEMWV6+RAM97P6UCuzP3LYeVyYxJGHIq0Ud i472d5FoQvjO6jpW7eFgSgtmcWCs2kDdi2dhrKSv7W+NqvmRfjvs5QC40SnG2YMln/su tzJM2Z1FzCSbYmrhM3ZnjHrE2ZrHWocILYNaGliATVqXZJuIasrdJ+t8VEnSOvZ63YcF YBtA== X-Gm-Message-State: AOAM533Mpb78TmiPshS6STJ/oM29s6Q8z890DVg9vxIMcj/xZJO3BoSV DFgx7xuEAU1nod2OTmjPH9srhRNoSB5K8/bbPqg= X-Received: by 2002:a1c:a301:: with SMTP id m1mr904862wme.118.1637165077356; Wed, 17 Nov 2021 08:04:37 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/17] meson: Add build infrastructure for common-user Date: Wed, 17 Nov 2021 17:04:08 +0100 Message-Id: <20211117160412.71563-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::333 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The first objects to be added will be target-independent, and so built once for the host. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- meson.build | 16 +++++++++++++++- bsd-user/meson.build | 2 ++ common-user/meson.build | 1 + linux-user/meson.build | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 common-user/meson.build diff --git a/meson.build b/meson.build index c58abf0d0d..387f7fe1c9 100644 --- a/meson.build +++ b/meson.build @@ -2359,6 +2359,7 @@ block_ss = ss.source_set() bsd_user_ss = ss.source_set() chardev_ss = ss.source_set() common_ss = ss.source_set() +common_user_ss = ss.source_set() crypto_ss = ss.source_set() hwcore_ss = ss.source_set() io_ss = ss.source_set() @@ -2603,15 +2604,28 @@ subdir('tcg') subdir('fpu') subdir('accel') subdir('plugins') +subdir('ebpf') + +common_user_inc = [] + +subdir('common-user') subdir('bsd-user') subdir('linux-user') -subdir('ebpf') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) linux_user_ss.add(files('thunk.c')) specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) +common_user_ss = common_user_ss.apply(config_all, strict: false) +common_user = static_library('common-user', + sources: common_user_ss.sources(), + dependencies: common_user_ss.dependencies(), + include_directories: common_user_inc) +common_user = declare_dependency(link_with: common_user) + +user_ss.add(common_user) + # needed for fuzzing binaries subdir('tests/qtest/libqos') subdir('tests/qtest/fuzz') diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 87885d91ed..25c3976ead 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -2,6 +2,8 @@ if not have_bsd_user subdir_done() endif +common_user_inc += include_directories('.') + bsd_user_ss.add(files( 'bsdload.c', 'elfload.c', diff --git a/common-user/meson.build b/common-user/meson.build new file mode 100644 index 0000000000..4f5c0f2f88 --- /dev/null +++ b/common-user/meson.build @@ -0,0 +1 @@ +common_user_inc += include_directories('host/' / config_host['ARCH']) diff --git a/linux-user/meson.build b/linux-user/meson.build index bf62c13e37..d6fa4f4d74 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -2,6 +2,9 @@ if not have_linux_user subdir_done() endif +common_user_inc += include_directories('host/' / config_host['ARCH']) +common_user_inc += include_directories('.') + linux_user_ss.add(files( 'elfload.c', 'exit.c', From patchwork Wed Nov 17 16:04:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519223 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1172085imj; Wed, 17 Nov 2021 08:11:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYdaU9Ax2EryFtftfN9DXqEmlpH8GhlJmFCxIIhd1nZY1mGjvL6DrbW8QwtYmAG7V5b7E1 X-Received: by 2002:a7b:c010:: with SMTP id c16mr890684wmb.141.1637165467912; Wed, 17 Nov 2021 08:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165467; cv=none; d=google.com; s=arc-20160816; b=wxxoScW+ZqnH5ISpKsrnxPxfdj6O2v+OWGRU7iXDhufnbqt0T+jq8Mcvidhra44hZj E5q1On8GTtrYvBOQWAtTjVnwVI/dxWP9NjAgjXjJET5DvOt04ahqyH41Ax380eEA1B17 FcTyX31A+OoIowRSkh7oxZqvld6jXm8BrHlCKYFsWJn7HXu+6JP6nHK2UwLBxdc7+pcS i0j0bxHMOlIBUJyHLokXlZvL+cvTs1wqTQf/nm9aQhRaXi/5rLbDblY+VHoSLpM9VNRV ZuFFM1fRn3iy4l9ISJa+HWjiK0DPjpFNssfVrkmAqgglsvgIGqCq73KOkhoOE3MFhVpM OJAA== 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=OArr8UR7K4YMXVKamElRFw6E82XDCuMwJPDbbf5VtT4=; b=ojLAPRN5XEGsVpiuoWs1pQyRyKBdHp9MDkedW2+d79mup7p03yeSqxUzy3ELlXFOUn hnhZ8t2WdCKa2mR96RaX6ZdxN9sRsuO+BTJ2YKYuOsL5MctEmUv8SkmxAprpXzJhpAmW SsRH1tLvxj/lAlhaprV0gn9a/AZyL8m+bD5wzD98OlK5DHvZJcMg18E3vtLWYi6Y/cZC QTvIcqa4ehfNjhUtSKRZ10oNw50kWcnGcXNh/Z/iDDM90QpGxiUjjaRp8bhNBPRkQJ8u Xp7Tfm/R6MlrZFy6lWJjyZ6oOhJ1Ctrv2MRkhKrwZ7CyaPiUQZPzmWI/4fbVAPiOfw+H 7Nmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qJmhe5l+; 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=fail (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 bd11si13054173wmb.204.2021.11.17.08.11.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:11:07 -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=fail header.i=@linaro.org header.s=google header.b=qJmhe5l+; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNWc-0003SN-TS for patch@linaro.org; Wed, 17 Nov 2021 11:11:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQP-0000aW-Il for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:41 -0500 Received: from [2a00:1450:4864:20::32f] (port=40564 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQO-00034g-2U for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:41 -0500 Received: by mail-wm1-x32f.google.com with SMTP id az33-20020a05600c602100b00333472fef04so5203115wmb.5 for ; Wed, 17 Nov 2021 08:04:39 -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=OArr8UR7K4YMXVKamElRFw6E82XDCuMwJPDbbf5VtT4=; b=qJmhe5l+5TvW5jXq8TiaQM8AO7Rtc0ThdpaIpAjzMGs1aTHuTGk52+5h8xjUqpeE4C KQd7hFkYrztGuYsQQAwPDhpnmDQ93K0cDF1uYH5iadfWqZTYOcur+tWYlXSNJTsTgZRu Zd+x8aW9FSOmguSYe4gS+yMTdIGMsN0Zhz7aJ4gzOtD0OVURjyzuUC6WWR7zZNqukdNl +gfRuIY6F1uZq4y8sYRMqBnY0YPEIMFWIddKErwEWBiBpmfWRCwtEXdAuY08P58CqvFq 0tx7HAkhxoKL7QOyf0PzXV9o7FrtoWL3+fsn/mTKbn0ZhCTwkEVuAawU8fgniA4hrnLH 41Sw== 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=OArr8UR7K4YMXVKamElRFw6E82XDCuMwJPDbbf5VtT4=; b=uUSatIck3VxTl/Ilvj9+eZ9B7e0/3rpFmBhcGc+6lLXM4xoXSlMeCCZMwf+0aLr+GS zMUZnNnWkQ72orPncImep2Ez54w3qx1yz4CeKgvD+LTrhHMx0IJPpwt4vP+NagvgmUOs aAxYNGEj00EugINZm2qreRGDIO8ERgpYTDoqWFukvk97yPQKJF9R3BVHI3bfh43JO9TO qUGcaBHxA+gdiNdu83XrJs2DzwDHND3Ot3vJTfVuCIW1U/Be+gx74KUy12zBBVJOKtGi VV0uKWH1wDBvroWtVuPSXxEnCQQFz7CcrtCrp/7opNIlY7otcyJgEcU3nI5ow8DUm1/U I8sQ== X-Gm-Message-State: AOAM531oBva0mbm0m2NJNCywrszUfq86WdkQBB6uIfenHil3iXmRTnt3 xwg4k+RZDJmgjjz3pv3uLHpVu09qCd5g8S710ZE= X-Received: by 2002:a1c:23cb:: with SMTP id j194mr890512wmj.13.1637165078760; Wed, 17 Nov 2021 08:04:38 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 14/17] common-user: Move safe-syscall.* from linux-user Date: Wed, 17 Nov 2021 17:04:09 +0100 Message-Id: <20211117160412.71563-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move linux-user/safe-syscall.S to common-user so that bsd-user can also use it. Also move safe-syscall.h to include/user/. Since there is nothing here that is related to the guest, as opposed to the host, build it once. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- {linux-user => include/user}/safe-syscall.h | 0 linux-user/signal.c | 2 +- linux-user/syscall.c | 2 +- common-user/meson.build | 2 ++ {linux-user => common-user}/safe-syscall.S | 0 linux-user/meson.build | 1 - 6 files changed, 4 insertions(+), 3 deletions(-) rename {linux-user => include/user}/safe-syscall.h (100%) rename {linux-user => common-user}/safe-syscall.S (100%) diff --git a/linux-user/safe-syscall.h b/include/user/safe-syscall.h similarity index 100% rename from linux-user/safe-syscall.h rename to include/user/safe-syscall.h diff --git a/linux-user/signal.c b/linux-user/signal.c index 12b1705287..510db73c34 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -31,7 +31,7 @@ #include "trace.h" #include "signal-common.h" #include "host-signal.h" -#include "safe-syscall.h" +#include "user/safe-syscall.h" static struct target_sigaction sigact_table[TARGET_NSIG]; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 33d342157d..53deb887ca 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -132,7 +132,7 @@ #include "signal-common.h" #include "loader.h" #include "user-mmap.h" -#include "safe-syscall.h" +#include "user/safe-syscall.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" diff --git a/common-user/meson.build b/common-user/meson.build index 4f5c0f2f88..c02b5d9cc2 100644 --- a/common-user/meson.build +++ b/common-user/meson.build @@ -1 +1,3 @@ common_user_inc += include_directories('host/' / config_host['ARCH']) + +common_user_ss.add(files('safe-syscall.S')) diff --git a/linux-user/safe-syscall.S b/common-user/safe-syscall.S similarity index 100% rename from linux-user/safe-syscall.S rename to common-user/safe-syscall.S diff --git a/linux-user/meson.build b/linux-user/meson.build index d6fa4f4d74..bf9d945504 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -12,7 +12,6 @@ linux_user_ss.add(files( 'linuxload.c', 'main.c', 'mmap.c', - 'safe-syscall.S', 'signal.c', 'strace.c', 'syscall.c', From patchwork Wed Nov 17 16:04:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519230 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1181219imj; Wed, 17 Nov 2021 08:17:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZgL7zkGqf+QE0ZKKi4qQUsmz+QDS3+kpguJhe3XmWwSUe6By7MuCBsFNCeQ0Lzj+2JFoo X-Received: by 2002:a05:622a:42:: with SMTP id y2mr18223170qtw.250.1637165872714; Wed, 17 Nov 2021 08:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165872; cv=none; d=google.com; s=arc-20160816; b=wGMdbfZGT1Kb919pUjyQ+HJntAALTYLjTUdF0/P+R9ZPMki7qxWx/FAVgm9AJiGtFn TExl1HHoBVRxPXlpYAOkBCecw4WZJsNmO+D5WL3qYNAqAhrjnD+QDdVzJ3r5cBEDXqj7 zt7TCcdrymQupYb/OmAQyfjO3CZQdvl+Jg9bcP/wGZ+z+dKU86v7wz9IAVXnrCcMbwhJ y+X/wxpRbuWDroPIpEpqkzXipkKWN1Mk/ijJyRtYpEtNQ8DI7eyua8rSupTo7b0PJu33 TOQL/XvxtZjWy3e0+KyJkGWixUwXcSMUc+4JuRMdg2yThOkHHbgrfPw82Uaj6e4+Xjcq v0BA== 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=wf8sidbCeve0P0JaE6VQCRWBZsCGCNB330akAsLUJZk=; b=aVimRwQYbSrWlcQ/V72AD9UFi/+NJDkBCLwX2dGz7EMtDOrJypJkAHE0n8IyVu3O8L tsahciVGUNhmXJoibz7K9UVY57DCCM+Z83lj3d9dVf1J96z3Jb4Nl8kbUi/+1FgFqWRJ P38jnttBKwZv9sbSYerfNjli0fUakCmKMt9OD2VGTlcspvxXNQ/Do6zP6q8XCt/2tiuh uPt1GtqRv4XFqu8hblpYlhJaVeNrv+EuoNcObZkN43Uf6FbXmpAjNKoungE4OQrfjlfz aiLLYD8otoXt+17INr/9U/bxtqXjeHGwPtwtOfhYqXpZzg6uMNJaGkqt/33KTDY61Mo8 y0Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="bqrY9/wq"; 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=fail (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 e21si122477qkl.268.2021.11.17.08.17.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:17:52 -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=fail header.i=@linaro.org header.s=google header.b="bqrY9/wq"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNdA-0007AL-5O for patch@linaro.org; Wed, 17 Nov 2021 11:17:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQQ-0000fF-OD for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:42 -0500 Received: from [2a00:1450:4864:20::436] (port=43802 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQP-00034z-CN for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:42 -0500 Received: by mail-wr1-x436.google.com with SMTP id t30so5632595wra.10 for ; Wed, 17 Nov 2021 08:04:41 -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=wf8sidbCeve0P0JaE6VQCRWBZsCGCNB330akAsLUJZk=; b=bqrY9/wqKCxhSG4/k8IDVXcQ/PHp7lbhZwJZce/l4povg+/QIgVbrFbess06LZgOPb tNJT0G6u5t3KtaYswNE7bYBnnI+ReK3WVkX2z5Ve2ofoFAwDpeqZdjITcTdl/wogDks4 XNJaYkIaXoCGslwa61x6PKBYVQYlbtYU0XLrb2RhBj6meV9Ru99zjlaw3mGPTzbb9wZm cJyqAkiy/zAuvfs7cDV4Y0WUumKkhERK7VmvXFbOnKDh4EQMJ1Ydv97lbGLSJau0Oixm iKcGd0R1XnjPmCkPabZ1j2SqNMUetfP3LiJFcjMG5+g06BKjyZ+xa0Kn5oMlF4bU0Fu0 eiQQ== 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=wf8sidbCeve0P0JaE6VQCRWBZsCGCNB330akAsLUJZk=; b=LFd1Are6SopOAJH1iSAcdmq7jPT4MCwbfM2jkz3Kn3MlTM+HTjhO7a+EZ63ZLt7H28 CJQFyu9Zo0cfzIs+tpCCdOC/pvZC0rwG8vitVAMquZIMIsLetItVcuRzsm3AtMA5RXAf pMS1hiuXuToPUOyg40+H0BVHfhDAkb5Yjf31fXrgC4seVZvxA0898IcNO608T9fmdZQX Ql6ZgLaGs+Y1MM+iRl1adkCupOMd9pOROGI0q1siQ8pdD1XsyNUBtIjpL14YD/CzNfKP WSTxgoTZKGx+g7SkQi0q7PuMqI5ChSmfPOA2rSvoYr+VtgOqS6Z6aZIi9yms3eNacnMz hrDw== X-Gm-Message-State: AOAM5314VFJBeBGgwTlWrrlCFzlw6MW6A13bbf6tZg//3T3hXWWj6FqV f2KL6GNmrfpvxLYEg0xSBbXLXk8dAwXvwR65FwQ= X-Received: by 2002:adf:dd0d:: with SMTP id a13mr20419484wrm.259.1637165080149; Wed, 17 Nov 2021 08:04:40 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 15/17] linux-user: Move thunk.c from top-level Date: Wed, 17 Nov 2021 17:04:10 +0100 Message-Id: <20211117160412.71563-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" So far, linux-user is the only user of these functions. Clean up the build machinery by restricting it to linux-user. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Warner Losh --- meson.build | 1 - thunk.c => linux-user/thunk.c | 0 linux-user/meson.build | 1 + 3 files changed, 1 insertion(+), 1 deletion(-) rename thunk.c => linux-user/thunk.c (100%) diff --git a/meson.build b/meson.build index 387f7fe1c9..9f59c57909 100644 --- a/meson.build +++ b/meson.build @@ -2614,7 +2614,6 @@ subdir('linux-user') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) -linux_user_ss.add(files('thunk.c')) specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) common_user_ss = common_user_ss.apply(config_all, strict: false) diff --git a/thunk.c b/linux-user/thunk.c similarity index 100% rename from thunk.c rename to linux-user/thunk.c diff --git a/linux-user/meson.build b/linux-user/meson.build index bf9d945504..fcf7d40f23 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -15,6 +15,7 @@ linux_user_ss.add(files( 'signal.c', 'strace.c', 'syscall.c', + 'thunk.c', 'uaccess.c', 'uname.c', )) From patchwork Wed Nov 17 16:04:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519229 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1181103imj; Wed, 17 Nov 2021 08:17:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkV0wMok1j1mSKpqeoO2W8YGbyZQ4T5nP33VmRsCZK3+1jF6k4YDN3XLAjZt6ekoDGuzNs X-Received: by 2002:a67:d216:: with SMTP id y22mr68969669vsi.6.1637165868424; Wed, 17 Nov 2021 08:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637165868; cv=none; d=google.com; s=arc-20160816; b=BOTOMGQfq8VEaZQg7Q5gkug8UjIJmHFAIcON/n6haqE/ESTwPeJoqzStE8KvPi84mh 3seriYrkBVToZbfxYYZAx+RlJ85fZEny1Jxdlm98ctPL9KsIP/+OkrdWtekLSHHoESg9 UbV+0UdPAxobORW3f3ajEBIdipMFZbjZYC3a+NqKrwRYLn3d+lJ601BwS4wQYVeFJO+W tiBaikSNJQKh2/kdtypI5+AjvNpu2qF3xSX1PGv3fdngMUftUY1+bHOBs+//6Sb7NBY0 Yk+qhadRm5TyX06BnhVZFvLq5JbcjWLXAl2sPX6k4Ziq/Zc7u9NedQtbHdyE6xR/EqnV Feig== 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=u/A8dNepwkmZQUjVDq9nLnqwpFSL4s0WWo1frLw06AU=; b=pp7efPlAEqZedYPAlGW2havhxIJ6O8uOxlCAslsypBg9Hz2BeVuyuunPxP/ayIw/LK ON+DHzwBkwbaY4c6xB8I9OYpyKRJnAg2yg7t4xy62pgFBWeAMF/5yrr0cbnX1XMxvmvZ uWQNLTlp47B3kCos6TdYobO/yKQVNTWuynKsggiWmTidLElLCt1GZkwW8CAXAJTJFPW7 86+VHdbnVm+qR9tkcE+meGqzK+93Xd9qaTlIx/hRcTAOm1rBBVPhE5ZP6/OWuR7S1HXO rtdJQnM1S8cBcOZwJteJFQ4gFXfRcnVP/Fvuwh8fHiZhZvLQ8TmSjLBYkGiV69vKRknO GNEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qAzw3ecy; 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=fail (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 h9si411145vsp.95.2021.11.17.08.17.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:17:48 -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=fail header.i=@linaro.org header.s=google header.b=qAzw3ecy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNd5-0006qH-Sl for patch@linaro.org; Wed, 17 Nov 2021 11:17:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQS-0000kJ-1F for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:44 -0500 Received: from [2a00:1450:4864:20::434] (port=36481 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQQ-00035H-JF for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:43 -0500 Received: by mail-wr1-x434.google.com with SMTP id s13so5688590wrb.3 for ; Wed, 17 Nov 2021 08:04:42 -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=u/A8dNepwkmZQUjVDq9nLnqwpFSL4s0WWo1frLw06AU=; b=qAzw3ecy+t2yzm5NexeiUorhWCkC7lXo96CEMAs4YRRKaod0/A1T3gDtJZ24ru/tcu Qthrcq6NKXP2gdvj6lCIWewby+sDP23yRQHKoQWp2THK208ddUygkvXUAveXab4Y1gWU 0+LISYQZJss3Db24DBypYW9/NOMsxgqp2d/RESB68SDTLeR70k5pzeTgjgg+RCtpSO+n cHLBYRK10lgY5BlkabMdPDBX+w3xPEQ3W9WHTjXs7Op+y9CFhOhDsR+XLBWxhhZP/GRo L0cORfS4cmRz5ZuHlPm3Teq6+RGM9DeJtlG6Eg4PO4Bmf8D5303Qvr8C/Kevgf+I/0pj o8bg== 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=u/A8dNepwkmZQUjVDq9nLnqwpFSL4s0WWo1frLw06AU=; b=8DJhNnecoy8Gk2D1IPl9CPWlgbSCa82x9p5Y8F+TZRz0fSlukVgWPJMnsihV4SVlUT qZkCSFrAVMifYXEwsqaKW6yuR4tMHceScUFxDOxwicruqexuzAD0KB+IhPo+cYD/1aVP DxBDuSLApohfpECRHEr5DVWgIj5tuUwA6rgYKwYJD25T7YroRwtw3ZFDn7wV4T8z5WRM Tp0BbrlvMTVcGFT3ViZQ05hoHuWBmc8/btT5xmz1GyH0Vdc4f/xmifRlDENaL4fe/ILz yPDlnknrT5RTGnCCiFNE2yz9hAT6n0n5j1/R2BtDcGRgy1FVlasY/tkFA69KCmZHBA+M mpsQ== X-Gm-Message-State: AOAM533qMC8gBFozMPYu+2FouTXy1v+PCBOldVVTkUQ/MxAoJLp4fJWK pgVW5HJM5nGcgLaRc1FEXlW/sJZZ01NZVytpZLQ= X-Received: by 2002:adf:a2de:: with SMTP id t30mr21353133wra.58.1637165081296; Wed, 17 Nov 2021 08:04:41 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 16/17] meson: Move linux_user_ss to linux-user/ Date: Wed, 17 Nov 2021 17:04:11 +0100 Message-Id: <20211117160412.71563-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have no need to reference linux_user_ss outside of linux-user. Go ahead and merge it directly into specific_ss. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Warner Losh --- meson.build | 3 --- linux-user/meson.build | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 9f59c57909..ecc181ea13 100644 --- a/meson.build +++ b/meson.build @@ -2363,7 +2363,6 @@ common_user_ss = ss.source_set() crypto_ss = ss.source_set() hwcore_ss = ss.source_set() io_ss = ss.source_set() -linux_user_ss = ss.source_set() qmp_ss = ss.source_set() qom_ss = ss.source_set() softmmu_ss = ss.source_set() @@ -2614,8 +2613,6 @@ subdir('linux-user') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) -specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) - common_user_ss = common_user_ss.apply(config_all, strict: false) common_user = static_library('common-user', sources: common_user_ss.sources(), diff --git a/linux-user/meson.build b/linux-user/meson.build index fcf7d40f23..b89534c49c 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -2,6 +2,8 @@ if not have_linux_user subdir_done() endif +linux_user_ss = ss.source_set() + common_user_inc += include_directories('host/' / config_host['ARCH']) common_user_inc += include_directories('.') @@ -42,3 +44,5 @@ subdir('sh4') subdir('sparc') subdir('x86_64') subdir('xtensa') + +specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) From patchwork Wed Nov 17 16:04:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519231 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1184110imj; Wed, 17 Nov 2021 08:20:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQHKfnbSzjwZN9XdjweqYDndpcm6tFpYKRyYa1ItJtnhk0iTalMeKuEaDn8+Sh7s9KHyen X-Received: by 2002:a05:6102:2748:: with SMTP id p8mr71822769vsu.13.1637166002705; Wed, 17 Nov 2021 08:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637166002; cv=none; d=google.com; s=arc-20160816; b=pFzmgptt6TS9gSUO+SQhu4jyiVjpZe+BYLsEJSVe2Kj7hPl/RmuNtsoqnQxSwd5rxk 2sX9dc0LKvcJQ6/729Eir+NF7wZmZCXTswFQs8MlPw+/IwhE9edWNYCJhJ+Sp8Rjkkk5 Bz0BEdZhposeEuRCHTFNoRChXrdKH5iXKZ2YSNsd7K2BhqN2eRnoqudPAQ8T9LhLiDNj 6LBX8sRnKeQsIl9bVNSPLQloKW1feOqj1Ud9B6MXzv0tH+gl6z8zlo3DGcUncyKIdkUA 7E2WKqlw3+Rn2OmIbMuJBYOxVSWI7CiOqLSy8wj0z/ykv/V6nbyLZtsWL0KE5pyOaJcn Il1w== 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=+h63Maw63ktvyuEogld2/EfBtiWXaS9LUhKmRtLAPjA=; b=weLuxCHkpQ+Y5S9GU9CjxNvWd88R0411bZ0bUTPEQXUtLVZi7GAxahlx85OCi0Ab6b mmihnJkn30oFYfWh9n7hBqNGo9MR84ZhGmcjjyMyeR7ecXxA/AHh9bN0RvZKWEPDTq9G 9/4prDLdTU8TFeHFPuU2ctEo50nvv/wPm7/ue4tAvVDd6tCAmuJDif9xxluTPyReqiXZ y0C95gxIan419Aa+D/FgPlOXIZLP/YoP3Z3PHkM9++iXY1LvThO9c+uI/ZNn1xy2jp6w bSrrfWTWCNOEL5DVmBhBNWjRCiCh2701agO86QrP15z69wGvuFtS4TprYv4plHNPfIRf Bjow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HPyfeM8j; 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=fail (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 l6si593424vkd.80.2021.11.17.08.20.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 08:20:02 -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=fail header.i=@linaro.org header.s=google header.b=HPyfeM8j; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnNfG-0003wT-47 for patch@linaro.org; Wed, 17 Nov 2021 11:20:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnNQT-0000qT-Ca for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:45 -0500 Received: from [2a00:1450:4864:20::42f] (port=38861 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnNQR-00035Z-UA for qemu-devel@nongnu.org; Wed, 17 Nov 2021 11:04:45 -0500 Received: by mail-wr1-x42f.google.com with SMTP id u18so5661924wrg.5 for ; Wed, 17 Nov 2021 08:04:43 -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=+h63Maw63ktvyuEogld2/EfBtiWXaS9LUhKmRtLAPjA=; b=HPyfeM8jFO34EfE0TJJB+LB+lHN76nAmdIDZt4jb3r1Tpa5cNQaDsNktg3zuHujKYM ZdOtdn92sSaA4X2P/j/8KNnszRxJRRo7nTY9PBZCT0NtL9Q4QGUjYJV74JJWTrB+z5Gh a7BVkym1an1gTjqYT/CJAEQoUQjRUiOv3ENo5SPH77pKBVr6kNf5hfMU3OYJHrYMgdA5 Bk5w8bETeChuHuOM+eWGwUwh6rZ+VIG9sbyXp753dryRdLkWlXYsioN49gcgfqYfTn/M CqOyulJc+N9gXp08NNPNjQBehVpbU0OF0RK4z2dovy04DN+n6bV5qERnZUxS1hq9xgid HNgA== 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=+h63Maw63ktvyuEogld2/EfBtiWXaS9LUhKmRtLAPjA=; b=g73wisq1tx/FZmZi90BetZhoZR1Au/3IM95ePkVPgmlB8iqWFLO+aYcw5Wk8GDSuLW V08ekHYMrDCEds/qYNgpVxE7qHAZFssDoTFi5ifwFzk6Mnp9QG2FCkNuGByj/98fBCJq a3o4VOVJ+PUDIyLFMS9KXzqOu8z3pyVpSi0gZXJzzszvQgOW7EX3qkwxG01Gu2e8hEs0 LPN2/vVIxSeEH4a3cj5LZV4dJzbsWy3f2eJMuMGPen837TKZPb3yDfcCl8McD+v3oPLP 3e1oM9U0Jac5eWRb2Agn+FEuVoc3D3N0SZ7j0g4mL6+dIyIvKekaq0Mp98PQlwiSqVFk EcSg== X-Gm-Message-State: AOAM531CAzZUoGjBC8P7ELGVnw0r61gXVAIS6860LPZkXqXiVbyEFFje eGlJ/H1GZxL4GaYg8zvodRdDuUF0Dt2U8Z1fa7g= X-Received: by 2002:adf:e904:: with SMTP id f4mr21956298wrm.245.1637165082586; Wed, 17 Nov 2021 08:04:42 -0800 (PST) Received: from localhost.localdomain (101.red-176-80-44.dynamicip.rima-tde.net. [176.80.44.101]) by smtp.gmail.com with ESMTPSA id m2sm5826742wml.15.2021.11.17.08.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 08:04:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 17/17] meson: Move bsd_user_ss to bsd-user/ Date: Wed, 17 Nov 2021 17:04:12 +0100 Message-Id: <20211117160412.71563-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117160412.71563-1-richard.henderson@linaro.org> References: <20211117160412.71563-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42f.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, PDS_HP_HELO_NORDNS=0.001, 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: laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have no need to reference bsd_user_ss outside of bsd-user. Go ahead and merge it directly into specific_ss. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Warner Losh --- meson.build | 3 --- bsd-user/meson.build | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index ecc181ea13..9f7756a805 100644 --- a/meson.build +++ b/meson.build @@ -2356,7 +2356,6 @@ genh += hxdep authz_ss = ss.source_set() blockdev_ss = ss.source_set() block_ss = ss.source_set() -bsd_user_ss = ss.source_set() chardev_ss = ss.source_set() common_ss = ss.source_set() common_user_ss = ss.source_set() @@ -2611,8 +2610,6 @@ subdir('common-user') subdir('bsd-user') subdir('linux-user') -specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) - common_user_ss = common_user_ss.apply(config_all, strict: false) common_user = static_library('common-user', sources: common_user_ss.sources(), diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 25c3976ead..9fcb80c3fa 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -2,6 +2,8 @@ if not have_bsd_user subdir_done() endif +bsd_user_ss = ss.source_set() + common_user_inc += include_directories('.') bsd_user_ss.add(files( @@ -17,3 +19,5 @@ bsd_user_ss.add(files( # Pull in the OS-specific build glue, if any subdir(targetos) + +specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)