From patchwork Fri Oct 1 17:11:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515059 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1000553jaf; Fri, 1 Oct 2021 10:17:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziyWt7OM19Ij1h1uh/FuZwbpBgOLt45DuK+NYgPRHMQJbmuT13OTqHw/meXBaVlzLyNOJb X-Received: by 2002:a67:1004:: with SMTP id 4mr5718672vsq.26.1633108662207; Fri, 01 Oct 2021 10:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633108662; cv=none; d=google.com; s=arc-20160816; b=KylFZlx6D1ydt5cJQvw6AJiIEOm8wzmButFn6C07jFiu2jWxna6ecOS9xSQoM6kjgt yxo7qw4sg/bDEBFcwV1ZArupr/5AU6lu891b2j2YtCE9dCRCtSVhglF+kovDWD46nXzr AwNv52uUB+a77QXxjLOc4TW2vl6KRXLPDOUYJmWjdJlyM1JqypRJwr1guH/0oQC0IDRd XNkxdFF4sthLg2wbyz+r9e2I3yVFLgD/Tib5nfrnPzaN/tuoXFQKu5E21E8cxIr500of VblpZslOVKCvYbkkV6wXwZbss0pLA9S8lr55sG8uDDAj++Mm2Z/xwA8fY7ZEhWk+OIgl uuHw== 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=6fVjVy4AkVzaH6Z0yyaREpJWIPed0v0p7SS/ifUGXt0=; b=QB3jcsGtZ51PwNdvctgClEFUfUlodr0/RKYTiFlk78wAqhORrWiHHojcOBsgQtaqqP cxiw4to+TOzM/87v2BuOk2sQaC+wg/dcjyCyzaaBFVR/QA2xC6UpUqJb9ZGQABGeIwB2 jJUoymFy+3JZblur9v1pXjZQnv7Bqkc6FCdJRJfNCkd6G2AO5uSZaoPwPMIA7xLQ1RGs hZQ3wtmmzrWnY0SapwjAXkbK6a9ZrsvwpcaDDJk7yDbDhquIf0XAsxTqlVPDXkuJuFmx +M2Qhv3hHPLQz1d/Xv4UjRy+8qhHb+sM9Eo5kfaMcqvCiw0+UzbADoSpbDcUipFUcqP6 3ZBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WD6ib4KH; 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 a7si2451586vst.104.2021.10.01.10.17.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Oct 2021 10:17:42 -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=WD6ib4KH; 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]:58794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWMAG-0002yE-DK for patch@linaro.org; Fri, 01 Oct 2021 13:17:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWM4u-0004hq-2t for qemu-devel@nongnu.org; Fri, 01 Oct 2021 13:12:08 -0400 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:35683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWM4q-00050O-IA for qemu-devel@nongnu.org; Fri, 01 Oct 2021 13:12:07 -0400 Received: by mail-qv1-xf2d.google.com with SMTP id dk4so5994502qvb.2 for ; Fri, 01 Oct 2021 10:12:01 -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=6fVjVy4AkVzaH6Z0yyaREpJWIPed0v0p7SS/ifUGXt0=; b=WD6ib4KHXSeGBc+f2/sASNKNA/iL4eFr5Acjq9YfznAiJj3B1FfHxUPa6DFtMjYfeD XzMVM9xL63I9xREhoQffnYbXw++MzEMqI9JBl5zz8vgpGVHNq6mMrvnIf0zg0E0qLUgw hn3j9wz6KJgPS1THOrLIC5W/W+thPgOKE9HDC9vPHRZSacvHx5Z4JpVYe2kb6QCjV36T ArxdGyuQ4TX+ugFFxywVSUpLcIEJDH331hYBzLFEMsCFLj/RvxN9gTAnRc+nhXz7VQG5 ROGFa0z2A8mUPtosbqfVYuVwNhMLnRbBTWUfajCDysLebw99xBUXlDybCXyGcCbTF49p s8LA== 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=6fVjVy4AkVzaH6Z0yyaREpJWIPed0v0p7SS/ifUGXt0=; b=Ls3K5LwLanoYrLOJL9i7AgaHz5H7Lq6ccYdShbxeRznRco2dhvYTe0y/Z69Ypc9YKc PBe2HeHMOUaGvJDhmPT5inWWvSvacaYFlnIhdIBc/Cw9NXOOUqHbXXpCkQ5cNQkq94zT 1G8VLHjcORbnMflmnU020ptY2TD46/YdtZG1+Osp2vbteXhOSL6HccRaH00yuCJJocnI 6TavSivxPvoLvbCZdhEhaEECSVq6EEMhC6kolIKk8KopTF6gdNodhdKU3G5q32hrIa27 GcNlPkbFyPc0EpSQT2lRhw+OeoCHauc614pN/6mvkvrPzJIGIziTGR6Hms8XKQ9fK2jA nBKg== X-Gm-Message-State: AOAM532EPY48aB/OQZLwWuK6o3MsRMpmSxEXGKZ8vsCwp1iFYQYaHZBp R8PMwlgqg7RtR9jxuFv7nlEilQA5QlWwRw== X-Received: by 2002:a0c:c2c4:: with SMTP id c4mr10374993qvi.18.1633108320518; Fri, 01 Oct 2021 10:12:00 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id y15sm3557250qko.78.2021.10.01.10.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:12:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/41] linux-user/host/ppc: Populate host_signal.h Date: Fri, 1 Oct 2021 13:11:18 -0400 Message-Id: <20211001171151.1739472-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001171151.1739472-1-richard.henderson@linaro.org> References: <20211001171151.1739472-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf2d.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, Warner Losh 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 Signed-off-by: Richard Henderson --- linux-user/host/ppc/host-signal.h | 25 ++++++++- linux-user/host/ppc64/host-signal.h | 2 +- accel/tcg/user-exec.c | 79 +---------------------------- 3 files changed, 26 insertions(+), 80 deletions(-) -- 2.25.1 diff --git a/linux-user/host/ppc/host-signal.h b/linux-user/host/ppc/host-signal.h index f4b4d65031..e09756c691 100644 --- a/linux-user/host/ppc/host-signal.h +++ b/linux-user/host/ppc/host-signal.h @@ -1 +1,24 @@ -#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 PPC_HOST_SIGNAL_H +#define PPC_HOST_SIGNAL_H + +static inline uintptr_t host_signal_pc(ucontext_t *uc) +{ + return uc->uc_mcontext.regs->nip; +} + +static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) +{ + return uc->uc_mcontext.regs->trap != 0x400 + && (uc->uc_mcontext.regs->dsisr & 0x02000000); +} + +#endif diff --git a/linux-user/host/ppc64/host-signal.h b/linux-user/host/ppc64/host-signal.h index f4b4d65031..a353c22a90 100644 --- a/linux-user/host/ppc64/host-signal.h +++ b/linux-user/host/ppc64/host-signal.h @@ -1 +1 @@ -#define HOST_SIGNAL_PLACEHOLDER +#include "../ppc/host-signal.h" diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index b5d06183db..e9e530e2e1 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -255,84 +255,7 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, return size ? g2h(env_cpu(env), addr) : NULL; } -#if defined(_ARCH_PPC) - -/*********************************************************************** - * signal context platform-specific definitions - * From Wine - */ -#ifdef linux -/* All Registers access - only for local access */ -#define REG_sig(reg_name, context) \ - ((context)->uc_mcontext.regs->reg_name) -/* Gpr Registers access */ -#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context) -/* Program counter */ -#define IAR_sig(context) REG_sig(nip, context) -/* Machine State Register (Supervisor) */ -#define MSR_sig(context) REG_sig(msr, context) -/* Count register */ -#define CTR_sig(context) REG_sig(ctr, context) -/* User's integer exception register */ -#define XER_sig(context) REG_sig(xer, context) -/* Link register */ -#define LR_sig(context) REG_sig(link, context) -/* Condition register */ -#define CR_sig(context) REG_sig(ccr, context) - -/* Float Registers access */ -#define FLOAT_sig(reg_num, context) \ - (((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num]) -#define FPSCR_sig(context) \ - (*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4))) -/* Exception Registers access */ -#define DAR_sig(context) REG_sig(dar, context) -#define DSISR_sig(context) REG_sig(dsisr, context) -#define TRAP_sig(context) REG_sig(trap, context) -#endif /* linux */ - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include -#define IAR_sig(context) ((context)->uc_mcontext.mc_srr0) -#define MSR_sig(context) ((context)->uc_mcontext.mc_srr1) -#define CTR_sig(context) ((context)->uc_mcontext.mc_ctr) -#define XER_sig(context) ((context)->uc_mcontext.mc_xer) -#define LR_sig(context) ((context)->uc_mcontext.mc_lr) -#define CR_sig(context) ((context)->uc_mcontext.mc_cr) -/* Exception Registers access */ -#define DAR_sig(context) ((context)->uc_mcontext.mc_dar) -#define DSISR_sig(context) ((context)->uc_mcontext.mc_dsisr) -#define TRAP_sig(context) ((context)->uc_mcontext.mc_exc) -#endif /* __FreeBSD__|| __FreeBSD_kernel__ */ - -int cpu_signal_handler(int host_signum, void *pinfo, - void *puc) -{ - siginfo_t *info = pinfo; -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - ucontext_t *uc = puc; -#else - ucontext_t *uc = puc; -#endif - unsigned long pc; - int is_write; - - pc = IAR_sig(uc); - is_write = 0; -#if 0 - /* ppc 4xx case */ - if (DSISR_sig(uc) & 0x00800000) { - is_write = 1; - } -#else - if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000)) { - is_write = 1; - } -#endif - return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); -} - -#elif defined(__alpha__) +#if defined(__alpha__) int cpu_signal_handler(int host_signum, void *pinfo, void *puc)