From nobody Mon Feb 9 03:16:47 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=1768820747; cv=none; d=zohomail.com; s=zohoarc; b=igFlYItl95/I/Mxsp59bPGL/sVDCIb1HB8g0p7URZr4WEtyMZVXGd4gl04S47R1PImWUshYHqMYlg66v+VECOarKCfTQZPiS+rb6h8ZqSWzvc++hxVXUDbtMvII+cqVfeF+/E4O/RYy6WZEvNUG82FJmdFlqZc5YV0WNsRxORT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820747; 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=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=TSy1Dc/V+42ih+GvLwP7Jjjh10pwZS3u7u9DysYRwn+x7SburrpPxNFC4GbHuAKHmFs+xeKEu1t1c3WFekcQAlCN2ww+SOKmiVLAlCVf/V0jXw9TOlWFDLQZIzucpIClRE1hEH7pn+UHqq8sHZtp4QkM47fLQh7mc6jMZyEseSI= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768820746993629.3018966238035; Mon, 19 Jan 2026 03:05:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3y-00086r-6r; Mon, 19 Jan 2026 06:04:50 -0500 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 1vhn3w-00085B-Vp for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:49 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3v-0006dg-Hs for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:48 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-42fb0fc5aa9so2284611f8f.1 for ; Mon, 19 Jan 2026 03:04:47 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf42sm22578583f8f.20.2026.01.19.03.04.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820685; x=1769425485; 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=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=Vv+nj2FsYSCas08POv68c5ImuNSNsV1WGu/1i9f6X/c/Wv8pcGgMyX5Ahu/B5gmF2r 0UEIYZ3pZiQWGpiOZvAS3EmA2gtRqXk3Rsufaj76B9Glx5e2d7dhMb6z2didCKDavn64 WxhJ071Idqm+x5fMWUrKQjekqWMIiiBNsmza3a3ftfHtzfh7bvtMNFyN0guOi4+7w10O QqwHsAiRM0ThfegHc4mBc5Qcm+hjmnNX3taAWr3Xv2hc8/5ZobMqY9hW/BxOF57K4bsM 83zv2oqU5VN1sJ7BePNXlcgREXVyBehY9Qi+Fbe7hau67wmKzECuAGETcO/vFWVU/M30 S4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820685; x=1769425485; 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=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=JIOxG+i0K9wVpJ4tVgzlrLcqNbnbgjr2mgln0KLIVmt/+4zllTW1fmaDTDvBl17oV3 1udlTNxsQ5YOwptdyYnd3xVzxS103KrRdVGjlftSZnwxUiCMJ+fUkr2JE0jBfSKBnnu+ GRJZCwRjN7l7Yi40nFsuLaxUL9GkibrIxstB8xeVPLxnm+P8p6yUVZddKmXVTNCFJgDF reYlHvY2tM2AZzxOt9GOyY1HzLgYLinPnYc1XNrvmOzYpCtC8sFkBT0xaUw3nMJ8BgjA Z2dMs09z+MTWl/hj15C0zYsg8LqHhbkJGe5HAICXMmzaF4QpQ6HEcEdxTn8ku/rvFdPe pnjQ== X-Gm-Message-State: AOJu0YwXiT9jgpzw5Ydfl3DGMGPF+yzF/1m9XNDTWh+OcfDfXj0UO6u1 z+HQSWYe/r7nfXptZ2I6vOt+PCI7HZyj17U35KJRRQyxzsD5AEMzHQVAyESKvi55LH3qKTc9Dmm ufAv56ek= X-Gm-Gg: AZuq6aJPuc5Hc4uK9dNWhBDYEPKK1FqGDvn7KUrlwdA3LdmDoyi/omTckWlgt9Cl1bZ iVmxE3YvwnTNF3GvGirVA+cyqNk/WkC12XE9Mc34fmswjDnpFthtS3a+bgl9gNBzWAAvxUWUHl1 c4xlfhRDvc5pz+4iSe1H3iFLJANnIikfpZGhgqMcEFWnlhQABHmISP2AQeKf6lQs2q5bvVV3uM/ W6ELJ8/NUKwa8cbZEII344+0AP3pfiIqETK2ApsYSYjVee//EX6Zl6QsaC4ClyJd1FOC6/6S1qH vjS052HXo8DwHFztiVP9t4Q/jkq7XngydznBLZTQT6abfU9HGv6jsw3xm93Y5fiHkziW4PB01jL kfmWvlbVgrNdP3RKwok3Sx6W8wbCLUcMaDVTLPVMhPzvXtSidVfvufvite3WbbSZVDkIXRygBli q9GaTnWPIVpDJLrj+Vjw2h37KTn/BosZcua/5H5d0F+cxep4llIOu04T8Cc6cX X-Received: by 2002:adf:f983:0:b0:435:6c8d:d017 with SMTP id ffacd0b85a97d-4356c8dd0d7mr11585446f8f.32.1768820685525; Mon, 19 Jan 2026 03:04:45 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 6/8] monitor: Truncate target register using ldn_he_p() API Date: Mon, 19 Jan 2026 12:03:56 +0100 Message-ID: <20260119110358.66821-7-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-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 (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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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: 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: 1768820747702158500 Rather than truncating with a target_long cast, use the unaligned load/store API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/monitor/hmp-target.h | 3 --- monitor/hmp-target.c | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index 97d99f1c747..c56f8df505c 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -27,15 +27,12 @@ =20 typedef struct MonitorDef MonitorDef; =20 -#ifdef COMPILING_PER_TARGET -#include "cpu.h" struct MonitorDef { const char *name; int offset; uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int v= al); int type; }; -#endif =20 #define MD_TULONG 0 #define MD_U32 1 diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 5738b47bb03..257605a1c96 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/bswap.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "net/slirp.h" @@ -65,6 +66,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command) */ int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name) { + const unsigned length =3D target_long_bits() / 8; const MonitorDef *md =3D target_monitor_defs(); CPUState *cs =3D mon_get_cpu(mon); uint64_t tmp =3D 0; @@ -83,11 +85,11 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const= char *name) void *ptr =3D (uint8_t *)env + md->offset; =20 switch(md->type) { - case MD_U32: + case MD_I32: *pval =3D *(uint32_t *)ptr; break; case MD_TULONG: - *pval =3D *(target_ulong *)ptr; + *pval =3D ldn_he_p(ptr, length); break; default: *pval =3D 0; @@ -100,7 +102,7 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const= char *name) =20 ret =3D target_get_monitor_def(cs, name, &tmp); if (!ret) { - *pval =3D (target_ulong)tmp; + *pval =3D ldn_he_p(&tmp, length); } =20 return ret; --=20 2.52.0