From patchwork Sun Aug 22 03:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501404 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060196jab; Sat, 21 Aug 2021 21:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztUiL7KePdxOfGGlN9dTHeibUfAo+5DE0VsSXr4YV3TMGWvTcI2Vr9vGIdAwSOlrBXw1hI X-Received: by 2002:a02:a490:: with SMTP id d16mr25231697jam.42.1629604878018; Sat, 21 Aug 2021 21:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604878; cv=none; d=google.com; s=arc-20160816; b=ndHH/LqRg6qhIV3HqxWOrO89NcFC36INOgtAKJi10pmmnvBMqVB88KWMgSlBoq7RGC Qy/tO5y4KS+n5WvwnhVLRttdWOXOPtRhNwHPOBp8Rlx9HSbJP03c2R4j9hubgTq4VHpr VxNS85S9M4xwlWCbefeGV0IfwjIu8FCxnq+nyCgboPlQkLeC7rkaXilRfzpS4vcFXQP1 RLw2gwkFMOH6WkkWPDahS6Hc+qbf8lhxKzCXKYjHw6o9OCR3KWCKUwWbfEbbtFecKcJH yhkahFt5y8kuBA+RzrZ/d+Ahgb50Jy8cq3abjEi3nav5CjdmwxsMnKnmu56Ymf9tj8y7 qrYw== 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=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=tGnLAlv/uigd45p9mXEkm/kMEuIQbKKEKjArawcmPGxKnJhAQdO40q9xGx2ZzRubnU KjZdWUPiMFlVtpsQyb9z+AqZzah2IBfr4OYfiAU31zUb92XEgcX5811iwjjCBiCftG23 dezSLUKEs3DVweRe7m5bh6kvONIwBN9K+pBOS8/TyMH37UYTb/yJ5X8aXPc0pzKRXeKK tINuwbuiIO49HHLAR6DHnlgx68EsQIZeg0AZVqC971Z4Fn73dqpzXTq44dQ/wmPwMT8c myfsUpYu/q3ICozK5BX9UyGoUBtq1XPcQBtXtOnNftAfjiByWz81SsD6cdV79hjVjkpR DoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xchPxoDA; 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 c18si11214329iod.38.2021.08.21.21.01.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:18 -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=xchPxoDA; 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]:54502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefd-0002GO-5s for patch@linaro.org; Sun, 22 Aug 2021 00:01:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0007mY-4N for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:47 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:37662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaH-0000cu-I3 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: by mail-pg1-x532.google.com with SMTP id 17so13325252pgp.4 for ; Sat, 21 Aug 2021 20:55:45 -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=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=xchPxoDAQ04Eb5iiEHoc4Bee7DGqSwqeKuibN8T6S2vugK8iMJU67nCOn0UYusc5sj T7NQypJaVKqFIX2/C5oIOazxz8bI3W5R78YA+iWuber2asmW5No0pltsx6lglJi0724E Klq417kaIKeITb1VGbIgys5Y/nsZVU3+G/f2Fkm4vCzKnxDkTlwZ/Tcos/GNefA95ODo gGANtF3FgxCrqj0WqyfxuVdAnBkdWOzBUpSv9YA9LfHQqSEUELfQtb+FLN1lHQ9zCy90 m1dYI0qGtkrTJp/bQ7cV6qprMlI3xlF6Y25gXUJdaQqiYdm8PNOcXby32bHrU127LEIz rhsQ== 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=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=kOQHMHcOIXEFTgKsRr9oL+oyOGgkAh28bqLiDi6FxgEMucfvf4acBcE8AsOxjZ9UjS UzqfNC1JKuTO/YB0TvyTkRavDoG6K0kzKR3DutnLhs3bZMLgCXzRad2H/kOHrcI7Jm0G 6n3AtZsYj8cPwoydzBBxR2LYhwNt2N48N8GTTM7y13qHqNzTcSgMT7nkh3BQKrxBnzlR +I0EKgFNYvlTYORzyBEWlN5b0v6+vaC+QP2zqTdHZ5R1IUv0qf+UTSuVGvVRG6qDOq/d aMmt9UTn8ZppmcaSZHwOtdmst+GqgS68ibJ2/KLHGSrR1oPq57cb9yFACKpsgnYlvYOl JytQ== X-Gm-Message-State: AOAM533iDqy2LcYHu91l9wmsouwmCk9SeJH8s/NTpUqkquDrFyoDTr5y Q/ySTdESWNoUObmQEc8xNuLJD/shXnOAaQ== X-Received: by 2002:a05:6a00:a8a:b029:356:be61:7f18 with SMTP id b10-20020a056a000a8ab0290356be617f18mr27434020pfl.29.1629604544241; 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) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 08/30] linux-user/aarch64: Use force_sig_fault() Date: Sat, 21 Aug 2021 20:55:15 -0700 Message-Id: <20210822035537.283193-9-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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-8-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/aarch64/cpu_loop.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 5d8675944d..11e34cb100 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "qemu/guest-random.h" #include "semihosting/common-semi.h" #include "target/arm/syndrome.h" @@ -77,9 +78,8 @@ void cpu_loop(CPUARMState *env) { CPUState *cs = env_cpu(env); - int trapnr, ec, fsc; + int trapnr, ec, fsc, si_code; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -108,18 +108,10 @@ void cpu_loop(CPUARMState *env) /* just indicate that signals should be handled asap */ break; case EXCP_UDEF: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = env->exception.vaddress; - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ ec = syn_get_ec(env->exception.syndrome); assert(ec == EC_DATAABORT || ec == EC_INSNABORT); @@ -128,28 +120,24 @@ void cpu_loop(CPUARMState *env) fsc = extract32(env->exception.syndrome, 0, 6); switch (fsc) { case 0x04 ... 0x07: /* Translation fault, level {0-3} */ - info.si_code = TARGET_SEGV_MAPERR; + si_code = TARGET_SEGV_MAPERR; break; case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ - info.si_code = TARGET_SEGV_ACCERR; + si_code = TARGET_SEGV_ACCERR; break; case 0x11: /* Synchronous Tag Check Fault */ - info.si_code = TARGET_SEGV_MTESERR; + si_code = TARGET_SEGV_MTESERR; break; default: g_assert_not_reached(); } - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, si_code, env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_SEMIHOST: env->xregs[0] = do_common_semihosting(cs); @@ -169,11 +157,7 @@ void cpu_loop(CPUARMState *env) /* Check for MTE asynchronous faults */ if (unlikely(env->cp15.tfsr_el[0])) { env->cp15.tfsr_el[0] = 0; - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = 0; - info.si_code = TARGET_SEGV_MTEAERR; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MTEAERR, 0); } process_pending_signals(env);