From nobody Sat Apr 11 18:34:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1775850907; cv=none; d=zohomail.com; s=zohoarc; b=LNKZAxEbrMI03qulFpuOtoXkewAHC0vlNgkvTG+kccSby5hOnf+qlGSnNHec+CwZ/FtejF11eOYIWZPbNCsmUvkwtTQUjXStJVpnfmFoepDszk6fA2Zvdnmry0biUv6eF8W8K+ZVKWe6tnlsvX08T8G4VQdnhl0XW7AiwfPXdgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775850907; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vgSDBpX5CLw08pNI+SPMIuoznTVCeN74IG0qPtzmxwM=; b=OTvBpKkAwX8ZXRWKSMJJziRGc/H2wI9kHXwq9l/r+7r3VfJFSuVvrRM0C7NG8OcaFlQb7sA1i94PP+WB4DgZDfQ7pmE4p0CVUCco7qgqCpMFvv7CUYvWbASKWDASWejaHROSjo8vGztTfyS5uTMqqOaX5wbmsmNH7jxBRcxiE9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775850907414965.6768626663328; Fri, 10 Apr 2026 12:55:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBHv8-0008T1-97; Fri, 10 Apr 2026 15:53:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHv6-0008Rt-DX for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:53:36 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wBHv4-0000Sv-Oe for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:53:36 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43cfce3a195so1524423f8f.2 for ; Fri, 10 Apr 2026 12:53:34 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63deba9esm10266885f8f.10.2026.04.10.12.53.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Apr 2026 12:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1775850813; x=1776455613; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vgSDBpX5CLw08pNI+SPMIuoznTVCeN74IG0qPtzmxwM=; b=UWTA0ZCwd6DkBI7Zcydv37n/mKXNdg2B1rN/GlFMe7RfqsegtD3T1BeoVP+Jp0/Btj oCKybYrkdpcXq/zvXJIDRMm6Ydz7zZbwHU5vz0WuPPDlFgB8fi63uRgosx1kTcFqTclO Lua5hoSiF9WsmN3Nr+sfm7o/TFGiTUtzE+t9r0UUhvy860OrwPfB2HfPlH7brYznlH+m zflt0RQ+vlm7gbb3V7jBoMtaHN/3VwVeK9kht/4y2o94HwCH7jnNUc8DD6vY6kuVai5e WG4Yhwdc0iTDkZW3ItMv117AA5zTF5iJje8oeyXCGshVR9KKq9HaOVb5USQOvapzifTz NLIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775850813; x=1776455613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vgSDBpX5CLw08pNI+SPMIuoznTVCeN74IG0qPtzmxwM=; b=BNRth/7aBprNuEY+cUSbxJMe2JpjgtdughfZaknn1/wFUD1C959uNu/muFiZnxWl1y G+zwgSMGVtF1HpDzX4AdVa61CV6T78s9sz+ERrbL+wna105ayduo2//wlWXxb176p5Hb KnjKXzg2es1EAmaOnVohWEor1EpPRnLJeZbFCTY5fc3Ti/LB8nywj8SfOgNaZE5lxjFz XnW4bwFpNjGDpc+PsZM5bB2LGLhXbpO8Bgw2tH035aNqCACmlqlD1klfRZ6uybDQZvkS alfqZZAizVyW04AwruQn1l7mlGgh1HmkmGPiQLxgz8ti3XXzro9PCW5nAOaix3n/Zp7+ nYnQ== X-Gm-Message-State: AOJu0Yx7PB/F5gog+1gthmXHAc2R+997fBeoz8dgWmRlPMlYjpZp0H2i 68x5V507m3CP4MsyYR9Etb1/glKFe8vHOzxn6tjpcsgpR2PAe/FazjLgG5DeDiPJ542wDVwcHNT GOFGGz4E= X-Gm-Gg: AeBDieuI49eo0CGczHh0Xe/h/pdx8PPrNwmedm4b1wR1XLFYozfL4pNJR0JQhiTWVqZ k+b/uzZytmsQL5sS6EUoelw1141K2wFFvXWh0oaMRwHBR/NlgZUuGJuX1DQsfmKx9yvilB/VW7t 7xemt88nBhsAVzDnqCsKfZe8VGVG4WHhk0GjqTDpX0XoXnqFaLOzNfEiyNW8wVlphG06ugwW5o/ hiOIyk+Lmggapk/rY5NXCRkSQqrZnQscvshb58spWePLACSfiaObC1AiGTrGTlSIZGID9qgFGiJ ov1MbeSbE4EKPfylE89fff1jmR2BEVyzDdzlYfdrkaL0rtEgngKeaV4evnvyvLIb/E8506TPEH5 DCJ+2MTUSqnKcB/hqFG6TJw8Jahx6ZjTPsxV+HYSsLEYDc8BMo6R7zdaRrbm2MtdRiZJKE8ar63 FhXQcOVXEJoqpgWwGXs2f+bvtJsu13rXCpcQ78+TcXdjPGDHldn5jvWUAXJ1p8UlvKW9mT6WxV X-Received: by 2002:a05:6000:420b:b0:43c:fd18:a30e with SMTP id ffacd0b85a97d-43d642b4653mr6664483f8f.35.1775850812787; Fri, 10 Apr 2026 12:53:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , "Dr. David Alan Gilbert" , Pierrick Bouvier , qemu-riscv@nongnu.org, Markus Armbruster , qemu-s390x@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhao Liu Subject: [PATCH v2 01/27] monitor: Have MonitorDef::get_value() always return int64_t type Date: Fri, 10 Apr 2026 21:52:55 +0200 Message-ID: <20260410195323.17937-2-philmd@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410195323.17937-1-philmd@linaro.org> References: <20260410195323.17937-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1775850910207154100 Simplify MonitorDef::get_value() handler by having it always return a int64_t type. Truncate to 32-bit in the single caller. Note, this handler is only implemented once for the x86 targets. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/monitor/hmp-target.h | 6 +----- monitor/hmp-target.c | 4 +++- target/i386/monitor.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index ce0bb1983cc..6364c94edf8 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -27,15 +27,11 @@ =20 typedef struct MonitorDef MonitorDef; =20 -#ifdef COMPILING_PER_TARGET -#include "exec/target_long.h" struct MonitorDef { const char *name; int offset; - target_long (*get_value)(Monitor *mon, const struct MonitorDef *md, - int val); + int64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int of= fset); }; -#endif =20 const MonitorDef *target_monitor_defs(void); int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index da7dd7f31f2..812714ada01 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/target-info.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "net/slirp.h" @@ -79,7 +80,8 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const ch= ar *name) for(; md->name !=3D NULL; md++) { if (hmp_compare_cmd(name, md->name)) { if (md->get_value) { - *pval =3D md->get_value(mon, md, md->offset); + int64_t val =3D md->get_value(mon, md, md->offset); + *pval =3D target_long_bits() =3D=3D 32 ? (int32_t)val : va= l; } else { CPUArchState *env =3D mon_get_cpu_env(mon); ptr =3D (uint8_t *)env + md->offset; diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 977f65fe16c..b128334e571 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -593,8 +593,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict) } } =20 -static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *m= d, - int val) +static int64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md, + int offset) { CPUArchState *env =3D mon_get_cpu_env(mon); return env->eip + env->segs[R_CS].base; --=20 2.53.0