From nobody Tue Feb 10 20:47:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1629604909; cv=none; d=zohomail.com; s=zohoarc; b=Yv3AQR76C/w+HHCiwqcTCoLJnlDEXghP5eTuJ7m093mvE5TO8JTTUQzBT4xRwc6oew4JzLhhRz/xBLaWi3+BX1dr24/WG5R1i6xZKNJ/cDRZmEoxGFSOluy5pCIIjFus3MOSXwutyfWair3+xZ4H2fqQCj7NWX1He732LgdEq7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629604909; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=nJ9h2dueQZoC8KkpKvY29vlYcOjuKF0t5vEXt8rsSrHK7O1Uo3F6Rb4xgfHmuzjKYl9/pCN/F9f+XtUtQDMJmBBW0z0zNyJFrjVU9KZSZkOVrgTcwXjux/29/JXq4pW6LT8/86YQnrHL5pVFUdIFI9NUOKbFgSvjr9xbZBLqgYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629604909193386.6714889008126; Sat, 21 Aug 2021 21:01:49 -0700 (PDT) Received: from localhost ([::1]:58494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHeg8-0004zR-77 for importer@patchew.org; Sun, 22 Aug 2021 00:01:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaI-0007l3-HB for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:45760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0000c3-So for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d17so8184185plr.12 for ; Sat, 21 Aug 2021 20:55:44 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:43 -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=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=Q0UfAH+lsheZ+rL9/EIPlLbjIhmJghjkBazqhaoQgHeNMqmFGQFAZz0KSllGnjjhWo Nnu6fMjAaFalx9zKoYADERsIBoh9p/dRJ8u2gVjE5vyCCpunpOCd682TCgjtpm/XWgkA SPXItbBXQsMPwNV8WrTUhjztC8qj6BDNaxvmy9boZYBMftvLBYaTDVbfzdzGQrgBWjCW +hdD2LlNqNu+CKv0GJpfTcc6h7W9EotoamT/Z9rZOdoTZAGifB2D+wmxySyYUAIQjkCd 0x96RiqMOjeXst+t7eJAoeoPWT+HExTLAy90wy23dngQf1o/S2sdUILsdCyNUeOipCqC 6npg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=Q/VyUmgVwasbdpg6RSc4Ic9uGANmk96wK2v5rEC6eZQCKG2hlEGeQVM3NeSpF/9aWF y0s8ERDD6pjLVBBnyuKNDdR9+77GR3/FgRzBcbkW31DZAAmCLICzfkYn/Hb2ZiwShdCs IrXNQqzepeIm2zMy6xE/3J+A9Y09rG+ARaV1dkm05kJAOt2SMAtDk5NfI0nJBn/q0K1p 3eYQiZh+TVcgf+OIkctOprMBQ1g54PzsdOJc0EK+zzNSZQTBdDpkzMdUyzcCexACgFiW sJ1k1Uv0PuVdMQ0P6pYy98LUuE9LqZhZJ4go3j/atduTAzEm3EWBg7LcKgjuHFzghXm4 LB2w== X-Gm-Message-State: AOAM533K4zj3gDSk2VTsmHbQ1BPg0zD5KkiNslzQuYxGy+QX1+/HcxDD N7yj+arq9fSW18uGzIw8I8byTEBOo4YCUg== X-Google-Smtp-Source: ABdhPJwu+bTJP1ngLip0kcG4Gkl/3QROvxFrBd5Seb8lqvzX8U7MoEJCwPz2NK9uBhiIIaReyXlWXA== X-Received: by 2002:a17:90a:5583:: with SMTP id c3mr12634365pji.133.1629604543624; Sat, 21 Aug 2021 20:55:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/30] linux-user/arm: Use force_sig_fault() Date: Sat, 21 Aug 2021 20:55:14 -0700 Message-Id: <20210822035537.283193-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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: peter.maydell@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1629604909656100003 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Use the new force_sig_fault() function instead of setting up a target_siginfo_t and calling queue_signal(). Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-7-peter.maydell@linaro.org> Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/arm/cpu_loop.c | 53 +++++++++++---------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index b8ece169f9..d4b4f0c71f 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -93,7 +93,6 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env) { uint64_t oldval, newval, val; uint32_t addr, cpsr; - target_siginfo_t info; =20 /* Based on the 32 bit code in do_kernel_trap */ =20 @@ -142,12 +141,9 @@ segv: end_exclusive(); /* We get the PC of the entry address - which is as good as anything, on a real kernel what you get depends on which mode it uses. */ - info.si_signo =3D TARGET_SIGSEGV; - info.si_errno =3D 0; /* XXX: check env->error_code */ - info.si_code =3D TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr =3D env->exception.vaddress; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); } =20 /* Handle a jump to the kernel code page. */ @@ -285,8 +281,6 @@ void cpu_loop(CPUARMState *env) CPUState *cs =3D env_cpu(env); int trapnr; unsigned int n, insn; - target_siginfo_t info; - uint32_t addr; abi_ulong ret; =20 for(;;) { @@ -321,11 +315,8 @@ void cpu_loop(CPUARMState *env) break; } =20 - info.si_signo =3D TARGET_SIGILL; - info.si_errno =3D 0; - info.si_code =3D TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr =3D env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, + env->regs[15]); } break; case EXCP_SWI: @@ -393,18 +384,14 @@ void cpu_loop(CPUARMState *env) * Otherwise SIGILL. This includes any SWI with * immediate not originally 0x9fxxxx, because * of the earlier XOR. + * Like the real kernel, we report the addr of= the + * SWI in the siginfo si_addr but leave the PC + * pointing at the insn after the SWI. */ - info.si_signo =3D TARGET_SIGILL; - info.si_errno =3D 0; - info.si_code =3D TARGET_ILL_ILLTRP; - info._sifields._sigfault._addr =3D env->regs[1= 5]; - if (env->thumb) { - info._sifields._sigfault._addr -=3D 2; - } else { - info._sifields._sigfault._addr -=3D 4; - } - queue_signal(env, info.si_signo, - QEMU_SI_FAULT, &info); + abi_ulong faultaddr =3D env->regs[15]; + faultaddr -=3D env->thumb ? 2 : 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLT= RP, + faultaddr); } break; } @@ -435,24 +422,14 @@ void cpu_loop(CPUARMState *env) break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - addr =3D env->exception.vaddress; - { - info.si_signo =3D TARGET_SIGSEGV; - info.si_errno =3D 0; - /* XXX: check env->error_code */ - info.si_code =3D TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr =3D addr; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + /* XXX: check env->error_code */ + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: excp_debug: - info.si_signo =3D TARGET_SIGTRAP; - info.si_errno =3D 0; - info.si_code =3D TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr =3D env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->regs[1= 5]); break; case EXCP_KERNEL_TRAP: if (do_kernel_trap(env)) --=20 2.25.1