From patchwork Sat Oct 30 17:15:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516472 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1428935iml; Sat, 30 Oct 2021 10:50:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmKcSXbxGeA6Pc/RwAixv1KTxqyoBz8eEJ+A+7e3bom4LPjzoHtPq+LkBL6jlJ60yWg3ii X-Received: by 2002:a05:6808:30b:: with SMTP id i11mr12844377oie.2.1635616258580; Sat, 30 Oct 2021 10:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635616258; cv=none; d=google.com; s=arc-20160816; b=d/5BzWQw3H0Si/NMQ1acMDJqATYTu2Uoi4AXoANcKYKQdAMUHdAs0vLU/e8og1QwJ1 Z5ZcBvxxcGJXY0BFuQmz0lDP6g5iDOhf9tgVrO9Zkpx9AXWwUpCshf7XdGmdAHrgsoia ZJ5zyGX22ZzFN49qNfXs9dIsliRT+Ywm1OXBCUfxIPFPe625acODfyOzw7K/Okomjp9b BnqBOyfw6th/R7D4cAqL1nT5u0vV913YZbQUM2HeZaZzmhL+48IPaL6LO/Ayuy1YSmCc nLUDxCWAumiqLsHNZa9iO4k/V4ZmIq7xNnEWY5FXm3kJUbZyp71KLZtowyoPB3THhL4C lJcw== 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=M+c0oxO/KqkWahATCsn/ry8zft6rVGU+nYtnuTkgrVg=; b=tLKvIXQve2GaJ9oNUiVy4KLtSPqDwcm3CusGG32zBmtHZcC9IDQ8pGiQI9TZNc7exL jy9+uFkByT1cWZinMMKjZrqBaK3z551rrDwD7Gv9KPDoD2GofrGkW6+eaLw6mjlTU/q8 YYNIeTcFADLw3S1d7IIq5AsR/bjR/HoJb2640aiweASzqyIKXxl+lpEDzSxMM9u/RD6W Xr/opmgpbqxSTd7De8ZfYvicuJBthP6rlg8qLTm7J6Ynl/fePSFf/lye0IvFN5ybWoVP 97oejXABZcxfW/j9p7FFy0J//gzlqPicSkjVqe0erjdtWuScC1Ea3wqApuNEI1C/xQ/a YFJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EC7dLdOf; 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 r207si8548754oie.181.2021.10.30.10.50.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Oct 2021 10:50:58 -0700 (PDT) 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=EC7dLdOf; 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]:41106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgsVN-0000hl-RT for patch@linaro.org; Sat, 30 Oct 2021 13:50:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgryO-00020S-P7 for qemu-devel@nongnu.org; Sat, 30 Oct 2021 13:16:52 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:41792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgryK-00007T-ME for qemu-devel@nongnu.org; Sat, 30 Oct 2021 13:16:52 -0400 Received: by mail-pg1-x536.google.com with SMTP id n23so2348787pgh.8 for ; Sat, 30 Oct 2021 10:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M+c0oxO/KqkWahATCsn/ry8zft6rVGU+nYtnuTkgrVg=; b=EC7dLdOfmVdUrgDhCF7NCut2nPF9drNieXhjzbdmwjJtMSUhyHk6wBgilcaRgLz26k Sqnl4BHPnCjXc6wxraxYeC6FO1VcCXbHs9/O3z1z5l9fZSOI/q1+3ZdI8kUyEzFiUMW1 cqj9eq4wU3m3EOYMc8pdQRKPFSbcpzDQxZr7bhNLMFUG5r/QVkp13yrinF46aP7EkUVu tgMiGejv7oAD5216lse38mQfVGptBhF5dBla0EVaRUXJVxeZPSpSEjRrTbRcLiaKBLjU bEQFFZ7FOqj1fr9Sw9XQrrjvy2LUee2A1C/4AqZPD7pPUCBpGnPs64keX1KraMFKfr1h GTUw== 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=M+c0oxO/KqkWahATCsn/ry8zft6rVGU+nYtnuTkgrVg=; b=UaiOYfZNLZLeoNPgTCMw8reRj5ZoH+EPsGuZ/V+oofwNFzHLL/1hIrYXDLmoMD1dBS bfDNoCauvg64GJTi/+tv1snLQ33gy4ilz53kdz+VKONtci/gWKpD3QTmTiegnsBwa0yM SQa9N0mv53JWYqq59txygJGDptTNZtOH8unQoZ0gwcF3SuVMYef7bWy9ONb85oKw84hb hqGJrI7SXBeMpXfyXEusyT82mZsS7ylQkYC250F3V+zzQ+QzLqBzOnWqulnc5pm2gotU j24p2qI4Ia7zAFvRcxE8QWI1aikyJXRhR2CKeUiQ5Vnl4J94+4AOUkv7uLe5QsGULZXW WYnA== X-Gm-Message-State: AOAM531hXQS3Yf95JjKnYECL1/dW5ADa9gmCpmr4Uc9ltlZHUbsjiHZj oIC3Vq76+RzouoS1kD7yLAvh/qYrWm8hlQ== X-Received: by 2002:a65:4942:: with SMTP id q2mr10938836pgs.405.1635614207305; Sat, 30 Oct 2021 10:16:47 -0700 (PDT) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id nv4sm3111943pjb.17.2021.10.30.10.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 10:16:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 11/66] linux-user/host/arm: Populate host_signal.h Date: Sat, 30 Oct 2021 10:15:40 -0700 Message-Id: <20211030171635.1689530-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211030171635.1689530-1-richard.henderson@linaro.org> References: <20211030171635.1689530-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, imp@bsdimp.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Split host_signal_pc and host_signal_write out of user-exec.c. Drop the *BSD code, to be re-created under bsd-user/ later. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/host/arm/host-signal.h | 30 ++++++++++++++++++++- accel/tcg/user-exec.c | 45 +------------------------------ 2 files changed, 30 insertions(+), 45 deletions(-) -- 2.25.1 diff --git a/linux-user/host/arm/host-signal.h b/linux-user/host/arm/host-signal.h index f4b4d65031..6932224c1c 100644 --- a/linux-user/host/arm/host-signal.h +++ b/linux-user/host/arm/host-signal.h @@ -1 +1,29 @@ -#define HOST_SIGNAL_PLACEHOLDER +/* + * host-signal.h: signal info dependent on the host architecture + * + * Copyright (C) 2021 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_HOST_SIGNAL_H +#define ARM_HOST_SIGNAL_H + +static inline uintptr_t host_signal_pc(ucontext_t *uc) +{ + return uc->uc_mcontext.arm_pc; +} + +static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) +{ + /* + * In the FSR, bit 11 is WnR, assuming a v6 or + * later processor. On v5 we will always report + * this as a read, which will fail later. + */ + uint32_t fsr = uc->uc_mcontext.error_code; + return extract32(fsr, 11, 1); +} + +#endif diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 694eff7f04..fabc8855a9 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -253,50 +253,7 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, return size ? g2h(env_cpu(env), addr) : NULL; } -#if defined(__arm__) - -#if defined(__NetBSD__) -#include -#include -#endif - -int cpu_signal_handler(int host_signum, void *pinfo, - void *puc) -{ - siginfo_t *info = pinfo; -#if defined(__NetBSD__) - ucontext_t *uc = puc; - siginfo_t *si = pinfo; -#else - ucontext_t *uc = puc; -#endif - unsigned long pc; - uint32_t fsr; - int is_write; - -#if defined(__NetBSD__) - pc = uc->uc_mcontext.__gregs[_REG_R15]; -#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) - pc = uc->uc_mcontext.gregs[R15]; -#else - pc = uc->uc_mcontext.arm_pc; -#endif - -#ifdef __NetBSD__ - fsr = si->si_trap; -#else - fsr = uc->uc_mcontext.error_code; -#endif - /* - * In the FSR, bit 11 is WnR, assuming a v6 or - * later processor. On v5 we will always report - * this as a read, which will fail later. - */ - is_write = extract32(fsr, 11, 1); - return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); -} - -#elif defined(__aarch64__) +#if defined(__aarch64__) #if defined(__NetBSD__)