From nobody Mon Feb 9 01:20:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) client-ip=209.85.128.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1646571625; cv=none; d=zohomail.com; s=zohoarc; b=IwK60nkFkdolb9erqSpGzFkWlHY7LPJauBwlE52JlQWCqyY4P1hN+dl1fCIxkkxFonmRzMlW79rGBJlVQ4UkJL2FIzSqOg0Wfl0tzge7WLlGqo06HA9Z8nBeixLlz2a5cPZyvgz3tpC0vCTI6iAT215WMobu8AYmKktPI3lCw/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646571625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Hf7bfn2NDQl8QJroqEZfIkgs6K9JXsrKL2jIgOmtsyM=; b=dWUzDbzoV0+Z8ieR1fHgVYJyKhBcDJlI78p9rGuDT21OKmVcw5bwK+JtnuHQd0lVW9PhXFldzoeXnF+Cp5TEd0cyV1WGJqJsJO0ew9OzOgJfoTxnRjzFL2lC+DtBe9P5jFp0jsuNSm340TY+Hm+BRLkBCl+rENUd07/b57Z3/E4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=pass header.from= (p=none dis=none) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.zohomail.com with SMTPS id 1646571625974521.0314771270803; Sun, 6 Mar 2022 05:00:25 -0800 (PST) Received: by mail-wm1-f54.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so7738919wmp.5 for ; Sun, 06 Mar 2022 05:00:26 -0800 (PST) Return-Path: Return-Path: Received: from nuc.lan ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u15-20020a056000038f00b001f1e57a74e2sm2750597wrf.4.2022.03.06.05.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Mar 2022 05:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hf7bfn2NDQl8QJroqEZfIkgs6K9JXsrKL2jIgOmtsyM=; b=Zt7bU7jmOcnTZmCqAb2+FKLzubO65jmE4UIvD3kvF44i4B/udXDxw3yZk5oq8cqY0H qPqrw0H/fFfbgaPPOEJFqkFx7r69GeEWSeavch/WQBgoSFEQ8meBuh66mrpQqoDRYcuI 2CmQiLh+CSH31OCDI7uvoI2lxAfX3x9JUYm1pfsbDMjQgej6lHWNXYbI4e/v6AALV8UT 0HEIYwXB967Hen10s8CKMWCbVIPafUecFPfbHNMJGwct+/BfqUHQNycOCa3/7W766C4N aVo9KPlKEMimcTFfNH3U6bEBK0fXIdlACGn2xYTCS4IUray62aXbM0Zl7DpNMnR49kiz n7kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hf7bfn2NDQl8QJroqEZfIkgs6K9JXsrKL2jIgOmtsyM=; b=IhpWNcXhkHJAHbBomUVk+T17ANsusNiSn6Hiza6aF5OhcW4qse3RV7cc2GAAFU0IL7 MQ998cllpt/mTf4Mop6caUfOv9vH/5bRM0QRIi2hCoPb5iTu5ZghxSPEK5qH0EuPAlts KUB5DNZPHtdsXuBSxZQFCl2V0HHaaiTm+DBc00K8ct/NU8EmoJmgWw+zO3gRiku8cIZD bx3tjO53zWys+8rGmZeuHZa/0PSSMR7jqYNW+/E+oEHa0G3v10jESGWY08UTAyG12/qK 36w2l/5A4MM5OlZ5pwdwugqiW0TfOa665u9p9OKc8d0wvy+Ii9kneMdcg85CAcvirWLW 9YFQ== X-Gm-Message-State: AOAM5301BOZKwlpQa9A3RO3/r/HR33W2hM6rdAdDSVXkxpa81kfm0aC3 CON4s9k3C4KI7PvGHyhwA0auxuecSiQ= X-Google-Smtp-Source: ABdhPJyrnhrbi+frsOk5J8cx3URkg4gkRhBaoZ09LHzB2c69ZwSERvmeUs2ZEy5iLUiKJfMW5QNGJg== X-Received: by 2002:a05:600c:4e94:b0:381:84cf:e9b0 with SMTP id f20-20020a05600c4e9400b0038184cfe9b0mr5616215wmq.79.1646571624798; Sun, 06 Mar 2022 05:00:24 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Thomas Huth , Eduardo Habkost , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 04/33] exec: Make cpu_memory_rw_debug() target agnostic Date: Sun, 6 Mar 2022 13:59:31 +0100 Message-Id: <20220306130000.8104-5-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220306130000.8104-1-philippe.mathieu.daude@gmail.com> References: <20220306130000.8104-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1646571627928100001 From: Philippe Mathieu-Daud=C3=A9 cpu_memory_rw_debug() is declared in "exec/cpu-all.h" which contains target-specific declarations. To be able to use it from target agnostic source, move the declaration to the generic "exec/cpu-common.h" header. Replace the target-specific 'target_ulong' type by 'vaddr' which better reflects the argument type, and is target agnostic. Suggested-by: Richard Henderson Reviewed-by: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220207075426.81934-5-f4bug@amsat.org> --- include/exec/cpu-all.h | 4 ---- include/exec/cpu-common.h | 4 ++++ cpu.c | 6 +++--- softmmu/cpus.c | 2 +- softmmu/physmem.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 84caf5c3d9f..c0f0fab28a1 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -433,10 +433,6 @@ int cpu_exec(CPUState *cpu); void tcg_exec_realizefn(CPUState *cpu, Error **errp); void tcg_exec_unrealizefn(CPUState *cpu); =20 -/* Returns: 0 on success, -1 on error */ -int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, - void *ptr, target_ulong len, bool is_write); - /** * cpu_set_cpustate_pointers(cpu) * @cpu: The cpu object diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index cd1d7328a1d..8031ebc680c 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -128,6 +128,10 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t sta= rt, size_t length); =20 #endif =20 +/* Returns: 0 on success, -1 on error */ +int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, + void *ptr, size_t len, bool is_write); + /* vl.c */ extern int singlestep; =20 diff --git a/cpu.c b/cpu.c index 3ea38aea707..d5d4cbf8cb7 100644 --- a/cpu.c +++ b/cpu.c @@ -415,11 +415,11 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...) =20 /* physical memory access (slow version, mainly for debug) */ #if defined(CONFIG_USER_ONLY) -int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, - void *ptr, target_ulong len, bool is_write) +int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, + void *ptr, size_t len, bool is_write) { int flags; - target_ulong l, page; + vaddr l, page; void * p; uint8_t *buf =3D ptr; =20 diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 1681844b61d..3f8fae43ba6 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -33,7 +33,7 @@ #include "qapi/qmp/qerror.h" #include "exec/gdbstub.h" #include "sysemu/hw_accel.h" -#include "exec/exec-all.h" +#include "exec/cpu-common.h" #include "qemu/thread.h" #include "qemu/plugin.h" #include "sysemu/cpus.h" diff --git a/softmmu/physmem.c b/softmmu/physmem.c index a13289a594a..cf6b2b48995 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -3436,11 +3436,11 @@ address_space_write_cached_slow(MemoryRegionCache *= cache, hwaddr addr, #include "memory_ldst.c.inc" =20 /* virtual memory access for debug (includes writing to ROM) */ -int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, - void *ptr, target_ulong len, bool is_write) +int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, + void *ptr, size_t len, bool is_write) { hwaddr phys_addr; - target_ulong l, page; + vaddr l, page; uint8_t *buf =3D ptr; =20 cpu_synchronize_state(cpu); --=20 2.35.1