mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
rust: add definitions for vmstate
Add a new qemu_api module, `vmstate`. Declare a bunch of Rust macros declared that are equivalent in spirit to the C macros in include/migration/vmstate.h. For example the Rust of equivalent of the C macro: VMSTATE_UINT32(field_name, struct_name) is: vmstate_uint32!(field_name, StructName) This breathtaking development will allow us to reach feature parity between the Rust and C pl011 implementations. Extracted from a patch by Manos Pitsidianakis (https://lore.kernel.org/qemu-devel/20241024-rust-round-2-v1-4-051e7a25b978@linaro.org/). Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f60f3670fd
commit
0a65e4124a
5 changed files with 370 additions and 26 deletions
|
@ -62,24 +62,3 @@ macro_rules! declare_properties {
|
|||
];
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! vm_state_description {
|
||||
($(#[$outer:meta])*
|
||||
$name:ident,
|
||||
$(name: $vname:expr,)*
|
||||
$(unmigratable: $um_val:expr,)*
|
||||
) => {
|
||||
#[used]
|
||||
$(#[$outer])*
|
||||
pub static $name: $crate::bindings::VMStateDescription = $crate::bindings::VMStateDescription {
|
||||
$(name: {
|
||||
#[used]
|
||||
static VMSTATE_NAME: &::core::ffi::CStr = $vname;
|
||||
$vname.as_ptr()
|
||||
},)*
|
||||
unmigratable: true,
|
||||
..$crate::zeroable::Zeroable::ZERO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue