From patchwork Tue Nov 2 11:06:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516639 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4407036iml; Tue, 2 Nov 2021 04:23:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVdyo60EcZ84c2px0JhfLTX5fvrkNpbK17naFM8KMNiMuWe3TXzeWpsmZ8uwWg73d48LGi X-Received: by 2002:a05:6808:238f:: with SMTP id bp15mr4707399oib.30.1635852232848; Tue, 02 Nov 2021 04:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635852232; cv=none; d=google.com; s=arc-20160816; b=uV2Pumys5FS1LuF+waXgaM5DknTBGUh5MM7K8pBleMFlULuIaRGjwYpDPDB9yCbekc EBaVy9pG2g8YN8YjKGPDcv2fJK53Pc+2ycV8M8YiGP90LpTjsNpT2mXTHvXh82lpY38g KbDn17x2QnlubaetAF5fFsdtKYoOPg2MSnzRh8mixCvsVdPU+H5Y6re3vnj9uGh+8p5E OKpfTKu6k4RRJyTf0RbgqTsbk0Klz1d3agOsE1RT4J0uWPzDQoqHVYIJV/JyznouZEuA ngExh4KttU0C3mKqbIAuDgrSzRcHjxA6P9Z9ZsUILeNEhVgPO1oMMcouOKz3YBJ0ng/r TgUw== 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=8/7KXVD3zq87x6TOe7PU4RK3OGzoSoejAMrm7z+tUkk=; b=C4XGIuQV2jq7MP8l3q3lKodbVBxfHbxBbs2RX96aQEQLAwrr2TeDxIm26PzdwqFsMi d0ofefGQDhx45zDDCS7nleNqKBOyOcOHbbdjeff6CJNQZ7UXM1ENKfChLxkmyA6pkmlu s06OksNVvflSV029wnAFfpiEIIhvpr1GFwjmMOMWWVtqCx+ObqkpeHZWTCP/iuZDQG+R W+IvZ8IbDP2MKQ4jR6uAMT7F11DYdUmpWrxLrJHTC1LGXADv1AuBuqhi9/IPd4Ic/jHK i8WrYRisXOg0jKSrq6bzeyPe7zmRjvN5NncN18pxu+4/TxRAOwk2fxLtoNnvPsjFLJsZ lJlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aEJ791Nd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w20si5786841oik.300.2021.11.02.04.23.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 04:23:52 -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=pass header.i=@linaro.org header.s=google header.b=aEJ791Nd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhrtQ-0004fV-7M for patch@linaro.org; Tue, 02 Nov 2021 07:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhrdz-0003jd-QH for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:07:59 -0400 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:45038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhrdr-0000sF-8p for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:07:53 -0400 Received: by mail-qk1-x736.google.com with SMTP id bj20so7951719qkb.11 for ; Tue, 02 Nov 2021 04:07:46 -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=8/7KXVD3zq87x6TOe7PU4RK3OGzoSoejAMrm7z+tUkk=; b=aEJ791NdOwLJ3MBpD57UXs5LdjWjmtoREtOAI6CCNAe1YYkzZZy+v1+UIjt+X7pIro IIpFEjL0M2srSnjn+zO5f5JcVBbfHefDOuluox5Ihnuww9XG9GupeGULwPlPSMoMTwJ8 oH3zIa3jIRF+KH1BDQSq8diajZjYEmA2+ThdL8813beVAOFmDvqEb3kSnKlewWwXs7gF QUh8XsPGWUdkrAmDK0jJ8tpAha9F3GBQO9H+JtiEtDWOs88XSDp5/PvYEkempvLKEBGM U7Ch05dyDtfMy8bWaIzvnARnLYH6Tuvvg7yZQi0N5iRrZiB9+kszlT38Ef/k5k1Rh5j8 6yog== 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=8/7KXVD3zq87x6TOe7PU4RK3OGzoSoejAMrm7z+tUkk=; b=2ZDSHfyTFjTtuV6jUskCFpS1p6wFi+hPlPb+B1xXxEqRumuEvfZv0eQr/ya/oZxCQP QU3kPoQdLaTZrVaTvx2o4mHaberBO29M9xv3Muf4w2LKk1qx63bGGzubNDFBNQKJ4rUS FJJiHRUK9jFTPdEVdfL7QvCuCMf4lifJ233Nag8shFvOwxwzgB1eaqAXL+tt+VSR/F+/ QI8synRvzC+mBvWbKm8nRv/D4yOeAVlYb6UdkpGBajVYEtk3GtHG88/GTlAgOnsmEIo6 QNjt9sStnbOmUiWDqs4eVcLzjsA2W1rQ5oLBcAPYsC8TxIw+jEDH56evXIZ8mB8TY9V1 1ZGA== X-Gm-Message-State: AOAM530BLcYONRYwxNxPPqCUBPcMZVQQwFPEcAEDydY77Lub2GXSCABu dy019tIRmse5VImSV3Rk4kC08xk4Uxn/vA== X-Received: by 2002:a05:620a:2910:: with SMTP id m16mr11515492qkp.389.1635851266289; Tue, 02 Nov 2021 04:07:46 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id bm7sm3568612qkb.86.2021.11.02.04.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 04:07:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/60] linux-user/host/ppc: Populate host_signal.h Date: Tue, 2 Nov 2021 07:06:48 -0400 Message-Id: <20211102110740.215699-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102110740.215699-1-richard.henderson@linaro.org> References: <20211102110740.215699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x736.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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 | 26 +++++++++- linux-user/host/ppc64/host-signal.h | 2 +- accel/tcg/user-exec.c | 79 +---------------------------- 3 files changed, 27 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..a491c413dc 100644 --- a/linux-user/host/ppc/host-signal.h +++ b/linux-user/host/ppc/host-signal.h @@ -1 +1,25 @@ -#define HOST_SIGNAL_PLACEHOLDER +/* + * host-signal.h: signal info dependent on the host architecture + * + * Copyright (c) 2003-2005 Fabrice Bellard + * Copyright (c) 2021 Linaro Limited + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 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 b121e6c2e9..5a0a65fa46 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -253,84 +253,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)