mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
rust: pl011: fix migration stream
The Rust vmstate macros lack the type-safety of their C equivalents (so safe, much abstraction), and therefore they were predictably wrong. The registers have already been changed to 32-bits in the previous patch, but read_pos/read_count/read_trigger also have to be u32 instead of usize. The easiest way to do so is to let the FIFO use u32 indices instead of usize. My plan for making VMStateField typesafe is to have a trait to retrieve a basic VMStateField; for example something like vmstate_uint32 would become an implementation of the VMState trait on u32. Then you'd write something like "vmstate_of!(Type, field).with_version_id(2)". That is, vmstate_of retrieves the basic VMStateField and fills in the offset, and then more changes can be applied on top. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e2e0828e0f
commit
6b4f7b0705
3 changed files with 37 additions and 33 deletions
|
@ -106,28 +106,6 @@ macro_rules! vmstate_uint32 {
|
|||
}};
|
||||
}
|
||||
|
||||
#[doc(alias = "VMSTATE_INT32_V")]
|
||||
#[macro_export]
|
||||
macro_rules! vmstate_int32_v {
|
||||
($field_name:ident, $struct_name:ty, $version_id:expr) => {{
|
||||
$crate::vmstate_single!(
|
||||
$field_name,
|
||||
$struct_name,
|
||||
$version_id,
|
||||
::core::ptr::addr_of!($crate::bindings::vmstate_info_int32),
|
||||
::core::mem::size_of::<i32>()
|
||||
)
|
||||
}};
|
||||
}
|
||||
|
||||
#[doc(alias = "VMSTATE_INT32")]
|
||||
#[macro_export]
|
||||
macro_rules! vmstate_int32 {
|
||||
($field_name:ident, $struct_name:ty) => {{
|
||||
$crate::vmstate_int32_v!($field_name, $struct_name, 0)
|
||||
}};
|
||||
}
|
||||
|
||||
#[doc(alias = "VMSTATE_ARRAY")]
|
||||
#[macro_export]
|
||||
macro_rules! vmstate_array {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue