From nobody Thu Nov 6 01:08:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538295545208647.8639726178544; Sun, 30 Sep 2018 01:19:05 -0700 (PDT) Received: from localhost ([::1]:54232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6WwR-0006md-TX for importer@patchew.org; Sun, 30 Sep 2018 04:19:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6WrA-00027y-9N for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:13:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Wr8-00007e-R8 for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:13:36 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:50893) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Wr8-00005r-Ih for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:13:34 -0400 Received: by mail-wm1-x332.google.com with SMTP id s12-v6so5813172wmc.0 for ; Sun, 30 Sep 2018 01:13:34 -0700 (PDT) Received: from 640k.lan (94-36-187-248.adsl-ull.clienti.tiscali.it. [94.36.187.248]) by smtp.gmail.com with ESMTPSA id u76-v6sm11369194wmd.10.2018.09.30.01.13.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 01:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=GUO347Pf5gF5wPOOSFQyo6giS3ymDQqMfCL6e5MXYD0=; b=AOy1cf+GVVyiyZnh6RZ5fyNT5w8XQz7fnz19eYjbkHW3bb22D+UXB3SYsi0DRbymzC 74yY0/HXcZzVAGTN8O51ENTMwjkWlr7qd2X3Jn0er8dg09quhbXP2qjsqb6gqyzmXe+c HUhZ6OUANRRmpBgufbBTSsuNmQXCwN6scbV/CcprC5zOVu1eJ1DBAr77y4uUBqqycbKr RnRWW24qnZrq9g3nmCrLXXzO5XPGJVo8lc2WZjc6nU0q0BKmDDWVbLa6+9HifgUF/ZCj gcLuMo7Ri6vE0q6Vc2uSYqzOXM00ss6edEF/yW7Z43LmrXK/hgTht1TEwbOD+biqA2ak C/lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=GUO347Pf5gF5wPOOSFQyo6giS3ymDQqMfCL6e5MXYD0=; b=uhdyjDm6FMefBbtqgHmv0iN6MMYjGBR52XIsqSCZnLWEHWfVlvLSlp2aQiag5b++DF pnPOozzAlHdubH6oUY0ei9uLnkJwW2MFrg9WSIaT95up0LjKZkHkQVq//tYrOrgNOBM3 YjYN6JNtxwLJAwvchDXio8HwYq15SCAcPTFgw9CzOscxZny86ZbttThUQ1PO1Uw4fa7o KQ2jUMRnA4aef47MTHGTG9qcC8IUtTfWibHa8nPiwGKfY3O6nBFWc62zN7MxwPem3Yis 8/IqFcD84P494pliquQ13NjTkrI5AmBKfDH6/GFf/8orvuWpplhghbaZ5YRAXD2xJTrO hjow== X-Gm-Message-State: ABuFfojIME/Oi+vaxigyKLSl9CqT1jH3cz17HGMRcj/4U0kn0xwaytf7 Mxten6bWlWn6N3sHRw4LeMUEzDwR X-Google-Smtp-Source: ACcGV61onbsQVvq7wW2JmCbqsqmnI0/1Wdqh4u9+rKue9ZXEix3oobYwPxp7UCezHWIZNG/0sv92/w== X-Received: by 2002:a7b:c0d3:: with SMTP id s19-v6mr5970286wmh.119.1538295213281; Sun, 30 Sep 2018 01:13:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 30 Sep 2018 10:12:13 +0200 Message-Id: <1538295197-23704-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> References: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 15/79] dump: fix Windows dump memory run mapping X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viktor Prutyanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Viktor Prutyanov We should map and use guest memory run by parts if it can't be mapped as a whole. After this patch, continuos guest physical memory blocks which are not continuos in host virtual address space will be processed correctly. Signed-off-by: Viktor Prutyanov Message-Id: <1535567456-6904-1-git-send-email-viktor.prutyanov@virtuozzo.co= m> Signed-off-by: Paolo Bonzini --- win_dump.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/win_dump.c b/win_dump.c index b15c191..e10a783 100644 --- a/win_dump.c +++ b/win_dump.c @@ -30,28 +30,32 @@ static size_t write_run(WinDumpPhyMemRun64 *run, int fd= , Error **errp) void *buf; uint64_t addr =3D run->BasePage << TARGET_PAGE_BITS; uint64_t size =3D run->PageCount << TARGET_PAGE_BITS; - uint64_t len =3D size; + uint64_t len, l; + size_t total =3D 0; =20 - buf =3D cpu_physical_memory_map(addr, &len, false); - if (!buf) { - error_setg(errp, "win-dump: failed to map run"); - return 0; - } - if (len !=3D size) { - error_setg(errp, "win-dump: failed to map entire run"); - len =3D 0; - goto out_unmap; - } + while (size) { + len =3D size; =20 - len =3D qemu_write_full(fd, buf, len); - if (len !=3D size) { - error_setg(errp, QERR_IO_ERROR); - } + buf =3D cpu_physical_memory_map(addr, &len, false); + if (!buf) { + error_setg(errp, "win-dump: failed to map physical range" + " 0x%016" PRIx64 "-0x%016" PRIx64, addr, addr= + size - 1); + return 0; + } + + l =3D qemu_write_full(fd, buf, len); + cpu_physical_memory_unmap(buf, addr, false, len); + if (l !=3D len) { + error_setg(errp, QERR_IO_ERROR); + return 0; + } =20 -out_unmap: - cpu_physical_memory_unmap(buf, addr, false, len); + addr +=3D l; + size -=3D l; + total +=3D l; + } =20 - return len; + return total; } =20 static void write_runs(DumpState *s, WinDumpHeader64 *h, Error **errp) --=20 1.8.3.1