|
@@ -2,7 +2,7 @@
|
|
|
// Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
-use std::{ffi::CStr, ptr::addr_of_mut};
|
|
|
+use std::{ffi::CStr, mem::size_of, ptr::addr_of_mut};
|
|
|
|
|
|
use qemu_api::{
|
|
|
chardev::{CharBackend, Chardev, Event},
|
|
@@ -12,6 +12,7 @@
|
|
|
prelude::*,
|
|
|
qdev::{Clock, ClockEvent, DeviceImpl, DeviceState, Property, ResetType, ResettablePhasesImpl},
|
|
|
qom::{ObjectImpl, Owned, ParentField},
|
|
|
+ static_assert,
|
|
|
sysbus::{SysBusDevice, SysBusDeviceImpl},
|
|
|
vmstate::VMStateDescription,
|
|
|
};
|
|
@@ -124,6 +125,12 @@ pub struct PL011State {
|
|
|
pub migrate_clock: bool,
|
|
|
}
|
|
|
|
|
|
+// Some C users of this device embed its state struct into their own
|
|
|
+// structs, so the size of the Rust version must not be any larger
|
|
|
+// than the size of the C one. If this assert triggers you need to
|
|
|
+// expand the padding_for_rust[] array in the C PL011State struct.
|
|
|
+static_assert!(size_of::<PL011State>() <= size_of::<qemu_api::bindings::PL011State>());
|
|
|
+
|
|
|
qom_isa!(PL011State : SysBusDevice, DeviceState, Object);
|
|
|
|
|
|
#[repr(C)]
|