diff --git a/fuzzers/qemu_systemmode/src/fuzzer.rs b/fuzzers/qemu_systemmode/src/fuzzer.rs index 74fbd0b1dd..c662503375 100644 --- a/fuzzers/qemu_systemmode/src/fuzzer.rs +++ b/fuzzers/qemu_systemmode/src/fuzzer.rs @@ -90,6 +90,9 @@ pub fn fuzz() { emu.set_breakpoint(breakpoint); // BREAKPOINT + let devices = emu.list_devices(); + println!("Devices = {:?}", devices); + // let saved_cpu_states: Vec<_> = (0..emu.num_cpus()) // .map(|i| emu.cpu_from_index(i).save_state()) // .collect(); diff --git a/libafl_qemu/libafl_qemu_build/src/bindings.rs b/libafl_qemu/libafl_qemu_build/src/bindings.rs index fe10f7638c..01b7766423 100644 --- a/libafl_qemu/libafl_qemu_build/src/bindings.rs +++ b/libafl_qemu/libafl_qemu_build/src/bindings.rs @@ -51,6 +51,7 @@ const WRAPPER_HEADER: &str = r#" #include "sysemu/tcg.h" #include "sysemu/replay.h" +#include "libafl_extras/syx-snapshot/device-save.h" #include "libafl_extras/syx-snapshot/syx-snapshot.h" #endif @@ -101,6 +102,7 @@ pub fn generate( .allowlist_type("qemu_plugin_mem_rw") .allowlist_type("MemOpIdx") .allowlist_type("MemOp") + .allowlist_type("device_snapshot_kind_t") .allowlist_function("qemu_user_init") .allowlist_function("target_mmap") .allowlist_function("target_mprotect") @@ -117,6 +119,7 @@ pub fn generate( .allowlist_function("syx_snapshot_create") .allowlist_function("syx_snapshot_root_restore") .allowlist_function("syx_snapshot_dirty_list_add") + .allowlist_function("device_list_all") .blocklist_function("main_loop_wait") // bindgen issue #1313 .parse_callbacks(Box::new(bindgen::CargoCallbacks)); diff --git a/libafl_qemu/libafl_qemu_build/src/build.rs b/libafl_qemu/libafl_qemu_build/src/build.rs index 88428acdb2..a083fde79c 100644 --- a/libafl_qemu/libafl_qemu_build/src/build.rs +++ b/libafl_qemu/libafl_qemu_build/src/build.rs @@ -8,7 +8,7 @@ use which::which; const QEMU_URL: &str = "https://github.com/AFLplusplus/qemu-libafl-bridge"; const QEMU_DIRNAME: &str = "qemu-libafl-bridge"; -const QEMU_REVISION: &str = "6df19ab8f161791b7b16a896d1da1d16b8749006"; +const QEMU_REVISION: &str = "659539eaceb7acf242f2f6a573b705e1be1befb6"; fn build_dep_check(tools: &[&str]) { for tool in tools { diff --git a/libafl_qemu/libafl_qemu_sys/src/x86_64_stub_bindings.rs b/libafl_qemu/libafl_qemu_sys/src/x86_64_stub_bindings.rs index 2e6f382024..07b26f7cbe 100644 --- a/libafl_qemu/libafl_qemu_sys/src/x86_64_stub_bindings.rs +++ b/libafl_qemu/libafl_qemu_sys/src/x86_64_stub_bindings.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.63.0 */ +/* automatically generated by rust-bindgen 0.66.1 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -1309,6 +1309,11 @@ pub struct CPUAddressSpace { } #[repr(C)] #[derive(Debug, Copy, Clone)] +pub struct CpuInfoFast { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct CPUJumpCache { _unused: [u8; 0], } @@ -1319,11 +1324,6 @@ pub struct Error { } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct JSONWriter { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct MemoryRegion { _unused: [u8; 0], } @@ -1339,11 +1339,6 @@ pub struct QDict { } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct QEMUFile { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct QObject { _unused: [u8; 0], } @@ -1364,6 +1359,11 @@ pub struct VMChangeStateEntry { } #[repr(C)] #[derive(Debug, Copy, Clone)] +pub struct VMStateDescription { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct IRQState { _unused: [u8; 0], } @@ -1430,56 +1430,6 @@ impl Default for QEnumLookup { } } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct QTailQLink { - pub tql_next: *mut ::std::os::raw::c_void, - pub tql_prev: *mut QTailQLink, -} -#[test] -fn bindgen_test_layout_QTailQLink() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(QTailQLink)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(QTailQLink)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tql_next) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(QTailQLink), - "::", - stringify!(tql_next) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tql_prev) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(QTailQLink), - "::", - stringify!(tql_prev) - ) - ); -} -impl Default for QTailQLink { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -#[repr(C)] #[derive(Copy, Clone)] pub struct QemuMutex { pub lock: pthread_mutex_t, @@ -1628,6 +1578,258 @@ fn bindgen_test_layout_QemuThread() { ); } #[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct QemuLockCnt { + pub count: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_QemuLockCnt() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(QemuLockCnt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(QemuLockCnt)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(QemuLockCnt), + "::", + stringify!(count) + ) + ); +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone)] +pub struct MemTxAttrs { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, +} +#[test] +fn bindgen_test_layout_MemTxAttrs() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(MemTxAttrs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(MemTxAttrs)) + ); +} +impl MemTxAttrs { + #[inline] + pub fn unspecified(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_unspecified(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn secure(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_secure(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn user(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_user(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn memory(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_memory(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn requester_id(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 16u8) as u32) } + } + #[inline] + pub fn set_requester_id(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 16u8, val as u64) + } + } + #[inline] + pub fn byte_swap(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) } + } + #[inline] + pub fn set_byte_swap(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(20usize, 1u8, val as u64) + } + } + #[inline] + pub fn target_tlb_bit0(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) } + } + #[inline] + pub fn set_target_tlb_bit0(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(21usize, 1u8, val as u64) + } + } + #[inline] + pub fn target_tlb_bit1(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) } + } + #[inline] + pub fn set_target_tlb_bit1(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(22usize, 1u8, val as u64) + } + } + #[inline] + pub fn target_tlb_bit2(&self) -> ::std::os::raw::c_uint { + unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u32) } + } + #[inline] + pub fn set_target_tlb_bit2(&mut self, val: ::std::os::raw::c_uint) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(23usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + unspecified: ::std::os::raw::c_uint, + secure: ::std::os::raw::c_uint, + user: ::std::os::raw::c_uint, + memory: ::std::os::raw::c_uint, + requester_id: ::std::os::raw::c_uint, + byte_swap: ::std::os::raw::c_uint, + target_tlb_bit0: ::std::os::raw::c_uint, + target_tlb_bit1: ::std::os::raw::c_uint, + target_tlb_bit2: ::std::os::raw::c_uint, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let unspecified: u32 = unsafe { ::std::mem::transmute(unspecified) }; + unspecified as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let secure: u32 = unsafe { ::std::mem::transmute(secure) }; + secure as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let user: u32 = unsafe { ::std::mem::transmute(user) }; + user as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let memory: u32 = unsafe { ::std::mem::transmute(memory) }; + memory as u64 + }); + __bindgen_bitfield_unit.set(4usize, 16u8, { + let requester_id: u32 = unsafe { ::std::mem::transmute(requester_id) }; + requester_id as u64 + }); + __bindgen_bitfield_unit.set(20usize, 1u8, { + let byte_swap: u32 = unsafe { ::std::mem::transmute(byte_swap) }; + byte_swap as u64 + }); + __bindgen_bitfield_unit.set(21usize, 1u8, { + let target_tlb_bit0: u32 = unsafe { ::std::mem::transmute(target_tlb_bit0) }; + target_tlb_bit0 as u64 + }); + __bindgen_bitfield_unit.set(22usize, 1u8, { + let target_tlb_bit1: u32 = unsafe { ::std::mem::transmute(target_tlb_bit1) }; + target_tlb_bit1 as u64 + }); + __bindgen_bitfield_unit.set(23usize, 1u8, { + let target_tlb_bit2: u32 = unsafe { ::std::mem::transmute(target_tlb_bit2) }; + target_tlb_bit2 as u64 + }); + __bindgen_bitfield_unit + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct QTailQLink { + pub tql_next: *mut ::std::os::raw::c_void, + pub tql_prev: *mut QTailQLink, +} +#[test] +fn bindgen_test_layout_QTailQLink() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(QTailQLink)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(QTailQLink)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tql_next) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(QTailQLink), + "::", + stringify!(tql_next) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tql_prev) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(QTailQLink), + "::", + stringify!(tql_prev) + ) + ); +} +impl Default for QTailQLink { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Notifier { pub notify: ::std::option::Option< @@ -2628,7 +2830,37 @@ impl Default for NamedClockList { } } } -#[doc = " DeviceState:\n @realized: Indicates whether the device has been fully constructed.\n When accessed outside big qemu lock, must be accessed with\n qatomic_load_acquire()\n @reset: ResettableState for the device; handled by Resettable interface.\n\n This structure should not be accessed directly. We declare it here\n so that it can be embedded in individual device state structures."] +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct MemReentrancyGuard { + pub engaged_in_io: bool, +} +#[test] +fn bindgen_test_layout_MemReentrancyGuard() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(MemReentrancyGuard)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(MemReentrancyGuard)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).engaged_in_io) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(MemReentrancyGuard), + "::", + stringify!(engaged_in_io) + ) + ); +} +#[doc = " DeviceState:\n @reset: ResettableState for the device; handled by Resettable interface.\n\n This structure should not be accessed directly. We declare it here\n so that it can be embedded in individual device state structures."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DeviceState { @@ -2650,6 +2882,7 @@ pub struct DeviceState { pub alias_required_for_version: ::std::os::raw::c_int, pub reset: ResettableState, pub unplug_blockers: *mut GSList, + pub mem_reentrancy_guard: MemReentrancyGuard, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -2777,7 +3010,7 @@ fn bindgen_test_layout_DeviceState() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 152usize, + 160usize, concat!("Size of: ", stringify!(DeviceState)) ); assert_eq!( @@ -2967,6 +3200,16 @@ fn bindgen_test_layout_DeviceState() { stringify!(unplug_blockers) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mem_reentrancy_guard) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(DeviceState), + "::", + stringify!(mem_reentrancy_guard) + ) + ); } impl Default for DeviceState { fn default() -> Self { @@ -3376,897 +3619,6 @@ impl ::std::fmt::Debug for BusState { write ! (f , "BusState {{ obj: {:?}, parent: {:?}, name: {:?}, hotplug_handler: {:?}, max_index: {:?}, realized: {:?}, full: {:?}, num_children: {:?}, children: {:?}, sibling: {:?}, reset: {:?} }}" , self . obj , self . parent , self . name , self . hotplug_handler , self . max_index , self . realized , self . full , self . num_children , self . children , self . sibling , self . reset) } } -#[doc = " Property:\n @set_default: true if the default value should be set from @defval,\n in which case @info->set_default_value must not be NULL\n (if false then no default value is set by the property system\n and the field retains whatever value it was given by instance_init).\n @defval: default value for the property. This is used only if @set_default\n is true."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct Property { - pub name: *const ::std::os::raw::c_char, - pub info: *const PropertyInfo, - pub offset: isize, - pub bitnr: u8, - pub bitmask: u64, - pub set_default: bool, - pub defval: Property__bindgen_ty_1, - pub arrayoffset: ::std::os::raw::c_int, - pub arrayinfo: *const PropertyInfo, - pub arrayfieldsize: ::std::os::raw::c_int, - pub link_type: *const ::std::os::raw::c_char, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union Property__bindgen_ty_1 { - pub i: i64, - pub u: u64, -} -#[test] -fn bindgen_test_layout_Property__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(Property__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(Property__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(Property__bindgen_ty_1), - "::", - stringify!(i) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(Property__bindgen_ty_1), - "::", - stringify!(u) - ) - ); -} -impl Default for Property__bindgen_ty_1 { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -impl ::std::fmt::Debug for Property__bindgen_ty_1 { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - write!(f, "Property__bindgen_ty_1 {{ union }}") - } -} -#[test] -fn bindgen_test_layout_Property() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(Property)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(Property)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).info) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(info) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bitnr) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(bitnr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bitmask) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(bitmask) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).set_default) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(set_default) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).defval) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(defval) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).arrayoffset) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(arrayoffset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).arrayinfo) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(arrayinfo) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).arrayfieldsize) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(arrayfieldsize) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).link_type) as usize - ptr as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(Property), - "::", - stringify!(link_type) - ) - ); -} -impl Default for Property { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -impl ::std::fmt::Debug for Property { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - write ! (f , "Property {{ name: {:?}, info: {:?}, set_default: {:?}, defval: {:?}, arrayoffset: {:?}, arrayinfo: {:?}, arrayfieldsize: {:?}, link_type: {:?} }}" , self . name , self . info , self . set_default , self . defval , self . arrayoffset , self . arrayinfo , self . arrayfieldsize , self . link_type) - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct PropertyInfo { - pub name: *const ::std::os::raw::c_char, - pub description: *const ::std::os::raw::c_char, - pub enum_table: *const QEnumLookup, - pub realized_set_allowed: bool, - pub print: ::std::option::Option< - unsafe extern "C" fn( - obj: *mut Object, - prop: *mut Property, - dest: *mut ::std::os::raw::c_char, - len: usize, - ) -> ::std::os::raw::c_int, - >, - pub set_default_value: - ::std::option::Option, - pub create: ::std::option::Option< - unsafe extern "C" fn( - oc: *mut ObjectClass, - name: *const ::std::os::raw::c_char, - prop: *mut Property, - ) -> *mut ObjectProperty, - >, - pub get: ObjectPropertyAccessor, - pub set: ObjectPropertyAccessor, - pub release: ObjectPropertyRelease, -} -#[test] -fn bindgen_test_layout_PropertyInfo() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 80usize, - concat!("Size of: ", stringify!(PropertyInfo)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(PropertyInfo)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).description) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(description) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).enum_table) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(enum_table) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).realized_set_allowed) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(realized_set_allowed) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).print) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(print) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).set_default_value) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(set_default_value) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).create) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(create) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).get) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(get) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).set) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(set) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).release) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(PropertyInfo), - "::", - stringify!(release) - ) - ); -} -impl Default for PropertyInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct VMStateInfo { - pub name: *const ::std::os::raw::c_char, - pub get: ::std::option::Option< - unsafe extern "C" fn( - f: *mut QEMUFile, - pv: *mut ::std::os::raw::c_void, - size: usize, - field: *const VMStateField, - ) -> ::std::os::raw::c_int, - >, - pub put: ::std::option::Option< - unsafe extern "C" fn( - f: *mut QEMUFile, - pv: *mut ::std::os::raw::c_void, - size: usize, - field: *const VMStateField, - vmdesc: *mut JSONWriter, - ) -> ::std::os::raw::c_int, - >, -} -#[test] -fn bindgen_test_layout_VMStateInfo() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(VMStateInfo)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(VMStateInfo)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(VMStateInfo), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).get) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(VMStateInfo), - "::", - stringify!(get) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).put) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(VMStateInfo), - "::", - stringify!(put) - ) - ); -} -impl Default for VMStateInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -pub const VMStateFlags_VMS_SINGLE: VMStateFlags = VMStateFlags(1); -pub const VMStateFlags_VMS_POINTER: VMStateFlags = VMStateFlags(2); -pub const VMStateFlags_VMS_ARRAY: VMStateFlags = VMStateFlags(4); -pub const VMStateFlags_VMS_STRUCT: VMStateFlags = VMStateFlags(8); -pub const VMStateFlags_VMS_VARRAY_INT32: VMStateFlags = VMStateFlags(16); -pub const VMStateFlags_VMS_BUFFER: VMStateFlags = VMStateFlags(32); -pub const VMStateFlags_VMS_ARRAY_OF_POINTER: VMStateFlags = VMStateFlags(64); -pub const VMStateFlags_VMS_VARRAY_UINT16: VMStateFlags = VMStateFlags(128); -pub const VMStateFlags_VMS_VBUFFER: VMStateFlags = VMStateFlags(256); -pub const VMStateFlags_VMS_MULTIPLY: VMStateFlags = VMStateFlags(512); -pub const VMStateFlags_VMS_VARRAY_UINT8: VMStateFlags = VMStateFlags(1024); -pub const VMStateFlags_VMS_VARRAY_UINT32: VMStateFlags = VMStateFlags(2048); -pub const VMStateFlags_VMS_MUST_EXIST: VMStateFlags = VMStateFlags(4096); -pub const VMStateFlags_VMS_ALLOC: VMStateFlags = VMStateFlags(8192); -pub const VMStateFlags_VMS_MULTIPLY_ELEMENTS: VMStateFlags = VMStateFlags(16384); -pub const VMStateFlags_VMS_VSTRUCT: VMStateFlags = VMStateFlags(32768); -impl ::std::ops::BitOr for VMStateFlags { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - VMStateFlags(self.0 | other.0) - } -} -impl ::std::ops::BitOrAssign for VMStateFlags { - #[inline] - fn bitor_assign(&mut self, rhs: VMStateFlags) { - self.0 |= rhs.0; - } -} -impl ::std::ops::BitAnd for VMStateFlags { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - VMStateFlags(self.0 & other.0) - } -} -impl ::std::ops::BitAndAssign for VMStateFlags { - #[inline] - fn bitand_assign(&mut self, rhs: VMStateFlags) { - self.0 &= rhs.0; - } -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct VMStateFlags(pub ::std::os::raw::c_uint); -pub const MigrationPriority_MIG_PRI_DEFAULT: MigrationPriority = MigrationPriority(0); -pub const MigrationPriority_MIG_PRI_IOMMU: MigrationPriority = MigrationPriority(1); -pub const MigrationPriority_MIG_PRI_PCI_BUS: MigrationPriority = MigrationPriority(2); -pub const MigrationPriority_MIG_PRI_VIRTIO_MEM: MigrationPriority = MigrationPriority(3); -pub const MigrationPriority_MIG_PRI_GICV3_ITS: MigrationPriority = MigrationPriority(4); -pub const MigrationPriority_MIG_PRI_GICV3: MigrationPriority = MigrationPriority(5); -pub const MigrationPriority_MIG_PRI_MAX: MigrationPriority = MigrationPriority(6); -impl ::std::ops::BitOr for MigrationPriority { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - MigrationPriority(self.0 | other.0) - } -} -impl ::std::ops::BitOrAssign for MigrationPriority { - #[inline] - fn bitor_assign(&mut self, rhs: MigrationPriority) { - self.0 |= rhs.0; - } -} -impl ::std::ops::BitAnd for MigrationPriority { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - MigrationPriority(self.0 & other.0) - } -} -impl ::std::ops::BitAndAssign for MigrationPriority { - #[inline] - fn bitand_assign(&mut self, rhs: MigrationPriority) { - self.0 &= rhs.0; - } -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct MigrationPriority(pub ::std::os::raw::c_uint); -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct VMStateField { - pub name: *const ::std::os::raw::c_char, - pub err_hint: *const ::std::os::raw::c_char, - pub offset: usize, - pub size: usize, - pub start: usize, - pub num: ::std::os::raw::c_int, - pub num_offset: usize, - pub size_offset: usize, - pub info: *const VMStateInfo, - pub flags: VMStateFlags, - pub vmsd: *const VMStateDescription, - pub version_id: ::std::os::raw::c_int, - pub struct_version_id: ::std::os::raw::c_int, - pub field_exists: ::std::option::Option< - unsafe extern "C" fn( - opaque: *mut ::std::os::raw::c_void, - version_id: ::std::os::raw::c_int, - ) -> bool, - >, -} -#[test] -fn bindgen_test_layout_VMStateField() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 104usize, - concat!("Size of: ", stringify!(VMStateField)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(VMStateField)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).err_hint) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(err_hint) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(start) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).num) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(num) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).num_offset) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(num_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).size_offset) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(size_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).info) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(info) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).vmsd) as usize - ptr as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(vmsd) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).version_id) as usize - ptr as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(version_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).struct_version_id) as usize - ptr as usize }, - 92usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(struct_version_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).field_exists) as usize - ptr as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(VMStateField), - "::", - stringify!(field_exists) - ) - ); -} -impl Default for VMStateField { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct VMStateDescription { - pub name: *const ::std::os::raw::c_char, - pub unmigratable: ::std::os::raw::c_int, - pub version_id: ::std::os::raw::c_int, - pub minimum_version_id: ::std::os::raw::c_int, - pub priority: MigrationPriority, - pub pre_load: ::std::option::Option< - unsafe extern "C" fn(opaque: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub post_load: ::std::option::Option< - unsafe extern "C" fn( - opaque: *mut ::std::os::raw::c_void, - version_id: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub pre_save: ::std::option::Option< - unsafe extern "C" fn(opaque: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub post_save: ::std::option::Option< - unsafe extern "C" fn(opaque: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub needed: - ::std::option::Option bool>, - pub dev_unplug_pending: - ::std::option::Option bool>, - pub fields: *const VMStateField, - pub subsections: *mut *const VMStateDescription, -} -#[test] -fn bindgen_test_layout_VMStateDescription() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(VMStateDescription)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(VMStateDescription)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).unmigratable) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(unmigratable) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).version_id) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(version_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).minimum_version_id) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(minimum_version_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).priority) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(priority) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pre_load) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(pre_load) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).post_load) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(post_load) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pre_save) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(pre_save) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).post_save) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(post_save) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).needed) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(needed) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dev_unplug_pending) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(dev_unplug_pending) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).fields) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(fields) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).subsections) as usize - ptr as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(VMStateDescription), - "::", - stringify!(subsections) - ) - ); -} -impl Default for VMStateDescription { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} pub type PTR = *mut ::std::os::raw::c_void; pub type bfd_vma = u64; pub type bfd_byte = u8; @@ -4633,7 +3985,7 @@ pub struct disassemble_info { pub target: bfd_vma, pub target2: bfd_vma, pub disassembler_options: *mut ::std::os::raw::c_char, - pub target_info: i64, + pub target_info: *mut ::std::os::raw::c_void, pub cap_arch: ::std::os::raw::c_int, pub cap_mode: ::std::os::raw::c_int, pub cap_insn_unit: ::std::os::raw::c_int, @@ -5016,300 +4368,6 @@ extern "C" { } pub type hwaddr = u64; #[repr(C)] -#[repr(align(4))] -#[derive(Debug, Default, Copy, Clone)] -pub struct MemTxAttrs { - pub _bitfield_align_1: [u16; 0], - pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, -} -#[test] -fn bindgen_test_layout_MemTxAttrs() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(MemTxAttrs)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(MemTxAttrs)) - ); -} -impl MemTxAttrs { - #[inline] - pub fn unspecified(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } - } - #[inline] - pub fn set_unspecified(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(0usize, 1u8, val as u64) - } - } - #[inline] - pub fn secure(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } - } - #[inline] - pub fn set_secure(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(1usize, 1u8, val as u64) - } - } - #[inline] - pub fn user(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } - } - #[inline] - pub fn set_user(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(2usize, 1u8, val as u64) - } - } - #[inline] - pub fn memory(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } - } - #[inline] - pub fn set_memory(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(3usize, 1u8, val as u64) - } - } - #[inline] - pub fn requester_id(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 16u8) as u32) } - } - #[inline] - pub fn set_requester_id(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(4usize, 16u8, val as u64) - } - } - #[inline] - pub fn byte_swap(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) } - } - #[inline] - pub fn set_byte_swap(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(20usize, 1u8, val as u64) - } - } - #[inline] - pub fn target_tlb_bit0(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) } - } - #[inline] - pub fn set_target_tlb_bit0(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(21usize, 1u8, val as u64) - } - } - #[inline] - pub fn target_tlb_bit1(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) } - } - #[inline] - pub fn set_target_tlb_bit1(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(22usize, 1u8, val as u64) - } - } - #[inline] - pub fn target_tlb_bit2(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u32) } - } - #[inline] - pub fn set_target_tlb_bit2(&mut self, val: ::std::os::raw::c_uint) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(23usize, 1u8, val as u64) - } - } - #[inline] - pub fn new_bitfield_1( - unspecified: ::std::os::raw::c_uint, - secure: ::std::os::raw::c_uint, - user: ::std::os::raw::c_uint, - memory: ::std::os::raw::c_uint, - requester_id: ::std::os::raw::c_uint, - byte_swap: ::std::os::raw::c_uint, - target_tlb_bit0: ::std::os::raw::c_uint, - target_tlb_bit1: ::std::os::raw::c_uint, - target_tlb_bit2: ::std::os::raw::c_uint, - ) -> __BindgenBitfieldUnit<[u8; 3usize]> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); - __bindgen_bitfield_unit.set(0usize, 1u8, { - let unspecified: u32 = unsafe { ::std::mem::transmute(unspecified) }; - unspecified as u64 - }); - __bindgen_bitfield_unit.set(1usize, 1u8, { - let secure: u32 = unsafe { ::std::mem::transmute(secure) }; - secure as u64 - }); - __bindgen_bitfield_unit.set(2usize, 1u8, { - let user: u32 = unsafe { ::std::mem::transmute(user) }; - user as u64 - }); - __bindgen_bitfield_unit.set(3usize, 1u8, { - let memory: u32 = unsafe { ::std::mem::transmute(memory) }; - memory as u64 - }); - __bindgen_bitfield_unit.set(4usize, 16u8, { - let requester_id: u32 = unsafe { ::std::mem::transmute(requester_id) }; - requester_id as u64 - }); - __bindgen_bitfield_unit.set(20usize, 1u8, { - let byte_swap: u32 = unsafe { ::std::mem::transmute(byte_swap) }; - byte_swap as u64 - }); - __bindgen_bitfield_unit.set(21usize, 1u8, { - let target_tlb_bit0: u32 = unsafe { ::std::mem::transmute(target_tlb_bit0) }; - target_tlb_bit0 as u64 - }); - __bindgen_bitfield_unit.set(22usize, 1u8, { - let target_tlb_bit1: u32 = unsafe { ::std::mem::transmute(target_tlb_bit1) }; - target_tlb_bit1 as u64 - }); - __bindgen_bitfield_unit.set(23usize, 1u8, { - let target_tlb_bit2: u32 = unsafe { ::std::mem::transmute(target_tlb_bit2) }; - target_tlb_bit2 as u64 - }); - __bindgen_bitfield_unit - } -} -pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_R: qemu_plugin_mem_rw = qemu_plugin_mem_rw(1); -pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_W: qemu_plugin_mem_rw = qemu_plugin_mem_rw(2); -pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_RW: qemu_plugin_mem_rw = qemu_plugin_mem_rw(3); -impl ::std::ops::BitOr for qemu_plugin_mem_rw { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - qemu_plugin_mem_rw(self.0 | other.0) - } -} -impl ::std::ops::BitOrAssign for qemu_plugin_mem_rw { - #[inline] - fn bitor_assign(&mut self, rhs: qemu_plugin_mem_rw) { - self.0 |= rhs.0; - } -} -impl ::std::ops::BitAnd for qemu_plugin_mem_rw { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - qemu_plugin_mem_rw(self.0 & other.0) - } -} -impl ::std::ops::BitAndAssign for qemu_plugin_mem_rw { - #[inline] - fn bitand_assign(&mut self, rhs: qemu_plugin_mem_rw) { - self.0 &= rhs.0; - } -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct qemu_plugin_mem_rw(pub ::std::os::raw::c_uint); -#[doc = " typedef qemu_plugin_meminfo_t - opaque memory transaction handle\n\n This can be further queried using the qemu_plugin_mem_* query\n functions."] -pub type qemu_plugin_meminfo_t = u32; -extern "C" { - #[doc = " qemu_plugin_hwaddr_phys_addr() - query physical address for memory operation\n @haddr: address handle from qemu_plugin_get_hwaddr()\n\n Returns the physical address associated with the memory operation\n\n Note that the returned physical address may not be unique if you are dealing\n with multiple address spaces."] - pub fn qemu_plugin_hwaddr_phys_addr(haddr: *const qemu_plugin_hwaddr) -> u64; -} -pub const MemOp_MO_8: MemOp = MemOp(0); -pub const MemOp_MO_16: MemOp = MemOp(1); -pub const MemOp_MO_32: MemOp = MemOp(2); -pub const MemOp_MO_64: MemOp = MemOp(3); -pub const MemOp_MO_128: MemOp = MemOp(4); -pub const MemOp_MO_256: MemOp = MemOp(5); -pub const MemOp_MO_512: MemOp = MemOp(6); -pub const MemOp_MO_1024: MemOp = MemOp(7); -pub const MemOp_MO_SIZE: MemOp = MemOp(7); -pub const MemOp_MO_SIGN: MemOp = MemOp(8); -pub const MemOp_MO_BSWAP: MemOp = MemOp(16); -pub const MemOp_MO_LE: MemOp = MemOp(0); -pub const MemOp_MO_BE: MemOp = MemOp(16); -pub const MemOp_MO_TE: MemOp = MemOp(0); -pub const MemOp_MO_ASHIFT: MemOp = MemOp(5); -pub const MemOp_MO_AMASK: MemOp = MemOp(224); -pub const MemOp_MO_ALIGN: MemOp = MemOp(224); -pub const MemOp_MO_UNALN: MemOp = MemOp(0); -pub const MemOp_MO_ALIGN_2: MemOp = MemOp(32); -pub const MemOp_MO_ALIGN_4: MemOp = MemOp(64); -pub const MemOp_MO_ALIGN_8: MemOp = MemOp(96); -pub const MemOp_MO_ALIGN_16: MemOp = MemOp(128); -pub const MemOp_MO_ALIGN_32: MemOp = MemOp(160); -pub const MemOp_MO_ALIGN_64: MemOp = MemOp(192); -pub const MemOp_MO_UB: MemOp = MemOp(0); -pub const MemOp_MO_UW: MemOp = MemOp(1); -pub const MemOp_MO_UL: MemOp = MemOp(2); -pub const MemOp_MO_UQ: MemOp = MemOp(3); -pub const MemOp_MO_UO: MemOp = MemOp(4); -pub const MemOp_MO_SB: MemOp = MemOp(8); -pub const MemOp_MO_SW: MemOp = MemOp(9); -pub const MemOp_MO_SL: MemOp = MemOp(10); -pub const MemOp_MO_SQ: MemOp = MemOp(11); -pub const MemOp_MO_SO: MemOp = MemOp(12); -pub const MemOp_MO_LEUW: MemOp = MemOp(1); -pub const MemOp_MO_LEUL: MemOp = MemOp(2); -pub const MemOp_MO_LEUQ: MemOp = MemOp(3); -pub const MemOp_MO_LESW: MemOp = MemOp(9); -pub const MemOp_MO_LESL: MemOp = MemOp(10); -pub const MemOp_MO_LESQ: MemOp = MemOp(11); -pub const MemOp_MO_BEUW: MemOp = MemOp(17); -pub const MemOp_MO_BEUL: MemOp = MemOp(18); -pub const MemOp_MO_BEUQ: MemOp = MemOp(19); -pub const MemOp_MO_BESW: MemOp = MemOp(25); -pub const MemOp_MO_BESL: MemOp = MemOp(26); -pub const MemOp_MO_BESQ: MemOp = MemOp(27); -pub const MemOp_MO_TEUW: MemOp = MemOp(1); -pub const MemOp_MO_TEUL: MemOp = MemOp(2); -pub const MemOp_MO_TEUQ: MemOp = MemOp(3); -pub const MemOp_MO_TEUO: MemOp = MemOp(4); -pub const MemOp_MO_TESW: MemOp = MemOp(9); -pub const MemOp_MO_TESL: MemOp = MemOp(10); -pub const MemOp_MO_TESQ: MemOp = MemOp(11); -pub const MemOp_MO_SSIZE: MemOp = MemOp(15); -impl ::std::ops::BitOr for MemOp { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - MemOp(self.0 | other.0) - } -} -impl ::std::ops::BitOrAssign for MemOp { - #[inline] - fn bitor_assign(&mut self, rhs: MemOp) { - self.0 |= rhs.0; - } -} -impl ::std::ops::BitAnd for MemOp { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - MemOp(self.0 & other.0) - } -} -impl ::std::ops::BitAndAssign for MemOp { - #[inline] - fn bitand_assign(&mut self, rhs: MemOp) { - self.0 &= rhs.0; - } -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct MemOp(pub ::std::os::raw::c_uint); -pub type MemOpIdx = u32; -#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct TCGCPUOps { _unused: [u8; 0], @@ -5319,7 +4377,7 @@ pub struct TCGCPUOps { pub struct SysemuCPUOps { _unused: [u8; 0], } -#[doc = " CPUClass:\n @class_by_name: Callback to map -cpu command line model name to an\n instantiatable CPU type.\n @parse_features: Callback to parse command line arguments.\n @reset_dump_flags: #CPUDumpFlags to use for reset logging.\n @has_work: Callback for checking if there is work to do.\n @memory_rw_debug: Callback for GDB memory access.\n @dump_state: Callback for dumping state.\n @get_arch_id: Callback for getting architecture-dependent CPU ID.\n @set_pc: Callback for setting the Program Counter register. This\n should have the semantics used by the target architecture when\n setting the PC from a source such as an ELF file entry point;\n for example on Arm it will also set the Thumb mode bit based\n on the least significant bit of the new PC value.\n If the target behaviour here is anything other than \"set\n the PC register to the value passed in\" then the target must\n also implement the synchronize_from_tb hook.\n @get_pc: Callback for getting the Program Counter register.\n As above, with the semantics of the target architecture.\n @gdb_read_register: Callback for letting GDB read a register.\n @gdb_write_register: Callback for letting GDB write a register.\n @gdb_adjust_breakpoint: Callback for adjusting the address of a\n breakpoint. Used by AVR to handle a gdb mis-feature with\n its Harvard architecture split code and data.\n @gdb_num_core_regs: Number of core registers accessible to GDB.\n @gdb_core_xml_file: File name for core registers GDB XML description.\n @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop\n before the insn which triggers a watchpoint rather than after it.\n @gdb_arch_name: Optional callback that returns the architecture name known\n to GDB. The caller must free the returned string with g_free.\n @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the\n gdb stub. Returns a pointer to the XML contents for the specified XML file\n or NULL if the CPU doesn't have a dynamically generated content for it.\n @disas_set_info: Setup architecture specific components of disassembly info\n @adjust_watchpoint_address: Perform a target-specific adjustment to an\n address before attempting to match it against watchpoints.\n @deprecation_note: If this CPUClass is deprecated, this field provides\n related information.\n\n Represents a CPU family or model."] +#[doc = " CPUClass:\n @class_by_name: Callback to map -cpu command line model name to an\n instantiatable CPU type.\n @parse_features: Callback to parse command line arguments.\n @reset_dump_flags: #CPUDumpFlags to use for reset logging.\n @has_work: Callback for checking if there is work to do.\n @memory_rw_debug: Callback for GDB memory access.\n @dump_state: Callback for dumping state.\n @query_cpu_fast:\n Fill in target specific information for the \"query-cpus-fast\"\n QAPI call.\n @get_arch_id: Callback for getting architecture-dependent CPU ID.\n @set_pc: Callback for setting the Program Counter register. This\n should have the semantics used by the target architecture when\n setting the PC from a source such as an ELF file entry point;\n for example on Arm it will also set the Thumb mode bit based\n on the least significant bit of the new PC value.\n If the target behaviour here is anything other than \"set\n the PC register to the value passed in\" then the target must\n also implement the synchronize_from_tb hook.\n @get_pc: Callback for getting the Program Counter register.\n As above, with the semantics of the target architecture.\n @gdb_read_register: Callback for letting GDB read a register.\n @gdb_write_register: Callback for letting GDB write a register.\n @gdb_adjust_breakpoint: Callback for adjusting the address of a\n breakpoint. Used by AVR to handle a gdb mis-feature with\n its Harvard architecture split code and data.\n @gdb_num_core_regs: Number of core registers accessible to GDB.\n @gdb_core_xml_file: File name for core registers GDB XML description.\n @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop\n before the insn which triggers a watchpoint rather than after it.\n @gdb_arch_name: Optional callback that returns the architecture name known\n to GDB. The caller must free the returned string with g_free.\n @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the\n gdb stub. Returns a pointer to the XML contents for the specified XML file\n or NULL if the CPU doesn't have a dynamically generated content for it.\n @disas_set_info: Setup architecture specific components of disassembly info\n @adjust_watchpoint_address: Perform a target-specific adjustment to an\n address before attempting to match it against watchpoints.\n @deprecation_note: If this CPUClass is deprecated, this field provides\n related information.\n\n Represents a CPU family or model."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CPUClass { @@ -5347,6 +4405,8 @@ pub struct CPUClass { pub dump_state: ::std::option::Option< unsafe extern "C" fn(cpu: *mut CPUState, arg1: *mut FILE, flags: ::std::os::raw::c_int), >, + pub query_cpu_fast: + ::std::option::Option, pub get_arch_id: ::std::option::Option i64>, pub set_pc: ::std::option::Option, pub get_pc: ::std::option::Option vaddr>, @@ -5395,7 +4455,7 @@ fn bindgen_test_layout_CPUClass() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 352usize, + 360usize, concat!("Size of: ", stringify!(CPUClass)) ); assert_eq!( @@ -5464,8 +4524,18 @@ fn bindgen_test_layout_CPUClass() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).get_arch_id) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).query_cpu_fast) as usize - ptr as usize }, 216usize, + concat!( + "Offset of field: ", + stringify!(CPUClass), + "::", + stringify!(query_cpu_fast) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).get_arch_id) as usize - ptr as usize }, + 224usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5475,7 +4545,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).set_pc) as usize - ptr as usize }, - 224usize, + 232usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5485,7 +4555,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).get_pc) as usize - ptr as usize }, - 232usize, + 240usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5495,7 +4565,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_read_register) as usize - ptr as usize }, - 240usize, + 248usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5505,7 +4575,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_write_register) as usize - ptr as usize }, - 248usize, + 256usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5515,7 +4585,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_adjust_breakpoint) as usize - ptr as usize }, - 256usize, + 264usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5525,7 +4595,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_core_xml_file) as usize - ptr as usize }, - 264usize, + 272usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5535,7 +4605,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_arch_name) as usize - ptr as usize }, - 272usize, + 280usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5545,7 +4615,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_get_dynamic_xml) as usize - ptr as usize }, - 280usize, + 288usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5555,7 +4625,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).disas_set_info) as usize - ptr as usize }, - 288usize, + 296usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5565,7 +4635,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).deprecation_note) as usize - ptr as usize }, - 296usize, + 304usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5575,7 +4645,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).accel_cpu) as usize - ptr as usize }, - 304usize, + 312usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5585,7 +4655,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).sysemu_ops) as usize - ptr as usize }, - 312usize, + 320usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5595,7 +4665,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tcg_ops) as usize - ptr as usize }, - 320usize, + 328usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5605,7 +4675,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).init_accel_cpu) as usize - ptr as usize }, - 328usize, + 336usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5615,7 +4685,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).reset_dump_flags) as usize - ptr as usize }, - 336usize, + 344usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5625,7 +4695,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_num_core_regs) as usize - ptr as usize }, - 340usize, + 348usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -5635,7 +4705,7 @@ fn bindgen_test_layout_CPUClass() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_stop_before_watchpoint) as usize - ptr as usize }, - 344usize, + 352usize, concat!( "Offset of field: ", stringify!(CPUClass), @@ -6110,7 +5180,7 @@ pub struct hvf_vcpu_state { pub struct qemu_work_item { _unused: [u8; 0], } -#[doc = " CPUState:\n @cpu_index: CPU index (informative).\n @cluster_index: Identifies which cluster this CPU is in.\n For boards which don't define clusters or for \"loose\" CPUs not assigned\n to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will\n be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER\n QOM parent.\n @tcg_cflags: Pre-computed cflags for this cpu.\n @nr_cores: Number of cores within this CPU package.\n @nr_threads: Number of threads within this CPU.\n @running: #true if CPU is currently running (lockless).\n @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;\n valid under cpu_list_lock.\n @created: Indicates whether the CPU thread has been successfully created.\n @interrupt_request: Indicates a pending interrupt request.\n @halted: Nonzero if the CPU is in suspended state.\n @stop: Indicates a pending stop request.\n @stopped: Indicates the CPU has been artificially stopped.\n @unplug: Indicates a pending CPU unplug request.\n @crash_occurred: Indicates the OS reported a crash (panic) for this CPU\n @singlestep_enabled: Flags for single-stepping.\n @icount_extra: Instructions until next timer event.\n @can_do_io: Nonzero if memory-mapped IO is safe. Deterministic execution\n requires that IO only be performed on the last instruction of a TB\n so that interrupts take effect immediately.\n @cpu_ases: Pointer to array of CPUAddressSpaces (which define the\n AddressSpaces this CPU has)\n @num_ases: number of CPUAddressSpaces in @cpu_ases\n @as: Pointer to the first AddressSpace, for the convenience of targets which\n only have a single AddressSpace\n @env_ptr: Pointer to subclass-specific CPUArchState field.\n @icount_decr_ptr: Pointer to IcountDecr field within subclass.\n @gdb_regs: Additional GDB registers.\n @gdb_num_regs: Number of total registers accessible to GDB.\n @gdb_num_g_regs: Number of registers in GDB 'g' packets.\n @next_cpu: Next CPU sharing TB cache.\n @opaque: User data.\n @mem_io_pc: Host Program Counter at which the memory was accessed.\n @kvm_fd: vCPU file descriptor for KVM.\n @work_mutex: Lock to prevent multiple access to @work_list.\n @work_list: List of pending asynchronous work.\n @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes\n to @trace_dstate).\n @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).\n @plugin_mask: Plugin event bitmap. Modified only via async work.\n @ignore_memory_transaction_failures: Cached copy of the MachineState\n flag of the same name: allows the board to suppress calling of the\n CPU do_transaction_failed hook function.\n @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dirty\n ring is enabled.\n @kvm_fetch_index: Keeps the index that we last fetched from the per-vCPU\n dirty ring structure.\n\n State of one CPU core or thread."] +#[doc = " CPUState:\n @cpu_index: CPU index (informative).\n @cluster_index: Identifies which cluster this CPU is in.\n For boards which don't define clusters or for \"loose\" CPUs not assigned\n to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will\n be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER\n QOM parent.\n Under TCG this value is propagated to @tcg_cflags.\n See TranslationBlock::TCG CF_CLUSTER_MASK.\n @tcg_cflags: Pre-computed cflags for this cpu.\n @nr_cores: Number of cores within this CPU package.\n @nr_threads: Number of threads within this CPU.\n @running: #true if CPU is currently running (lockless).\n @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;\n valid under cpu_list_lock.\n @created: Indicates whether the CPU thread has been successfully created.\n @interrupt_request: Indicates a pending interrupt request.\n @halted: Nonzero if the CPU is in suspended state.\n @stop: Indicates a pending stop request.\n @stopped: Indicates the CPU has been artificially stopped.\n @unplug: Indicates a pending CPU unplug request.\n @crash_occurred: Indicates the OS reported a crash (panic) for this CPU\n @singlestep_enabled: Flags for single-stepping.\n @icount_extra: Instructions until next timer event.\n @can_do_io: Nonzero if memory-mapped IO is safe. Deterministic execution\n requires that IO only be performed on the last instruction of a TB\n so that interrupts take effect immediately.\n @cpu_ases: Pointer to array of CPUAddressSpaces (which define the\n AddressSpaces this CPU has)\n @num_ases: number of CPUAddressSpaces in @cpu_ases\n @as: Pointer to the first AddressSpace, for the convenience of targets which\n only have a single AddressSpace\n @env_ptr: Pointer to subclass-specific CPUArchState field.\n @icount_decr_ptr: Pointer to IcountDecr field within subclass.\n @gdb_regs: Additional GDB registers.\n @gdb_num_regs: Number of total registers accessible to GDB.\n @gdb_num_g_regs: Number of registers in GDB 'g' packets.\n @next_cpu: Next CPU sharing TB cache.\n @opaque: User data.\n @mem_io_pc: Host Program Counter at which the memory was accessed.\n @kvm_fd: vCPU file descriptor for KVM.\n @work_mutex: Lock to prevent multiple access to @work_list.\n @work_list: List of pending asynchronous work.\n @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes\n to @trace_dstate).\n @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).\n @plugin_mask: Plugin event bitmap. Modified only via async work.\n @ignore_memory_transaction_failures: Cached copy of the MachineState\n flag of the same name: allows the board to suppress calling of the\n CPU do_transaction_failed hook function.\n @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dirty\n ring is enabled.\n @kvm_fetch_index: Keeps the index that we last fetched from the per-vCPU\n dirty ring structure.\n\n State of one CPU core or thread."] #[repr(C)] #[derive(Copy, Clone)] pub struct CPUState { @@ -6131,7 +5201,7 @@ pub struct CPUState { pub unplug: bool, pub crash_occurred: bool, pub exit_request: bool, - pub in_exclusive_context: bool, + pub exclusive_context_count: ::std::os::raw::c_int, pub cflags_next_tb: u32, pub interrupt_request: u32, pub singlestep_enabled: ::std::os::raw::c_int, @@ -6163,8 +5233,7 @@ pub struct CPUState { pub kvm_dirty_gfns: *mut kvm_dirty_gfn, pub kvm_fetch_index: u32, pub dirty_pages: u64, - pub trace_dstate_delayed: [::std::os::raw::c_ulong; 1usize], - pub trace_dstate: [::std::os::raw::c_ulong; 1usize], + pub in_ioctl_lock: QemuLockCnt, pub plugin_mask: [::std::os::raw::c_ulong; 1usize], pub plugin_mem_cbs: *mut GArray, pub saved_iotlb: SavedIOTLB, @@ -6428,7 +5497,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cc) as usize - ptr as usize }, - 152usize, + 160usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6438,7 +5507,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nr_cores) as usize - ptr as usize }, - 160usize, + 168usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6448,7 +5517,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nr_threads) as usize - ptr as usize }, - 164usize, + 172usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6458,7 +5527,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thread) as usize - ptr as usize }, - 168usize, + 176usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6468,7 +5537,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thread_id) as usize - ptr as usize }, - 176usize, + 184usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6478,7 +5547,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, - 180usize, + 188usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6488,7 +5557,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).has_waiter) as usize - ptr as usize }, - 181usize, + 189usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6498,7 +5567,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).halt_cond) as usize - ptr as usize }, - 184usize, + 192usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6508,7 +5577,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thread_kicked) as usize - ptr as usize }, - 192usize, + 200usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6518,7 +5587,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).created) as usize - ptr as usize }, - 193usize, + 201usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6528,7 +5597,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).stop) as usize - ptr as usize }, - 194usize, + 202usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6538,7 +5607,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).stopped) as usize - ptr as usize }, - 195usize, + 203usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6548,7 +5617,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).start_powered_off) as usize - ptr as usize }, - 196usize, + 204usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6558,7 +5627,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).unplug) as usize - ptr as usize }, - 197usize, + 205usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6568,7 +5637,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).crash_occurred) as usize - ptr as usize }, - 198usize, + 206usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6578,7 +5647,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exit_request) as usize - ptr as usize }, - 199usize, + 207usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6587,18 +5656,18 @@ fn bindgen_test_layout_CPUState() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).in_exclusive_context) as usize - ptr as usize }, - 200usize, + unsafe { ::std::ptr::addr_of!((*ptr).exclusive_context_count) as usize - ptr as usize }, + 208usize, concat!( "Offset of field: ", stringify!(CPUState), "::", - stringify!(in_exclusive_context) + stringify!(exclusive_context_count) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cflags_next_tb) as usize - ptr as usize }, - 204usize, + 212usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6608,7 +5677,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).interrupt_request) as usize - ptr as usize }, - 208usize, + 216usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6618,7 +5687,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).singlestep_enabled) as usize - ptr as usize }, - 212usize, + 220usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6628,7 +5697,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).icount_budget) as usize - ptr as usize }, - 216usize, + 224usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6638,7 +5707,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).icount_extra) as usize - ptr as usize }, - 224usize, + 232usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6648,7 +5717,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).random_seed) as usize - ptr as usize }, - 232usize, + 240usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6658,7 +5727,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).jmp_env) as usize - ptr as usize }, - 240usize, + 248usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6668,7 +5737,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).work_mutex) as usize - ptr as usize }, - 440usize, + 448usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6678,7 +5747,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).work_list) as usize - ptr as usize }, - 488usize, + 496usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6688,7 +5757,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cpu_ases) as usize - ptr as usize }, - 504usize, + 512usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6698,7 +5767,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).num_ases) as usize - ptr as usize }, - 512usize, + 520usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6708,7 +5777,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).as_) as usize - ptr as usize }, - 520usize, + 528usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6718,7 +5787,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).memory) as usize - ptr as usize }, - 528usize, + 536usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6728,7 +5797,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).env_ptr) as usize - ptr as usize }, - 536usize, + 544usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6738,7 +5807,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).icount_decr_ptr) as usize - ptr as usize }, - 544usize, + 552usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6748,7 +5817,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tb_jmp_cache) as usize - ptr as usize }, - 552usize, + 560usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6758,7 +5827,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_regs) as usize - ptr as usize }, - 560usize, + 568usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6768,7 +5837,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_num_regs) as usize - ptr as usize }, - 568usize, + 576usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6778,7 +5847,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).gdb_num_g_regs) as usize - ptr as usize }, - 572usize, + 580usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6788,7 +5857,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).node) as usize - ptr as usize }, - 576usize, + 584usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6798,7 +5867,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).breakpoints) as usize - ptr as usize }, - 592usize, + 600usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6808,7 +5877,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).watchpoints) as usize - ptr as usize }, - 608usize, + 616usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6818,7 +5887,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).watchpoint_hit) as usize - ptr as usize }, - 624usize, + 632usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6828,7 +5897,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize }, - 632usize, + 640usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6838,7 +5907,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mem_io_pc) as usize - ptr as usize }, - 640usize, + 648usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6848,7 +5917,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_fd) as usize - ptr as usize }, - 648usize, + 656usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6858,7 +5927,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_state) as usize - ptr as usize }, - 656usize, + 664usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6868,7 +5937,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_run) as usize - ptr as usize }, - 664usize, + 672usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6878,7 +5947,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_dirty_gfns) as usize - ptr as usize }, - 672usize, + 680usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6888,7 +5957,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_fetch_index) as usize - ptr as usize }, - 680usize, + 688usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6898,7 +5967,7 @@ fn bindgen_test_layout_CPUState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).dirty_pages) as usize - ptr as usize }, - 688usize, + 696usize, concat!( "Offset of field: ", stringify!(CPUState), @@ -6907,23 +5976,13 @@ fn bindgen_test_layout_CPUState() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).trace_dstate_delayed) as usize - ptr as usize }, - 696usize, - concat!( - "Offset of field: ", - stringify!(CPUState), - "::", - stringify!(trace_dstate_delayed) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).trace_dstate) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).in_ioctl_lock) as usize - ptr as usize }, 704usize, concat!( "Offset of field: ", stringify!(CPUState), "::", - stringify!(trace_dstate) + stringify!(in_ioctl_lock) ) ); assert_eq!( @@ -7110,15 +6169,13 @@ impl Default for CPUState { } impl ::std::fmt::Debug for CPUState { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - write ! (f , "CPUState {{ parent_obj: {:?}, cc: {:?}, nr_cores: {:?}, nr_threads: {:?}, thread: {:?}, thread_id: {:?}, running: {:?}, has_waiter: {:?}, halt_cond: {:?}, thread_kicked: {:?}, created: {:?}, stop: {:?}, stopped: {:?}, start_powered_off: {:?}, unplug: {:?}, crash_occurred: {:?}, exit_request: {:?}, in_exclusive_context: {:?}, singlestep_enabled: {:?}, jmp_env: {:?}, work_mutex: {:?}, work_list: {:?}, cpu_ases: {:?}, num_ases: {:?}, as: {:?}, memory: {:?}, env_ptr: {:?}, icount_decr_ptr: {:?}, tb_jmp_cache: {:?}, gdb_regs: {:?}, gdb_num_regs: {:?}, gdb_num_g_regs: {:?}, node: {:?}, breakpoints: {:?}, watchpoints: {:?}, watchpoint_hit: {:?}, opaque: {:?}, kvm_fd: {:?}, kvm_state: {:?}, kvm_run: {:?}, kvm_dirty_gfns: {:?}, trace_dstate_delayed: {:?}, trace_dstate: {:?}, plugin_mask: {:?}, plugin_mem_cbs: {:?}, saved_iotlb: {:?}, cpu_index: {:?}, cluster_index: {:?}, vcpu_dirty: {:?}, throttle_thread_scheduled: {:?}, ignore_memory_transaction_failures: {:?}, prctl_unalign_sigbus: {:?}, hax_vcpu: {:?}, hvf: {:?}, iommu_notifiers: {:?} }}" , self . parent_obj , self . cc , self . nr_cores , self . nr_threads , self . thread , self . thread_id , self . running , self . has_waiter , self . halt_cond , self . thread_kicked , self . created , self . stop , self . stopped , self . start_powered_off , self . unplug , self . crash_occurred , self . exit_request , self . in_exclusive_context , self . singlestep_enabled , self . jmp_env , self . work_mutex , self . work_list , self . cpu_ases , self . num_ases , self . as_ , self . memory , self . env_ptr , self . icount_decr_ptr , self . tb_jmp_cache , self . gdb_regs , self . gdb_num_regs , self . gdb_num_g_regs , self . node , self . breakpoints , self . watchpoints , self . watchpoint_hit , self . opaque , self . kvm_fd , self . kvm_state , self . kvm_run , self . kvm_dirty_gfns , self . trace_dstate_delayed , self . trace_dstate , self . plugin_mask , self . plugin_mem_cbs , self . saved_iotlb , self . cpu_index , self . cluster_index , self . vcpu_dirty , self . throttle_thread_scheduled , self . ignore_memory_transaction_failures , self . prctl_unalign_sigbus , self . hax_vcpu , self . hvf , self . iommu_notifiers) + write ! (f , "CPUState {{ parent_obj: {:?}, cc: {:?}, nr_cores: {:?}, nr_threads: {:?}, thread: {:?}, thread_id: {:?}, running: {:?}, has_waiter: {:?}, halt_cond: {:?}, thread_kicked: {:?}, created: {:?}, stop: {:?}, stopped: {:?}, start_powered_off: {:?}, unplug: {:?}, crash_occurred: {:?}, exit_request: {:?}, exclusive_context_count: {:?}, singlestep_enabled: {:?}, jmp_env: {:?}, work_mutex: {:?}, work_list: {:?}, cpu_ases: {:?}, num_ases: {:?}, as: {:?}, memory: {:?}, env_ptr: {:?}, icount_decr_ptr: {:?}, tb_jmp_cache: {:?}, gdb_regs: {:?}, gdb_num_regs: {:?}, gdb_num_g_regs: {:?}, node: {:?}, breakpoints: {:?}, watchpoints: {:?}, watchpoint_hit: {:?}, opaque: {:?}, kvm_fd: {:?}, kvm_state: {:?}, kvm_run: {:?}, kvm_dirty_gfns: {:?}, in_ioctl_lock: {:?}, plugin_mask: {:?}, plugin_mem_cbs: {:?}, saved_iotlb: {:?}, cpu_index: {:?}, cluster_index: {:?}, vcpu_dirty: {:?}, throttle_thread_scheduled: {:?}, ignore_memory_transaction_failures: {:?}, prctl_unalign_sigbus: {:?}, hax_vcpu: {:?}, hvf: {:?}, iommu_notifiers: {:?} }}" , self . parent_obj , self . cc , self . nr_cores , self . nr_threads , self . thread , self . thread_id , self . running , self . has_waiter , self . halt_cond , self . thread_kicked , self . created , self . stop , self . stopped , self . start_powered_off , self . unplug , self . crash_occurred , self . exit_request , self . exclusive_context_count , self . singlestep_enabled , self . jmp_env , self . work_mutex , self . work_list , self . cpu_ases , self . num_ases , self . as_ , self . memory , self . env_ptr , self . icount_decr_ptr , self . tb_jmp_cache , self . gdb_regs , self . gdb_num_regs , self . gdb_num_g_regs , self . node , self . breakpoints , self . watchpoints , self . watchpoint_hit , self . opaque , self . kvm_fd , self . kvm_state , self . kvm_run , self . kvm_dirty_gfns , self . in_ioctl_lock , self . plugin_mask , self . plugin_mem_cbs , self . saved_iotlb , self . cpu_index , self . cluster_index , self . vcpu_dirty , self . throttle_thread_scheduled , self . ignore_memory_transaction_failures , self . prctl_unalign_sigbus , self . hax_vcpu , self . hvf , self . iommu_notifiers) } } extern "C" { #[doc = " cpu_reset:\n @cpu: The CPU whose state is to be reset."] pub fn cpu_reset(cpu: *mut CPUState); } -#[doc = " X86CPU:\n @env: #CPUX86State\n @migratable: If set, only migratable flags will be accepted when \"enforce\"\n mode is used, and only migratable flags will be included in the \"host\"\n CPU model.\n\n An x86 CPU."] -pub type X86CPU = ArchCPU; pub type target_long = i64; pub type target_ulong = u64; #[repr(C)] @@ -7197,6 +6254,371 @@ impl ::std::fmt::Debug for CPUNegativeOffsetState { ) } } +#[doc = " Property:\n @set_default: true if the default value should be set from @defval,\n in which case @info->set_default_value must not be NULL\n (if false then no default value is set by the property system\n and the field retains whatever value it was given by instance_init).\n @defval: default value for the property. This is used only if @set_default\n is true."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Property { + pub name: *const ::std::os::raw::c_char, + pub info: *const PropertyInfo, + pub offset: isize, + pub bitnr: u8, + pub bitmask: u64, + pub set_default: bool, + pub defval: Property__bindgen_ty_1, + pub arrayoffset: ::std::os::raw::c_int, + pub arrayinfo: *const PropertyInfo, + pub arrayfieldsize: ::std::os::raw::c_int, + pub link_type: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Property__bindgen_ty_1 { + pub i: i64, + pub u: u64, +} +#[test] +fn bindgen_test_layout_Property__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(Property__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(Property__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(Property__bindgen_ty_1), + "::", + stringify!(i) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(Property__bindgen_ty_1), + "::", + stringify!(u) + ) + ); +} +impl Default for Property__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl ::std::fmt::Debug for Property__bindgen_ty_1 { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + write!(f, "Property__bindgen_ty_1 {{ union }}") + } +} +#[test] +fn bindgen_test_layout_Property() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!("Size of: ", stringify!(Property)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(Property)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).info) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(info) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bitnr) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(bitnr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bitmask) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(bitmask) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_default) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(set_default) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).defval) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(defval) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).arrayoffset) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(arrayoffset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).arrayinfo) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(arrayinfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).arrayfieldsize) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(arrayfieldsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).link_type) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(Property), + "::", + stringify!(link_type) + ) + ); +} +impl Default for Property { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl ::std::fmt::Debug for Property { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + write ! (f , "Property {{ name: {:?}, info: {:?}, set_default: {:?}, defval: {:?}, arrayoffset: {:?}, arrayinfo: {:?}, arrayfieldsize: {:?}, link_type: {:?} }}" , self . name , self . info , self . set_default , self . defval , self . arrayoffset , self . arrayinfo , self . arrayfieldsize , self . link_type) + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct PropertyInfo { + pub name: *const ::std::os::raw::c_char, + pub description: *const ::std::os::raw::c_char, + pub enum_table: *const QEnumLookup, + pub realized_set_allowed: bool, + pub print: ::std::option::Option< + unsafe extern "C" fn( + obj: *mut Object, + prop: *mut Property, + dest: *mut ::std::os::raw::c_char, + len: usize, + ) -> ::std::os::raw::c_int, + >, + pub set_default_value: + ::std::option::Option, + pub create: ::std::option::Option< + unsafe extern "C" fn( + oc: *mut ObjectClass, + name: *const ::std::os::raw::c_char, + prop: *mut Property, + ) -> *mut ObjectProperty, + >, + pub get: ObjectPropertyAccessor, + pub set: ObjectPropertyAccessor, + pub release: ObjectPropertyRelease, +} +#[test] +fn bindgen_test_layout_PropertyInfo() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(PropertyInfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(PropertyInfo)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).description) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(description) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).enum_table) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(enum_table) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).realized_set_allowed) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(realized_set_allowed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).print) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(print) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set_default_value) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(set_default_value) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).create) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(create) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).get) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(get) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).set) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(set) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).release) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(PropertyInfo), + "::", + stringify!(release) + ) + ); +} +impl Default for PropertyInfo { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[doc = " X86CPU:\n @env: #CPUX86State\n @migratable: If set, only migratable flags will be accepted when \"enforce\"\n mode is used, and only migratable flags will be included in the \"host\"\n CPU model.\n\n An x86 CPU."] +pub type X86CPU = ArchCPU; pub const OnOffAuto_ON_OFF_AUTO_AUTO: OnOffAuto = OnOffAuto(0); pub const OnOffAuto_ON_OFF_AUTO_ON: OnOffAuto = OnOffAuto(1); pub const OnOffAuto_ON_OFF_AUTO_OFF: OnOffAuto = OnOffAuto(2); @@ -7502,7 +6924,7 @@ impl Default for float_status { } } } -pub type FeatureWordArray = [u64; 36usize]; +pub type FeatureWordArray = [u64; 38usize]; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct SegmentCache { @@ -8726,7 +8148,7 @@ fn bindgen_test_layout_CPUArchState() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 14848usize, + 14880usize, concat!("Size of: ", stringify!(CPUArchState)) ); assert_eq!( @@ -10290,7 +9712,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).user_features) as usize - ptr as usize }, - 13728usize, + 13744usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10300,7 +9722,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cpuid_model) as usize - ptr as usize }, - 14016usize, + 14048usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10310,7 +9732,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cache_info_cpuid2) as usize - ptr as usize }, - 14064usize, + 14096usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10320,7 +9742,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cache_info_cpuid4) as usize - ptr as usize }, - 14096usize, + 14128usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10330,7 +9752,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cache_info_amd) as usize - ptr as usize }, - 14128usize, + 14160usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10340,7 +9762,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mtrr_fixed) as usize - ptr as usize }, - 14160usize, + 14192usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10350,7 +9772,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mtrr_deftype) as usize - ptr as usize }, - 14248usize, + 14280usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10360,7 +9782,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mtrr_var) as usize - ptr as usize }, - 14256usize, + 14288usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10370,7 +9792,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mp_state) as usize - ptr as usize }, - 14384usize, + 14416usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10380,7 +9802,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exception_nr) as usize - ptr as usize }, - 14388usize, + 14420usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10390,7 +9812,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).interrupt_injected) as usize - ptr as usize }, - 14392usize, + 14424usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10400,7 +9822,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).soft_interrupt) as usize - ptr as usize }, - 14396usize, + 14428usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10410,7 +9832,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exception_pending) as usize - ptr as usize }, - 14397usize, + 14429usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10420,7 +9842,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exception_injected) as usize - ptr as usize }, - 14398usize, + 14430usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10430,7 +9852,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).has_error_code) as usize - ptr as usize }, - 14399usize, + 14431usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10440,7 +9862,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exception_has_payload) as usize - ptr as usize }, - 14400usize, + 14432usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10450,7 +9872,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).exception_payload) as usize - ptr as usize }, - 14408usize, + 14440usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10460,7 +9882,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).triple_fault_pending) as usize - ptr as usize }, - 14416usize, + 14448usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10470,7 +9892,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ins_len) as usize - ptr as usize }, - 14420usize, + 14452usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10480,7 +9902,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).sipi_vector) as usize - ptr as usize }, - 14424usize, + 14456usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10490,7 +9912,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tsc_valid) as usize - ptr as usize }, - 14428usize, + 14460usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10500,7 +9922,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tsc_khz) as usize - ptr as usize }, - 14432usize, + 14464usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10510,7 +9932,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).user_tsc_khz) as usize - ptr as usize }, - 14440usize, + 14472usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10520,7 +9942,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).apic_bus_freq) as usize - ptr as usize }, - 14448usize, + 14480usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10530,7 +9952,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tsc) as usize - ptr as usize }, - 14456usize, + 14488usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10540,7 +9962,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mcg_cap) as usize - ptr as usize }, - 14464usize, + 14496usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10550,7 +9972,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mcg_ctl) as usize - ptr as usize }, - 14472usize, + 14504usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10560,7 +9982,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mcg_ext_ctl) as usize - ptr as usize }, - 14480usize, + 14512usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10570,7 +9992,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mce_banks) as usize - ptr as usize }, - 14488usize, + 14520usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10580,7 +10002,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).xstate_bv) as usize - ptr as usize }, - 14808usize, + 14840usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10590,7 +10012,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fpus_vmstate) as usize - ptr as usize }, - 14816usize, + 14848usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10600,7 +10022,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fptag_vmstate) as usize - ptr as usize }, - 14818usize, + 14850usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10610,7 +10032,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fpregs_format_vmstate) as usize - ptr as usize }, - 14820usize, + 14852usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10620,7 +10042,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).xss) as usize - ptr as usize }, - 14824usize, + 14856usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10630,7 +10052,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).umwait) as usize - ptr as usize }, - 14832usize, + 14864usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10640,7 +10062,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).tpr_access_type) as usize - ptr as usize }, - 14836usize, + 14868usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10650,7 +10072,7 @@ fn bindgen_test_layout_CPUArchState() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).nr_dies) as usize - ptr as usize }, - 14840usize, + 14872usize, concat!( "Offset of field: ", stringify!(CPUArchState), @@ -10746,6 +10168,7 @@ pub struct ArchCPU { pub core_id: i32, pub thread_id: i32, pub hv_max_vps: i32, + pub xen_vapic: bool, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -10817,7 +10240,7 @@ fn bindgen_test_layout_ArchCPU() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 16240usize, + 16304usize, concat!("Size of: ", stringify!(ArchCPU)) ); assert_eq!( @@ -10857,7 +10280,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vmsentry) as usize - ptr as usize }, - 15680usize, + 15712usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10867,7 +10290,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ucode_rev) as usize - ptr as usize }, - 15688usize, + 15720usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10877,7 +10300,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_spinlock_attempts) as usize - ptr as usize }, - 15696usize, + 15728usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10887,7 +10310,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_vendor) as usize - ptr as usize }, - 15704usize, + 15736usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10897,7 +10320,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_synic_kvm_only) as usize - ptr as usize }, - 15712usize, + 15744usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10907,7 +10330,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_features) as usize - ptr as usize }, - 15720usize, + 15752usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10917,7 +10340,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_passthrough) as usize - ptr as usize }, - 15728usize, + 15760usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10927,7 +10350,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_no_nonarch_cs) as usize - ptr as usize }, - 15732usize, + 15764usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10937,7 +10360,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_vendor_id) as usize - ptr as usize }, - 15736usize, + 15768usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10947,7 +10370,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_interface_id) as usize - ptr as usize }, - 15748usize, + 15780usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10957,7 +10380,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_limits) as usize - ptr as usize }, - 15764usize, + 15796usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10967,7 +10390,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_enforce_cpuid) as usize - ptr as usize }, - 15776usize, + 15808usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10977,7 +10400,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_build) as usize - ptr as usize }, - 15780usize, + 15812usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10987,7 +10410,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_major) as usize - ptr as usize }, - 15784usize, + 15816usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -10997,7 +10420,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_minor) as usize - ptr as usize }, - 15786usize, + 15818usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11007,7 +10430,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_sp) as usize - ptr as usize }, - 15788usize, + 15820usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11017,7 +10440,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_sb) as usize - ptr as usize }, - 15792usize, + 15824usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11027,7 +10450,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hyperv_ver_id_sn) as usize - ptr as usize }, - 15796usize, + 15828usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11037,7 +10460,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).check_cpuid) as usize - ptr as usize }, - 15800usize, + 15832usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11047,7 +10470,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).enforce_cpuid) as usize - ptr as usize }, - 15801usize, + 15833usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11057,7 +10480,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).force_features) as usize - ptr as usize }, - 15802usize, + 15834usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11067,7 +10490,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).expose_kvm) as usize - ptr as usize }, - 15803usize, + 15835usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11077,7 +10500,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).expose_tcg) as usize - ptr as usize }, - 15804usize, + 15836usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11087,7 +10510,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).migratable) as usize - ptr as usize }, - 15805usize, + 15837usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11097,7 +10520,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).migrate_smi_count) as usize - ptr as usize }, - 15806usize, + 15838usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11107,7 +10530,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).max_features) as usize - ptr as usize }, - 15807usize, + 15839usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11117,7 +10540,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).apic_id) as usize - ptr as usize }, - 15808usize, + 15840usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11127,7 +10550,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vmware_cpuid_freq) as usize - ptr as usize }, - 15812usize, + 15844usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11137,7 +10560,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cache_info_passthrough) as usize - ptr as usize }, - 15813usize, + 15845usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11147,7 +10570,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).mwait) as usize - ptr as usize }, - 15816usize, + 15848usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11157,7 +10580,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).filtered_features) as usize - ptr as usize }, - 15832usize, + 15864usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11167,7 +10590,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).enable_pmu) as usize - ptr as usize }, - 16120usize, + 16168usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11177,7 +10600,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).lbr_fmt) as usize - ptr as usize }, - 16128usize, + 16176usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11187,7 +10610,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).enable_lmce) as usize - ptr as usize }, - 16136usize, + 16184usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11197,7 +10620,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).enable_l3_cache) as usize - ptr as usize }, - 16137usize, + 16185usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11207,7 +10630,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).legacy_cache) as usize - ptr as usize }, - 16138usize, + 16186usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11217,7 +10640,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).enable_cpuid_0xb) as usize - ptr as usize }, - 16139usize, + 16187usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11227,7 +10650,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).full_cpuid_auto_level) as usize - ptr as usize }, - 16140usize, + 16188usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11237,7 +10660,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).vendor_cpuid_only) as usize - ptr as usize }, - 16141usize, + 16189usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11247,7 +10670,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).intel_pt_auto_level) as usize - ptr as usize }, - 16142usize, + 16190usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11257,7 +10680,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).fill_mtrr_mask) as usize - ptr as usize }, - 16143usize, + 16191usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11267,7 +10690,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).host_phys_bits) as usize - ptr as usize }, - 16144usize, + 16192usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11277,7 +10700,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).host_phys_bits_limit) as usize - ptr as usize }, - 16145usize, + 16193usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11287,7 +10710,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_no_smi_migration) as usize - ptr as usize }, - 16146usize, + 16194usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11297,7 +10720,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_pv_enforce_cpuid) as usize - ptr as usize }, - 16147usize, + 16195usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11307,7 +10730,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).phys_bits) as usize - ptr as usize }, - 16148usize, + 16196usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11317,7 +10740,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).apic_state) as usize - ptr as usize }, - 16152usize, + 16200usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11327,7 +10750,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cpu_as_root) as usize - ptr as usize }, - 16160usize, + 16208usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11337,7 +10760,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).cpu_as_mem) as usize - ptr as usize }, - 16168usize, + 16216usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11347,7 +10770,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).smram) as usize - ptr as usize }, - 16176usize, + 16224usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11357,7 +10780,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).machine_done) as usize - ptr as usize }, - 16184usize, + 16232usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11367,7 +10790,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).kvm_msr_buf) as usize - ptr as usize }, - 16208usize, + 16256usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11377,7 +10800,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).node_id) as usize - ptr as usize }, - 16216usize, + 16264usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11387,7 +10810,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).socket_id) as usize - ptr as usize }, - 16220usize, + 16268usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11397,7 +10820,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).die_id) as usize - ptr as usize }, - 16224usize, + 16272usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11407,7 +10830,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).core_id) as usize - ptr as usize }, - 16228usize, + 16276usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11417,7 +10840,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).thread_id) as usize - ptr as usize }, - 16232usize, + 16280usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11427,7 +10850,7 @@ fn bindgen_test_layout_ArchCPU() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).hv_max_vps) as usize - ptr as usize }, - 16236usize, + 16284usize, concat!( "Offset of field: ", stringify!(ArchCPU), @@ -11435,6 +10858,16 @@ fn bindgen_test_layout_ArchCPU() { stringify!(hv_max_vps) ) ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).xen_vapic) as usize - ptr as usize }, + 16288usize, + concat!( + "Offset of field: ", + stringify!(ArchCPU), + "::", + stringify!(xen_vapic) + ) + ); } impl Default for ArchCPU { fn default() -> Self { @@ -11447,11 +10880,103 @@ impl Default for ArchCPU { } impl ::std::fmt::Debug for ArchCPU { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - write ! (f , "ArchCPU {{ parent_obj: {:?}, neg: {:?}, env: {:?}, vmsentry: {:?}, hyperv_vendor: {:?}, hyperv_synic_kvm_only: {:?}, hyperv_passthrough: {:?}, hyperv_no_nonarch_cs: {:?}, hyperv_vendor_id: {:?}, hyperv_interface_id: {:?}, hyperv_limits: {:?}, hyperv_enforce_cpuid: {:?}, check_cpuid: {:?}, enforce_cpuid: {:?}, force_features: {:?}, expose_kvm: {:?}, expose_tcg: {:?}, migratable: {:?}, migrate_smi_count: {:?}, max_features: {:?}, vmware_cpuid_freq: {:?}, cache_info_passthrough: {:?}, mwait: {:?}, filtered_features: {:?}, enable_pmu: {:?}, enable_lmce: {:?}, enable_l3_cache: {:?}, legacy_cache: {:?}, enable_cpuid_0xb: {:?}, full_cpuid_auto_level: {:?}, vendor_cpuid_only: {:?}, intel_pt_auto_level: {:?}, fill_mtrr_mask: {:?}, host_phys_bits: {:?}, kvm_no_smi_migration: {:?}, kvm_pv_enforce_cpuid: {:?}, apic_state: {:?}, cpu_as_root: {:?}, cpu_as_mem: {:?}, smram: {:?}, machine_done: {:?}, kvm_msr_buf: {:?} }}" , self . parent_obj , self . neg , self . env , self . vmsentry , self . hyperv_vendor , self . hyperv_synic_kvm_only , self . hyperv_passthrough , self . hyperv_no_nonarch_cs , self . hyperv_vendor_id , self . hyperv_interface_id , self . hyperv_limits , self . hyperv_enforce_cpuid , self . check_cpuid , self . enforce_cpuid , self . force_features , self . expose_kvm , self . expose_tcg , self . migratable , self . migrate_smi_count , self . max_features , self . vmware_cpuid_freq , self . cache_info_passthrough , self . mwait , self . filtered_features , self . enable_pmu , self . enable_lmce , self . enable_l3_cache , self . legacy_cache , self . enable_cpuid_0xb , self . full_cpuid_auto_level , self . vendor_cpuid_only , self . intel_pt_auto_level , self . fill_mtrr_mask , self . host_phys_bits , self . kvm_no_smi_migration , self . kvm_pv_enforce_cpuid , self . apic_state , self . cpu_as_root , self . cpu_as_mem , self . smram , self . machine_done , self . kvm_msr_buf) + write ! (f , "ArchCPU {{ parent_obj: {:?}, neg: {:?}, env: {:?}, vmsentry: {:?}, hyperv_vendor: {:?}, hyperv_synic_kvm_only: {:?}, hyperv_passthrough: {:?}, hyperv_no_nonarch_cs: {:?}, hyperv_vendor_id: {:?}, hyperv_interface_id: {:?}, hyperv_limits: {:?}, hyperv_enforce_cpuid: {:?}, check_cpuid: {:?}, enforce_cpuid: {:?}, force_features: {:?}, expose_kvm: {:?}, expose_tcg: {:?}, migratable: {:?}, migrate_smi_count: {:?}, max_features: {:?}, vmware_cpuid_freq: {:?}, cache_info_passthrough: {:?}, mwait: {:?}, filtered_features: {:?}, enable_pmu: {:?}, enable_lmce: {:?}, enable_l3_cache: {:?}, legacy_cache: {:?}, enable_cpuid_0xb: {:?}, full_cpuid_auto_level: {:?}, vendor_cpuid_only: {:?}, intel_pt_auto_level: {:?}, fill_mtrr_mask: {:?}, host_phys_bits: {:?}, kvm_no_smi_migration: {:?}, kvm_pv_enforce_cpuid: {:?}, apic_state: {:?}, cpu_as_root: {:?}, cpu_as_mem: {:?}, smram: {:?}, machine_done: {:?}, kvm_msr_buf: {:?}, xen_vapic: {:?} }}" , self . parent_obj , self . neg , self . env , self . vmsentry , self . hyperv_vendor , self . hyperv_synic_kvm_only , self . hyperv_passthrough , self . hyperv_no_nonarch_cs , self . hyperv_vendor_id , self . hyperv_interface_id , self . hyperv_limits , self . hyperv_enforce_cpuid , self . check_cpuid , self . enforce_cpuid , self . force_features , self . expose_kvm , self . expose_tcg , self . migratable , self . migrate_smi_count , self . max_features , self . vmware_cpuid_freq , self . cache_info_passthrough , self . mwait , self . filtered_features , self . enable_pmu , self . enable_lmce , self . enable_l3_cache , self . legacy_cache , self . enable_cpuid_0xb , self . full_cpuid_auto_level , self . vendor_cpuid_only , self . intel_pt_auto_level , self . fill_mtrr_mask , self . host_phys_bits , self . kvm_no_smi_migration , self . kvm_pv_enforce_cpuid , self . apic_state , self . cpu_as_root , self . cpu_as_mem , self . smram , self . machine_done , self . kvm_msr_buf , self . xen_vapic) } } pub type abi_ulong = target_ulong; pub type abi_long = target_long; +pub const MemOp_MO_8: MemOp = MemOp(0); +pub const MemOp_MO_16: MemOp = MemOp(1); +pub const MemOp_MO_32: MemOp = MemOp(2); +pub const MemOp_MO_64: MemOp = MemOp(3); +pub const MemOp_MO_128: MemOp = MemOp(4); +pub const MemOp_MO_256: MemOp = MemOp(5); +pub const MemOp_MO_512: MemOp = MemOp(6); +pub const MemOp_MO_1024: MemOp = MemOp(7); +pub const MemOp_MO_SIZE: MemOp = MemOp(7); +pub const MemOp_MO_SIGN: MemOp = MemOp(8); +pub const MemOp_MO_BSWAP: MemOp = MemOp(16); +pub const MemOp_MO_LE: MemOp = MemOp(0); +pub const MemOp_MO_BE: MemOp = MemOp(16); +pub const MemOp_MO_TE: MemOp = MemOp(0); +pub const MemOp_MO_ASHIFT: MemOp = MemOp(5); +pub const MemOp_MO_AMASK: MemOp = MemOp(224); +pub const MemOp_MO_UNALN: MemOp = MemOp(0); +pub const MemOp_MO_ALIGN_2: MemOp = MemOp(32); +pub const MemOp_MO_ALIGN_4: MemOp = MemOp(64); +pub const MemOp_MO_ALIGN_8: MemOp = MemOp(96); +pub const MemOp_MO_ALIGN_16: MemOp = MemOp(128); +pub const MemOp_MO_ALIGN_32: MemOp = MemOp(160); +pub const MemOp_MO_ALIGN_64: MemOp = MemOp(192); +pub const MemOp_MO_ALIGN: MemOp = MemOp(224); +pub const MemOp_MO_ATOM_SHIFT: MemOp = MemOp(8); +pub const MemOp_MO_ATOM_IFALIGN: MemOp = MemOp(0); +pub const MemOp_MO_ATOM_IFALIGN_PAIR: MemOp = MemOp(256); +pub const MemOp_MO_ATOM_WITHIN16: MemOp = MemOp(512); +pub const MemOp_MO_ATOM_WITHIN16_PAIR: MemOp = MemOp(768); +pub const MemOp_MO_ATOM_SUBALIGN: MemOp = MemOp(1024); +pub const MemOp_MO_ATOM_NONE: MemOp = MemOp(1280); +pub const MemOp_MO_ATOM_MASK: MemOp = MemOp(1792); +pub const MemOp_MO_UB: MemOp = MemOp(0); +pub const MemOp_MO_UW: MemOp = MemOp(1); +pub const MemOp_MO_UL: MemOp = MemOp(2); +pub const MemOp_MO_UQ: MemOp = MemOp(3); +pub const MemOp_MO_UO: MemOp = MemOp(4); +pub const MemOp_MO_SB: MemOp = MemOp(8); +pub const MemOp_MO_SW: MemOp = MemOp(9); +pub const MemOp_MO_SL: MemOp = MemOp(10); +pub const MemOp_MO_SQ: MemOp = MemOp(11); +pub const MemOp_MO_SO: MemOp = MemOp(12); +pub const MemOp_MO_LEUW: MemOp = MemOp(1); +pub const MemOp_MO_LEUL: MemOp = MemOp(2); +pub const MemOp_MO_LEUQ: MemOp = MemOp(3); +pub const MemOp_MO_LESW: MemOp = MemOp(9); +pub const MemOp_MO_LESL: MemOp = MemOp(10); +pub const MemOp_MO_LESQ: MemOp = MemOp(11); +pub const MemOp_MO_BEUW: MemOp = MemOp(17); +pub const MemOp_MO_BEUL: MemOp = MemOp(18); +pub const MemOp_MO_BEUQ: MemOp = MemOp(19); +pub const MemOp_MO_BESW: MemOp = MemOp(25); +pub const MemOp_MO_BESL: MemOp = MemOp(26); +pub const MemOp_MO_BESQ: MemOp = MemOp(27); +pub const MemOp_MO_TEUW: MemOp = MemOp(1); +pub const MemOp_MO_TEUL: MemOp = MemOp(2); +pub const MemOp_MO_TEUQ: MemOp = MemOp(3); +pub const MemOp_MO_TEUO: MemOp = MemOp(4); +pub const MemOp_MO_TESW: MemOp = MemOp(9); +pub const MemOp_MO_TESL: MemOp = MemOp(10); +pub const MemOp_MO_TESQ: MemOp = MemOp(11); +pub const MemOp_MO_SSIZE: MemOp = MemOp(15); +impl ::std::ops::BitOr for MemOp { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + MemOp(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for MemOp { + #[inline] + fn bitor_assign(&mut self, rhs: MemOp) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd for MemOp { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + MemOp(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for MemOp { + #[inline] + fn bitand_assign(&mut self, rhs: MemOp) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct MemOp(pub ::std::os::raw::c_uint); +pub type MemOpIdx = u32; extern "C" { pub fn target_mprotect( start: abi_ulong, @@ -11546,6 +11071,51 @@ impl Default for AccelCPUClass { } } } +pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_R: qemu_plugin_mem_rw = qemu_plugin_mem_rw(1); +pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_W: qemu_plugin_mem_rw = qemu_plugin_mem_rw(2); +pub const qemu_plugin_mem_rw_QEMU_PLUGIN_MEM_RW: qemu_plugin_mem_rw = qemu_plugin_mem_rw(3); +impl ::std::ops::BitOr for qemu_plugin_mem_rw { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + qemu_plugin_mem_rw(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for qemu_plugin_mem_rw { + #[inline] + fn bitor_assign(&mut self, rhs: qemu_plugin_mem_rw) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd for qemu_plugin_mem_rw { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + qemu_plugin_mem_rw(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for qemu_plugin_mem_rw { + #[inline] + fn bitand_assign(&mut self, rhs: qemu_plugin_mem_rw) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct qemu_plugin_mem_rw(pub ::std::os::raw::c_uint); +#[doc = " typedef qemu_plugin_meminfo_t - opaque memory transaction handle\n\n This can be further queried using the qemu_plugin_mem_* query\n functions."] +pub type qemu_plugin_meminfo_t = u32; +extern "C" { + #[doc = " qemu_plugin_get_hwaddr() - return handle for memory operation\n @info: opaque memory info structure\n @vaddr: the virtual address of the memory operation\n\n For system emulation returns a qemu_plugin_hwaddr handle to query\n details about the actual physical address backing the virtual\n address. For linux-user guests it just returns NULL.\n\n This handle is *only* valid for the duration of the callback. Any\n information about the handle should be recovered before the\n callback returns."] + pub fn qemu_plugin_get_hwaddr( + info: qemu_plugin_meminfo_t, + vaddr: u64, + ) -> *mut qemu_plugin_hwaddr; +} +extern "C" { + #[doc = " qemu_plugin_hwaddr_phys_addr() - query physical address for memory operation\n @haddr: address handle from qemu_plugin_get_hwaddr()\n\n Returns the physical address associated with the memory operation\n\n Note that the returned physical address may not be unique if you are dealing\n with multiple address spaces."] + pub fn qemu_plugin_hwaddr_phys_addr(haddr: *const qemu_plugin_hwaddr) -> u64; +} #[doc = " struct qemu_plugin_hwaddr - opaque hw address handle"] #[repr(C)] #[derive(Copy, Clone)] diff --git a/libafl_qemu/src/emu.rs b/libafl_qemu/src/emu.rs index 712d67458d..36996e9387 100644 --- a/libafl_qemu/src/emu.rs +++ b/libafl_qemu/src/emu.rs @@ -8,7 +8,10 @@ use core::{ ptr::{addr_of, copy_nonoverlapping, null}, }; #[cfg(emulation_mode = "systemmode")] -use std::ffi::CString; +use std::{ + ffi::{CStr, CString}, + ptr::null_mut, +}; use std::{slice::from_raw_parts, str::from_utf8_unchecked}; #[cfg(emulation_mode = "usermode")] @@ -30,6 +33,43 @@ pub type GuestHwAddrInfo = libafl_qemu_sys::qemu_plugin_hwaddr; #[cfg(emulation_mode = "systemmode")] pub type FastSnapshot = *mut libafl_qemu_sys::syx_snapshot_t; +#[cfg(emulation_mode = "systemmode")] +pub enum DeviceSnapshotFilter { + All, + AllowList(Vec), + DenyList(Vec), +} + +#[cfg(emulation_mode = "systemmode")] +impl DeviceSnapshotFilter { + fn enum_id(&self) -> libafl_qemu_sys::device_snapshot_kind_t { + match self { + DeviceSnapshotFilter::All => { + libafl_qemu_sys::device_snapshot_kind_e_DEVICE_SNAPSHOT_ALL + } + DeviceSnapshotFilter::AllowList(_) => { + libafl_qemu_sys::device_snapshot_kind_e_DEVICE_SNAPSHOT_ALLOWLIST + } + DeviceSnapshotFilter::DenyList(_) => { + libafl_qemu_sys::device_snapshot_kind_e_DEVICE_SNAPSHOT_DENYLIST + } + } + } + + fn devices(&self, v: &mut Vec<*mut i8>) -> *mut *mut i8 { + v.clear(); + match self { + DeviceSnapshotFilter::All => null_mut(), + DeviceSnapshotFilter::AllowList(l) | DeviceSnapshotFilter::DenyList(l) => { + for name in l { + v.push(name.as_bytes().as_ptr() as *mut i8); + } + v.as_mut_ptr() + } + } + } +} + #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct MemAccessInfo { @@ -1142,7 +1182,30 @@ impl Emulator { #[cfg(emulation_mode = "systemmode")] #[must_use] pub fn create_fast_snapshot(&self, track: bool) -> FastSnapshot { - unsafe { libafl_qemu_sys::syx_snapshot_create(track) } + unsafe { + libafl_qemu_sys::syx_snapshot_create( + track, + libafl_qemu_sys::device_snapshot_kind_e_DEVICE_SNAPSHOT_ALL, + null_mut(), + ) + } + } + + #[cfg(emulation_mode = "systemmode")] + #[must_use] + pub fn create_fast_snapshot_filter( + &self, + track: bool, + device_filter: &DeviceSnapshotFilter, + ) -> FastSnapshot { + let mut v = vec![]; + unsafe { + libafl_qemu_sys::syx_snapshot_create( + track, + device_filter.enum_id(), + device_filter.devices(&mut v), + ) + } } #[cfg(emulation_mode = "systemmode")] @@ -1150,6 +1213,29 @@ impl Emulator { unsafe { libafl_qemu_sys::syx_snapshot_root_restore(snapshot) } } + #[cfg(emulation_mode = "systemmode")] + pub fn list_devices(&self) -> Vec { + let mut r = vec![]; + unsafe { + let devices = libafl_qemu_sys::device_list_all(); + if devices.is_null() { + return r; + } + + let mut ptr = devices; + while !(*ptr).is_null() { + let c_str: &CStr = CStr::from_ptr(*ptr); + let name = c_str.to_str().unwrap().to_string(); + r.push(name); + + ptr = ptr.add(1); + } + + libc::free(devices as *mut c_void); + r + } + } + #[cfg(emulation_mode = "usermode")] pub fn set_pre_syscall_hook( &self,