From patchwork Fri Oct 15 04:10:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515799 Delivered-To: patch@linaro.org Received: by 2002:ac0:da11:0:0:0:0:0 with SMTP id d17csp138951imi; Thu, 14 Oct 2021 21:24:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQSY5Jsk/3yCvjqgHkgbTRwzU5FjvOcwDkD4sbK2noisB5VB7HiQSFjZau9Va0O2I78G58 X-Received: by 2002:a5b:887:: with SMTP id e7mr10911763ybq.114.1634271886575; Thu, 14 Oct 2021 21:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634271886; cv=none; d=google.com; s=arc-20160816; b=f34dPWc/uybD5I+SDEjPXM/ztE1HaLtVNrMavk0Dmbe0UYr8zilArg7z5l3uZaQwRZ x0qQVjWLQ/KqSxWuNpQf+V1aLRfRLHC2e7U5rLCfD5dFrI4vIGtUXn9c69q7cjdtvM5m ptLrEW5dGyphMC1UhHcuFE3Ctp/k044beNgvftYts9HBDQSRRQYlcp5lZCPaJQbkDkh4 0pAhpINXvfbcRcH85m/lGr4fpE91ISAR03Q76vkI+x+182us8Q6C6rfvThDiU+eKaxeW y+eAlydRdGfFBKrJI/AHBwgqNuJt4waNw8wJq5YgXTIH4/caS4dr7Pd7D05p30uN3K4q CaGw== 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=uF38/TBQjdWDQM8FyXjqkWfqx61a2FgTbzu2sn+FnBE=; b=MdtoTPMFUQ0GfvjzFpH5LbO+dlV9Cu3vey4+L2L11QWKPvikwFXmpDRB0K4NDtgg9p cbKz+bhf341yMuHokXmyCEJRBa7eSMlIf6W5u2Nn0Y0IFnAHqi6R9vKrdxapjKWikiFA uuCWbtMgmvfyXiirNolwqCluHghjZV+8uiC4jFzNHe6YcigIfpA+NEntG13LDpArrV// JOqW2MUuTHTWBHL7LyqvVLvunR+tNcFXZPBnTwLYBmIuQCythqu9qOnavUJFzt+08dno XCUzh+2ivXIL+9bAmH/yCHCe1pEEze08Q0zPpNXYKbOHbNCQ65S1roOu0FEb1xmjEJOV ZeHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jF3RtzXz; 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 f65si4810277ybi.95.2021.10.14.21.24.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Oct 2021 21:24:46 -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=jF3RtzXz; 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]:37126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbElx-0001nn-U9 for patch@linaro.org; Fri, 15 Oct 2021 00:24:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbEZ2-0007OK-Ph for qemu-devel@nongnu.org; Fri, 15 Oct 2021 00:11:26 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:38456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbEZ0-0000Pb-Bk for qemu-devel@nongnu.org; Fri, 15 Oct 2021 00:11:23 -0400 Received: by mail-pj1-x102a.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so8450178pjc.3 for ; Thu, 14 Oct 2021 21:11:21 -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=uF38/TBQjdWDQM8FyXjqkWfqx61a2FgTbzu2sn+FnBE=; b=jF3RtzXzt5MZzqir004gfvqFOPQopXnZQNA1a5y917Sy5Vq/K35jRfw9abd1JuYe0g 3/ais4O6lVkzC+eGfHxRleTx9PBqlS6uhSctPcdkD1J3CftPCP6yBVdSD4vIgSpMxO7l CGm4NOOZdRu5qDg/mvmHCvlk80I4F4jaPDZ8hD3mUA6ZGx1FJbKRtARTLKh/aYXYChxZ VbKTEY0xszS//0ar/w4CLNM5ex24zd2ziiMaZ4ZCyMQSjKhJXq/g+Wkls6goxWTXQOsJ T0O1CqzygQuQZbW9XMayxJbGkv8PDdf4Z8xMXY3bAPSg7h4/Xa2K0dimsRCttvvH2Zp7 fQKQ== 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=uF38/TBQjdWDQM8FyXjqkWfqx61a2FgTbzu2sn+FnBE=; b=N9OQskrcwkay3qWzoOzcS4bkrv/SB/lFw8XSW1Dsmb2AUoYvTR6SEpM3Ivg+IGgpBd Lrjhw7cFrGMzXnFLjMVDeqnxT6WB7WtmNEG5z9WntozJLnYnXZZ2iZ9PVBYR6AKgWmna oRHH2kQGr8039Y0oLERD01BiJVAKWdK9FI73gBpfmbFgEyjHkUcMI2VVMa+xsjEo6mum tvhICd+pLsfb9fzKWWoiezn8hb7HpX0s7Td71tMwzQNkabZ5eqozy0NVBJZIt+1Fl2L6 QxU5AQirnTmPf3gH0coeWnhsYBeJG8u/5b4dUKXaEHnUJT/qac/dCGS/blglNIXjlw8o PtBw== X-Gm-Message-State: AOAM531xmEc+SwWgWwi2GNPgkO3ljHElN1HcYcXiTq7fC2swQ6f/yuyB a2aApgZ7yok3z7jJq+4cd4QyWLMaAxu2og== X-Received: by 2002:a17:902:f54c:b0:13f:1e7:e467 with SMTP id h12-20020a170902f54c00b0013f01e7e467mr8958318plf.40.1634271080682; Thu, 14 Oct 2021 21:11:20 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id me12sm5718006pjb.27.2021.10.14.21.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 21:11:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 31/67] target/nios2: Implement nios2_cpu_record_sigsegv Date: Thu, 14 Oct 2021 21:10:17 -0700 Message-Id: <20211015041053.2769193-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015041053.2769193-1-richard.henderson@linaro.org> References: <20211015041053.2769193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Because the linux-user kuser page handling is currently implemented by detecting magic addresses in the unnamed 0xaa trap, we cannot simply remove nios2_cpu_tlb_fill and rely on the fallback code. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 6 ++++++ target/nios2/cpu.c | 6 ++++-- target/nios2/helper.c | 7 ++++--- 3 files changed, 14 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index a80587338a..1a69ed7a49 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -218,9 +218,15 @@ static inline int cpu_mmu_index(CPUNios2State *env, bool ifetch) MMU_SUPERVISOR_IDX; } +#ifdef CONFIG_USER_ONLY +void nios2_cpu_record_sigsegv(CPUState *cpu, vaddr addr, + MMUAccessType access_type, + bool maperr, uintptr_t ra); +#else bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); +#endif static inline int cpu_interrupts_enabled(CPUNios2State *env) { diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 947bb09bc1..421cad114a 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -220,9 +220,11 @@ static const struct SysemuCPUOps nios2_sysemu_ops = { static const struct TCGCPUOps nios2_tcg_ops = { .initialize = nios2_tcg_init, - .tlb_fill = nios2_cpu_tlb_fill, -#ifndef CONFIG_USER_ONLY +#ifdef CONFIG_USER_ONLY + .record_sigsegv = nios2_cpu_record_sigsegv, +#else + .tlb_fill = nios2_cpu_tlb_fill, .cpu_exec_interrupt = nios2_cpu_exec_interrupt, .do_interrupt = nios2_cpu_do_interrupt, .do_unaligned_access = nios2_cpu_do_unaligned_access, diff --git a/target/nios2/helper.c b/target/nios2/helper.c index 53be8398e9..e5c98650e1 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -38,10 +38,11 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->regs[R_EA] = env->regs[R_PC] + 4; } -bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr) +void nios2_cpu_record_sigsegv(CPUState *cs, vaddr addr, + MMUAccessType access_type, + bool maperr, uintptr_t retaddr) { + /* FIXME: Disentangle kuser page from linux-user sigsegv handling. */ cs->exception_index = 0xaa; cpu_loop_exit_restore(cs, retaddr); }