From patchwork Mon Dec 10 16:56:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 153308 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3775985ljp; Mon, 10 Dec 2018 08:56:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/UuyWeYrtR+ZcH3SHgaSY9GFClRfwgi45qXM+6yHmliQ7PCsd7A0st9WxQNXukE0PQYtj3l X-Received: by 2002:a19:c413:: with SMTP id u19mr7220501lff.100.1544460999506; Mon, 10 Dec 2018 08:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544460999; cv=none; d=google.com; s=arc-20160816; b=UuyL2jPvM0br0xaSClDkfbRfjot/zcSsca0S0aj9iaCeJBb1n9xIVaOVDu4QvtUxCL AkVSWixaFvQmyssGSVm8QhvQJXdJe/rNLLdFhGENG1wuGc/f3cftQNAoPQAck4BR7OQg IF1YhXzhhw3DATCODThx2TdzmS4Y//ry8V6Qv/yi2iGzm0rjfCTxlWTAItH3BakH+K1U 6RskC60Ov19y5bDnplWsRb+RlC6btI+fh6dMhEY/1kvwcHx4VCap7YsQoc2mXJku5tKs eGB9Tw0TVHKt8kfiP5k37CIYL+6yu1KYQmWN5x1lwqQTRMTphLNOlMep6AkBaFowhFWZ 8n4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=n+7hwrxAniTUGxX9CM4rzmR81vtu+tSCnMgOk4/mCXY=; b=I2909BX2yc/fb9DMqKH9LE6jDLaprccAMkRNXAqCYWEN8v8V8C8vXJG0hZHXAp3Q4F YoNzTWgpWR8lNiGIyeKUf0Ec0z5e93ZjGfthZlKui57270+8fCLSvJE8x/G9MaXBD4Ud cCdTIs2HaudfamZzE8wVoDJdpc0YOZzMZrku3zgYZMtwA8IXXwtRDpGYgtfgkzrPty3A CyE/N9OwhonWCnhBk1rRtDvggCdj730fukNIMFAAInW7wpjR4KU/xVYhz8Ewe+xhtqoN Ukk+2ibpBGOJQsoPGB2SVRkHXX2I0IAnHinZ1vFpVxG470twH2roytkWQyl8SQqo524x rmVQ== 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 f21-v6si9690899ljg.217.2018.12.10.08.56.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Dec 2018 08:56:39 -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 1gWOrF-0000MR-TT; Mon, 10 Dec 2018 16:56:37 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Laurent Vivier , Mark Cave-Ayland Subject: [RFC 1/3] target/m68k: In dump_address_map() check for memory access failures Date: Mon, 10 Dec 2018 16:56:34 +0000 Message-Id: <20181210165636.28366-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210165636.28366-1-peter.maydell@linaro.org> References: <20181210165636.28366-1-peter.maydell@linaro.org> MIME-Version: 1.0 In dump_address_map(), use address_space_ldl() instead of ldl_phys(). This allows us to check whether the memory access failed. Signed-off-by: Peter Maydell --- target/m68k/helper.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) -- 2.19.2 Reviewed-by: Laurent Vivier diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 917d46efcc3..374e4861886 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -411,6 +411,7 @@ static void dump_address_map(FILE *f, fprintf_function cpu_fprintf, int last_attr = -1, attr = -1; M68kCPU *cpu = m68k_env_get_cpu(env); CPUState *cs = CPU(cpu); + MemTxResult txres; if (env->mmu.tcr & M68K_TCR_PAGE_8K) { /* 8k page */ @@ -424,22 +425,29 @@ static void dump_address_map(FILE *f, fprintf_function cpu_fprintf, tib_mask = M68K_4K_PAGE_MASK; } for (i = 0; i < M68K_ROOT_POINTER_ENTRIES; i++) { - tia = ldl_phys(cs->as, M68K_POINTER_BASE(root_pointer) + i * 4); - if (!M68K_UDT_VALID(tia)) { + tia = address_space_ldl(cs->as, M68K_POINTER_BASE(root_pointer) + i * 4, + MEMTXATTRS_UNSPECIFIED, &txres); + if (txres != MEMTX_OK || !M68K_UDT_VALID(tia)) { continue; } for (j = 0; j < M68K_ROOT_POINTER_ENTRIES; j++) { - tib = ldl_phys(cs->as, M68K_POINTER_BASE(tia) + j * 4); - if (!M68K_UDT_VALID(tib)) { + tib = address_space_ldl(cs->as, M68K_POINTER_BASE(tia) + j * 4, + MEMTXATTRS_UNSPECIFIED, &txres); + if (txres != MEMTX_OK || !M68K_UDT_VALID(tib)) { continue; } for (k = 0; k < tic_size; k++) { - tic = ldl_phys(cs->as, (tib & tib_mask) + k * 4); - if (!M68K_PDT_VALID(tic)) { + tic = address_space_ldl(cs->as, (tib & tib_mask) + k * 4, + MEMTXATTRS_UNSPECIFIED, &txres); + if (txres != MEMTX_OK || !M68K_PDT_VALID(tic)) { continue; } if (M68K_PDT_INDIRECT(tic)) { - tic = ldl_phys(cs->as, M68K_INDIRECT_POINTER(tic)); + tic = address_space_ldl(cs->as, M68K_INDIRECT_POINTER(tic), + MEMTXATTRS_UNSPECIFIED, &txres); + if (txres != MEMTX_OK) { + continue; + } } last_logical = logical;