From patchwork Mon Nov 6 18:33:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 118081 Delivered-To: patches@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3072855qgn; Mon, 6 Nov 2017 10:32:55 -0800 (PST) X-Google-Smtp-Source: ABhQp+T/2OGehSyc/MqTqS0TYfTiVH5gEcRuR9rGzsIcDiCVWM40U5pHEjidBaWrJDNL9rlkmNYS X-Received: by 10.28.184.143 with SMTP id i137mr6388358wmf.143.1509993175447; Mon, 06 Nov 2017 10:32:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509993175; cv=none; d=google.com; s=arc-20160816; b=UpefQwrsrgc0QJ55AedNUiAuuv0MQyBY/7MhDe1Qi0XJj4R8IGrF3BgOGRh6903Cr3 Xre6K4wmbMXMevvT/filmFe1k1kgTmV85Hpos9aPukqQ9wCNAvAOJ23jFkU0494+zWOO izpzFfdY6Iqrtsb+iHY93768mhN4QSczReVN9xnMrTdBQhb8mDG2Pzgg2xT2/HnGQdqm qGBvlyucQmQ9ohqZxXCwj/WeYtyAugxkR2sCE8ljhmz20a/SIW0WYCaRnBsfSAk40MnI dY8VupbRKgMGc+TIKKxa6IplO28cWOz75oYidulrZwf6JLApwqlXwH5FX6Bf+bqhodTU ew4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9nAYwv4RIuf8TZe5kX60A0drPmuKDJNOHSEf0F/KLQI=; b=iW9KgMp7OCUViEwG2/OWLbYv+kMy9671mBzYuYeXFCDmL++KBlhDtoc1NZEVeSZqsu QX2Hz5zNxVGEPtKRwyi/APrhnTrZCWlcAwc8W9JDaIvwYkXr5Z0U1apbw/75BfwiwtNv StyJsDu52bRQP5gKFKKueMgyBjNP3cjrgJg5OCIrGb9vV0QgyQhPAWHs8bQk4fxT0luH VDGlzliAVzOu0jUFyxhqugw1yFKrnDLnsH15ZuES6rjsATSUbw0j+EsQIVtUzjLe1oyL Pb6tEuecgmEyeyE+ubXYziNiolYTNkXILro9Cg1ONZNlJ3jPNwGJlenYckUnZ7vRnzOL Amvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id i8si1419934wmh.247.2017.11.06.10.32.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2017 10:32:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eBmCc-00038l-TL; Mon, 06 Nov 2017 18:32:54 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier Subject: [PATCH 3/4] linux-user/sparc: Put address for data faults where linux-user expects it Date: Mon, 6 Nov 2017 18:33:25 +0000 Message-Id: <1509993206-26637-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509993206-26637-1-git-send-email-peter.maydell@linaro.org> References: <1509993206-26637-1-git-send-email-peter.maydell@linaro.org> In the user-mode-only version of sparc_cpu_handle_mmu_fault(), we must save the fault address for a data fault into the CPU state's mmu registers, because the code in linux-user/main.c expects to find it there in order to populate the si_addr field of the guest siginfo. Signed-off-by: Peter Maydell --- target/sparc/mmu_helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index 126ea5e..d5b6c1e 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -30,10 +30,18 @@ int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw, int mmu_idx) { + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; + if (rw & 2) { cs->exception_index = TT_TFAULT; } else { cs->exception_index = TT_DFAULT; +#ifdef TARGET_SPARC64 + env->dmmu.mmuregs[4] = address; +#else + env->mmuregs[4] = address; +#endif } return 1; }