From patchwork Mon Oct 16 16:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 734032 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp60704wro; Mon, 16 Oct 2023 09:43:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoBakeuDVapUUHpAFv4D7jC62udUs0y1iyR/jxc5BZNlIZBpukC20fUu0oYVcCFHWHN0OM X-Received: by 2002:a05:6214:3f92:b0:63d:8447:ddd with SMTP id ow18-20020a0562143f9200b0063d84470dddmr11155029qvb.20.1697474638280; Mon, 16 Oct 2023 09:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697474638; cv=none; d=google.com; s=arc-20160816; b=ZaJm5gjE+/aBmuPN1iavP442yE2zoL7mOFhJjuXb5lIHM54dR7sVyUapRJzPohtU5Q B4dPXJyf9cFRWRR9Cl7W/llHSrbG1EfWO2+jveLO2x6VsV51btJ31Y9lVcwMRiCNra30 VCLFqy2GoSys5cGXHGMtQG2SQ8fUsaPUgiigOQDxRDjRdG7dVH0uxv4vPhY65MMZ2F+s +/Z0J2MuDSr1YH2Lxmrs51PGqy5STyZVIDvRXXq0FNgCetk0nBW5xvQd14ELBkEPx1Jk UeTOe3hinuaW9LvimL9Y5UI35EPuMU8tyQPEpF5N+RIX08M0rLP356c4HeuHAb6obN80 JgoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=BKmqz6rtUUntrbdALxrGCYPIOal8cYf8H9FLm0YLPvo=; fh=x+yc1QCm7NCEZoGsUba3vomPLtn6uMR81Tg2jnds3Ho=; b=OIO7QBKjCi7H4ebr5nJ3L/NKotSPK986dinP9Tap+f92m89UL0bIrtR+42C3fK/YZp EbB4Rog7FoFVnoQ8zIMCJZwdC19uKRvmw2+GJzsf7vo4lATUNjJWXwKPguBK2VBimsTk VjA5kCKNauxWPs24cp8b8fLSnsizWJz71lVERAkvUKOhRtNZAfJFReb5fTKH0ni4zCqt GPJd+zK+kjCGA5JolKgfQTTV8/uibmYw/jrtU9YIlpkd1GWoHcxoSjKe0B1C9JGqg4R1 o7HvCQiKs2WPAPznn6DC6BidT1pLsvQI3nyJpp3Lu3jcMghkIfgcK+z8Fo7czvs/I4Vy M2fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n0kfKWyE; 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 pf10-20020a05620a858a00b0077419b27787si5514439qkn.177.2023.10.16.09.43.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 09:43:58 -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=n0kfKWyE; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsQgM-0004FW-HL; Mon, 16 Oct 2023 12:43:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qsQgC-0004DS-SN for qemu-devel@nongnu.org; Mon, 16 Oct 2023 12:42:57 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsQg3-0004Le-Bn for qemu-devel@nongnu.org; Mon, 16 Oct 2023 12:42:54 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-307d58b3efbso3919784f8f.0 for ; Mon, 16 Oct 2023 09:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697474564; x=1698079364; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BKmqz6rtUUntrbdALxrGCYPIOal8cYf8H9FLm0YLPvo=; b=n0kfKWyEpFtXHWSYecMQQ3AqvD15eeqCrbGOZYdrXiu2o4D2G00hM3eAelox7dyaeS g7Ai+bLKOIJLVRq8GF3iTUqK8LvoM0KlnV85wIyBX9nxYFKXbmBdCFC15HM9jrIrGw7c pMdRIL9wVNNCi3Q18qRRwFwJpCN4/qkKziCP4+NuZfRnqMKq+Le67iYi/2KYyLNNqQ1z 1j904s2vjz2KJ71JyTNYuEk+cW0K2/wnhp6U3xFXz+3Gbded8dBbMla21jqKQms515Gq iuKkP0+Lf47+Lz2ujFWbcEaerYP1FyHCsgLvJ7sX0Ky6bDoZCyJPmV1Y29xuXWmRsW4z zaMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697474564; x=1698079364; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BKmqz6rtUUntrbdALxrGCYPIOal8cYf8H9FLm0YLPvo=; b=Rd+vuA9u/9AfceO9slcFzTy4ZkyI7T2A4ALxQAC+JGcZRQ3FQftSF3SL3q3d67bSXN yJ7ief53xaJULKI9PQ+AKftJweF3bSn5MfloA4i3Bop+BeV8FWU+sGyR0dVp/gMvXIdS Y8nLy5SQblyQ4TYdHb5115/txR+G1hGgGhhSLZlmUnbR5bGvwtXoCKxq9Ar9JnewyCK9 uzfmB6MgMzBG4/FSKP8XeuHCeRXhj7hEgkWGx9+wvuAoqEtjileO1HkHMQClUzdJQxeu 0udPJmF+9MWwahhjvJOPB+pOaxYgCZ51H23rVp/o7/+oN4OyLhlUL8tnLv6ijjWR4+Fx Cb2g== X-Gm-Message-State: AOJu0Yxclyj+TW5+MEu/QfWkdHyKuBgAl7au4dBhmAltJQCMKHqTF5JS J62TMG9g38dZC/w+eHQjDgjd498cABx3n0b8a+E= X-Received: by 2002:a05:6000:b84:b0:32d:a49c:dfd1 with SMTP id dl4-20020a0560000b8400b0032da49cdfd1mr5832352wrb.48.1697474564643; Mon, 16 Oct 2023 09:42:44 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id u12-20020adff88c000000b0032d9a1f2ec3sm8728159wrp.27.2023.10.16.09.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:42:44 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C65981FFBB; Mon, 16 Oct 2023 17:42:43 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , "Dr. David Alan Gilbert" Subject: [RFC PATCH] hmp: implement hmp_ram_memory_dump Date: Mon, 16 Oct 2023 17:42:35 +0100 Message-Id: <20231016164235.2179049-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org While reviewing the tb-stats series I was confused by the different between physical and ram address. This implements the RAM dump so I can replicate the disassembly of "info tb". Whether or not that is a good idea remains to be discussed. Based-on: 20231003183058.1639121-1-richard.henderson@linaro.org Signed-off-by: Alex Bennée Cc: Richard Henderson --- include/monitor/hmp-target.h | 1 + monitor/hmp-cmds-target.c | 10 ++++++++++ hmp-commands.hx | 19 ++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index 730507bd65..a3fa7dc089 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -50,6 +50,7 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict); void hmp_info_via(Monitor *mon, const QDict *qdict); void hmp_memory_dump(Monitor *mon, const QDict *qdict); void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); +void hmp_ram_memory_dump(Monitor *mon, const QDict *qdict); void hmp_info_registers(Monitor *mon, const QDict *qdict); void hmp_gva2gpa(Monitor *mon, const QDict *qdict); void hmp_gpa2hva(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds-target.c b/monitor/hmp-cmds-target.c index 476cf68e81..21ce790502 100644 --- a/monitor/hmp-cmds-target.c +++ b/monitor/hmp-cmds-target.c @@ -253,6 +253,16 @@ void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict) memory_dump(mon, count, format, size, addr, MON_DISAS_GPA); } +void hmp_ram_memory_dump(Monitor *mon, const QDict *qdict) +{ + int count = qdict_get_int(qdict, "count"); + int format = qdict_get_int(qdict, "format"); + int size = qdict_get_int(qdict, "size"); + hwaddr addr = qdict_get_int(qdict, "addr"); + + memory_dump(mon, count, format, size, addr, MON_DISAS_GRA); +} + void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **errp) { Int128 gpa_region_size; diff --git a/hmp-commands.hx b/hmp-commands.hx index e1d78ab69d..5a9ecefdcb 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -471,7 +471,10 @@ ERST SRST ``x/``\ *fmt* *addr* - Virtual memory dump starting at *addr*. + Virtual memory dump starting at *addr*. See xp/ for physical memory and xr/ for ram + + *fmt* is a format which tells the command how to format the + data. Its syntax is: ``/{count}{format}{size}`` ERST { @@ -530,7 +533,21 @@ SRST 0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 ERST + { + .name = "xr", + .args_type = "fmt:/,addr:l", + .params = "/fmt addr", + .help = "ram memory dump starting at 'addr'", + .cmd = hmp_ram_memory_dump, + }, + +SRST +``xr /``\ *fmt* *addr* + RAM memory dump starting at *addr*. See xp/ for physical and x/ for virtual memory + *fmt* is a format which tells the command how to format the + data. Its syntax is: ``/{count}{format}{size}`` +ERST { .name = "gpa2hva", .args_type = "addr:l",