On 5/12/24 07:07, Zhao Liu wrote:
HPET device needs to access and update hpet_cfg variable, but now it is
defined in hw/i386/fw_cfg.c and Rust code can't access it.

Move hpet_cfg definition to hpet.c (and rename it to hpet_fw_cfg). This
allows Rust HPET device implements its own global hpet_fw_cfg variable,
and will further reduce the use of unsafe C code access and calls in the
Rust HPET implementation.

Signed-off-by: Zhao Liu <zhao1....@intel.com>
---
  hw/i386/fw_cfg.c        |  4 +---
  hw/timer/hpet.c         | 16 +++++++++-------
  include/hw/timer/hpet.h |  2 +-
  3 files changed, 11 insertions(+), 11 deletions(-)


diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
index d17a8d43199e..dbf709251a8f 100644
--- a/include/hw/timer/hpet.h
+++ b/include/hw/timer/hpet.h
@@ -74,7 +74,7 @@ struct hpet_fw_config
      struct hpet_fw_entry hpet[8];
  } QEMU_PACKED;
-extern struct hpet_fw_config hpet_cfg;
+extern struct hpet_fw_config hpet_fw_cfg;

Could this field belong to the (yet unexisting) HPETClass?

#define TYPE_HPET "hpet"


Reply via email to