From f674882ada759790c424169a9198126d90772d32 Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 05:46:36 +0000 Subject: [PATCH 1/6] Integrate arch code and optimize folders Refactor the project code structure to organize all architecture-specific code under the src/arch directory. This restructuring includes creating subdirectories such as aarch64, x86, and further dividing each architecture directory into submodules like bootloader, cpu, device, device_tree, memory, and kvm. Bootloader: Responsible for loading the kernel into the guest virtual memory according to the configuration provided by the kvm submodule. It returns the kernel start address, the initrd address, and the address information for the reserved device tree space, which are required for kernel booting. CPU: Manages the control logic for registers specific to the architecture. This covers initializing and configuring processor internal registers along with any other tasks closely related to the CPU. Memory: Implements functionality for setting up the memory address space layout and size specific to the architecture. This module is responsible for initializing memory regions, defining their scope, and ensuring that memory management adheres to architectural specifications. Device_tree: Provides a series of interfaces for manipulating the device tree. These interfaces allow dynamic querying or modification of device tree data, supporting more flexible hardware configurations. Device: Handles initialization and drivers for devices specific to the architecture. This includes constructing the device tree, configuring interrupt controllers, and setting up serial ports. Kvm: Provides architecture-specific support for kernel initialization in virtualized environments. This includes setting basic initialization parameters, such as specifying the paths for the kernel and initrd files, ensuring they are correctly loaded during bootup. --- .../aarch64/boot_loader}/mod.rs | 23 +- src/{cpu/aarch64 => arch/aarch64/cpu}/mod.rs | 5 +- src/arch/aarch64/device/fdt.rs | 126 +++++++++ src/{ => arch/aarch64}/device/gicv3.rs | 42 ++- src/arch/aarch64/device/mod.rs | 30 +++ src/arch/aarch64/device/serial.rs | 4 + .../aarch64/device_tree/mod.rs} | 0 src/arch/aarch64/kvm/mod.rs | 20 ++ src/arch/aarch64/memory/mod.rs | 27 ++ src/arch/aarch64/mod.rs | 6 + src/arch/mod.rs | 39 +++ .../x86_64/boot_loader}/bootparam.rs | 0 .../x86_64 => arch/x86_64/boot_loader}/gdt.rs | 0 .../x86_64/boot_loader}/loader.rs | 0 .../x86_64 => arch/x86_64/boot_loader}/mod.rs | 27 ++ .../x86_64/boot_loader}/mptable.rs | 0 src/{cpu/x86_64 => arch/x86_64/cpu}/mod.rs | 2 +- src/arch/x86_64/device/mod.rs | 14 + src/arch/x86_64/device/serial.rs | 3 + src/{ => arch/x86_64}/helper/cpuid.rs | 0 src/arch/x86_64/helper/mod.rs | 1 + src/arch/x86_64/kvm/mod.rs | 46 ++++ src/arch/x86_64/memory/mod.rs | 30 +++ src/arch/x86_64/mod.rs | 6 + src/boot_loader/mod.rs | 27 -- src/cpu/mod.rs | 17 +- src/device/mod.rs | 6 +- src/device/serial.rs | 18 +- src/helper/mod.rs | 4 - src/main.rs | 247 +----------------- src/memory/guest_memory.rs | 21 +- src/memory/mod.rs | 42 --- 32 files changed, 446 insertions(+), 387 deletions(-) rename src/{boot_loader/aarch64 => arch/aarch64/boot_loader}/mod.rs (85%) rename src/{cpu/aarch64 => arch/aarch64/cpu}/mod.rs (98%) create mode 100644 src/arch/aarch64/device/fdt.rs rename src/{ => arch/aarch64}/device/gicv3.rs (84%) create mode 100644 src/arch/aarch64/device/mod.rs create mode 100644 src/arch/aarch64/device/serial.rs rename src/{helper/device_tree.rs => arch/aarch64/device_tree/mod.rs} (100%) create mode 100644 src/arch/aarch64/kvm/mod.rs create mode 100644 src/arch/aarch64/memory/mod.rs create mode 100644 src/arch/aarch64/mod.rs create mode 100644 src/arch/mod.rs rename src/{boot_loader/x86_64 => arch/x86_64/boot_loader}/bootparam.rs (100%) rename src/{boot_loader/x86_64 => arch/x86_64/boot_loader}/gdt.rs (100%) rename src/{boot_loader/x86_64 => arch/x86_64/boot_loader}/loader.rs (100%) rename src/{boot_loader/x86_64 => arch/x86_64/boot_loader}/mod.rs (65%) rename src/{boot_loader/x86_64 => arch/x86_64/boot_loader}/mptable.rs (100%) rename src/{cpu/x86_64 => arch/x86_64/cpu}/mod.rs (99%) create mode 100644 src/arch/x86_64/device/mod.rs create mode 100644 src/arch/x86_64/device/serial.rs rename src/{ => arch/x86_64}/helper/cpuid.rs (100%) create mode 100644 src/arch/x86_64/helper/mod.rs create mode 100644 src/arch/x86_64/kvm/mod.rs create mode 100644 src/arch/x86_64/memory/mod.rs create mode 100644 src/arch/x86_64/mod.rs delete mode 100644 src/boot_loader/mod.rs diff --git a/src/boot_loader/aarch64/mod.rs b/src/arch/aarch64/boot_loader/mod.rs similarity index 85% rename from src/boot_loader/aarch64/mod.rs rename to src/arch/aarch64/boot_loader/mod.rs index e2b48aca3..220509eb2 100644 --- a/src/boot_loader/aarch64/mod.rs +++ b/src/arch/aarch64/boot_loader/mod.rs @@ -14,9 +14,15 @@ use std::fs::File; use std::path::PathBuf; use std::sync::Arc; -use crate::helper::device_tree; +use kvm_ioctls::VmFd; + +use crate::arch::aarch64::device_tree::*; +use crate::arch::CPUBootConfig; +use crate::cpu::CPU; use crate::memory::GuestMemory; +use super::kvm::load_boot_source; + const AARCH64_KERNEL_OFFSET: u64 = 0x8_0000; /// Boot loader config used for aarch64. @@ -73,7 +79,7 @@ pub fn load_kernel( let dtb_addr = sys_mem .memory_end_address() - .checked_sub(u64::from(device_tree::FDT_MAX_SIZE)) + .checked_sub(u64::from(FDT_MAX_SIZE)) .filter(|addr| *addr > kernel_end) .expect("no memory to load DTB"); @@ -96,3 +102,16 @@ pub fn load_kernel( dtb_start: dtb_addr, } } + +pub fn kvm_load_kernel(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc) -> AArch64BootLoader{ + + let layout = load_boot_source(guest_memory); + let cpu_boot_cfg = CPUBootConfig { + fdt_addr: layout.dtb_start, + kernel_addr: layout.kernel_start, + }; + vcpu.realize(&vm_fd, cpu_boot_cfg); + + + layout +} diff --git a/src/cpu/aarch64/mod.rs b/src/arch/aarch64/cpu/mod.rs similarity index 98% rename from src/cpu/aarch64/mod.rs rename to src/arch/aarch64/cpu/mod.rs index e2a6c2ce7..55ccc17f1 100644 --- a/src/cpu/aarch64/mod.rs +++ b/src/arch/aarch64/cpu/mod.rs @@ -155,15 +155,18 @@ pub struct CPUState { boot_ip: u64, /// The guest physical address of device tree blob (dtb). fdt_addr: u64, + + pub nr_vcpus: u32, } impl CPUState { - pub fn new(vcpu_id: u32) -> Self { + pub fn new(vcpu_id: u32, nr_vcpus: u32) -> Self { CPUState { vcpu_id, mpidr: UNINIT_MPIDR, boot_ip: 0, fdt_addr: 0, + nr_vcpus, } } diff --git a/src/arch/aarch64/device/fdt.rs b/src/arch/aarch64/device/fdt.rs new file mode 100644 index 000000000..6b61f69be --- /dev/null +++ b/src/arch/aarch64/device/fdt.rs @@ -0,0 +1,126 @@ +use crate::arch::aarch64::device_tree::*; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::cpu::CPU; +use crate::memory::GuestMemory; +use std::sync::Arc; + +use super::gicv3::GICv3; +use crate::arch::{MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ}; +pub fn generate_fdt( + sys_mem: &Arc, + gic: &GICv3, + initrd_range: (u64, u64), + cmdline: &str, + cpu: &mut CPU, + fdt_addr: u64, +) { + let mut fdt = vec![0; FDT_MAX_SIZE as usize]; + + create_device_tree(&mut fdt); + set_property_string(&mut fdt, "/", "compatible", "linux,dummy-virt"); + set_property_u32(&mut fdt, "/", "#address-cells", 0x2); + set_property_u32(&mut fdt, "/", "#size-cells", 0x2); + set_property_u32(&mut fdt, "/", "interrupt-parent", GIC_PHANDLE); + + generate_cpu_node(&mut fdt, cpu); + generate_memory_node(&mut fdt, sys_mem); + generate_devices_node(&mut fdt); + generate_chosen_node(&mut fdt, cmdline, initrd_range.0, initrd_range.1); + gic.generate_fdt_node(&mut fdt); + + let fdt_len = fdt.len() as u64; + sys_mem + .write(&mut fdt.as_slice(), fdt_addr, fdt_len) + .expect("Failed to load fdt to memory"); + + dump_dtb(&fdt, "/tmp/stratovirt.dtb"); +} + +fn generate_memory_node(fdt: &mut Vec, sys_mem: &Arc) { + let mem_base = MEM_LAYOUT[LayoutEntryType::Mem as usize].0; + let mem_size = sys_mem.memory_end_address() - MEM_LAYOUT[LayoutEntryType::Mem as usize].0; + let node = "/memory"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "device_type", "memory"); + set_property_array_u64(fdt, node, "reg", &[mem_base, mem_size as u64]); +} + + +fn generate_cpu_node(fdt: &mut Vec, cpu: &mut CPU) { + let node = "/cpus"; + add_sub_node(fdt, node); + set_property_u32(fdt, node, "#address-cells", 0x02); + set_property_u32(fdt, node, "#size-cells", 0x0); + + let mpidr = cpu.state.get_mpidr(&cpu.fd); + let node = format!("/cpus/cpu@{:x}", mpidr); + add_sub_node(fdt, &node); + set_property_u32( + fdt, + &node, + "phandle", + u32::from(cpu.id) + CPU_PHANDLE_START, + ); + set_property_string(fdt, &node, "device_type", "cpu"); + set_property_string(fdt, &node, "compatible", "arm,arm-v8"); + set_property_u64(fdt, &node, "reg", mpidr & 0x007F_FFFF); +} + +fn generate_devices_node(fdt: &mut Vec) { + // timer + let mut cells: Vec = Vec::new(); + for &irq in [13, 14, 11, 10].iter() { + cells.push(GIC_FDT_IRQ_TYPE_PPI); + cells.push(irq); + cells.push(IRQ_TYPE_LEVEL_HIGH); + } + let node = "/timer"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "arm,armv8-timer"); + set_property(fdt, node, "always-on", None); + set_property_array_u32(fdt, node, "interrupts", &cells); + // clock + let node = "/apb-pclk"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "fixed-clock"); + set_property_string(fdt, node, "clock-output-names", "clk24mhz"); + set_property_u32(fdt, node, "#clock-cells", 0x0); + set_property_u32(fdt, node, "clock-frequency", 24_000_000); + set_property_u32(fdt, node, "phandle", CLK_PHANDLE); + // psci + let node = "/psci"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "arm,psci-0.2"); + set_property_string(fdt, node, "method", "hvc"); + // serial + let node = format!("/uart@{:x}", MMIO_SERIAL_ADDR); + add_sub_node(fdt, &node); + set_property_string(fdt, &node, "compatible", "ns16550a"); + set_property_string(fdt, &node, "clock-names", "apb_pclk"); + set_property_u32(fdt, &node, "clocks", CLK_PHANDLE); + set_property_array_u64( + fdt, + &node, + "reg", + &[MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE], + ); + set_property_array_u32( + fdt, + &node, + "interrupts", + &[ + GIC_FDT_IRQ_TYPE_SPI, + MMIO_SERIAL_IRQ, + IRQ_TYPE_EDGE_RISING, + ], + ); +} + + +fn generate_chosen_node(fdt: &mut Vec, cmdline: &str, initrd_addr: u64, initrd_size: u64) { + let node = "/chosen"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "bootargs", cmdline); + set_property_u64(fdt, node, "linux,initrd-start", initrd_addr); + set_property_u64(fdt, node, "linux,initrd-end", initrd_addr + initrd_size); +} diff --git a/src/device/gicv3.rs b/src/arch/aarch64/device/gicv3.rs similarity index 84% rename from src/device/gicv3.rs rename to src/arch/aarch64/device/gicv3.rs index 5233ce479..ab66a2c28 100644 --- a/src/device/gicv3.rs +++ b/src/arch/aarch64/device/gicv3.rs @@ -13,10 +13,8 @@ use std::sync::Arc; use kvm_ioctls::{DeviceFd, VmFd}; - -#[cfg(target_arch = "aarch64")] -use crate::helper::device_tree; -use crate::memory::{LayoutEntryType, MEM_LAYOUT}; +use crate::arch::aarch64::device_tree::*; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; // See arch/arm64/include/uapi/asm/kvm.h file from the linux kernel. const SZ_64K: u64 = 0x0001_0000; @@ -188,31 +186,31 @@ impl GICv3 { self.redist_size, ]; let node = "/intc"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "compatible", "arm,gic-v3"); - device_tree::set_property(fdt, node, "interrupt-controller", None); - device_tree::set_property_u32(fdt, node, "#interrupt-cells", 0x3); - device_tree::set_property_u32(fdt, node, "phandle", device_tree::GIC_PHANDLE); - device_tree::set_property_u32(fdt, node, "#address-cells", 0x2); - device_tree::set_property_u32(fdt, node, "#size-cells", 0x2); - device_tree::set_property_u32(fdt, node, "#redistributor-regions", 0x1); - device_tree::set_property_array_u64(fdt, node, "reg", &gic_reg); + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "arm,gic-v3"); + set_property(fdt, node, "interrupt-controller", None); + set_property_u32(fdt, node, "#interrupt-cells", 0x3); + set_property_u32(fdt, node, "phandle", GIC_PHANDLE); + set_property_u32(fdt, node, "#address-cells", 0x2); + set_property_u32(fdt, node, "#size-cells", 0x2); + set_property_u32(fdt, node, "#redistributor-regions", 0x1); + set_property_array_u64(fdt, node, "reg", &gic_reg); let gic_intr = [ - device_tree::GIC_FDT_IRQ_TYPE_PPI, + GIC_FDT_IRQ_TYPE_PPI, 0x9, - device_tree::IRQ_TYPE_LEVEL_HIGH, + IRQ_TYPE_LEVEL_HIGH, ]; - device_tree::set_property_array_u32(fdt, node, "interrupts", &gic_intr); + set_property_array_u32(fdt, node, "interrupts", &gic_intr); - device_tree::set_property(fdt, node, "ranges", None); + set_property(fdt, node, "ranges", None); let its_reg = [self.its_dev.msi_base, self.its_dev.msi_size]; let node = "/intc/its"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "compatible", "arm,gic-v3-its"); - device_tree::set_property(fdt, node, "msi-controller", None); - device_tree::set_property_u32(fdt, node, "phandle", device_tree::GIC_ITS_PHANDLE); - device_tree::set_property_array_u64(fdt, node, "reg", &its_reg); + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "arm,gic-v3-its"); + set_property(fdt, node, "msi-controller", None); + set_property_u32(fdt, node, "phandle", GIC_ITS_PHANDLE); + set_property_array_u64(fdt, node, "reg", &its_reg); } } diff --git a/src/arch/aarch64/device/mod.rs b/src/arch/aarch64/device/mod.rs new file mode 100644 index 000000000..0dec42943 --- /dev/null +++ b/src/arch/aarch64/device/mod.rs @@ -0,0 +1,30 @@ +pub mod gicv3; +pub mod serial; +mod fdt; +use gicv3::GICv3; +use kvm_ioctls::VmFd; + +use crate::{arch::aarch64::boot_loader::AArch64BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; +use std::sync::Arc; +use crate::arch::CPUState; +pub fn kvm_setup_fireware(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc, layout : &AArch64BootLoader) { + + let vcpu_count = vcpu.state.nr_vcpus; + let gic = GICv3::new(&vm_fd, vcpu_count as u64, 192).expect("Failed to create GICv3 device"); + gic.realize().expect("Failed to realize GICv3 device"); + + let serial = Serial::new(&vm_fd); + vcpu.set_serial_dev(serial); + + let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; + let initrd_range = (layout.initrd_start, layout.initrd_size); + let fdt_addr = layout.dtb_start; + fdt::generate_fdt( + guest_memory, + &gic, + initrd_range, + cmdline, + vcpu, + fdt_addr, + ); +} \ No newline at end of file diff --git a/src/arch/aarch64/device/serial.rs b/src/arch/aarch64/device/serial.rs new file mode 100644 index 000000000..c90c53278 --- /dev/null +++ b/src/arch/aarch64/device/serial.rs @@ -0,0 +1,4 @@ +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +pub const MMIO_SERIAL_IRQ: u32 = 32; +pub const MMIO_SERIAL_ADDR: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].0; +pub const MMIO_SERIAL_ADDR_SIZE: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].1; \ No newline at end of file diff --git a/src/helper/device_tree.rs b/src/arch/aarch64/device_tree/mod.rs similarity index 100% rename from src/helper/device_tree.rs rename to src/arch/aarch64/device_tree/mod.rs diff --git a/src/arch/aarch64/kvm/mod.rs b/src/arch/aarch64/kvm/mod.rs new file mode 100644 index 000000000..d336890ed --- /dev/null +++ b/src/arch/aarch64/kvm/mod.rs @@ -0,0 +1,20 @@ +use std::path::PathBuf; +use std::sync::Arc; +use kvm_ioctls::VmFd; + +use crate::memory::{GuestMemory }; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::arch::{load_kernel, BootLoader, BootLoaderConfig}; +pub fn load_boot_source(guest_memory: &Arc) -> BootLoader { + let initrd_path = PathBuf::from("/tmp/initrd.img"); + let boot_cfg = BootLoaderConfig { + kernel: PathBuf::from("/tmp/vmlinux.bin"), + initrd: initrd_path, + mem_start: MEM_LAYOUT[LayoutEntryType::Mem as usize].0, + }; + load_kernel(&boot_cfg, &guest_memory) +} + +pub fn arch_init_based_dev(vm_fd: &Arc) { + +} \ No newline at end of file diff --git a/src/arch/aarch64/memory/mod.rs b/src/arch/aarch64/memory/mod.rs new file mode 100644 index 000000000..2bb31c03d --- /dev/null +++ b/src/arch/aarch64/memory/mod.rs @@ -0,0 +1,27 @@ + +/// The type of memory layout entry on aarch64 +#[repr(usize)] +pub enum LayoutEntryType { + GicDist, + GicIts, + GicRedist, + Mmio, + Mem, +} + +/// Layout of aarch64 + +pub const MEM_LAYOUT: &[(u64, u64)] = &[ + (0x0800_0000, 0x0001_0000), // GicDist + (0x0808_0000, 0x0002_0000), // GicIts + (0x080A_0000, 0x00F6_0000), // GicRedist (max 123 redistributors) + (0x0A00_0000, 0x0000_0200), // Mmio + (0x4000_0000, 0x80_0000_0000), // Mem +]; + + +pub fn arch_add_ram_ranges(mem_size: u64, ranges: &mut Vec<(u64, u64)>) { + + ranges.push((MEM_LAYOUT[LayoutEntryType::Mem as usize].0, mem_size)); + +} \ No newline at end of file diff --git a/src/arch/aarch64/mod.rs b/src/arch/aarch64/mod.rs new file mode 100644 index 000000000..8a5dbcd79 --- /dev/null +++ b/src/arch/aarch64/mod.rs @@ -0,0 +1,6 @@ +pub mod kvm; +pub mod cpu; +pub mod memory; +pub mod device_tree; +pub mod device; +pub mod boot_loader; \ No newline at end of file diff --git a/src/arch/mod.rs b/src/arch/mod.rs new file mode 100644 index 000000000..8092a8699 --- /dev/null +++ b/src/arch/mod.rs @@ -0,0 +1,39 @@ +#[cfg(target_arch = "aarch64")] +mod aarch64; +#[cfg(target_arch = "aarch64")] +pub use aarch64::kvm::*; +#[cfg(target_arch = "aarch64")] +pub use aarch64::cpu::AArch64CPUBootConfig as CPUBootConfig; +#[cfg(target_arch = "aarch64")] +pub use aarch64::cpu::CPUState; +#[cfg(target_arch = "aarch64")] +pub use aarch64::boot_loader::{ + load_kernel, kvm_load_kernel,AArch64BootLoader as BootLoader, AArch64BootLoaderConfig as BootLoaderConfig, +}; +#[cfg(target_arch = "aarch64")] +pub use aarch64::device::kvm_setup_fireware; +#[cfg(target_arch = "aarch64")] +pub use aarch64::device::serial::*; +#[cfg(target_arch = "aarch64")] +pub use aarch64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; + + +#[cfg(target_arch = "x86_64")] +mod x86_64; +#[cfg(target_arch = "x86_64")] +pub use x86_64::kvm::*; +#[cfg(target_arch = "x86_64")] +pub use x86_64::cpu::X86CPUBootConfig as CPUBootConfig; +#[cfg(target_arch = "x86_64")] +pub use x86_64::cpu::CPUState; +#[cfg(target_arch = "x86_64")] +pub use x86_64::boot_loader::{ + load_kernel, kvm_load_kernel,X86BootLoader as BootLoader, X86BootLoaderConfig as BootLoaderConfig, +}; +#[cfg(target_arch = "x86_64")] +pub use x86_64::device::kvm_setup_fireware; +#[cfg(target_arch = "x86_64")] +pub use x86_64::device::serial::*; +#[cfg(target_arch = "x86_64")] +pub use x86_64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; + diff --git a/src/boot_loader/x86_64/bootparam.rs b/src/arch/x86_64/boot_loader/bootparam.rs similarity index 100% rename from src/boot_loader/x86_64/bootparam.rs rename to src/arch/x86_64/boot_loader/bootparam.rs diff --git a/src/boot_loader/x86_64/gdt.rs b/src/arch/x86_64/boot_loader/gdt.rs similarity index 100% rename from src/boot_loader/x86_64/gdt.rs rename to src/arch/x86_64/boot_loader/gdt.rs diff --git a/src/boot_loader/x86_64/loader.rs b/src/arch/x86_64/boot_loader/loader.rs similarity index 100% rename from src/boot_loader/x86_64/loader.rs rename to src/arch/x86_64/boot_loader/loader.rs diff --git a/src/boot_loader/x86_64/mod.rs b/src/arch/x86_64/boot_loader/mod.rs similarity index 65% rename from src/boot_loader/x86_64/mod.rs rename to src/arch/x86_64/boot_loader/mod.rs index c215370a1..ed4cf36e9 100644 --- a/src/boot_loader/x86_64/mod.rs +++ b/src/arch/x86_64/boot_loader/mod.rs @@ -17,12 +17,18 @@ mod mptable; use std::fs::File; use std::io::{Seek, SeekFrom}; +use std::sync::Arc; +use kvm_ioctls::VmFd; pub use loader::{X86BootLoader, X86BootLoaderConfig}; +use crate::arch::CPUBootConfig; +use crate::cpu::CPU; use crate::memory::GuestMemory; use loader::linux_bootloader; +use super::kvm::load_boot_source; + fn load_image(image: &mut File, start_addr: u64, sys_mem: &GuestMemory) -> std::io::Result<()> { let len = image.seek(SeekFrom::End(0))?; image.seek(SeekFrom::Start(0))?; @@ -48,3 +54,24 @@ pub fn load_kernel(config: &X86BootLoaderConfig, sys_mem: &GuestMemory) -> X86Bo boot_loader } + +pub fn kvm_load_kernel(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc) -> X86BootLoader{ + let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; + + let layout = load_boot_source(guest_memory, cmdline); + let cpu_boot_cfg = CPUBootConfig { + boot_ip: layout.kernel_start, + boot_sp: layout.kernel_sp, + zero_page: layout.zero_page_addr, + code_segment: layout.segments.code_segment, + data_segment: layout.segments.data_segment, + gdt_base: layout.segments.gdt_base, + gdt_size: layout.segments.gdt_limit, + idt_base: layout.segments.idt_base, + idt_size: layout.segments.idt_limit, + pml4_start: layout.boot_pml4_addr, + }; + vcpu.realize(&vm_fd, cpu_boot_cfg); + + layout +} \ No newline at end of file diff --git a/src/boot_loader/x86_64/mptable.rs b/src/arch/x86_64/boot_loader/mptable.rs similarity index 100% rename from src/boot_loader/x86_64/mptable.rs rename to src/arch/x86_64/boot_loader/mptable.rs diff --git a/src/cpu/x86_64/mod.rs b/src/arch/x86_64/cpu/mod.rs similarity index 99% rename from src/cpu/x86_64/mod.rs rename to src/arch/x86_64/cpu/mod.rs index a1e460b6c..97333fead 100644 --- a/src/cpu/x86_64/mod.rs +++ b/src/arch/x86_64/cpu/mod.rs @@ -16,7 +16,7 @@ use kvm_bindings::{ }; use kvm_ioctls::{Kvm, VcpuFd, VmFd}; -use crate::helper::cpuid::host_cpuid; +use crate::arch::x86_64::helper::cpuid::host_cpuid; const ECX_EPB_SHIFT: u32 = 3; const X86_FEATURE_HYPERVISOR: u32 = 31; diff --git a/src/arch/x86_64/device/mod.rs b/src/arch/x86_64/device/mod.rs new file mode 100644 index 000000000..88f6b5e93 --- /dev/null +++ b/src/arch/x86_64/device/mod.rs @@ -0,0 +1,14 @@ +pub mod serial; +use std::sync::Arc; + +use kvm_ioctls::VmFd; + +use crate::{arch::x86_64::boot_loader::X86BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; + + +pub fn kvm_setup_fireware(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc, layout : &X86BootLoader) { + + let serial = Serial::new(&vm_fd); + vcpu.set_serial_dev(serial); + +} \ No newline at end of file diff --git a/src/arch/x86_64/device/serial.rs b/src/arch/x86_64/device/serial.rs new file mode 100644 index 000000000..eb0787d28 --- /dev/null +++ b/src/arch/x86_64/device/serial.rs @@ -0,0 +1,3 @@ +pub const MMIO_SERIAL_IRQ: u32 = 4; +pub const MMIO_SERIAL_ADDR: u64 = 0x3f8; +pub const MMIO_SERIAL_ADDR_SIZE: u64 = 8; \ No newline at end of file diff --git a/src/helper/cpuid.rs b/src/arch/x86_64/helper/cpuid.rs similarity index 100% rename from src/helper/cpuid.rs rename to src/arch/x86_64/helper/cpuid.rs diff --git a/src/arch/x86_64/helper/mod.rs b/src/arch/x86_64/helper/mod.rs new file mode 100644 index 000000000..e13a58bf8 --- /dev/null +++ b/src/arch/x86_64/helper/mod.rs @@ -0,0 +1 @@ +pub mod cpuid; \ No newline at end of file diff --git a/src/arch/x86_64/kvm/mod.rs b/src/arch/x86_64/kvm/mod.rs new file mode 100644 index 000000000..6d733647a --- /dev/null +++ b/src/arch/x86_64/kvm/mod.rs @@ -0,0 +1,46 @@ +use std::path::PathBuf; +use std::sync::Arc; +use kvm_ioctls::{Kvm, VmFd}; +use kvm_bindings::{kvm_pit_config, KVM_PIT_SPEAKER_DUMMY}; +use crate::memory::{GuestMemory }; +use crate::arch::{load_kernel, BootLoader, BootLoaderConfig}; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +pub fn load_boot_source(guest_memory: &Arc, cmdline: &str) -> BootLoader { + let initrd_path = PathBuf::from("/tmp/initrd.img"); + let initrd_size = match std::fs::metadata("/tmp/initrd.img") { + Ok(meta) => meta.len() as u32, + _ => panic!("initrd file init failed!"), + }; + let gap_start = MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].0 + + MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].1; + let gap_end = MEM_LAYOUT[LayoutEntryType::MemAbove4g as usize].0; + let boot_cfg = BootLoaderConfig { + kernel: PathBuf::from("/tmp/vmlinux.bin"), + initrd: initrd_path, + initrd_size, + kernel_cmdline: cmdline.to_string(), + cpu_count: 1_u8, + gap_range: (gap_start, gap_end - gap_start), + ioapic_addr: MEM_LAYOUT[LayoutEntryType::IoApic as usize].0 as u32, + lapic_addr: MEM_LAYOUT[LayoutEntryType::LocalApic as usize].0 as u32, + }; + load_kernel(&boot_cfg, &guest_memory) +} + +pub fn arch_init_based_dev(vm_fd: &Arc) { + vm_fd.create_irq_chip().expect("Failed to create irq chip."); + vm_fd + .set_tss_address(0xfffb_d000_usize) + .expect("Failed to set tss address."); + + let pit_config = kvm_pit_config { + flags: KVM_PIT_SPEAKER_DUMMY, + pad: Default::default(), + }; + + vm_fd + .create_pit2(pit_config) + .expect("Failed to create pit2."); +} + + diff --git a/src/arch/x86_64/memory/mod.rs b/src/arch/x86_64/memory/mod.rs new file mode 100644 index 000000000..138068a3d --- /dev/null +++ b/src/arch/x86_64/memory/mod.rs @@ -0,0 +1,30 @@ +/// The type of memory layout entry on x86_64 +#[repr(usize)] +pub enum LayoutEntryType { + MemBelow4g = 0_usize, + Mmio, + IoApic, + LocalApic, + MemAbove4g, +} + +/// Layout of x86_64 +pub const MEM_LAYOUT: &[(u64, u64)] = &[ + (0, 0xC000_0000), // MemBelow4g + (0xF010_0000, 0x200), // Mmio + (0xFEC0_0000, 0x10_0000), // IoApic + (0xFEE0_0000, 0x10_0000), // LocalApic + (0x1_0000_0000, 0x80_0000_0000), // MemAbove4g +]; + +pub fn arch_add_ram_ranges(mem_size: u64, ranges: &mut Vec<(u64, u64)>) { + + let gap_start = MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].0 + + MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].1; + ranges.push((0, std::cmp::min(gap_start, mem_size))); + if mem_size > gap_start { + let gap_end = MEM_LAYOUT[LayoutEntryType::MemAbove4g as usize].0; + ranges.push((gap_end, mem_size - gap_start)); + } + +} \ No newline at end of file diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs new file mode 100644 index 000000000..d1018d105 --- /dev/null +++ b/src/arch/x86_64/mod.rs @@ -0,0 +1,6 @@ +pub mod kvm; +pub mod boot_loader; +pub mod cpu; +pub mod device; +pub mod memory; +pub mod helper; \ No newline at end of file diff --git a/src/boot_loader/mod.rs b/src/boot_loader/mod.rs deleted file mode 100644 index bb4140d16..000000000 --- a/src/boot_loader/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. -// -// StratoVirt is licensed under Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan -// PSL v2. -// You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY -// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -// See the Mulan PSL v2 for more details. - -#[cfg(target_arch = "x86_64")] -mod x86_64; - -#[cfg(target_arch = "x86_64")] -pub use x86_64::{ - load_kernel, X86BootLoader as BootLoader, X86BootLoaderConfig as BootLoaderConfig, -}; - -#[cfg(target_arch = "aarch64")] -mod aarch64; - -#[cfg(target_arch = "aarch64")] -pub use aarch64::{ - load_kernel, AArch64BootLoader as BootLoader, AArch64BootLoaderConfig as BootLoaderConfig, -}; diff --git a/src/cpu/mod.rs b/src/cpu/mod.rs index 428a8c274..21097ec93 100644 --- a/src/cpu/mod.rs +++ b/src/cpu/mod.rs @@ -10,16 +10,7 @@ // NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. // See the Mulan PSL v2 for more details. -#[cfg(target_arch = "aarch64")] -mod aarch64; -#[cfg(target_arch = "x86_64")] -mod x86_64; - -#[cfg(target_arch = "aarch64")] -pub use aarch64::AArch64CPUBootConfig as CPUBootConfig; -#[cfg(target_arch = "x86_64")] -pub use x86_64::X86CPUBootConfig as CPUBootConfig; - +use crate::arch::CPUBootConfig; use std::sync::{Arc, Mutex}; use std::thread; @@ -27,10 +18,7 @@ use kvm_ioctls::{VcpuExit, VcpuFd, VmFd}; use crate::device::{judge_serial_addr, Serial}; use crate::memory::GuestMemory; -#[cfg(target_arch = "aarch64")] -use aarch64::CPUState; -#[cfg(target_arch = "x86_64")] -use x86_64::CPUState; +use crate::arch::CPUState; pub struct CPU { /// ID of this virtual CPU, `0` means this cpu is primary `CPU`. @@ -63,7 +51,6 @@ impl CPU { sys_mem, state: CPUState::new( vcpu_id, - #[cfg(target_arch = "x86_64")] nr_vcpus, ), serial: None, diff --git a/src/device/mod.rs b/src/device/mod.rs index 956247f79..928aec337 100644 --- a/src/device/mod.rs +++ b/src/device/mod.rs @@ -10,14 +10,10 @@ // NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. // See the Mulan PSL v2 for more details. -#[cfg(target_arch = "aarch64")] -mod gicv3; mod serial; -#[cfg(target_arch = "aarch64")] -pub use gicv3::GICv3; pub use serial::{ - judge_serial_addr, Serial, MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ, + judge_serial_addr, Serial, }; #[derive(Debug)] diff --git a/src/device/serial.rs b/src/device/serial.rs index 33a114c24..d237d4ef0 100644 --- a/src/device/serial.rs +++ b/src/device/serial.rs @@ -20,9 +20,9 @@ use kvm_ioctls::VmFd; use vmm_sys_util::{epoll::EventSet, eventfd::EventFd, terminal::Terminal}; use super::{Error, Result}; +use crate::arch::{MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ}; use crate::helper::epoll::{EpollContext, EventNotifier}; -#[cfg(target_arch = "aarch64")] -use crate::memory::{LayoutEntryType, MEM_LAYOUT}; + const UART_IER_RDI: u8 = 0x01; const UART_IER_THRI: u8 = 0x02; @@ -46,20 +46,6 @@ const UART_MSR_DCD: u8 = 0x80; const RECEIVER_BUFF_SIZE: usize = 1024; -#[cfg(target_arch = "x86_64")] -pub const MMIO_SERIAL_IRQ: u32 = 4; -#[cfg(target_arch = "aarch64")] -pub const MMIO_SERIAL_IRQ: u32 = 32; - -#[cfg(target_arch = "x86_64")] -pub const MMIO_SERIAL_ADDR: u64 = 0x3f8; -#[cfg(target_arch = "x86_64")] -pub const MMIO_SERIAL_ADDR_SIZE: u64 = 8; -#[cfg(target_arch = "aarch64")] -pub const MMIO_SERIAL_ADDR: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].0; -#[cfg(target_arch = "aarch64")] -pub const MMIO_SERIAL_ADDR_SIZE: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].1; - pub fn judge_serial_addr(addr: u64) -> Option { if (MMIO_SERIAL_ADDR..MMIO_SERIAL_ADDR + MMIO_SERIAL_ADDR_SIZE).contains(&addr) { Some(addr - MMIO_SERIAL_ADDR) diff --git a/src/helper/mod.rs b/src/helper/mod.rs index 390a32174..005f16659 100644 --- a/src/helper/mod.rs +++ b/src/helper/mod.rs @@ -12,10 +12,6 @@ pub mod byte_code; pub mod checksum; -#[cfg(target_arch = "x86_64")] -pub mod cpuid; -#[cfg(target_arch = "aarch64")] -pub mod device_tree; pub mod epoll; pub mod num_ops; diff --git a/src/main.rs b/src/main.rs index 52d63d429..dc3046bdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,6 @@ // NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. // See the Mulan PSL v2 for more details. -mod boot_loader; mod cpu; mod device; #[allow(dead_code)] @@ -18,22 +17,16 @@ mod device; mod helper; #[allow(dead_code)] mod memory; +mod arch; -use std::path::PathBuf; use std::sync::Arc; - -#[cfg(target_arch = "x86_64")] -use kvm_bindings::{kvm_pit_config, KVM_PIT_SPEAKER_DUMMY}; use kvm_ioctls::Kvm; -use crate::boot_loader::{load_kernel, BootLoader, BootLoaderConfig}; -use crate::cpu::{CPUBootConfig, CPU}; +use crate::arch::CPUBootConfig; +use crate::cpu::CPU; use crate::device::Serial; -#[cfg(target_arch = "aarch64")] -use crate::device::{GICv3, MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ}; -#[cfg(target_arch = "aarch64")] -use crate::helper::device_tree; -use crate::memory::{GuestMemory, LayoutEntryType, MEM_LAYOUT}; +use crate::memory::GuestMemory; +use crate::arch::{kvm_load_kernel,load_boot_source,arch_init_based_dev,kvm_setup_fireware}; // Run a simple VM on x86_64 platfrom. // Reference: https://lwn.net/Articles/658511/. @@ -48,21 +41,7 @@ fn main() { let guest_memory = GuestMemory::new(&vm_fd, mem_size).expect("Failed to init guest memory"); // 3. Init kvm_based devices. - #[cfg(target_arch = "x86_64")] - { - vm_fd.create_irq_chip().expect("Failed to create irq chip."); - vm_fd - .set_tss_address(0xfffb_d000_usize) - .expect("Failed to set tss address."); - - let pit_config = kvm_pit_config { - flags: KVM_PIT_SPEAKER_DUMMY, - pad: Default::default(), - }; - vm_fd - .create_pit2(pit_config) - .expect("Failed to create pit2."); - } + arch_init_based_dev(&vm_fd); // 4. Init vCPU. let vcpu_count = 1_u32; @@ -70,219 +49,15 @@ fn main() { let mut vcpu = CPU::new(&vm_fd, arc_memory.clone(), 0, vcpu_count); // 5. load boot source and realize vCPU0. - let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; - #[cfg(target_arch = "aarch64")] - let fdt_addr: u64; - #[cfg(target_arch = "aarch64")] - let initrd_range: (u64, u64); - #[cfg(target_arch = "x86_64")] - { - let layout = load_boot_source(&arc_memory, cmdline); - let cpu_boot_cfg = CPUBootConfig { - boot_ip: layout.kernel_start, - boot_sp: layout.kernel_sp, - zero_page: layout.zero_page_addr, - code_segment: layout.segments.code_segment, - data_segment: layout.segments.data_segment, - gdt_base: layout.segments.gdt_base, - gdt_size: layout.segments.gdt_limit, - idt_base: layout.segments.idt_base, - idt_size: layout.segments.idt_limit, - pml4_start: layout.boot_pml4_addr, - }; - vcpu.realize(&vm_fd, cpu_boot_cfg); - } - #[cfg(target_arch = "aarch64")] - { - let layout = load_boot_source(&arc_memory); - let cpu_boot_cfg = CPUBootConfig { - fdt_addr: layout.dtb_start, - kernel_addr: layout.kernel_start, - }; - vcpu.realize(&vm_fd, cpu_boot_cfg); - fdt_addr = layout.dtb_start; - initrd_range = (layout.initrd_start, layout.initrd_size); - } - - // 6. On aarch64 platform, interrupt controller has to be created after vCPU is created. - #[cfg(target_arch = "aarch64")] - let gic = GICv3::new(&vm_fd, vcpu_count as u64, 192).expect("Failed to create GICv3 device"); - #[cfg(target_arch = "aarch64")] - gic.realize().expect("Failed to realize GICv3 device"); + - // 7. Initialize serial device. - let serial = Serial::new(&vm_fd); - vcpu.set_serial_dev(serial); - - // 8. generate device tree. - #[cfg(target_arch = "aarch64")] - generate_fdt( - &arc_memory, - &gic, - initrd_range, - cmdline, - &mut vcpu, - fdt_addr, - ); + let layout = kvm_load_kernel(&arc_memory,&mut vcpu, &vm_fd); + + kvm_setup_fireware(&arc_memory,&mut vcpu, &vm_fd, &layout); + // 9. Run vCPU0. let cpu_task_0 = CPU::start(Arc::new(vcpu)); println!("Start to run linux kernel!"); cpu_task_0.join().expect("Failed to wait cpu task 0"); } - -#[cfg(target_arch = "x86_64")] -fn load_boot_source(guest_memory: &Arc, cmdline: &str) -> BootLoader { - let initrd_path = PathBuf::from("/tmp/initrd.img"); - let initrd_size = match std::fs::metadata("/tmp/initrd.img") { - Ok(meta) => meta.len() as u32, - _ => panic!("initrd file init failed!"), - }; - let gap_start = MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].0 - + MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].1; - let gap_end = MEM_LAYOUT[LayoutEntryType::MemAbove4g as usize].0; - let boot_cfg = BootLoaderConfig { - kernel: PathBuf::from("/tmp/vmlinux.bin"), - initrd: initrd_path, - initrd_size, - kernel_cmdline: cmdline.to_string(), - cpu_count: 1_u8, - gap_range: (gap_start, gap_end - gap_start), - ioapic_addr: MEM_LAYOUT[LayoutEntryType::IoApic as usize].0 as u32, - lapic_addr: MEM_LAYOUT[LayoutEntryType::LocalApic as usize].0 as u32, - }; - load_kernel(&boot_cfg, &guest_memory) -} - -#[cfg(target_arch = "aarch64")] -fn load_boot_source(guest_memory: &Arc) -> BootLoader { - let initrd_path = PathBuf::from("/tmp/initrd.img"); - let boot_cfg = BootLoaderConfig { - kernel: PathBuf::from("/tmp/vmlinux.bin"), - initrd: initrd_path, - mem_start: MEM_LAYOUT[LayoutEntryType::Mem as usize].0, - }; - load_kernel(&boot_cfg, &guest_memory) -} - -#[cfg(target_arch = "aarch64")] -fn generate_fdt( - sys_mem: &Arc, - gic: &GICv3, - initrd_range: (u64, u64), - cmdline: &str, - cpu: &mut CPU, - fdt_addr: u64, -) { - let mut fdt = vec![0; device_tree::FDT_MAX_SIZE as usize]; - - device_tree::create_device_tree(&mut fdt); - device_tree::set_property_string(&mut fdt, "/", "compatible", "linux,dummy-virt"); - device_tree::set_property_u32(&mut fdt, "/", "#address-cells", 0x2); - device_tree::set_property_u32(&mut fdt, "/", "#size-cells", 0x2); - device_tree::set_property_u32(&mut fdt, "/", "interrupt-parent", device_tree::GIC_PHANDLE); - - generate_cpu_node(&mut fdt, cpu); - generate_memory_node(&mut fdt, sys_mem); - generate_devices_node(&mut fdt); - generate_chosen_node(&mut fdt, cmdline, initrd_range.0, initrd_range.1); - gic.generate_fdt_node(&mut fdt); - - let fdt_len = fdt.len() as u64; - sys_mem - .write(&mut fdt.as_slice(), fdt_addr, fdt_len) - .expect("Failed to load fdt to memory"); - - device_tree::dump_dtb(&fdt, "/tmp/stratovirt.dtb"); -} - -#[cfg(target_arch = "aarch64")] -fn generate_memory_node(fdt: &mut Vec, sys_mem: &Arc) { - let mem_base = MEM_LAYOUT[LayoutEntryType::Mem as usize].0; - let mem_size = sys_mem.memory_end_address() - MEM_LAYOUT[LayoutEntryType::Mem as usize].0; - let node = "/memory"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "device_type", "memory"); - device_tree::set_property_array_u64(fdt, node, "reg", &[mem_base, mem_size as u64]); -} - -#[cfg(target_arch = "aarch64")] -fn generate_cpu_node(fdt: &mut Vec, cpu: &mut CPU) { - let node = "/cpus"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_u32(fdt, node, "#address-cells", 0x02); - device_tree::set_property_u32(fdt, node, "#size-cells", 0x0); - - let mpidr = cpu.state.get_mpidr(&cpu.fd); - let node = format!("/cpus/cpu@{:x}", mpidr); - device_tree::add_sub_node(fdt, &node); - device_tree::set_property_u32( - fdt, - &node, - "phandle", - u32::from(cpu.id) + device_tree::CPU_PHANDLE_START, - ); - device_tree::set_property_string(fdt, &node, "device_type", "cpu"); - device_tree::set_property_string(fdt, &node, "compatible", "arm,arm-v8"); - device_tree::set_property_u64(fdt, &node, "reg", mpidr & 0x007F_FFFF); -} - -#[cfg(target_arch = "aarch64")] -fn generate_devices_node(fdt: &mut Vec) { - // timer - let mut cells: Vec = Vec::new(); - for &irq in [13, 14, 11, 10].iter() { - cells.push(device_tree::GIC_FDT_IRQ_TYPE_PPI); - cells.push(irq); - cells.push(device_tree::IRQ_TYPE_LEVEL_HIGH); - } - let node = "/timer"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "compatible", "arm,armv8-timer"); - device_tree::set_property(fdt, node, "always-on", None); - device_tree::set_property_array_u32(fdt, node, "interrupts", &cells); - // clock - let node = "/apb-pclk"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "compatible", "fixed-clock"); - device_tree::set_property_string(fdt, node, "clock-output-names", "clk24mhz"); - device_tree::set_property_u32(fdt, node, "#clock-cells", 0x0); - device_tree::set_property_u32(fdt, node, "clock-frequency", 24_000_000); - device_tree::set_property_u32(fdt, node, "phandle", device_tree::CLK_PHANDLE); - // psci - let node = "/psci"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "compatible", "arm,psci-0.2"); - device_tree::set_property_string(fdt, node, "method", "hvc"); - // serial - let node = format!("/uart@{:x}", MMIO_SERIAL_ADDR); - device_tree::add_sub_node(fdt, &node); - device_tree::set_property_string(fdt, &node, "compatible", "ns16550a"); - device_tree::set_property_string(fdt, &node, "clock-names", "apb_pclk"); - device_tree::set_property_u32(fdt, &node, "clocks", device_tree::CLK_PHANDLE); - device_tree::set_property_array_u64( - fdt, - &node, - "reg", - &[MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE], - ); - device_tree::set_property_array_u32( - fdt, - &node, - "interrupts", - &[ - device_tree::GIC_FDT_IRQ_TYPE_SPI, - MMIO_SERIAL_IRQ, - device_tree::IRQ_TYPE_EDGE_RISING, - ], - ); -} - -#[cfg(target_arch = "aarch64")] -fn generate_chosen_node(fdt: &mut Vec, cmdline: &str, initrd_addr: u64, initrd_size: u64) { - let node = "/chosen"; - device_tree::add_sub_node(fdt, node); - device_tree::set_property_string(fdt, node, "bootargs", cmdline); - device_tree::set_property_u64(fdt, node, "linux,initrd-start", initrd_addr); - device_tree::set_property_u64(fdt, node, "linux,initrd-end", initrd_addr + initrd_size); -} diff --git a/src/memory/guest_memory.rs b/src/memory/guest_memory.rs index 6fd0f6f9f..6196f4717 100644 --- a/src/memory/guest_memory.rs +++ b/src/memory/guest_memory.rs @@ -16,9 +16,9 @@ use kvm_bindings::kvm_userspace_memory_region; use kvm_ioctls::VmFd; use super::host_mmap::HostMemMapping; -use super::{Error, LayoutEntryType, Result, MEM_LAYOUT}; +use super::{Error, Result}; use crate::helper::byte_code::ByteCode; - +use crate::arch::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; #[derive(Clone)] pub struct GuestMemory { host_mmaps: Vec>, @@ -65,20 +65,9 @@ impl GuestMemory { // ranges is the vector of (start_addr, size) let mut ranges = Vec::<(u64, u64)>::new(); - #[cfg(target_arch = "aarch64")] - ranges.push((MEM_LAYOUT[LayoutEntryType::Mem as usize].0, mem_size)); - - #[cfg(target_arch = "x86_64")] - { - let gap_start = MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].0 - + MEM_LAYOUT[LayoutEntryType::MemBelow4g as usize].1; - ranges.push((0, std::cmp::min(gap_start, mem_size))); - if mem_size > gap_start { - let gap_end = MEM_LAYOUT[LayoutEntryType::MemAbove4g as usize].0; - ranges.push((gap_end, mem_size - gap_start)); - } - } - + + + arch_add_ram_ranges(mem_size, &mut ranges); ranges } diff --git a/src/memory/mod.rs b/src/memory/mod.rs index 4795b3fad..035faafe6 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -56,45 +56,3 @@ impl std::fmt::Display for Error { } pub type Result = std::result::Result; - -/// The type of memory layout entry on x86_64 -#[cfg(target_arch = "x86_64")] -#[repr(usize)] -pub enum LayoutEntryType { - MemBelow4g = 0_usize, - Mmio, - IoApic, - LocalApic, - MemAbove4g, -} - -/// Layout of x86_64 -#[cfg(target_arch = "x86_64")] -pub const MEM_LAYOUT: &[(u64, u64)] = &[ - (0, 0xC000_0000), // MemBelow4g - (0xF010_0000, 0x200), // Mmio - (0xFEC0_0000, 0x10_0000), // IoApic - (0xFEE0_0000, 0x10_0000), // LocalApic - (0x1_0000_0000, 0x80_0000_0000), // MemAbove4g -]; - -/// The type of memory layout entry on aarch64 -#[cfg(target_arch = "aarch64")] -#[repr(usize)] -pub enum LayoutEntryType { - GicDist, - GicIts, - GicRedist, - Mmio, - Mem, -} - -/// Layout of aarch64 -#[cfg(target_arch = "aarch64")] -pub const MEM_LAYOUT: &[(u64, u64)] = &[ - (0x0800_0000, 0x0001_0000), // GicDist - (0x0808_0000, 0x0002_0000), // GicIts - (0x080A_0000, 0x00F6_0000), // GicRedist (max 123 redistributors) - (0x0A00_0000, 0x0000_0200), // Mmio - (0x4000_0000, 0x80_0000_0000), // Mem -]; -- Gitee From 4e3a1c521c7fc978f0b616102b3ff070f4be4c09 Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 06:51:45 +0000 Subject: [PATCH 2/6] Adapt kvm-bindings and kvm-ioctls for RISC-V RISCV kvm-bindings: Adapt the kvm-bindings library for the RISC-V architecture following the official guidelines provided at https://github.com/rust-vmm/kvm-bindings/blob/main/CONTRIBUTING.md. The library was generated from the Linux kernel header files specifically for the RISC-V architecture. RISC-V kvm-ioctls: 1: Adapt the kvm-ioctls library for RISC-V-specific content based on the Linux kernel virtualization documentation located at https://docs.kernel.org/virt/kvm/api.html#api-description. The adaptations include implementing the functions set_one_reg and get_one_reg , get_mp_state and set_mp_state 2: Implement the macro KVM_INTERRUPT and the function set_interrupt to set external interrupts for RISC-V VCPUs, and introduce the function unset_interrupt to clear external interrupts for RISC-V VCPUs. --- Cargo.toml | 4 +- kvm-bindings/.buildkite/pipeline.yml | 111 + kvm-bindings/.cargo/config | 5 + kvm-bindings/.gitignore | 4 + kvm-bindings/.gitmodules | 3 + kvm-bindings/CHANGELOG.md | 32 + kvm-bindings/CODEOWNERS | 2 + kvm-bindings/CONTRIBUTING.md | 81 + kvm-bindings/Cargo.toml | 17 + kvm-bindings/LICENSE | 202 + kvm-bindings/README.md | 44 + kvm-bindings/coverage_config.json | 5 + kvm-bindings/src/arm/bindings_v4_14_0.rs | 6879 ++++++++++++ kvm-bindings/src/arm/bindings_v4_20_0.rs | 7667 ++++++++++++++ kvm-bindings/src/arm/fam_wrappers.rs | 22 + kvm-bindings/src/arm/mod.rs | 33 + kvm-bindings/src/arm64/bindings_v4_14_0.rs | 7098 +++++++++++++ kvm-bindings/src/arm64/bindings_v4_20_0.rs | 8603 +++++++++++++++ kvm-bindings/src/arm64/fam_wrappers.rs | 22 + kvm-bindings/src/arm64/mod.rs | 33 + kvm-bindings/src/lib.rs | 30 + kvm-bindings/src/riscv/bindings.rs | 10510 ++++++++++++++++++ kvm-bindings/src/riscv/mod.rs | 9 + kvm-bindings/src/x86/bindings_v4_14_0.rs | 9622 +++++++++++++++++ kvm-bindings/src/x86/bindings_v4_20_0.rs | 10559 +++++++++++++++++++ kvm-bindings/src/x86/fam_wrappers.rs | 64 + kvm-bindings/src/x86/mod.rs | 33 + kvm-ioctls/.cargo/config | 3 + kvm-ioctls/.gitignore | 6 + kvm-ioctls/.gitmodules | 3 + kvm-ioctls/CHANGELOG.md | 112 + kvm-ioctls/CODEOWNERS | 3 + kvm-ioctls/Cargo.toml | 17 + kvm-ioctls/LICENSE-APACHE | 202 + kvm-ioctls/LICENSE-MIT | 24 + kvm-ioctls/README.md | 47 + kvm-ioctls/THIRD-PARTY | 27 + kvm-ioctls/coverage_config_aarch64.json | 5 + kvm-ioctls/coverage_config_x86_64.json | 5 + kvm-ioctls/src/cap.rs | 154 + kvm-ioctls/src/ioctls/device.rs | 311 + kvm-ioctls/src/ioctls/mod.rs | 96 + kvm-ioctls/src/ioctls/system.rs | 652 ++ kvm-ioctls/src/ioctls/vcpu.rs | 2186 ++++ kvm-ioctls/src/ioctls/vm.rs | 1804 ++++ kvm-ioctls/src/kvm_ioctls.rs | 279 + kvm-ioctls/src/lib.rs | 235 + 47 files changed, 67863 insertions(+), 2 deletions(-) create mode 100644 kvm-bindings/.buildkite/pipeline.yml create mode 100644 kvm-bindings/.cargo/config create mode 100644 kvm-bindings/.gitignore create mode 100644 kvm-bindings/.gitmodules create mode 100644 kvm-bindings/CHANGELOG.md create mode 100644 kvm-bindings/CODEOWNERS create mode 100644 kvm-bindings/CONTRIBUTING.md create mode 100644 kvm-bindings/Cargo.toml create mode 100644 kvm-bindings/LICENSE create mode 100644 kvm-bindings/README.md create mode 100644 kvm-bindings/coverage_config.json create mode 100644 kvm-bindings/src/arm/bindings_v4_14_0.rs create mode 100644 kvm-bindings/src/arm/bindings_v4_20_0.rs create mode 100644 kvm-bindings/src/arm/fam_wrappers.rs create mode 100644 kvm-bindings/src/arm/mod.rs create mode 100644 kvm-bindings/src/arm64/bindings_v4_14_0.rs create mode 100644 kvm-bindings/src/arm64/bindings_v4_20_0.rs create mode 100644 kvm-bindings/src/arm64/fam_wrappers.rs create mode 100644 kvm-bindings/src/arm64/mod.rs create mode 100644 kvm-bindings/src/lib.rs create mode 100644 kvm-bindings/src/riscv/bindings.rs create mode 100644 kvm-bindings/src/riscv/mod.rs create mode 100644 kvm-bindings/src/x86/bindings_v4_14_0.rs create mode 100644 kvm-bindings/src/x86/bindings_v4_20_0.rs create mode 100644 kvm-bindings/src/x86/fam_wrappers.rs create mode 100644 kvm-bindings/src/x86/mod.rs create mode 100644 kvm-ioctls/.cargo/config create mode 100644 kvm-ioctls/.gitignore create mode 100644 kvm-ioctls/.gitmodules create mode 100644 kvm-ioctls/CHANGELOG.md create mode 100644 kvm-ioctls/CODEOWNERS create mode 100644 kvm-ioctls/Cargo.toml create mode 100644 kvm-ioctls/LICENSE-APACHE create mode 100644 kvm-ioctls/LICENSE-MIT create mode 100644 kvm-ioctls/README.md create mode 100644 kvm-ioctls/THIRD-PARTY create mode 100644 kvm-ioctls/coverage_config_aarch64.json create mode 100644 kvm-ioctls/coverage_config_x86_64.json create mode 100644 kvm-ioctls/src/cap.rs create mode 100644 kvm-ioctls/src/ioctls/device.rs create mode 100644 kvm-ioctls/src/ioctls/mod.rs create mode 100644 kvm-ioctls/src/ioctls/system.rs create mode 100644 kvm-ioctls/src/ioctls/vcpu.rs create mode 100644 kvm-ioctls/src/ioctls/vm.rs create mode 100644 kvm-ioctls/src/kvm_ioctls.rs create mode 100644 kvm-ioctls/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index e63642497..7749e5c67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ license = "Mulan PSL v2" [dependencies] libc = ">=0.2.39" vmm-sys-util = "0.7.0" -kvm-ioctls = "0.6.0" -kvm-bindings = "0.3.0" +kvm-ioctls = { path = "kvm-ioctls" } +kvm-bindings = { path = "kvm-bindings", features = ["fam-wrappers"]} [[bin]] name = "stratovirt" diff --git a/kvm-bindings/.buildkite/pipeline.yml b/kvm-bindings/.buildkite/pipeline.yml new file mode 100644 index 000000000..526375899 --- /dev/null +++ b/kvm-bindings/.buildkite/pipeline.yml @@ -0,0 +1,111 @@ +steps: + # Test release build with kernel bindings 4.14. + - label: "build-v4.14-x86" + commands: + - cargo build --release --features=fam-wrappers,kvm-v4_14_0 + - cargo build --release --features=fam-wrappers,kvm-v4_14_0 --target x86_64-unknown-linux-musl + - cargo build --release --features=kvm-v4_14_0 + - cargo build --release --features=kvm-v4_14_0 --target x86_64-unknown-linux-musl + retry: + automatic: false + agents: + platform: x86_64.metal + os: linux + plugins: + - docker#v3.0.1: + image: "rustvmm/dev:v4" + always-pull: true + + # Test release build with kernel bindings 4.20 and fam-wrappers feature. + - label: "build-v4.20-x86" + commands: + - cargo build --release --features=fam-wrappers,kvm-v4_20_0 + - cargo build --release --features=fam-wrappers,kvm-v4_20_0 --target x86_64-unknown-linux-musl + # No need to test the kvm-v4_20_0 because that one is tested by default when no kernel bindings + # feature is specified. + retry: + automatic: false + agents: + platform: x86_64.metal + os: linux + plugins: + - docker#v3.0.1: + image: "rustvmm/dev:v4" + always-pull: true + + - label: "build-v4.14-arm" + commands: + - cargo build --release --features=fam-wrappers,kvm-v4_14_0 + - cargo build --release --features=fam-wrappers,kvm-v4_14_0 --target aarch64-unknown-linux-musl + - cargo build --release --features=kvm-v4_14_0 + - cargo build --release --features=kvm-v4_14_0 --target aarch64-unknown-linux-musl + retry: + automatic: false + agents: + platform: arm.metal + os: linux + plugins: + - docker#v3.0.1: + image: "rustvmm/dev:v4" + always-pull: true + + # Run unit tests for 4.14 bindings. These are the only ones that are not run by the rust-vmm-ci. + - label: "unittests-v4.14-x86" + command: + - cargo test --features=kvm-v4_14_0 + - cargo test --features=kvm-v4_14_0 --target x86_64-unknown-linux-musl + retry: + automatic: false + agents: + platform: x86_64.metal + os: linux + plugins: + - docker#v3.0.1: + image: "rustvmm/dev:v4" + always-pull: true + + - label: "unittests-v4.14-arm" + command: + - cargo test --features=kvm-v4_14_0 + - cargo test --features=kvm-v4_14_0 --target aarch64-unknown-linux-musl + retry: + automatic: false + agents: + platform: arm.metal + os: linux + plugins: + - docker#v3.0.1: + image: "rustvmm/dev:v4" + always-pull: true + + - label: "check-warnings-x86" + commands: + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_14_0,fam-wrappers + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_20_0,fam-wrappers + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_14_0 + retry: + automatic: false + agents: + platform: x86_64.metal + os: linux + plugins: + - docker#v3.0.1: + privileged: true + image: "rustvmm/dev:v4" + always-pull: true + + - label: "check-warnings-arm" + commands: + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_14_0,fam-wrappers + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_20_0,fam-wrappers + - RUSTFLAGS="-D warnings" cargo check --features=kvm-v4_14_0 + retry: + automatic: false + agents: + platform: arm.metal + os: linux + plugins: + - docker#v3.0.1: + privileged: true + image: "rustvmm/dev:v4" + always-pull: true \ No newline at end of file diff --git a/kvm-bindings/.cargo/config b/kvm-bindings/.cargo/config new file mode 100644 index 000000000..bf8523e02 --- /dev/null +++ b/kvm-bindings/.cargo/config @@ -0,0 +1,5 @@ +# This workaround is needed because the linker is unable to find __addtf3, +# __multf3 and __subtf3. +# Related issue: https://github.com/rust-lang/compiler-builtins/issues/201 +[target.aarch64-unknown-linux-musl] +rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"] diff --git a/kvm-bindings/.gitignore b/kvm-bindings/.gitignore new file mode 100644 index 000000000..d889fbf5b --- /dev/null +++ b/kvm-bindings/.gitignore @@ -0,0 +1,4 @@ +/target +**/*.rs.bk +Cargo.lock +.idea diff --git a/kvm-bindings/.gitmodules b/kvm-bindings/.gitmodules new file mode 100644 index 000000000..bda97eb35 --- /dev/null +++ b/kvm-bindings/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rust-vmm-ci"] + path = rust-vmm-ci + url = https://github.com/rust-vmm/rust-vmm-ci.git diff --git a/kvm-bindings/CHANGELOG.md b/kvm-bindings/CHANGELOG.md new file mode 100644 index 000000000..f3a0cc318 --- /dev/null +++ b/kvm-bindings/CHANGELOG.md @@ -0,0 +1,32 @@ +# Changelog + +## [0.3.0] + +### Added + +- Enabled `fam-wrappers` support on arm and arm64. +- Added fam-wrapper for the arm specific `kvm_reg_list` struct. + +## [0.2.0] + +### Added + +- Added opt-in feature `fam-wrappers` that enables exporting + safe wrappers over generated structs with flexible array + members. This optional feature has an external dependency + on `vmm-sys-util`. +- Added safe fam-wrappers for `kvm_msr_list`, `kvm_msrs`, + and `kvm_cpuid2`. + +## [0.1.1] + +### Changed + +- Do not enforce rust Edition 2018. + +## [0.1.0] + +### Added + +- KVM bindings for Linux kernel version 4.14 and 4.20 with + support for arm, arm64, x86 and x86_64. diff --git a/kvm-bindings/CODEOWNERS b/kvm-bindings/CODEOWNERS new file mode 100644 index 000000000..4d96c3f9f --- /dev/null +++ b/kvm-bindings/CODEOWNERS @@ -0,0 +1,2 @@ +# Add the list of code owners here (using their GitHub username) +* gatekeeper-PullAssigner diff --git a/kvm-bindings/CONTRIBUTING.md b/kvm-bindings/CONTRIBUTING.md new file mode 100644 index 000000000..556a441eb --- /dev/null +++ b/kvm-bindings/CONTRIBUTING.md @@ -0,0 +1,81 @@ +# Contributing to kvm-bindings + +## Dependencies + +### Bindgen +The bindings are currently generated using +[bindgen](https://crates.io/crates/bindgen) version 0.46.0: +```bash +cargo install bindgen --vers 0.46.0 +``` + +### Linux Kernel +Generating bindings depends on the Linux kernel, so you need to have the +repository on your machine: + +```bash +git clone https://github.com/torvalds/linux.git +``` + +## Add a new architecture +When adding a new architecture, the bindings must be generated for all existing +versions for consistency reasons. + +### Example for arm64 and version 4.14 and 4.20 + +For this example we assume that you have both linux and kvm-bindings +repositories in your root. + +```bash +# Step 1: Crate a new module using the name of the architecture in src/ +cd kvm-bindings +mkdir src/arm64 +cd ~ + +# linux is the repository that you cloned at the previous step. +cd linux +# Step 2: Checkout the version you want to generate the bindings for. +git checkout v4.14 + +# Step 3: Generate the bindings. +# This will generate the headers for the targeted architecture and place them +# in the user specified directory. In this case, we generate them in the +# arm64_v4_20_headers directory. +make headers_install ARCH=arm64 INSTALL_HDR_PATH=arm64_v4_20_headers +cd arm64_v4_20_headers +bindgen include/linux/kvm.h -o bindings_v4_20_0.rs \ + --with-derive-default + --with-derive-partialeq + -- -Iinclude +cd ~ + +# Step 4: Copy the generated file to the arm64 module. +cp linux/arm64_v4_20_headers/bindings_v4_20_0.rs +``` + +Steps 2, 3 and 4 must be repeated for each of the existing KVM versions. Don't +forget to change the name of the bindings file using the appropriate version. + +Now that we have the bindings generated, we can copy the module file from +one of the existing modules as this is only changed when a new version is +added. + +```bash +cp arm/mod.rs arm64/ +``` + +Also, you will need to add the new architecture to `kvm-bindings/lib.rs`. + +### Future Improvements +All the above steps are scriptable, so in the next iteration I will add a +script to generate the bindings. + +# Testing + +This crate is tested using +[rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) and +[Buildkite](https://buildkite.com/) pipelines. Each new feature added to this crate must be +accompanied by Buildkite steps for testing the following: +- Release builds (using musl/gnu) with the new feature on arm and x86 +- Coverage test as specified in the +[rust-vmm-ci readme](https://github.com/rust-vmm/rust-vmm-ci#getting-started-with-rust-vmm-ci). diff --git a/kvm-bindings/Cargo.toml b/kvm-bindings/Cargo.toml new file mode 100644 index 000000000..918ec3842 --- /dev/null +++ b/kvm-bindings/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "kvm-bindings" +version = "0.3.0" +authors = ["Amazon firecracker team "] +description = "Rust FFI bindings to KVM generated using bindgen." +repository = "https://github.com/rust-vmm/kvm-bindings" +readme = "README.md" +keywords = ["kvm"] +license = "Apache-2.0" + +[features] +kvm-v4_14_0 = [] +kvm-v4_20_0 = [] +fam-wrappers = ["vmm-sys-util"] + +[dependencies] +vmm-sys-util = { version = ">=0.2.0", optional = true } diff --git a/kvm-bindings/LICENSE b/kvm-bindings/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/kvm-bindings/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/kvm-bindings/README.md b/kvm-bindings/README.md new file mode 100644 index 000000000..04b1872a3 --- /dev/null +++ b/kvm-bindings/README.md @@ -0,0 +1,44 @@ +[![Build Status](https://travis-ci.org/rust-vmm/kvm-bindings.svg?branch=master)](https://travis-ci.org/rust-vmm/kvm-bindings) +[![Crates.io](https://img.shields.io/crates/v/kvm-bindings.svg)](https://crates.io/crates/kvm-bindings) +![](https://img.shields.io/crates/l/kvm-bindings.svg) +# kvm-bindings +Rust FFI bindings to KVM generated using +[bindgen](https://crates.io/crates/bindgen). It currently has support for the +following target architectures: +- x86 +- x86_64 +- arm +- arm64 + +# Usage +First, add the following to your `Cargo.toml`: +```toml +kvm-bindings = "0.1" +``` +Next, add this to your crate root: +```rust +extern crate kvm_bindings; +``` +By default `kvm-bindings` will export a wrapper over the latest available kernel +version (4.20), but you can select a different version by specifying it in your +toml: +```toml +kvm-bindings = { version = "0.1", features = ["kvm_v4_20_0"]} +``` +Bindings are generated for each specific Linux kernel version based on the enabled +crate features as follows: +- `kvm_v4_14_0` contains the bindings for the Linux kernel version 4.14 +- `kvm_v4_20_0` contains the bindings for the Linux kernel version 4.20 + +This crate also offers safe wrappers over FAM structs - FFI structs that have +a Flexible Array Member in their definition. +These safe wrappers can be used if the `fam-wrappers` feature is enabled for +this crate. Example: +```toml +kvm-bindings = { version = "0.1", features = ["kvm_v4_20_0", "fam-wrappers"]} +``` + +# Dependencies +The crate has an `optional` dependency to +[vmm-sys-util](https://crates.io/crates/vmm-sys-util) when enabling the +`fam-wrappers` feature. diff --git a/kvm-bindings/coverage_config.json b/kvm-bindings/coverage_config.json new file mode 100644 index 000000000..c987837f0 --- /dev/null +++ b/kvm-bindings/coverage_config.json @@ -0,0 +1,5 @@ +{ + "coverage_score": 67.4, + "exclude_path": "", + "crate_features": "fam-wrappers" +} diff --git a/kvm-bindings/src/arm/bindings_v4_14_0.rs b/kvm-bindings/src/arm/bindings_v4_14_0.rs new file mode 100644 index 000000000..de2f91587 --- /dev/null +++ b/kvm-bindings/src/arm/bindings_v4_14_0.rs @@ -0,0 +1,6879 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 32; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const PSCI_0_2_FN_BASE: u32 = 2214592512; +pub const PSCI_0_2_64BIT: u32 = 1073741824; +pub const PSCI_0_2_FN64_BASE: u32 = 3288334336; +pub const PSCI_0_2_POWER_STATE_ID_MASK: u32 = 65535; +pub const PSCI_0_2_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_0_2_POWER_STATE_TYPE_SHIFT: u32 = 16; +pub const PSCI_0_2_POWER_STATE_TYPE_MASK: u32 = 65536; +pub const PSCI_0_2_POWER_STATE_AFFL_SHIFT: u32 = 24; +pub const PSCI_0_2_POWER_STATE_AFFL_MASK: u32 = 50331648; +pub const PSCI_1_0_EXT_POWER_STATE_ID_MASK: u32 = 268435455; +pub const PSCI_1_0_EXT_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT: u32 = 30; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_MASK: u32 = 1073741824; +pub const PSCI_0_2_AFFINITY_LEVEL_ON: u32 = 0; +pub const PSCI_0_2_AFFINITY_LEVEL_OFF: u32 = 1; +pub const PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: u32 = 2; +pub const PSCI_0_2_TOS_UP_MIGRATE: u32 = 0; +pub const PSCI_0_2_TOS_UP_NO_MIGRATE: u32 = 1; +pub const PSCI_0_2_TOS_MP: u32 = 2; +pub const PSCI_VERSION_MAJOR_SHIFT: u32 = 16; +pub const PSCI_VERSION_MINOR_MASK: u32 = 65535; +pub const PSCI_VERSION_MAJOR_MASK: i32 = -65536; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT: u32 = 1; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK: u32 = 2; +pub const PSCI_RET_SUCCESS: u32 = 0; +pub const PSCI_RET_NOT_SUPPORTED: i32 = -1; +pub const PSCI_RET_INVALID_PARAMS: i32 = -2; +pub const PSCI_RET_DENIED: i32 = -3; +pub const PSCI_RET_ALREADY_ON: i32 = -4; +pub const PSCI_RET_ON_PENDING: i32 = -5; +pub const PSCI_RET_INTERNAL_FAILURE: i32 = -6; +pub const PSCI_RET_NOT_PRESENT: i32 = -7; +pub const PSCI_RET_DISABLED: i32 = -8; +pub const PSCI_RET_INVALID_ADDRESS: i32 = -9; +pub const HWCAP_SWP: u32 = 1; +pub const HWCAP_HALF: u32 = 2; +pub const HWCAP_THUMB: u32 = 4; +pub const HWCAP_26BIT: u32 = 8; +pub const HWCAP_FAST_MULT: u32 = 16; +pub const HWCAP_FPA: u32 = 32; +pub const HWCAP_VFP: u32 = 64; +pub const HWCAP_EDSP: u32 = 128; +pub const HWCAP_JAVA: u32 = 256; +pub const HWCAP_IWMMXT: u32 = 512; +pub const HWCAP_CRUNCH: u32 = 1024; +pub const HWCAP_THUMBEE: u32 = 2048; +pub const HWCAP_NEON: u32 = 4096; +pub const HWCAP_VFPv3: u32 = 8192; +pub const HWCAP_VFPv3D16: u32 = 16384; +pub const HWCAP_TLS: u32 = 32768; +pub const HWCAP_VFPv4: u32 = 65536; +pub const HWCAP_IDIVA: u32 = 131072; +pub const HWCAP_IDIVT: u32 = 262144; +pub const HWCAP_VFPD32: u32 = 524288; +pub const HWCAP_IDIV: u32 = 393216; +pub const HWCAP_LPAE: u32 = 1048576; +pub const HWCAP_EVTSTRM: u32 = 2097152; +pub const HWCAP2_AES: u32 = 1; +pub const HWCAP2_PMULL: u32 = 2; +pub const HWCAP2_SHA1: u32 = 4; +pub const HWCAP2_SHA2: u32 = 8; +pub const HWCAP2_CRC32: u32 = 16; +pub const PTRACE_GETREGS: u32 = 12; +pub const PTRACE_SETREGS: u32 = 13; +pub const PTRACE_GETFPREGS: u32 = 14; +pub const PTRACE_SETFPREGS: u32 = 15; +pub const PTRACE_GETWMMXREGS: u32 = 18; +pub const PTRACE_SETWMMXREGS: u32 = 19; +pub const PTRACE_OLDSETOPTIONS: u32 = 21; +pub const PTRACE_GET_THREAD_AREA: u32 = 22; +pub const PTRACE_SET_SYSCALL: u32 = 23; +pub const PTRACE_GETCRUNCHREGS: u32 = 25; +pub const PTRACE_SETCRUNCHREGS: u32 = 26; +pub const PTRACE_GETVFPREGS: u32 = 27; +pub const PTRACE_SETVFPREGS: u32 = 28; +pub const PTRACE_GETHBPREGS: u32 = 29; +pub const PTRACE_SETHBPREGS: u32 = 30; +pub const USR26_MODE: u32 = 0; +pub const FIQ26_MODE: u32 = 1; +pub const IRQ26_MODE: u32 = 2; +pub const SVC26_MODE: u32 = 3; +pub const USR_MODE: u32 = 16; +pub const SVC_MODE: u32 = 19; +pub const FIQ_MODE: u32 = 17; +pub const IRQ_MODE: u32 = 18; +pub const ABT_MODE: u32 = 23; +pub const HYP_MODE: u32 = 26; +pub const UND_MODE: u32 = 27; +pub const SYSTEM_MODE: u32 = 31; +pub const MODE32_BIT: u32 = 16; +pub const MODE_MASK: u32 = 31; +pub const V4_PSR_T_BIT: u32 = 32; +pub const V7M_PSR_T_BIT: u32 = 16777216; +pub const PSR_T_BIT: u32 = 32; +pub const PSR_F_BIT: u32 = 64; +pub const PSR_I_BIT: u32 = 128; +pub const PSR_A_BIT: u32 = 256; +pub const PSR_E_BIT: u32 = 512; +pub const PSR_J_BIT: u32 = 16777216; +pub const PSR_Q_BIT: u32 = 134217728; +pub const PSR_V_BIT: u32 = 268435456; +pub const PSR_C_BIT: u32 = 536870912; +pub const PSR_Z_BIT: u32 = 1073741824; +pub const PSR_N_BIT: u32 = 2147483648; +pub const PSR_f: u32 = 4278190080; +pub const PSR_s: u32 = 16711680; +pub const PSR_x: u32 = 65280; +pub const PSR_c: u32 = 255; +pub const APSR_MASK: u32 = 4161732608; +pub const PSR_ISET_MASK: u32 = 16777232; +pub const PSR_IT_MASK: u32 = 100727808; +pub const PSR_ENDIAN_MASK: u32 = 512; +pub const PSR_ENDSTATE: u32 = 0; +pub const PT_TEXT_ADDR: u32 = 65536; +pub const PT_DATA_ADDR: u32 = 65540; +pub const PT_TEXT_END_ADDR: u32 = 65544; +pub const ARM_VFPREGS_SIZE: u32 = 260; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_ARM_TARGET_CORTEX_A15: u32 = 0; +pub const KVM_ARM_TARGET_CORTEX_A7: u32 = 1; +pub const KVM_ARM_NUM_TARGETS: u32 = 2; +pub const KVM_ARM_DEVICE_TYPE_SHIFT: u32 = 0; +pub const KVM_ARM_DEVICE_TYPE_MASK: u32 = 65535; +pub const KVM_ARM_DEVICE_ID_SHIFT: u32 = 16; +pub const KVM_ARM_DEVICE_ID_MASK: u32 = 4294901760; +pub const KVM_ARM_DEVICE_VGIC_V2: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_DIST: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_CPU: u32 = 1; +pub const KVM_VGIC_V2_DIST_SIZE: u32 = 4096; +pub const KVM_VGIC_V2_CPU_SIZE: u32 = 8192; +pub const KVM_VGIC_V3_ADDR_TYPE_DIST: u32 = 2; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST: u32 = 3; +pub const KVM_VGIC_ITS_ADDR_TYPE: u32 = 4; +pub const KVM_ARM_VCPU_POWER_OFF: u32 = 0; +pub const KVM_ARM_VCPU_PSCI_0_2: u32 = 1; +pub const KVM_REG_ARM_COPROC_MASK: u32 = 268369920; +pub const KVM_REG_ARM_COPROC_SHIFT: u32 = 16; +pub const KVM_REG_ARM_32_OPC2_MASK: u32 = 7; +pub const KVM_REG_ARM_32_OPC2_SHIFT: u32 = 0; +pub const KVM_REG_ARM_OPC1_MASK: u32 = 120; +pub const KVM_REG_ARM_OPC1_SHIFT: u32 = 3; +pub const KVM_REG_ARM_CRM_MASK: u32 = 1920; +pub const KVM_REG_ARM_CRM_SHIFT: u32 = 7; +pub const KVM_REG_ARM_32_CRN_MASK: u32 = 30720; +pub const KVM_REG_ARM_32_CRN_SHIFT: u32 = 11; +pub const KVM_REG_ARM_CORE: u32 = 1048576; +pub const KVM_REG_ARM_DEMUX: u32 = 1114112; +pub const KVM_REG_ARM_DEMUX_ID_MASK: u32 = 65280; +pub const KVM_REG_ARM_DEMUX_ID_SHIFT: u32 = 8; +pub const KVM_REG_ARM_DEMUX_ID_CCSIDR: u32 = 0; +pub const KVM_REG_ARM_DEMUX_VAL_MASK: u32 = 255; +pub const KVM_REG_ARM_DEMUX_VAL_SHIFT: u32 = 0; +pub const KVM_REG_ARM_VFP: u32 = 1179648; +pub const KVM_REG_ARM_VFP_MASK: u32 = 65535; +pub const KVM_REG_ARM_VFP_BASE_REG: u32 = 0; +pub const KVM_REG_ARM_VFP_FPSID: u32 = 4096; +pub const KVM_REG_ARM_VFP_FPSCR: u32 = 4097; +pub const KVM_REG_ARM_VFP_MVFR1: u32 = 4102; +pub const KVM_REG_ARM_VFP_MVFR0: u32 = 4103; +pub const KVM_REG_ARM_VFP_FPEXC: u32 = 4104; +pub const KVM_REG_ARM_VFP_FPINST: u32 = 4105; +pub const KVM_REG_ARM_VFP_FPINST2: u32 = 4106; +pub const KVM_DEV_ARM_VGIC_GRP_ADDR: u32 = 0; +pub const KVM_DEV_ARM_VGIC_GRP_DIST_REGS: u32 = 1; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_REGS: u32 = 2; +pub const KVM_DEV_ARM_VGIC_CPUID_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_CPUID_MASK: u64 = 1095216660480; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_MASK: i64 = -4294967296; +pub const KVM_DEV_ARM_VGIC_OFFSET_SHIFT: u32 = 0; +pub const KVM_DEV_ARM_VGIC_OFFSET_MASK: u32 = 4294967295; +pub const KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK: u32 = 65535; +pub const KVM_DEV_ARM_VGIC_GRP_NR_IRQS: u32 = 3; +pub const KVM_DEV_ARM_VGIC_GRP_CTRL: u32 = 4; +pub const KVM_DEV_ARM_VGIC_GRP_REDIST_REGS: u32 = 5; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: u32 = 6; +pub const KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO: u32 = 7; +pub const KVM_DEV_ARM_VGIC_GRP_ITS_REGS: u32 = 8; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT: u32 = 10; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK: u32 = 4294966272; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK: u32 = 1023; +pub const VGIC_LEVEL_INFO_LINE_LEVEL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_CTRL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_IRQ: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_INIT: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_CTRL: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_IRQ_VTIMER: u32 = 0; +pub const KVM_ARM_VCPU_TIMER_IRQ_PTIMER: u32 = 1; +pub const KVM_DEV_ARM_VGIC_CTRL_INIT: u32 = 0; +pub const KVM_DEV_ARM_ITS_SAVE_TABLES: u32 = 1; +pub const KVM_DEV_ARM_ITS_RESTORE_TABLES: u32 = 2; +pub const KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES: u32 = 3; +pub const KVM_ARM_IRQ_TYPE_SHIFT: u32 = 24; +pub const KVM_ARM_IRQ_TYPE_MASK: u32 = 255; +pub const KVM_ARM_IRQ_VCPU_SHIFT: u32 = 16; +pub const KVM_ARM_IRQ_VCPU_MASK: u32 = 255; +pub const KVM_ARM_IRQ_NUM_SHIFT: u32 = 0; +pub const KVM_ARM_IRQ_NUM_MASK: u32 = 65535; +pub const KVM_ARM_IRQ_TYPE_CPU: u32 = 0; +pub const KVM_ARM_IRQ_TYPE_SPI: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_PPI: u32 = 2; +pub const KVM_ARM_IRQ_CPU_IRQ: u32 = 0; +pub const KVM_ARM_IRQ_CPU_FIQ: u32 = 1; +pub const KVM_ARM_IRQ_GIC_MAX: u32 = 127; +pub const KVM_NR_IRQCHIPS: u32 = 1; +pub const KVM_PSCI_FN_BASE: u32 = 2512501342; +pub const KVM_PSCI_RET_SUCCESS: u32 = 0; +pub const KVM_PSCI_RET_NI: i32 = -1; +pub const KVM_PSCI_RET_INVAL: i32 = -2; +pub const KVM_PSCI_RET_DENIED: i32 = -3; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_GUEST_MWAIT: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_mode_t = ::std::os::raw::c_ushort; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_ushort; +pub type __kernel_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_uid_t = __kernel_uid_t; +pub type __kernel_old_gid_t = __kernel_gid_t; +pub type __kernel_size_t = ::std::os::raw::c_uint; +pub type __kernel_ssize_t = ::std::os::raw::c_int; +pub type __kernel_ptrdiff_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct pt_regs { + pub uregs: [::std::os::raw::c_long; 18usize], +} +#[test] +fn bindgen_test_layout_pt_regs() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(pt_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pt_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uregs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pt_regs), + "::", + stringify!(uregs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub usr_regs: pt_regs, + pub svc_regs: [::std::os::raw::c_ulong; 3usize], + pub abt_regs: [::std::os::raw::c_ulong; 3usize], + pub und_regs: [::std::os::raw::c_ulong; 3usize], + pub irq_regs: [::std::os::raw::c_ulong; 3usize], + pub fiq_regs: [::std::os::raw::c_ulong; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 304usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usr_regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(usr_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).svc_regs as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(svc_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).abt_regs as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(abt_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).und_regs as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(und_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq_regs as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(irq_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fiq_regs as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(fiq_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_init { + pub target: __u32, + pub features: [__u32; 7usize], +} +#[test] +fn bindgen_test_layout_kvm_vcpu_init() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).target as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(target) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).features as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(features) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs {} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu {} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch {} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch {} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs { + pub device_irq_level: __u64, +} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).device_irq_level as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(device_irq_level) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arch_memory_slot {} +#[test] +fn bindgen_test_layout_kvm_arch_memory_slot() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_arch_memory_slot)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_arch_memory_slot)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + _bindgen_union_align: [u8; 512usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u64; 256usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub pad: __u32, + pub data: [__u8; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} diff --git a/kvm-bindings/src/arm/bindings_v4_20_0.rs b/kvm-bindings/src/arm/bindings_v4_20_0.rs new file mode 100644 index 000000000..ce2e38ac2 --- /dev/null +++ b/kvm-bindings/src/arm/bindings_v4_20_0.rs @@ -0,0 +1,7667 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 32; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const PSCI_0_2_FN_BASE: u32 = 2214592512; +pub const PSCI_0_2_64BIT: u32 = 1073741824; +pub const PSCI_0_2_FN64_BASE: u32 = 3288334336; +pub const PSCI_0_2_POWER_STATE_ID_MASK: u32 = 65535; +pub const PSCI_0_2_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_0_2_POWER_STATE_TYPE_SHIFT: u32 = 16; +pub const PSCI_0_2_POWER_STATE_TYPE_MASK: u32 = 65536; +pub const PSCI_0_2_POWER_STATE_AFFL_SHIFT: u32 = 24; +pub const PSCI_0_2_POWER_STATE_AFFL_MASK: u32 = 50331648; +pub const PSCI_1_0_EXT_POWER_STATE_ID_MASK: u32 = 268435455; +pub const PSCI_1_0_EXT_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT: u32 = 30; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_MASK: u32 = 1073741824; +pub const PSCI_0_2_AFFINITY_LEVEL_ON: u32 = 0; +pub const PSCI_0_2_AFFINITY_LEVEL_OFF: u32 = 1; +pub const PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: u32 = 2; +pub const PSCI_0_2_TOS_UP_MIGRATE: u32 = 0; +pub const PSCI_0_2_TOS_UP_NO_MIGRATE: u32 = 1; +pub const PSCI_0_2_TOS_MP: u32 = 2; +pub const PSCI_VERSION_MAJOR_SHIFT: u32 = 16; +pub const PSCI_VERSION_MINOR_MASK: u32 = 65535; +pub const PSCI_VERSION_MAJOR_MASK: i32 = -65536; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT: u32 = 1; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK: u32 = 2; +pub const PSCI_RET_SUCCESS: u32 = 0; +pub const PSCI_RET_NOT_SUPPORTED: i32 = -1; +pub const PSCI_RET_INVALID_PARAMS: i32 = -2; +pub const PSCI_RET_DENIED: i32 = -3; +pub const PSCI_RET_ALREADY_ON: i32 = -4; +pub const PSCI_RET_ON_PENDING: i32 = -5; +pub const PSCI_RET_INTERNAL_FAILURE: i32 = -6; +pub const PSCI_RET_NOT_PRESENT: i32 = -7; +pub const PSCI_RET_DISABLED: i32 = -8; +pub const PSCI_RET_INVALID_ADDRESS: i32 = -9; +pub const HWCAP_SWP: u32 = 1; +pub const HWCAP_HALF: u32 = 2; +pub const HWCAP_THUMB: u32 = 4; +pub const HWCAP_26BIT: u32 = 8; +pub const HWCAP_FAST_MULT: u32 = 16; +pub const HWCAP_FPA: u32 = 32; +pub const HWCAP_VFP: u32 = 64; +pub const HWCAP_EDSP: u32 = 128; +pub const HWCAP_JAVA: u32 = 256; +pub const HWCAP_IWMMXT: u32 = 512; +pub const HWCAP_CRUNCH: u32 = 1024; +pub const HWCAP_THUMBEE: u32 = 2048; +pub const HWCAP_NEON: u32 = 4096; +pub const HWCAP_VFPv3: u32 = 8192; +pub const HWCAP_VFPv3D16: u32 = 16384; +pub const HWCAP_TLS: u32 = 32768; +pub const HWCAP_VFPv4: u32 = 65536; +pub const HWCAP_IDIVA: u32 = 131072; +pub const HWCAP_IDIVT: u32 = 262144; +pub const HWCAP_VFPD32: u32 = 524288; +pub const HWCAP_IDIV: u32 = 393216; +pub const HWCAP_LPAE: u32 = 1048576; +pub const HWCAP_EVTSTRM: u32 = 2097152; +pub const HWCAP2_AES: u32 = 1; +pub const HWCAP2_PMULL: u32 = 2; +pub const HWCAP2_SHA1: u32 = 4; +pub const HWCAP2_SHA2: u32 = 8; +pub const HWCAP2_CRC32: u32 = 16; +pub const PTRACE_GETREGS: u32 = 12; +pub const PTRACE_SETREGS: u32 = 13; +pub const PTRACE_GETFPREGS: u32 = 14; +pub const PTRACE_SETFPREGS: u32 = 15; +pub const PTRACE_GETWMMXREGS: u32 = 18; +pub const PTRACE_SETWMMXREGS: u32 = 19; +pub const PTRACE_OLDSETOPTIONS: u32 = 21; +pub const PTRACE_GET_THREAD_AREA: u32 = 22; +pub const PTRACE_SET_SYSCALL: u32 = 23; +pub const PTRACE_GETCRUNCHREGS: u32 = 25; +pub const PTRACE_SETCRUNCHREGS: u32 = 26; +pub const PTRACE_GETVFPREGS: u32 = 27; +pub const PTRACE_SETVFPREGS: u32 = 28; +pub const PTRACE_GETHBPREGS: u32 = 29; +pub const PTRACE_SETHBPREGS: u32 = 30; +pub const PTRACE_GETFDPIC: u32 = 31; +pub const PTRACE_GETFDPIC_EXEC: u32 = 0; +pub const PTRACE_GETFDPIC_INTERP: u32 = 1; +pub const USR26_MODE: u32 = 0; +pub const FIQ26_MODE: u32 = 1; +pub const IRQ26_MODE: u32 = 2; +pub const SVC26_MODE: u32 = 3; +pub const USR_MODE: u32 = 16; +pub const SVC_MODE: u32 = 19; +pub const FIQ_MODE: u32 = 17; +pub const IRQ_MODE: u32 = 18; +pub const MON_MODE: u32 = 22; +pub const ABT_MODE: u32 = 23; +pub const HYP_MODE: u32 = 26; +pub const UND_MODE: u32 = 27; +pub const SYSTEM_MODE: u32 = 31; +pub const MODE32_BIT: u32 = 16; +pub const MODE_MASK: u32 = 31; +pub const V4_PSR_T_BIT: u32 = 32; +pub const V7M_PSR_T_BIT: u32 = 16777216; +pub const PSR_T_BIT: u32 = 32; +pub const PSR_F_BIT: u32 = 64; +pub const PSR_I_BIT: u32 = 128; +pub const PSR_A_BIT: u32 = 256; +pub const PSR_E_BIT: u32 = 512; +pub const PSR_J_BIT: u32 = 16777216; +pub const PSR_Q_BIT: u32 = 134217728; +pub const PSR_V_BIT: u32 = 268435456; +pub const PSR_C_BIT: u32 = 536870912; +pub const PSR_Z_BIT: u32 = 1073741824; +pub const PSR_N_BIT: u32 = 2147483648; +pub const PSR_f: u32 = 4278190080; +pub const PSR_s: u32 = 16711680; +pub const PSR_x: u32 = 65280; +pub const PSR_c: u32 = 255; +pub const APSR_MASK: u32 = 4161732608; +pub const PSR_ISET_MASK: u32 = 16777232; +pub const PSR_IT_MASK: u32 = 100727808; +pub const PSR_ENDIAN_MASK: u32 = 512; +pub const PSR_ENDSTATE: u32 = 0; +pub const PT_TEXT_ADDR: u32 = 65536; +pub const PT_DATA_ADDR: u32 = 65540; +pub const PT_TEXT_END_ADDR: u32 = 65544; +pub const ARM_VFPREGS_SIZE: u32 = 260; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_ARM_TARGET_CORTEX_A15: u32 = 0; +pub const KVM_ARM_TARGET_CORTEX_A7: u32 = 1; +pub const KVM_ARM_NUM_TARGETS: u32 = 2; +pub const KVM_ARM_DEVICE_TYPE_SHIFT: u32 = 0; +pub const KVM_ARM_DEVICE_TYPE_MASK: u32 = 65535; +pub const KVM_ARM_DEVICE_ID_SHIFT: u32 = 16; +pub const KVM_ARM_DEVICE_ID_MASK: u32 = 4294901760; +pub const KVM_ARM_DEVICE_VGIC_V2: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_DIST: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_CPU: u32 = 1; +pub const KVM_VGIC_V2_DIST_SIZE: u32 = 4096; +pub const KVM_VGIC_V2_CPU_SIZE: u32 = 8192; +pub const KVM_VGIC_V3_ADDR_TYPE_DIST: u32 = 2; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST: u32 = 3; +pub const KVM_VGIC_ITS_ADDR_TYPE: u32 = 4; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION: u32 = 5; +pub const KVM_ARM_VCPU_POWER_OFF: u32 = 0; +pub const KVM_ARM_VCPU_PSCI_0_2: u32 = 1; +pub const KVM_REG_ARM_COPROC_MASK: u32 = 268369920; +pub const KVM_REG_ARM_COPROC_SHIFT: u32 = 16; +pub const KVM_REG_ARM_32_OPC2_MASK: u32 = 7; +pub const KVM_REG_ARM_32_OPC2_SHIFT: u32 = 0; +pub const KVM_REG_ARM_OPC1_MASK: u32 = 120; +pub const KVM_REG_ARM_OPC1_SHIFT: u32 = 3; +pub const KVM_REG_ARM_CRM_MASK: u32 = 1920; +pub const KVM_REG_ARM_CRM_SHIFT: u32 = 7; +pub const KVM_REG_ARM_32_CRN_MASK: u32 = 30720; +pub const KVM_REG_ARM_32_CRN_SHIFT: u32 = 11; +pub const KVM_REG_ARM_SECURE_MASK: u32 = 268435456; +pub const KVM_REG_ARM_SECURE_SHIFT: u32 = 28; +pub const KVM_REG_ARM_CORE: u32 = 1048576; +pub const KVM_REG_ARM_DEMUX: u32 = 1114112; +pub const KVM_REG_ARM_DEMUX_ID_MASK: u32 = 65280; +pub const KVM_REG_ARM_DEMUX_ID_SHIFT: u32 = 8; +pub const KVM_REG_ARM_DEMUX_ID_CCSIDR: u32 = 0; +pub const KVM_REG_ARM_DEMUX_VAL_MASK: u32 = 255; +pub const KVM_REG_ARM_DEMUX_VAL_SHIFT: u32 = 0; +pub const KVM_REG_ARM_VFP: u32 = 1179648; +pub const KVM_REG_ARM_VFP_MASK: u32 = 65535; +pub const KVM_REG_ARM_VFP_BASE_REG: u32 = 0; +pub const KVM_REG_ARM_VFP_FPSID: u32 = 4096; +pub const KVM_REG_ARM_VFP_FPSCR: u32 = 4097; +pub const KVM_REG_ARM_VFP_MVFR1: u32 = 4102; +pub const KVM_REG_ARM_VFP_MVFR0: u32 = 4103; +pub const KVM_REG_ARM_VFP_FPEXC: u32 = 4104; +pub const KVM_REG_ARM_VFP_FPINST: u32 = 4105; +pub const KVM_REG_ARM_VFP_FPINST2: u32 = 4106; +pub const KVM_REG_ARM_FW: u32 = 1310720; +pub const KVM_DEV_ARM_VGIC_GRP_ADDR: u32 = 0; +pub const KVM_DEV_ARM_VGIC_GRP_DIST_REGS: u32 = 1; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_REGS: u32 = 2; +pub const KVM_DEV_ARM_VGIC_CPUID_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_CPUID_MASK: u64 = 1095216660480; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_MASK: i64 = -4294967296; +pub const KVM_DEV_ARM_VGIC_OFFSET_SHIFT: u32 = 0; +pub const KVM_DEV_ARM_VGIC_OFFSET_MASK: u32 = 4294967295; +pub const KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK: u32 = 65535; +pub const KVM_DEV_ARM_VGIC_GRP_NR_IRQS: u32 = 3; +pub const KVM_DEV_ARM_VGIC_GRP_CTRL: u32 = 4; +pub const KVM_DEV_ARM_VGIC_GRP_REDIST_REGS: u32 = 5; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: u32 = 6; +pub const KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO: u32 = 7; +pub const KVM_DEV_ARM_VGIC_GRP_ITS_REGS: u32 = 8; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT: u32 = 10; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK: u32 = 4294966272; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK: u32 = 1023; +pub const VGIC_LEVEL_INFO_LINE_LEVEL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_CTRL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_IRQ: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_INIT: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_CTRL: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_IRQ_VTIMER: u32 = 0; +pub const KVM_ARM_VCPU_TIMER_IRQ_PTIMER: u32 = 1; +pub const KVM_DEV_ARM_VGIC_CTRL_INIT: u32 = 0; +pub const KVM_DEV_ARM_ITS_SAVE_TABLES: u32 = 1; +pub const KVM_DEV_ARM_ITS_RESTORE_TABLES: u32 = 2; +pub const KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES: u32 = 3; +pub const KVM_DEV_ARM_ITS_CTRL_RESET: u32 = 4; +pub const KVM_ARM_IRQ_TYPE_SHIFT: u32 = 24; +pub const KVM_ARM_IRQ_TYPE_MASK: u32 = 255; +pub const KVM_ARM_IRQ_VCPU_SHIFT: u32 = 16; +pub const KVM_ARM_IRQ_VCPU_MASK: u32 = 255; +pub const KVM_ARM_IRQ_NUM_SHIFT: u32 = 0; +pub const KVM_ARM_IRQ_NUM_MASK: u32 = 65535; +pub const KVM_ARM_IRQ_TYPE_CPU: u32 = 0; +pub const KVM_ARM_IRQ_TYPE_SPI: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_PPI: u32 = 2; +pub const KVM_ARM_IRQ_CPU_IRQ: u32 = 0; +pub const KVM_ARM_IRQ_CPU_FIQ: u32 = 1; +pub const KVM_ARM_IRQ_GIC_MAX: u32 = 127; +pub const KVM_NR_IRQCHIPS: u32 = 1; +pub const KVM_PSCI_FN_BASE: u32 = 2512501342; +pub const KVM_PSCI_RET_SUCCESS: u32 = 0; +pub const KVM_PSCI_RET_NI: i32 = -1; +pub const KVM_PSCI_RET_INVAL: i32 = -2; +pub const KVM_PSCI_RET_DENIED: i32 = -3; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_MWAIT: u32 = 1; +pub const KVM_X86_DISABLE_EXITS_HLT: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_PAUSE: u32 = 4; +pub const KVM_X86_DISABLE_VALID_EXITS: u32 = 7; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVM_PPC_NO_HASH: u32 = 4; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_VM_TYPE_ARM_IPA_SIZE_MASK: u32 = 255; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_VCPU_EVENTS: u32 = 41; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_DISABLE_EXITS: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_CAP_S390_AIS_MIGRATION: u32 = 150; +pub const KVM_CAP_PPC_GET_CPU_CHAR: u32 = 151; +pub const KVM_CAP_S390_BPB: u32 = 152; +pub const KVM_CAP_GET_MSR_FEATURES: u32 = 153; +pub const KVM_CAP_HYPERV_EVENTFD: u32 = 154; +pub const KVM_CAP_HYPERV_TLBFLUSH: u32 = 155; +pub const KVM_CAP_S390_HPAGE_1M: u32 = 156; +pub const KVM_CAP_NESTED_STATE: u32 = 157; +pub const KVM_CAP_ARM_INJECT_SERROR_ESR: u32 = 158; +pub const KVM_CAP_MSR_PLATFORM_INFO: u32 = 159; +pub const KVM_CAP_PPC_NESTED_HV: u32 = 160; +pub const KVM_CAP_HYPERV_SEND_IPI: u32 = 161; +pub const KVM_CAP_COALESCED_PIO: u32 = 162; +pub const KVM_CAP_HYPERV_ENLIGHTENED_VMCS: u32 = 163; +pub const KVM_CAP_EXCEPTION_PAYLOAD: u32 = 164; +pub const KVM_CAP_ARM_VM_IPA_SIZE: u32 = 165; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub const KVM_HYPERV_CONN_ID_MASK: u32 = 16777215; +pub const KVM_HYPERV_EVENTFD_DEASSIGN: u32 = 1; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_mode_t = ::std::os::raw::c_ushort; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_ushort; +pub type __kernel_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_uid_t = __kernel_uid_t; +pub type __kernel_old_gid_t = __kernel_gid_t; +pub type __kernel_size_t = ::std::os::raw::c_uint; +pub type __kernel_ssize_t = ::std::os::raw::c_int; +pub type __kernel_ptrdiff_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct pt_regs { + pub uregs: [::std::os::raw::c_long; 18usize], +} +#[test] +fn bindgen_test_layout_pt_regs() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(pt_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pt_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uregs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pt_regs), + "::", + stringify!(uregs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub usr_regs: pt_regs, + pub svc_regs: [::std::os::raw::c_ulong; 3usize], + pub abt_regs: [::std::os::raw::c_ulong; 3usize], + pub und_regs: [::std::os::raw::c_ulong; 3usize], + pub irq_regs: [::std::os::raw::c_ulong; 3usize], + pub fiq_regs: [::std::os::raw::c_ulong; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 304usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usr_regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(usr_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).svc_regs as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(svc_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).abt_regs as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(abt_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).und_regs as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(und_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq_regs as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(irq_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fiq_regs as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(fiq_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_init { + pub target: __u32, + pub features: [__u32; 7usize], +} +#[test] +fn bindgen_test_layout_kvm_vcpu_init() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).target as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(target) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).features as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(features) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs {} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu {} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch {} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch {} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs { + pub device_irq_level: __u64, +} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).device_irq_level as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(device_irq_level) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arch_memory_slot {} +#[test] +fn bindgen_test_layout_kvm_arch_memory_slot() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_arch_memory_slot)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_arch_memory_slot)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events { + pub exception: kvm_vcpu_events__bindgen_ty_1, + pub reserved: [__u32; 12usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_1 { + pub serror_pending: __u8, + pub serror_has_esr: __u8, + pub pad: [__u8; 6usize], + pub serror_esr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_pending as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_has_esr as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_has_esr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_esr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_esr) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + _bindgen_union_align: [u8; 512usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u64; 256usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio_zone__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio_zone__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio__bindgen_ty_1, + pub data: [__u8; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_coalesced_mmio { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +impl Default for kvm_coalesced_mmio_ring { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_enc_region { + pub addr: __u64, + pub size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_enc_region() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_enc_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enc_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(size) + ) + ); +} +pub const sev_cmd_id_KVM_SEV_INIT: sev_cmd_id = 0; +pub const sev_cmd_id_KVM_SEV_ES_INIT: sev_cmd_id = 1; +pub const sev_cmd_id_KVM_SEV_LAUNCH_START: sev_cmd_id = 2; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_DATA: sev_cmd_id = 3; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_VMSA: sev_cmd_id = 4; +pub const sev_cmd_id_KVM_SEV_LAUNCH_SECRET: sev_cmd_id = 5; +pub const sev_cmd_id_KVM_SEV_LAUNCH_MEASURE: sev_cmd_id = 6; +pub const sev_cmd_id_KVM_SEV_LAUNCH_FINISH: sev_cmd_id = 7; +pub const sev_cmd_id_KVM_SEV_SEND_START: sev_cmd_id = 8; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_DATA: sev_cmd_id = 9; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_VMSA: sev_cmd_id = 10; +pub const sev_cmd_id_KVM_SEV_SEND_FINISH: sev_cmd_id = 11; +pub const sev_cmd_id_KVM_SEV_RECEIVE_START: sev_cmd_id = 12; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_DATA: sev_cmd_id = 13; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_VMSA: sev_cmd_id = 14; +pub const sev_cmd_id_KVM_SEV_RECEIVE_FINISH: sev_cmd_id = 15; +pub const sev_cmd_id_KVM_SEV_GUEST_STATUS: sev_cmd_id = 16; +pub const sev_cmd_id_KVM_SEV_DBG_DECRYPT: sev_cmd_id = 17; +pub const sev_cmd_id_KVM_SEV_DBG_ENCRYPT: sev_cmd_id = 18; +pub const sev_cmd_id_KVM_SEV_CERT_EXPORT: sev_cmd_id = 19; +pub const sev_cmd_id_KVM_SEV_NR_MAX: sev_cmd_id = 20; +pub type sev_cmd_id = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_cmd { + pub id: __u32, + pub data: __u64, + pub error: __u32, + pub sev_fd: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_cmd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).error as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sev_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(sev_fd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_start { + pub handle: __u32, + pub policy: __u32, + pub dh_uaddr: __u64, + pub dh_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_start() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_update_data { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_secret { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_secret() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).trans_len as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_measure { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_measure() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_guest_status { + pub handle: __u32, + pub policy: __u32, + pub state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_guest_status() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).state as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_dbg { + pub src_uaddr: __u64, + pub dst_uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_dbg() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).src_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(src_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dst_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(dst_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_eventfd { + pub conn_id: __u32, + pub fd: __s32, + pub flags: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_eventfd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).conn_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(conn_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(padding) + ) + ); +} diff --git a/kvm-bindings/src/arm/fam_wrappers.rs b/kvm-bindings/src/arm/fam_wrappers.rs new file mode 100644 index 000000000..41e2b6a4f --- /dev/null +++ b/kvm-bindings/src/arm/fam_wrappers.rs @@ -0,0 +1,22 @@ +// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +use vmm_sys_util::fam::{FamStruct, FamStructWrapper}; + +use arm::bindings::*; + +// There is no constant in the kernel as far as the maximum number +// of registers on arm, but KVM_GET_REG_LIST usually returns around 450. +const ARM_REGS_MAX: usize = 500; + +// Implement the FamStruct trait for kvm_reg_list. +generate_fam_struct_impl!(kvm_reg_list, u64, reg, u64, n, ARM_REGS_MAX); + +/// Wrapper over the `kvm_reg_list` structure. +/// +/// The `kvm_reg_list` structure contains a flexible array member. For details check the +/// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) +/// documentation on `kvm_reg_list`. To provide safe access to +/// the array elements, this type is implemented using +/// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html). +pub type RegList = FamStructWrapper; diff --git a/kvm-bindings/src/arm/mod.rs b/kvm-bindings/src/arm/mod.rs new file mode 100644 index 000000000..f449c6fc5 --- /dev/null +++ b/kvm-bindings/src/arm/mod.rs @@ -0,0 +1,33 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#[cfg(feature = "fam-wrappers")] +mod fam_wrappers; + +// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified. +#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] +#[allow(clippy::all)] +mod bindings_v4_14_0; + +// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version +// related features are specified. +#[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) +))] +#[allow(clippy::all)] +mod bindings_v4_20_0; + +pub mod bindings { + #[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] + pub use super::bindings_v4_14_0::*; + + #[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) + ))] + pub use super::bindings_v4_20_0::*; + + #[cfg(feature = "fam-wrappers")] + pub use super::fam_wrappers::*; +} diff --git a/kvm-bindings/src/arm64/bindings_v4_14_0.rs b/kvm-bindings/src/arm64/bindings_v4_14_0.rs new file mode 100644 index 000000000..1d7c53263 --- /dev/null +++ b/kvm-bindings/src/arm64/bindings_v4_14_0.rs @@ -0,0 +1,7098 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const KVM_SPSR_EL1: u32 = 0; +pub const KVM_SPSR_SVC: u32 = 0; +pub const KVM_SPSR_ABT: u32 = 1; +pub const KVM_SPSR_UND: u32 = 2; +pub const KVM_SPSR_IRQ: u32 = 3; +pub const KVM_SPSR_FIQ: u32 = 4; +pub const KVM_NR_SPSR: u32 = 5; +pub const PSCI_0_2_FN_BASE: u32 = 2214592512; +pub const PSCI_0_2_64BIT: u32 = 1073741824; +pub const PSCI_0_2_FN64_BASE: u32 = 3288334336; +pub const PSCI_0_2_POWER_STATE_ID_MASK: u32 = 65535; +pub const PSCI_0_2_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_0_2_POWER_STATE_TYPE_SHIFT: u32 = 16; +pub const PSCI_0_2_POWER_STATE_TYPE_MASK: u32 = 65536; +pub const PSCI_0_2_POWER_STATE_AFFL_SHIFT: u32 = 24; +pub const PSCI_0_2_POWER_STATE_AFFL_MASK: u32 = 50331648; +pub const PSCI_1_0_EXT_POWER_STATE_ID_MASK: u32 = 268435455; +pub const PSCI_1_0_EXT_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT: u32 = 30; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_MASK: u32 = 1073741824; +pub const PSCI_0_2_AFFINITY_LEVEL_ON: u32 = 0; +pub const PSCI_0_2_AFFINITY_LEVEL_OFF: u32 = 1; +pub const PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: u32 = 2; +pub const PSCI_0_2_TOS_UP_MIGRATE: u32 = 0; +pub const PSCI_0_2_TOS_UP_NO_MIGRATE: u32 = 1; +pub const PSCI_0_2_TOS_MP: u32 = 2; +pub const PSCI_VERSION_MAJOR_SHIFT: u32 = 16; +pub const PSCI_VERSION_MINOR_MASK: u32 = 65535; +pub const PSCI_VERSION_MAJOR_MASK: i32 = -65536; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT: u32 = 1; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK: u32 = 2; +pub const PSCI_RET_SUCCESS: u32 = 0; +pub const PSCI_RET_NOT_SUPPORTED: i32 = -1; +pub const PSCI_RET_INVALID_PARAMS: i32 = -2; +pub const PSCI_RET_DENIED: i32 = -3; +pub const PSCI_RET_ALREADY_ON: i32 = -4; +pub const PSCI_RET_ON_PENDING: i32 = -5; +pub const PSCI_RET_INTERNAL_FAILURE: i32 = -6; +pub const PSCI_RET_NOT_PRESENT: i32 = -7; +pub const PSCI_RET_DISABLED: i32 = -8; +pub const PSCI_RET_INVALID_ADDRESS: i32 = -9; +pub const HWCAP_FP: u32 = 1; +pub const HWCAP_ASIMD: u32 = 2; +pub const HWCAP_EVTSTRM: u32 = 4; +pub const HWCAP_AES: u32 = 8; +pub const HWCAP_PMULL: u32 = 16; +pub const HWCAP_SHA1: u32 = 32; +pub const HWCAP_SHA2: u32 = 64; +pub const HWCAP_CRC32: u32 = 128; +pub const HWCAP_ATOMICS: u32 = 256; +pub const HWCAP_FPHP: u32 = 512; +pub const HWCAP_ASIMDHP: u32 = 1024; +pub const HWCAP_CPUID: u32 = 2048; +pub const HWCAP_ASIMDRDM: u32 = 4096; +pub const HWCAP_JSCVT: u32 = 8192; +pub const HWCAP_FCMA: u32 = 16384; +pub const HWCAP_LRCPC: u32 = 32768; +pub const HWCAP_DCPOP: u32 = 65536; +pub const PSR_MODE_EL0t: u32 = 0; +pub const PSR_MODE_EL1t: u32 = 4; +pub const PSR_MODE_EL1h: u32 = 5; +pub const PSR_MODE_EL2t: u32 = 8; +pub const PSR_MODE_EL2h: u32 = 9; +pub const PSR_MODE_EL3t: u32 = 12; +pub const PSR_MODE_EL3h: u32 = 13; +pub const PSR_MODE_MASK: u32 = 15; +pub const PSR_MODE32_BIT: u32 = 16; +pub const PSR_F_BIT: u32 = 64; +pub const PSR_I_BIT: u32 = 128; +pub const PSR_A_BIT: u32 = 256; +pub const PSR_D_BIT: u32 = 512; +pub const PSR_PAN_BIT: u32 = 4194304; +pub const PSR_UAO_BIT: u32 = 8388608; +pub const PSR_Q_BIT: u32 = 134217728; +pub const PSR_V_BIT: u32 = 268435456; +pub const PSR_C_BIT: u32 = 536870912; +pub const PSR_Z_BIT: u32 = 1073741824; +pub const PSR_N_BIT: u32 = 2147483648; +pub const PSR_f: u32 = 4278190080; +pub const PSR_s: u32 = 16711680; +pub const PSR_x: u32 = 65280; +pub const PSR_c: u32 = 255; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_ARM_TARGET_AEM_V8: u32 = 0; +pub const KVM_ARM_TARGET_FOUNDATION_V8: u32 = 1; +pub const KVM_ARM_TARGET_CORTEX_A57: u32 = 2; +pub const KVM_ARM_TARGET_XGENE_POTENZA: u32 = 3; +pub const KVM_ARM_TARGET_CORTEX_A53: u32 = 4; +pub const KVM_ARM_TARGET_GENERIC_V8: u32 = 5; +pub const KVM_ARM_NUM_TARGETS: u32 = 6; +pub const KVM_ARM_DEVICE_TYPE_SHIFT: u32 = 0; +pub const KVM_ARM_DEVICE_TYPE_MASK: u32 = 65535; +pub const KVM_ARM_DEVICE_ID_SHIFT: u32 = 16; +pub const KVM_ARM_DEVICE_ID_MASK: u32 = 4294901760; +pub const KVM_ARM_DEVICE_VGIC_V2: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_DIST: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_CPU: u32 = 1; +pub const KVM_VGIC_V2_DIST_SIZE: u32 = 4096; +pub const KVM_VGIC_V2_CPU_SIZE: u32 = 8192; +pub const KVM_VGIC_V3_ADDR_TYPE_DIST: u32 = 2; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST: u32 = 3; +pub const KVM_VGIC_ITS_ADDR_TYPE: u32 = 4; +pub const KVM_ARM_VCPU_POWER_OFF: u32 = 0; +pub const KVM_ARM_VCPU_EL1_32BIT: u32 = 1; +pub const KVM_ARM_VCPU_PSCI_0_2: u32 = 2; +pub const KVM_ARM_VCPU_PMU_V3: u32 = 3; +pub const KVM_ARM_MAX_DBG_REGS: u32 = 16; +pub const KVM_GUESTDBG_USE_SW_BP: u32 = 65536; +pub const KVM_GUESTDBG_USE_HW: u32 = 131072; +pub const KVM_REG_ARM_COPROC_MASK: u32 = 268369920; +pub const KVM_REG_ARM_COPROC_SHIFT: u32 = 16; +pub const KVM_REG_ARM_CORE: u32 = 1048576; +pub const KVM_REG_ARM_DEMUX: u32 = 1114112; +pub const KVM_REG_ARM_DEMUX_ID_MASK: u32 = 65280; +pub const KVM_REG_ARM_DEMUX_ID_SHIFT: u32 = 8; +pub const KVM_REG_ARM_DEMUX_ID_CCSIDR: u32 = 0; +pub const KVM_REG_ARM_DEMUX_VAL_MASK: u32 = 255; +pub const KVM_REG_ARM_DEMUX_VAL_SHIFT: u32 = 0; +pub const KVM_REG_ARM64_SYSREG: u32 = 1245184; +pub const KVM_REG_ARM64_SYSREG_OP0_MASK: u32 = 49152; +pub const KVM_REG_ARM64_SYSREG_OP0_SHIFT: u32 = 14; +pub const KVM_REG_ARM64_SYSREG_OP1_MASK: u32 = 14336; +pub const KVM_REG_ARM64_SYSREG_OP1_SHIFT: u32 = 11; +pub const KVM_REG_ARM64_SYSREG_CRN_MASK: u32 = 1920; +pub const KVM_REG_ARM64_SYSREG_CRN_SHIFT: u32 = 7; +pub const KVM_REG_ARM64_SYSREG_CRM_MASK: u32 = 120; +pub const KVM_REG_ARM64_SYSREG_CRM_SHIFT: u32 = 3; +pub const KVM_REG_ARM64_SYSREG_OP2_MASK: u32 = 7; +pub const KVM_REG_ARM64_SYSREG_OP2_SHIFT: u32 = 0; +pub const KVM_DEV_ARM_VGIC_GRP_ADDR: u32 = 0; +pub const KVM_DEV_ARM_VGIC_GRP_DIST_REGS: u32 = 1; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_REGS: u32 = 2; +pub const KVM_DEV_ARM_VGIC_CPUID_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_CPUID_MASK: u64 = 1095216660480; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_MASK: i64 = -4294967296; +pub const KVM_DEV_ARM_VGIC_OFFSET_SHIFT: u32 = 0; +pub const KVM_DEV_ARM_VGIC_OFFSET_MASK: u32 = 4294967295; +pub const KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK: u32 = 65535; +pub const KVM_DEV_ARM_VGIC_GRP_NR_IRQS: u32 = 3; +pub const KVM_DEV_ARM_VGIC_GRP_CTRL: u32 = 4; +pub const KVM_DEV_ARM_VGIC_GRP_REDIST_REGS: u32 = 5; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: u32 = 6; +pub const KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO: u32 = 7; +pub const KVM_DEV_ARM_VGIC_GRP_ITS_REGS: u32 = 8; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT: u32 = 10; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK: u32 = 4294966272; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK: u32 = 1023; +pub const VGIC_LEVEL_INFO_LINE_LEVEL: u32 = 0; +pub const KVM_DEV_ARM_VGIC_CTRL_INIT: u32 = 0; +pub const KVM_DEV_ARM_ITS_SAVE_TABLES: u32 = 1; +pub const KVM_DEV_ARM_ITS_RESTORE_TABLES: u32 = 2; +pub const KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES: u32 = 3; +pub const KVM_ARM_VCPU_PMU_V3_CTRL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_IRQ: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_INIT: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_CTRL: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_IRQ_VTIMER: u32 = 0; +pub const KVM_ARM_VCPU_TIMER_IRQ_PTIMER: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_SHIFT: u32 = 24; +pub const KVM_ARM_IRQ_TYPE_MASK: u32 = 255; +pub const KVM_ARM_IRQ_VCPU_SHIFT: u32 = 16; +pub const KVM_ARM_IRQ_VCPU_MASK: u32 = 255; +pub const KVM_ARM_IRQ_NUM_SHIFT: u32 = 0; +pub const KVM_ARM_IRQ_NUM_MASK: u32 = 65535; +pub const KVM_ARM_IRQ_TYPE_CPU: u32 = 0; +pub const KVM_ARM_IRQ_TYPE_SPI: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_PPI: u32 = 2; +pub const KVM_ARM_IRQ_CPU_IRQ: u32 = 0; +pub const KVM_ARM_IRQ_CPU_FIQ: u32 = 1; +pub const KVM_ARM_IRQ_GIC_MAX: u32 = 127; +pub const KVM_NR_IRQCHIPS: u32 = 1; +pub const KVM_PSCI_FN_BASE: u32 = 2512501342; +pub const KVM_PSCI_RET_SUCCESS: u32 = 0; +pub const KVM_PSCI_RET_NI: i32 = -1; +pub const KVM_PSCI_RET_INVAL: i32 = -2; +pub const KVM_PSCI_RET_DENIED: i32 = -3; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_GUEST_MWAIT: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_dev_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_pt_regs { + pub regs: [__u64; 31usize], + pub sp: __u64, + pub pc: __u64, + pub pstate: __u64, +} +#[test] +fn bindgen_test_layout_user_pt_regs() { + assert_eq!( + ::std::mem::size_of::(), + 272usize, + concat!("Size of: ", stringify!(user_pt_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(user_pt_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(sp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pstate as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(pstate) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_fpsimd_state { + pub vregs: [__uint128_t; 32usize], + pub fpsr: __u32, + pub fpcr: __u32, + pub __reserved: [__u32; 2usize], +} +#[test] +fn bindgen_test_layout_user_fpsimd_state() { + assert_eq!( + ::std::mem::size_of::(), + 528usize, + concat!("Size of: ", stringify!(user_fpsimd_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vregs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(vregs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpsr as *const _ as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(fpsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpcr as *const _ as usize }, + 516usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(fpcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 520usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_hwdebug_state { + pub dbg_info: __u32, + pub pad: __u32, + pub dbg_regs: [user_hwdebug_state__bindgen_ty_1; 16usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_hwdebug_state__bindgen_ty_1 { + pub addr: __u64, + pub ctrl: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_user_hwdebug_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(user_hwdebug_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(user_hwdebug_state__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ctrl as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(ctrl) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +#[test] +fn bindgen_test_layout_user_hwdebug_state() { + assert_eq!( + ::std::mem::size_of::(), + 264usize, + concat!("Size of: ", stringify!(user_hwdebug_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(user_hwdebug_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_info as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(dbg_info) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_regs as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(dbg_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub regs: user_pt_regs, + pub sp_el1: __u64, + pub elr_el1: __u64, + pub spsr: [__u64; 5usize], + pub __bindgen_padding_0: u64, + pub fp_regs: user_fpsimd_state, +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 864usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp_el1 as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(sp_el1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elr_el1 as *const _ as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(elr_el1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).spsr as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(spsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fp_regs as *const _ as usize }, + 336usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(fp_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_init { + pub target: __u32, + pub features: [__u32; 7usize], +} +#[test] +fn bindgen_test_layout_kvm_vcpu_init() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).target as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(target) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).features as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(features) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs {} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu {} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch { + pub dbg_bcr: [__u64; 16usize], + pub dbg_bvr: [__u64; 16usize], + pub dbg_wcr: [__u64; 16usize], + pub dbg_wvr: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_bcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_bcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_bvr as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_bvr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_wcr as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_wcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_wvr as *const _ as usize }, + 384usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_wvr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch { + pub hsr: __u32, + pub far: __u64, +} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hsr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(hsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).far as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(far) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs { + pub device_irq_level: __u64, +} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).device_irq_level as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(device_irq_level) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arch_memory_slot {} +#[test] +fn bindgen_test_layout_kvm_arch_memory_slot() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_arch_memory_slot)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_arch_memory_slot)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + _bindgen_union_align: [u8; 512usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u64; 256usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub pad: __u32, + pub data: [__u8; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} +pub type __uint128_t = [u64; 2]; diff --git a/kvm-bindings/src/arm64/bindings_v4_20_0.rs b/kvm-bindings/src/arm64/bindings_v4_20_0.rs new file mode 100644 index 000000000..5e862354c --- /dev/null +++ b/kvm-bindings/src/arm64/bindings_v4_20_0.rs @@ -0,0 +1,8603 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const KVM_SPSR_EL1: u32 = 0; +pub const KVM_SPSR_SVC: u32 = 0; +pub const KVM_SPSR_ABT: u32 = 1; +pub const KVM_SPSR_UND: u32 = 2; +pub const KVM_SPSR_IRQ: u32 = 3; +pub const KVM_SPSR_FIQ: u32 = 4; +pub const KVM_NR_SPSR: u32 = 5; +pub const PSCI_0_2_FN_BASE: u32 = 2214592512; +pub const PSCI_0_2_64BIT: u32 = 1073741824; +pub const PSCI_0_2_FN64_BASE: u32 = 3288334336; +pub const PSCI_0_2_POWER_STATE_ID_MASK: u32 = 65535; +pub const PSCI_0_2_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_0_2_POWER_STATE_TYPE_SHIFT: u32 = 16; +pub const PSCI_0_2_POWER_STATE_TYPE_MASK: u32 = 65536; +pub const PSCI_0_2_POWER_STATE_AFFL_SHIFT: u32 = 24; +pub const PSCI_0_2_POWER_STATE_AFFL_MASK: u32 = 50331648; +pub const PSCI_1_0_EXT_POWER_STATE_ID_MASK: u32 = 268435455; +pub const PSCI_1_0_EXT_POWER_STATE_ID_SHIFT: u32 = 0; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT: u32 = 30; +pub const PSCI_1_0_EXT_POWER_STATE_TYPE_MASK: u32 = 1073741824; +pub const PSCI_0_2_AFFINITY_LEVEL_ON: u32 = 0; +pub const PSCI_0_2_AFFINITY_LEVEL_OFF: u32 = 1; +pub const PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: u32 = 2; +pub const PSCI_0_2_TOS_UP_MIGRATE: u32 = 0; +pub const PSCI_0_2_TOS_UP_NO_MIGRATE: u32 = 1; +pub const PSCI_0_2_TOS_MP: u32 = 2; +pub const PSCI_VERSION_MAJOR_SHIFT: u32 = 16; +pub const PSCI_VERSION_MINOR_MASK: u32 = 65535; +pub const PSCI_VERSION_MAJOR_MASK: i32 = -65536; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT: u32 = 1; +pub const PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK: u32 = 2; +pub const PSCI_RET_SUCCESS: u32 = 0; +pub const PSCI_RET_NOT_SUPPORTED: i32 = -1; +pub const PSCI_RET_INVALID_PARAMS: i32 = -2; +pub const PSCI_RET_DENIED: i32 = -3; +pub const PSCI_RET_ALREADY_ON: i32 = -4; +pub const PSCI_RET_ON_PENDING: i32 = -5; +pub const PSCI_RET_INTERNAL_FAILURE: i32 = -6; +pub const PSCI_RET_NOT_PRESENT: i32 = -7; +pub const PSCI_RET_DISABLED: i32 = -8; +pub const PSCI_RET_INVALID_ADDRESS: i32 = -9; +pub const HWCAP_FP: u32 = 1; +pub const HWCAP_ASIMD: u32 = 2; +pub const HWCAP_EVTSTRM: u32 = 4; +pub const HWCAP_AES: u32 = 8; +pub const HWCAP_PMULL: u32 = 16; +pub const HWCAP_SHA1: u32 = 32; +pub const HWCAP_SHA2: u32 = 64; +pub const HWCAP_CRC32: u32 = 128; +pub const HWCAP_ATOMICS: u32 = 256; +pub const HWCAP_FPHP: u32 = 512; +pub const HWCAP_ASIMDHP: u32 = 1024; +pub const HWCAP_CPUID: u32 = 2048; +pub const HWCAP_ASIMDRDM: u32 = 4096; +pub const HWCAP_JSCVT: u32 = 8192; +pub const HWCAP_FCMA: u32 = 16384; +pub const HWCAP_LRCPC: u32 = 32768; +pub const HWCAP_DCPOP: u32 = 65536; +pub const HWCAP_SHA3: u32 = 131072; +pub const HWCAP_SM3: u32 = 262144; +pub const HWCAP_SM4: u32 = 524288; +pub const HWCAP_ASIMDDP: u32 = 1048576; +pub const HWCAP_SHA512: u32 = 2097152; +pub const HWCAP_SVE: u32 = 4194304; +pub const HWCAP_ASIMDFHM: u32 = 8388608; +pub const HWCAP_DIT: u32 = 16777216; +pub const HWCAP_USCAT: u32 = 33554432; +pub const HWCAP_ILRCPC: u32 = 67108864; +pub const HWCAP_FLAGM: u32 = 134217728; +pub const HWCAP_SSBS: u32 = 268435456; +pub const FPSIMD_MAGIC: u32 = 1179680769; +pub const ESR_MAGIC: u32 = 1163088385; +pub const EXTRA_MAGIC: u32 = 1163416577; +pub const SVE_MAGIC: u32 = 1398162689; +pub const SVE_VQ_BYTES: u32 = 16; +pub const SVE_VQ_MIN: u32 = 1; +pub const SVE_VQ_MAX: u32 = 512; +pub const SVE_VL_MIN: u32 = 16; +pub const SVE_VL_MAX: u32 = 8192; +pub const SVE_NUM_ZREGS: u32 = 32; +pub const SVE_NUM_PREGS: u32 = 16; +pub const PSR_MODE_EL0t: u32 = 0; +pub const PSR_MODE_EL1t: u32 = 4; +pub const PSR_MODE_EL1h: u32 = 5; +pub const PSR_MODE_EL2t: u32 = 8; +pub const PSR_MODE_EL2h: u32 = 9; +pub const PSR_MODE_EL3t: u32 = 12; +pub const PSR_MODE_EL3h: u32 = 13; +pub const PSR_MODE_MASK: u32 = 15; +pub const PSR_MODE32_BIT: u32 = 16; +pub const PSR_F_BIT: u32 = 64; +pub const PSR_I_BIT: u32 = 128; +pub const PSR_A_BIT: u32 = 256; +pub const PSR_D_BIT: u32 = 512; +pub const PSR_SSBS_BIT: u32 = 4096; +pub const PSR_PAN_BIT: u32 = 4194304; +pub const PSR_UAO_BIT: u32 = 8388608; +pub const PSR_V_BIT: u32 = 268435456; +pub const PSR_C_BIT: u32 = 536870912; +pub const PSR_Z_BIT: u32 = 1073741824; +pub const PSR_N_BIT: u32 = 2147483648; +pub const PSR_f: u32 = 4278190080; +pub const PSR_s: u32 = 16711680; +pub const PSR_x: u32 = 65280; +pub const PSR_c: u32 = 255; +pub const PR_SET_PDEATHSIG: u32 = 1; +pub const PR_GET_PDEATHSIG: u32 = 2; +pub const PR_GET_DUMPABLE: u32 = 3; +pub const PR_SET_DUMPABLE: u32 = 4; +pub const PR_GET_UNALIGN: u32 = 5; +pub const PR_SET_UNALIGN: u32 = 6; +pub const PR_UNALIGN_NOPRINT: u32 = 1; +pub const PR_UNALIGN_SIGBUS: u32 = 2; +pub const PR_GET_KEEPCAPS: u32 = 7; +pub const PR_SET_KEEPCAPS: u32 = 8; +pub const PR_GET_FPEMU: u32 = 9; +pub const PR_SET_FPEMU: u32 = 10; +pub const PR_FPEMU_NOPRINT: u32 = 1; +pub const PR_FPEMU_SIGFPE: u32 = 2; +pub const PR_GET_FPEXC: u32 = 11; +pub const PR_SET_FPEXC: u32 = 12; +pub const PR_FP_EXC_SW_ENABLE: u32 = 128; +pub const PR_FP_EXC_DIV: u32 = 65536; +pub const PR_FP_EXC_OVF: u32 = 131072; +pub const PR_FP_EXC_UND: u32 = 262144; +pub const PR_FP_EXC_RES: u32 = 524288; +pub const PR_FP_EXC_INV: u32 = 1048576; +pub const PR_FP_EXC_DISABLED: u32 = 0; +pub const PR_FP_EXC_NONRECOV: u32 = 1; +pub const PR_FP_EXC_ASYNC: u32 = 2; +pub const PR_FP_EXC_PRECISE: u32 = 3; +pub const PR_GET_TIMING: u32 = 13; +pub const PR_SET_TIMING: u32 = 14; +pub const PR_TIMING_STATISTICAL: u32 = 0; +pub const PR_TIMING_TIMESTAMP: u32 = 1; +pub const PR_SET_NAME: u32 = 15; +pub const PR_GET_NAME: u32 = 16; +pub const PR_GET_ENDIAN: u32 = 19; +pub const PR_SET_ENDIAN: u32 = 20; +pub const PR_ENDIAN_BIG: u32 = 0; +pub const PR_ENDIAN_LITTLE: u32 = 1; +pub const PR_ENDIAN_PPC_LITTLE: u32 = 2; +pub const PR_GET_SECCOMP: u32 = 21; +pub const PR_SET_SECCOMP: u32 = 22; +pub const PR_CAPBSET_READ: u32 = 23; +pub const PR_CAPBSET_DROP: u32 = 24; +pub const PR_GET_TSC: u32 = 25; +pub const PR_SET_TSC: u32 = 26; +pub const PR_TSC_ENABLE: u32 = 1; +pub const PR_TSC_SIGSEGV: u32 = 2; +pub const PR_GET_SECUREBITS: u32 = 27; +pub const PR_SET_SECUREBITS: u32 = 28; +pub const PR_SET_TIMERSLACK: u32 = 29; +pub const PR_GET_TIMERSLACK: u32 = 30; +pub const PR_TASK_PERF_EVENTS_DISABLE: u32 = 31; +pub const PR_TASK_PERF_EVENTS_ENABLE: u32 = 32; +pub const PR_MCE_KILL: u32 = 33; +pub const PR_MCE_KILL_CLEAR: u32 = 0; +pub const PR_MCE_KILL_SET: u32 = 1; +pub const PR_MCE_KILL_LATE: u32 = 0; +pub const PR_MCE_KILL_EARLY: u32 = 1; +pub const PR_MCE_KILL_DEFAULT: u32 = 2; +pub const PR_MCE_KILL_GET: u32 = 34; +pub const PR_SET_MM: u32 = 35; +pub const PR_SET_MM_START_CODE: u32 = 1; +pub const PR_SET_MM_END_CODE: u32 = 2; +pub const PR_SET_MM_START_DATA: u32 = 3; +pub const PR_SET_MM_END_DATA: u32 = 4; +pub const PR_SET_MM_START_STACK: u32 = 5; +pub const PR_SET_MM_START_BRK: u32 = 6; +pub const PR_SET_MM_BRK: u32 = 7; +pub const PR_SET_MM_ARG_START: u32 = 8; +pub const PR_SET_MM_ARG_END: u32 = 9; +pub const PR_SET_MM_ENV_START: u32 = 10; +pub const PR_SET_MM_ENV_END: u32 = 11; +pub const PR_SET_MM_AUXV: u32 = 12; +pub const PR_SET_MM_EXE_FILE: u32 = 13; +pub const PR_SET_MM_MAP: u32 = 14; +pub const PR_SET_MM_MAP_SIZE: u32 = 15; +pub const PR_SET_PTRACER: u32 = 1499557217; +pub const PR_SET_CHILD_SUBREAPER: u32 = 36; +pub const PR_GET_CHILD_SUBREAPER: u32 = 37; +pub const PR_SET_NO_NEW_PRIVS: u32 = 38; +pub const PR_GET_NO_NEW_PRIVS: u32 = 39; +pub const PR_GET_TID_ADDRESS: u32 = 40; +pub const PR_SET_THP_DISABLE: u32 = 41; +pub const PR_GET_THP_DISABLE: u32 = 42; +pub const PR_MPX_ENABLE_MANAGEMENT: u32 = 43; +pub const PR_MPX_DISABLE_MANAGEMENT: u32 = 44; +pub const PR_SET_FP_MODE: u32 = 45; +pub const PR_GET_FP_MODE: u32 = 46; +pub const PR_FP_MODE_FR: u32 = 1; +pub const PR_FP_MODE_FRE: u32 = 2; +pub const PR_CAP_AMBIENT: u32 = 47; +pub const PR_CAP_AMBIENT_IS_SET: u32 = 1; +pub const PR_CAP_AMBIENT_RAISE: u32 = 2; +pub const PR_CAP_AMBIENT_LOWER: u32 = 3; +pub const PR_CAP_AMBIENT_CLEAR_ALL: u32 = 4; +pub const PR_SVE_SET_VL: u32 = 50; +pub const PR_SVE_SET_VL_ONEXEC: u32 = 262144; +pub const PR_SVE_GET_VL: u32 = 51; +pub const PR_SVE_VL_LEN_MASK: u32 = 65535; +pub const PR_SVE_VL_INHERIT: u32 = 131072; +pub const PR_GET_SPECULATION_CTRL: u32 = 52; +pub const PR_SET_SPECULATION_CTRL: u32 = 53; +pub const PR_SPEC_STORE_BYPASS: u32 = 0; +pub const PR_SPEC_INDIRECT_BRANCH: u32 = 1; +pub const PR_SPEC_NOT_AFFECTED: u32 = 0; +pub const PR_SPEC_PRCTL: u32 = 1; +pub const PR_SPEC_ENABLE: u32 = 2; +pub const PR_SPEC_DISABLE: u32 = 4; +pub const PR_SPEC_FORCE_DISABLE: u32 = 8; +pub const SVE_PT_REGS_MASK: u32 = 1; +pub const SVE_PT_REGS_FPSIMD: u32 = 0; +pub const SVE_PT_REGS_SVE: u32 = 1; +pub const SVE_PT_VL_INHERIT: u32 = 2; +pub const SVE_PT_VL_ONEXEC: u32 = 4; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_ARM_TARGET_AEM_V8: u32 = 0; +pub const KVM_ARM_TARGET_FOUNDATION_V8: u32 = 1; +pub const KVM_ARM_TARGET_CORTEX_A57: u32 = 2; +pub const KVM_ARM_TARGET_XGENE_POTENZA: u32 = 3; +pub const KVM_ARM_TARGET_CORTEX_A53: u32 = 4; +pub const KVM_ARM_TARGET_GENERIC_V8: u32 = 5; +pub const KVM_ARM_NUM_TARGETS: u32 = 6; +pub const KVM_ARM_DEVICE_TYPE_SHIFT: u32 = 0; +pub const KVM_ARM_DEVICE_TYPE_MASK: u32 = 65535; +pub const KVM_ARM_DEVICE_ID_SHIFT: u32 = 16; +pub const KVM_ARM_DEVICE_ID_MASK: u32 = 4294901760; +pub const KVM_ARM_DEVICE_VGIC_V2: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_DIST: u32 = 0; +pub const KVM_VGIC_V2_ADDR_TYPE_CPU: u32 = 1; +pub const KVM_VGIC_V2_DIST_SIZE: u32 = 4096; +pub const KVM_VGIC_V2_CPU_SIZE: u32 = 8192; +pub const KVM_VGIC_V3_ADDR_TYPE_DIST: u32 = 2; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST: u32 = 3; +pub const KVM_VGIC_ITS_ADDR_TYPE: u32 = 4; +pub const KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION: u32 = 5; +pub const KVM_ARM_VCPU_POWER_OFF: u32 = 0; +pub const KVM_ARM_VCPU_EL1_32BIT: u32 = 1; +pub const KVM_ARM_VCPU_PSCI_0_2: u32 = 2; +pub const KVM_ARM_VCPU_PMU_V3: u32 = 3; +pub const KVM_ARM_MAX_DBG_REGS: u32 = 16; +pub const KVM_GUESTDBG_USE_SW_BP: u32 = 65536; +pub const KVM_GUESTDBG_USE_HW: u32 = 131072; +pub const KVM_REG_ARM_COPROC_MASK: u32 = 268369920; +pub const KVM_REG_ARM_COPROC_SHIFT: u32 = 16; +pub const KVM_REG_ARM_CORE: u32 = 1048576; +pub const KVM_REG_ARM_DEMUX: u32 = 1114112; +pub const KVM_REG_ARM_DEMUX_ID_MASK: u32 = 65280; +pub const KVM_REG_ARM_DEMUX_ID_SHIFT: u32 = 8; +pub const KVM_REG_ARM_DEMUX_ID_CCSIDR: u32 = 0; +pub const KVM_REG_ARM_DEMUX_VAL_MASK: u32 = 255; +pub const KVM_REG_ARM_DEMUX_VAL_SHIFT: u32 = 0; +pub const KVM_REG_ARM64_SYSREG: u32 = 1245184; +pub const KVM_REG_ARM64_SYSREG_OP0_MASK: u32 = 49152; +pub const KVM_REG_ARM64_SYSREG_OP0_SHIFT: u32 = 14; +pub const KVM_REG_ARM64_SYSREG_OP1_MASK: u32 = 14336; +pub const KVM_REG_ARM64_SYSREG_OP1_SHIFT: u32 = 11; +pub const KVM_REG_ARM64_SYSREG_CRN_MASK: u32 = 1920; +pub const KVM_REG_ARM64_SYSREG_CRN_SHIFT: u32 = 7; +pub const KVM_REG_ARM64_SYSREG_CRM_MASK: u32 = 120; +pub const KVM_REG_ARM64_SYSREG_CRM_SHIFT: u32 = 3; +pub const KVM_REG_ARM64_SYSREG_OP2_MASK: u32 = 7; +pub const KVM_REG_ARM64_SYSREG_OP2_SHIFT: u32 = 0; +pub const KVM_REG_ARM_FW: u32 = 1310720; +pub const KVM_DEV_ARM_VGIC_GRP_ADDR: u32 = 0; +pub const KVM_DEV_ARM_VGIC_GRP_DIST_REGS: u32 = 1; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_REGS: u32 = 2; +pub const KVM_DEV_ARM_VGIC_CPUID_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_CPUID_MASK: u64 = 1095216660480; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT: u32 = 32; +pub const KVM_DEV_ARM_VGIC_V3_MPIDR_MASK: i64 = -4294967296; +pub const KVM_DEV_ARM_VGIC_OFFSET_SHIFT: u32 = 0; +pub const KVM_DEV_ARM_VGIC_OFFSET_MASK: u32 = 4294967295; +pub const KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK: u32 = 65535; +pub const KVM_DEV_ARM_VGIC_GRP_NR_IRQS: u32 = 3; +pub const KVM_DEV_ARM_VGIC_GRP_CTRL: u32 = 4; +pub const KVM_DEV_ARM_VGIC_GRP_REDIST_REGS: u32 = 5; +pub const KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: u32 = 6; +pub const KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO: u32 = 7; +pub const KVM_DEV_ARM_VGIC_GRP_ITS_REGS: u32 = 8; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT: u32 = 10; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK: u32 = 4294966272; +pub const KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK: u32 = 1023; +pub const VGIC_LEVEL_INFO_LINE_LEVEL: u32 = 0; +pub const KVM_DEV_ARM_VGIC_CTRL_INIT: u32 = 0; +pub const KVM_DEV_ARM_ITS_SAVE_TABLES: u32 = 1; +pub const KVM_DEV_ARM_ITS_RESTORE_TABLES: u32 = 2; +pub const KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES: u32 = 3; +pub const KVM_DEV_ARM_ITS_CTRL_RESET: u32 = 4; +pub const KVM_ARM_VCPU_PMU_V3_CTRL: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_IRQ: u32 = 0; +pub const KVM_ARM_VCPU_PMU_V3_INIT: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_CTRL: u32 = 1; +pub const KVM_ARM_VCPU_TIMER_IRQ_VTIMER: u32 = 0; +pub const KVM_ARM_VCPU_TIMER_IRQ_PTIMER: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_SHIFT: u32 = 24; +pub const KVM_ARM_IRQ_TYPE_MASK: u32 = 255; +pub const KVM_ARM_IRQ_VCPU_SHIFT: u32 = 16; +pub const KVM_ARM_IRQ_VCPU_MASK: u32 = 255; +pub const KVM_ARM_IRQ_NUM_SHIFT: u32 = 0; +pub const KVM_ARM_IRQ_NUM_MASK: u32 = 65535; +pub const KVM_ARM_IRQ_TYPE_CPU: u32 = 0; +pub const KVM_ARM_IRQ_TYPE_SPI: u32 = 1; +pub const KVM_ARM_IRQ_TYPE_PPI: u32 = 2; +pub const KVM_ARM_IRQ_CPU_IRQ: u32 = 0; +pub const KVM_ARM_IRQ_CPU_FIQ: u32 = 1; +pub const KVM_ARM_IRQ_GIC_MAX: u32 = 127; +pub const KVM_NR_IRQCHIPS: u32 = 1; +pub const KVM_PSCI_FN_BASE: u32 = 2512501342; +pub const KVM_PSCI_RET_SUCCESS: u32 = 0; +pub const KVM_PSCI_RET_NI: i32 = -1; +pub const KVM_PSCI_RET_INVAL: i32 = -2; +pub const KVM_PSCI_RET_DENIED: i32 = -3; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_MWAIT: u32 = 1; +pub const KVM_X86_DISABLE_EXITS_HLT: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_PAUSE: u32 = 4; +pub const KVM_X86_DISABLE_VALID_EXITS: u32 = 7; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVM_PPC_NO_HASH: u32 = 4; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_VM_TYPE_ARM_IPA_SIZE_MASK: u32 = 255; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_VCPU_EVENTS: u32 = 41; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_DISABLE_EXITS: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_CAP_S390_AIS_MIGRATION: u32 = 150; +pub const KVM_CAP_PPC_GET_CPU_CHAR: u32 = 151; +pub const KVM_CAP_S390_BPB: u32 = 152; +pub const KVM_CAP_GET_MSR_FEATURES: u32 = 153; +pub const KVM_CAP_HYPERV_EVENTFD: u32 = 154; +pub const KVM_CAP_HYPERV_TLBFLUSH: u32 = 155; +pub const KVM_CAP_S390_HPAGE_1M: u32 = 156; +pub const KVM_CAP_NESTED_STATE: u32 = 157; +pub const KVM_CAP_ARM_INJECT_SERROR_ESR: u32 = 158; +pub const KVM_CAP_MSR_PLATFORM_INFO: u32 = 159; +pub const KVM_CAP_PPC_NESTED_HV: u32 = 160; +pub const KVM_CAP_HYPERV_SEND_IPI: u32 = 161; +pub const KVM_CAP_COALESCED_PIO: u32 = 162; +pub const KVM_CAP_HYPERV_ENLIGHTENED_VMCS: u32 = 163; +pub const KVM_CAP_EXCEPTION_PAYLOAD: u32 = 164; +pub const KVM_CAP_ARM_VM_IPA_SIZE: u32 = 165; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub const KVM_HYPERV_CONN_ID_MASK: u32 = 16777215; +pub const KVM_HYPERV_EVENTFD_DEASSIGN: u32 = 1; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_dev_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sigcontext { + pub fault_address: __u64, + pub regs: [__u64; 31usize], + pub sp: __u64, + pub pc: __u64, + pub pstate: __u64, + pub __bindgen_padding_0: [u8; 8usize], + pub __reserved: [__u8; 4096usize], +} +#[test] +fn bindgen_test_layout_sigcontext() { + assert_eq!( + ::std::mem::size_of::(), + 4384usize, + concat!("Size of: ", stringify!(sigcontext)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fault_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(fault_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(sp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pstate as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(pstate) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(sigcontext), + "::", + stringify!(__reserved) + ) + ); +} +impl Default for sigcontext { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct _aarch64_ctx { + pub magic: __u32, + pub size: __u32, +} +#[test] +fn bindgen_test_layout__aarch64_ctx() { + assert_eq!( + ::std::mem::size_of::<_aarch64_ctx>(), + 8usize, + concat!("Size of: ", stringify!(_aarch64_ctx)) + ); + assert_eq!( + ::std::mem::align_of::<_aarch64_ctx>(), + 4usize, + concat!("Alignment of ", stringify!(_aarch64_ctx)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_aarch64_ctx>())).magic as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_aarch64_ctx), + "::", + stringify!(magic) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_aarch64_ctx>())).size as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(_aarch64_ctx), + "::", + stringify!(size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct fpsimd_context { + pub head: _aarch64_ctx, + pub fpsr: __u32, + pub fpcr: __u32, + pub vregs: [__uint128_t; 32usize], +} +#[test] +fn bindgen_test_layout_fpsimd_context() { + assert_eq!( + ::std::mem::size_of::(), + 528usize, + concat!("Size of: ", stringify!(fpsimd_context)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fpsimd_context), + "::", + stringify!(head) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpsr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(fpsimd_context), + "::", + stringify!(fpsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpcr as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(fpsimd_context), + "::", + stringify!(fpcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vregs as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(fpsimd_context), + "::", + stringify!(vregs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct esr_context { + pub head: _aarch64_ctx, + pub esr: __u64, +} +#[test] +fn bindgen_test_layout_esr_context() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(esr_context)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(esr_context)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(esr_context), + "::", + stringify!(head) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).esr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(esr_context), + "::", + stringify!(esr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct extra_context { + pub head: _aarch64_ctx, + pub datap: __u64, + pub size: __u32, + pub __reserved: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_extra_context() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(extra_context)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(extra_context)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(extra_context), + "::", + stringify!(head) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datap as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(extra_context), + "::", + stringify!(datap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(extra_context), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(extra_context), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct sve_context { + pub head: _aarch64_ctx, + pub vl: __u16, + pub __reserved: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_sve_context() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sve_context)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sve_context)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).head as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sve_context), + "::", + stringify!(head) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vl as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sve_context), + "::", + stringify!(vl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(sve_context), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct prctl_mm_map { + pub start_code: __u64, + pub end_code: __u64, + pub start_data: __u64, + pub end_data: __u64, + pub start_brk: __u64, + pub brk: __u64, + pub start_stack: __u64, + pub arg_start: __u64, + pub arg_end: __u64, + pub env_start: __u64, + pub env_end: __u64, + pub auxv: *mut __u64, + pub auxv_size: __u32, + pub exe_fd: __u32, +} +#[test] +fn bindgen_test_layout_prctl_mm_map() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(prctl_mm_map)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(prctl_mm_map)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(start_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).end_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(end_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(start_data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).end_data as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(end_data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_brk as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(start_brk) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).brk as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(brk) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_stack as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(start_stack) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arg_start as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(arg_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arg_end as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(arg_end) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env_start as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(env_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env_end as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(env_end) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).auxv as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(auxv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).auxv_size as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(auxv_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exe_fd as *const _ as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(prctl_mm_map), + "::", + stringify!(exe_fd) + ) + ); +} +impl Default for prctl_mm_map { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_pt_regs { + pub regs: [__u64; 31usize], + pub sp: __u64, + pub pc: __u64, + pub pstate: __u64, +} +#[test] +fn bindgen_test_layout_user_pt_regs() { + assert_eq!( + ::std::mem::size_of::(), + 272usize, + concat!("Size of: ", stringify!(user_pt_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(user_pt_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(sp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pstate as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(user_pt_regs), + "::", + stringify!(pstate) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_fpsimd_state { + pub vregs: [__uint128_t; 32usize], + pub fpsr: __u32, + pub fpcr: __u32, + pub __reserved: [__u32; 2usize], +} +#[test] +fn bindgen_test_layout_user_fpsimd_state() { + assert_eq!( + ::std::mem::size_of::(), + 528usize, + concat!("Size of: ", stringify!(user_fpsimd_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vregs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(vregs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpsr as *const _ as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(fpsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpcr as *const _ as usize }, + 516usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(fpcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 520usize, + concat!( + "Offset of field: ", + stringify!(user_fpsimd_state), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_hwdebug_state { + pub dbg_info: __u32, + pub pad: __u32, + pub dbg_regs: [user_hwdebug_state__bindgen_ty_1; 16usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_hwdebug_state__bindgen_ty_1 { + pub addr: __u64, + pub ctrl: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_user_hwdebug_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(user_hwdebug_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(user_hwdebug_state__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ctrl as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(ctrl) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +#[test] +fn bindgen_test_layout_user_hwdebug_state() { + assert_eq!( + ::std::mem::size_of::(), + 264usize, + concat!("Size of: ", stringify!(user_hwdebug_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(user_hwdebug_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_info as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(dbg_info) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_regs as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_hwdebug_state), + "::", + stringify!(dbg_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_sve_header { + pub size: __u32, + pub max_size: __u32, + pub vl: __u16, + pub max_vl: __u16, + pub flags: __u16, + pub __reserved: __u16, +} +#[test] +fn bindgen_test_layout_user_sve_header() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(user_sve_header)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(user_sve_header)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).max_size as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(max_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vl as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(vl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).max_vl as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(max_vl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(user_sve_header), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub regs: user_pt_regs, + pub sp_el1: __u64, + pub elr_el1: __u64, + pub spsr: [__u64; 5usize], + pub __bindgen_padding_0: u64, + pub fp_regs: user_fpsimd_state, +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 864usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp_el1 as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(sp_el1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elr_el1 as *const _ as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(elr_el1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).spsr as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(spsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fp_regs as *const _ as usize }, + 336usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(fp_regs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_init { + pub target: __u32, + pub features: [__u32; 7usize], +} +#[test] +fn bindgen_test_layout_kvm_vcpu_init() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_init)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).target as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(target) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).features as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_init), + "::", + stringify!(features) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs {} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu {} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch { + pub dbg_bcr: [__u64; 16usize], + pub dbg_bvr: [__u64; 16usize], + pub dbg_wcr: [__u64; 16usize], + pub dbg_wvr: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_bcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_bcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_bvr as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_bvr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_wcr as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_wcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dbg_wvr as *const _ as usize }, + 384usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(dbg_wvr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch { + pub hsr: __u32, + pub far: __u64, +} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hsr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(hsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).far as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(far) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs { + pub device_irq_level: __u64, +} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).device_irq_level as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(device_irq_level) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arch_memory_slot {} +#[test] +fn bindgen_test_layout_kvm_arch_memory_slot() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_arch_memory_slot)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_arch_memory_slot)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events { + pub exception: kvm_vcpu_events__bindgen_ty_1, + pub reserved: [__u32; 12usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_1 { + pub serror_pending: __u8, + pub serror_has_esr: __u8, + pub pad: [__u8; 6usize], + pub serror_esr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_pending as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_has_esr as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_has_esr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).serror_esr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(serror_esr) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + _bindgen_union_align: [u8; 512usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u64; 256usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio_zone__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio_zone__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio__bindgen_ty_1, + pub data: [__u8; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_coalesced_mmio { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +impl Default for kvm_coalesced_mmio_ring { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_enc_region { + pub addr: __u64, + pub size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_enc_region() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_enc_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enc_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(size) + ) + ); +} +pub const sev_cmd_id_KVM_SEV_INIT: sev_cmd_id = 0; +pub const sev_cmd_id_KVM_SEV_ES_INIT: sev_cmd_id = 1; +pub const sev_cmd_id_KVM_SEV_LAUNCH_START: sev_cmd_id = 2; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_DATA: sev_cmd_id = 3; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_VMSA: sev_cmd_id = 4; +pub const sev_cmd_id_KVM_SEV_LAUNCH_SECRET: sev_cmd_id = 5; +pub const sev_cmd_id_KVM_SEV_LAUNCH_MEASURE: sev_cmd_id = 6; +pub const sev_cmd_id_KVM_SEV_LAUNCH_FINISH: sev_cmd_id = 7; +pub const sev_cmd_id_KVM_SEV_SEND_START: sev_cmd_id = 8; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_DATA: sev_cmd_id = 9; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_VMSA: sev_cmd_id = 10; +pub const sev_cmd_id_KVM_SEV_SEND_FINISH: sev_cmd_id = 11; +pub const sev_cmd_id_KVM_SEV_RECEIVE_START: sev_cmd_id = 12; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_DATA: sev_cmd_id = 13; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_VMSA: sev_cmd_id = 14; +pub const sev_cmd_id_KVM_SEV_RECEIVE_FINISH: sev_cmd_id = 15; +pub const sev_cmd_id_KVM_SEV_GUEST_STATUS: sev_cmd_id = 16; +pub const sev_cmd_id_KVM_SEV_DBG_DECRYPT: sev_cmd_id = 17; +pub const sev_cmd_id_KVM_SEV_DBG_ENCRYPT: sev_cmd_id = 18; +pub const sev_cmd_id_KVM_SEV_CERT_EXPORT: sev_cmd_id = 19; +pub const sev_cmd_id_KVM_SEV_NR_MAX: sev_cmd_id = 20; +pub type sev_cmd_id = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_cmd { + pub id: __u32, + pub data: __u64, + pub error: __u32, + pub sev_fd: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_cmd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).error as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sev_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(sev_fd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_start { + pub handle: __u32, + pub policy: __u32, + pub dh_uaddr: __u64, + pub dh_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_start() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_update_data { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_secret { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_secret() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).trans_len as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_measure { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_measure() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_guest_status { + pub handle: __u32, + pub policy: __u32, + pub state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_guest_status() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).state as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_dbg { + pub src_uaddr: __u64, + pub dst_uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_dbg() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).src_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(src_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dst_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(dst_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_eventfd { + pub conn_id: __u32, + pub fd: __s32, + pub flags: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_eventfd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).conn_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(conn_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(padding) + ) + ); +} +pub type __uint128_t = [u64; 2]; diff --git a/kvm-bindings/src/arm64/fam_wrappers.rs b/kvm-bindings/src/arm64/fam_wrappers.rs new file mode 100644 index 000000000..3d491d123 --- /dev/null +++ b/kvm-bindings/src/arm64/fam_wrappers.rs @@ -0,0 +1,22 @@ +// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +use vmm_sys_util::fam::{FamStruct, FamStructWrapper}; + +use arm64::bindings::*; + +// There is no constant in the kernel as far as the maximum number +// of registers on arm, but KVM_GET_REG_LIST usually returns around 450. +const ARM64_REGS_MAX: usize = 500; + +// Implement the FamStruct trait for kvm_reg_list. +generate_fam_struct_impl!(kvm_reg_list, u64, reg, u64, n, ARM64_REGS_MAX); + +/// Wrapper over the `kvm_reg_list` structure. +/// +/// The `kvm_reg_list` structure contains a flexible array member. For details check the +/// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) +/// documentation on `kvm_reg_list`. To provide safe access to +/// the array elements, this type is implemented using +/// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html). +pub type RegList = FamStructWrapper; diff --git a/kvm-bindings/src/arm64/mod.rs b/kvm-bindings/src/arm64/mod.rs new file mode 100644 index 000000000..f449c6fc5 --- /dev/null +++ b/kvm-bindings/src/arm64/mod.rs @@ -0,0 +1,33 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#[cfg(feature = "fam-wrappers")] +mod fam_wrappers; + +// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified. +#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] +#[allow(clippy::all)] +mod bindings_v4_14_0; + +// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version +// related features are specified. +#[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) +))] +#[allow(clippy::all)] +mod bindings_v4_20_0; + +pub mod bindings { + #[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] + pub use super::bindings_v4_14_0::*; + + #[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) + ))] + pub use super::bindings_v4_20_0::*; + + #[cfg(feature = "fam-wrappers")] + pub use super::fam_wrappers::*; +} diff --git a/kvm-bindings/src/lib.rs b/kvm-bindings/src/lib.rs new file mode 100644 index 000000000..f4531289e --- /dev/null +++ b/kvm-bindings/src/lib.rs @@ -0,0 +1,30 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +#[macro_use] +#[cfg(feature = "fam-wrappers")] +extern crate vmm_sys_util; + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +mod x86; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +pub use self::x86::bindings::*; + +#[cfg(target_arch = "aarch")] +mod arm; +#[cfg(target_arch = "aarch")] +pub use self::arm::bindings::*; + +#[cfg(target_arch = "aarch64")] +mod arm64; +#[cfg(target_arch = "aarch64")] +pub use self::arm64::bindings::*; + +#[cfg(target_arch = "riscv64")] +mod riscv; +#[cfg(target_arch = "riscv64")] +pub use self::riscv::*; diff --git a/kvm-bindings/src/riscv/bindings.rs b/kvm-bindings/src/riscv/bindings.rs new file mode 100644 index 000000000..cfa1c8ab5 --- /dev/null +++ b/kvm-bindings/src/riscv/bindings.rs @@ -0,0 +1,10510 @@ +/* automatically generated by rust-bindgen 0.59.1 */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 1; +pub const KVM_INTERRUPT_SET: i32 = -1; +pub const KVM_INTERRUPT_UNSET: i32 = -2; +pub const KVM_RISCV_MODE_S: u32 = 1; +pub const KVM_RISCV_MODE_U: u32 = 0; +pub const KVM_RISCV_TIMER_STATE_OFF: u32 = 0; +pub const KVM_RISCV_TIMER_STATE_ON: u32 = 1; +pub const KVM_REG_RISCV_TYPE_MASK: u32 = 4278190080; +pub const KVM_REG_RISCV_TYPE_SHIFT: u32 = 24; +pub const KVM_REG_RISCV_CONFIG: u32 = 16777216; +pub const KVM_REG_RISCV_CORE: u32 = 33554432; +pub const KVM_REG_RISCV_CSR: u32 = 50331648; +pub const KVM_REG_RISCV_TIMER: u32 = 67108864; +pub const KVM_REG_RISCV_FP_F: u32 = 83886080; +pub const KVM_REG_RISCV_FP_D: u32 = 100663296; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_EXIT_HYPERV_SYNDBG: u32 = 3; +pub const KVM_EXIT_XEN_HCALL: u32 = 1; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_EXIT_ARM_NISV: u32 = 28; +pub const KVM_EXIT_X86_RDMSR: u32 = 29; +pub const KVM_EXIT_X86_WRMSR: u32 = 30; +pub const KVM_EXIT_DIRTY_RING_FULL: u32 = 31; +pub const KVM_EXIT_AP_RESET_HOLD: u32 = 32; +pub const KVM_EXIT_X86_BUS_LOCK: u32 = 33; +pub const KVM_EXIT_XEN: u32 = 34; +pub const KVM_EXIT_RISCV_SBI: u32 = 35; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON: u32 = 4; +pub const KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES: u32 = 1; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const KVM_MSR_EXIT_REASON_INVAL: u32 = 1; +pub const KVM_MSR_EXIT_REASON_UNKNOWN: u32 = 2; +pub const KVM_MSR_EXIT_REASON_FILTER: u32 = 4; +pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_SIDA_READ: u32 = 2; +pub const KVM_S390_MEMOP_SIDA_WRITE: u32 = 3; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_MP_STATE_AP_RESET_HOLD: u32 = 9; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_MWAIT: u32 = 1; +pub const KVM_X86_DISABLE_EXITS_HLT: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_PAUSE: u32 = 4; +pub const KVM_X86_DISABLE_EXITS_CSTATE: u32 = 8; +pub const KVM_X86_DISABLE_VALID_EXITS: u32 = 15; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVM_PPC_NO_HASH: u32 = 4; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_AUTO: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_VM_MIPS_TE: u32 = 2; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_VM_TYPE_ARM_IPA_SIZE_MASK: u32 = 255; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_DISABLE_EXITS: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_CAP_S390_AIS_MIGRATION: u32 = 150; +pub const KVM_CAP_PPC_GET_CPU_CHAR: u32 = 151; +pub const KVM_CAP_S390_BPB: u32 = 152; +pub const KVM_CAP_GET_MSR_FEATURES: u32 = 153; +pub const KVM_CAP_HYPERV_EVENTFD: u32 = 154; +pub const KVM_CAP_HYPERV_TLBFLUSH: u32 = 155; +pub const KVM_CAP_S390_HPAGE_1M: u32 = 156; +pub const KVM_CAP_NESTED_STATE: u32 = 157; +pub const KVM_CAP_ARM_INJECT_SERROR_ESR: u32 = 158; +pub const KVM_CAP_MSR_PLATFORM_INFO: u32 = 159; +pub const KVM_CAP_PPC_NESTED_HV: u32 = 160; +pub const KVM_CAP_HYPERV_SEND_IPI: u32 = 161; +pub const KVM_CAP_COALESCED_PIO: u32 = 162; +pub const KVM_CAP_HYPERV_ENLIGHTENED_VMCS: u32 = 163; +pub const KVM_CAP_EXCEPTION_PAYLOAD: u32 = 164; +pub const KVM_CAP_ARM_VM_IPA_SIZE: u32 = 165; +pub const KVM_CAP_MANUAL_DIRTY_LOG_PROTECT: u32 = 166; +pub const KVM_CAP_HYPERV_CPUID: u32 = 167; +pub const KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2: u32 = 168; +pub const KVM_CAP_PPC_IRQ_XIVE: u32 = 169; +pub const KVM_CAP_ARM_SVE: u32 = 170; +pub const KVM_CAP_ARM_PTRAUTH_ADDRESS: u32 = 171; +pub const KVM_CAP_ARM_PTRAUTH_GENERIC: u32 = 172; +pub const KVM_CAP_PMU_EVENT_FILTER: u32 = 173; +pub const KVM_CAP_ARM_IRQ_LINE_LAYOUT_2: u32 = 174; +pub const KVM_CAP_HYPERV_DIRECT_TLBFLUSH: u32 = 175; +pub const KVM_CAP_PPC_GUEST_DEBUG_SSTEP: u32 = 176; +pub const KVM_CAP_ARM_NISV_TO_USER: u32 = 177; +pub const KVM_CAP_ARM_INJECT_EXT_DABT: u32 = 178; +pub const KVM_CAP_S390_VCPU_RESETS: u32 = 179; +pub const KVM_CAP_S390_PROTECTED: u32 = 180; +pub const KVM_CAP_PPC_SECURE_GUEST: u32 = 181; +pub const KVM_CAP_HALT_POLL: u32 = 182; +pub const KVM_CAP_ASYNC_PF_INT: u32 = 183; +pub const KVM_CAP_LAST_CPU: u32 = 184; +pub const KVM_CAP_SMALLER_MAXPHYADDR: u32 = 185; +pub const KVM_CAP_S390_DIAG318: u32 = 186; +pub const KVM_CAP_STEAL_TIME: u32 = 187; +pub const KVM_CAP_X86_USER_SPACE_MSR: u32 = 188; +pub const KVM_CAP_X86_MSR_FILTER: u32 = 189; +pub const KVM_CAP_ENFORCE_PV_FEATURE_CPUID: u32 = 190; +pub const KVM_CAP_SYS_HYPERV_CPUID: u32 = 191; +pub const KVM_CAP_DIRTY_LOG_RING: u32 = 192; +pub const KVM_CAP_X86_BUS_LOCK_EXIT: u32 = 193; +pub const KVM_CAP_PPC_DAWR1: u32 = 194; +pub const KVM_CAP_SET_GUEST_DEBUG2: u32 = 195; +pub const KVM_CAP_SGX_ATTRIBUTE: u32 = 196; +pub const KVM_CAP_VM_COPY_ENC_CONTEXT_FROM: u32 = 197; +pub const KVM_CAP_PTP_KVM: u32 = 198; +pub const KVM_CAP_HYPERV_ENFORCE_CPUID: u32 = 199; +pub const KVM_CAP_SREGS2: u32 = 200; +pub const KVM_CAP_EXIT_HYPERCALL: u32 = 201; +pub const KVM_CAP_PPC_RPT_INVALIDATE: u32 = 202; +pub const KVM_CAP_BINARY_STATS_FD: u32 = 203; +pub const KVM_CAP_EXIT_ON_EMULATION_FAILURE: u32 = 204; +pub const KVM_CAP_ARM_MTE: u32 = 205; +pub const KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM: u32 = 206; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_CLOCK_REALTIME: u32 = 4; +pub const KVM_CLOCK_HOST_TSC: u32 = 8; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_RISCV: i64 = -9223372036854775808; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_REG_SIZE_U2048: u64 = 36028797018963968; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_XEN_ATTR_TYPE_LONG_MODE: u32 = 0; +pub const KVM_XEN_ATTR_TYPE_SHARED_INFO: u32 = 1; +pub const KVM_XEN_ATTR_TYPE_UPCALL_VECTOR: u32 = 2; +pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO: u32 = 0; +pub const KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: u32 = 1; +pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR: u32 = 2; +pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT: u32 = 3; +pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA: u32 = 4; +pub const KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST: u32 = 5; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub const KVM_HYPERV_CONN_ID_MASK: u32 = 16777215; +pub const KVM_HYPERV_EVENTFD_DEASSIGN: u32 = 1; +pub const KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE: u32 = 1; +pub const KVM_DIRTY_LOG_INITIALLY_SET: u32 = 2; +pub const KVM_DIRTY_LOG_PAGE_OFFSET: u32 = 0; +pub const KVM_DIRTY_GFN_F_MASK: u32 = 3; +pub const KVM_BUS_LOCK_DETECTION_OFF: u32 = 1; +pub const KVM_BUS_LOCK_DETECTION_EXIT: u32 = 2; +pub const KVM_STATS_TYPE_SHIFT: u32 = 0; +pub const KVM_STATS_TYPE_MASK: u32 = 15; +pub const KVM_STATS_TYPE_CUMULATIVE: u32 = 0; +pub const KVM_STATS_TYPE_INSTANT: u32 = 1; +pub const KVM_STATS_TYPE_PEAK: u32 = 2; +pub const KVM_STATS_TYPE_LINEAR_HIST: u32 = 3; +pub const KVM_STATS_TYPE_LOG_HIST: u32 = 4; +pub const KVM_STATS_TYPE_MAX: u32 = 4; +pub const KVM_STATS_UNIT_SHIFT: u32 = 4; +pub const KVM_STATS_UNIT_MASK: u32 = 240; +pub const KVM_STATS_UNIT_NONE: u32 = 0; +pub const KVM_STATS_UNIT_BYTES: u32 = 16; +pub const KVM_STATS_UNIT_SECONDS: u32 = 32; +pub const KVM_STATS_UNIT_CYCLES: u32 = 48; +pub const KVM_STATS_UNIT_MAX: u32 = 48; +pub const KVM_STATS_BASE_SHIFT: u32 = 8; +pub const KVM_STATS_BASE_MASK: u32 = 3840; +pub const KVM_STATS_BASE_POW10: u32 = 0; +pub const KVM_STATS_BASE_POW2: u32 = 256; +pub const KVM_STATS_BASE_MAX: u32 = 256; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_uid_t = __kernel_uid_t; +pub type __kernel_old_gid_t = __kernel_gid_t; +pub type __kernel_old_dev_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct user_regs_struct { + pub pc: ::std::os::raw::c_ulong, + pub ra: ::std::os::raw::c_ulong, + pub sp: ::std::os::raw::c_ulong, + pub gp: ::std::os::raw::c_ulong, + pub tp: ::std::os::raw::c_ulong, + pub t0: ::std::os::raw::c_ulong, + pub t1: ::std::os::raw::c_ulong, + pub t2: ::std::os::raw::c_ulong, + pub s0: ::std::os::raw::c_ulong, + pub s1: ::std::os::raw::c_ulong, + pub a0: ::std::os::raw::c_ulong, + pub a1: ::std::os::raw::c_ulong, + pub a2: ::std::os::raw::c_ulong, + pub a3: ::std::os::raw::c_ulong, + pub a4: ::std::os::raw::c_ulong, + pub a5: ::std::os::raw::c_ulong, + pub a6: ::std::os::raw::c_ulong, + pub a7: ::std::os::raw::c_ulong, + pub s2: ::std::os::raw::c_ulong, + pub s3: ::std::os::raw::c_ulong, + pub s4: ::std::os::raw::c_ulong, + pub s5: ::std::os::raw::c_ulong, + pub s6: ::std::os::raw::c_ulong, + pub s7: ::std::os::raw::c_ulong, + pub s8: ::std::os::raw::c_ulong, + pub s9: ::std::os::raw::c_ulong, + pub s10: ::std::os::raw::c_ulong, + pub s11: ::std::os::raw::c_ulong, + pub t3: ::std::os::raw::c_ulong, + pub t4: ::std::os::raw::c_ulong, + pub t5: ::std::os::raw::c_ulong, + pub t6: ::std::os::raw::c_ulong, +} +#[test] +fn bindgen_test_layout_user_regs_struct() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(user_regs_struct)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(user_regs_struct)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ra as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(ra) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sp as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(sp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gp as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(gp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tp as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(tp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t0 as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t1 as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t2 as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s0 as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s1 as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a0 as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a1 as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a2 as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a3 as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a4 as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a5 as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a5) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a6 as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a7 as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(a7) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s2 as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s3 as *const _ as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s4 as *const _ as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s5 as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s5) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s6 as *const _ as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s7 as *const _ as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s7) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s8 as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s9 as *const _ as usize }, + 200usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s9) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s10 as *const _ as usize }, + 208usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s10) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s11 as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(s11) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t3 as *const _ as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t4 as *const _ as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t5 as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t5) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).t6 as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(user_regs_struct), + "::", + stringify!(t6) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __riscv_f_ext_state { + pub f: [__u32; 32usize], + pub fcsr: __u32, +} +#[test] +fn bindgen_test_layout___riscv_f_ext_state() { + assert_eq!( + ::std::mem::size_of::<__riscv_f_ext_state>(), + 132usize, + concat!("Size of: ", stringify!(__riscv_f_ext_state)) + ); + assert_eq!( + ::std::mem::align_of::<__riscv_f_ext_state>(), + 4usize, + concat!("Alignment of ", stringify!(__riscv_f_ext_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_f_ext_state>())).f as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_f_ext_state), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_f_ext_state>())).fcsr as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(__riscv_f_ext_state), + "::", + stringify!(fcsr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __riscv_d_ext_state { + pub f: [__u64; 32usize], + pub fcsr: __u32, +} +#[test] +fn bindgen_test_layout___riscv_d_ext_state() { + assert_eq!( + ::std::mem::size_of::<__riscv_d_ext_state>(), + 264usize, + concat!("Size of: ", stringify!(__riscv_d_ext_state)) + ); + assert_eq!( + ::std::mem::align_of::<__riscv_d_ext_state>(), + 8usize, + concat!("Alignment of ", stringify!(__riscv_d_ext_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_d_ext_state>())).f as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_d_ext_state), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_d_ext_state>())).fcsr as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(__riscv_d_ext_state), + "::", + stringify!(fcsr) + ) + ); +} +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct __riscv_q_ext_state { + pub f: [__u64; 64usize], + pub fcsr: __u32, + pub reserved: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout___riscv_q_ext_state() { + assert_eq!( + ::std::mem::size_of::<__riscv_q_ext_state>(), + 528usize, + concat!("Size of: ", stringify!(__riscv_q_ext_state)) + ); + assert_eq!( + ::std::mem::align_of::<__riscv_q_ext_state>(), + 16usize, + concat!("Alignment of ", stringify!(__riscv_q_ext_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_q_ext_state>())).f as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_q_ext_state), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_q_ext_state>())).fcsr as *const _ as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(__riscv_q_ext_state), + "::", + stringify!(fcsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_q_ext_state>())).reserved as *const _ as usize }, + 516usize, + concat!( + "Offset of field: ", + stringify!(__riscv_q_ext_state), + "::", + stringify!(reserved) + ) + ); +} +impl Default for __riscv_q_ext_state { + 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)] +#[repr(align(16))] +#[derive(Copy, Clone)] +pub union __riscv_fp_state { + pub f: __riscv_f_ext_state, + pub d: __riscv_d_ext_state, + pub q: __riscv_q_ext_state, +} +#[test] +fn bindgen_test_layout___riscv_fp_state() { + assert_eq!( + ::std::mem::size_of::<__riscv_fp_state>(), + 528usize, + concat!("Size of: ", stringify!(__riscv_fp_state)) + ); + assert_eq!( + ::std::mem::align_of::<__riscv_fp_state>(), + 16usize, + concat!("Alignment of ", stringify!(__riscv_fp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_fp_state>())).f as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_fp_state), + "::", + stringify!(f) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_fp_state>())).d as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_fp_state), + "::", + stringify!(d) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__riscv_fp_state>())).q as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__riscv_fp_state), + "::", + stringify!(q) + ) + ); +} +impl Default for __riscv_fp_state { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs {} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_regs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu {} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch {} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch {} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs {} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs {} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_riscv_config { + pub isa: ::std::os::raw::c_ulong, + pub zicbom_block_size: ::std::os::raw::c_ulong, + pub mvendorid: ::std::os::raw::c_ulong, + pub marchid: ::std::os::raw::c_ulong, + pub mimpid: ::std::os::raw::c_ulong, + pub zicboz_block_size: ::std::os::raw::c_ulong, + pub satp_mode: ::std::os::raw::c_ulong, +} +#[test] +fn bindgen_test_layout_kvm_riscv_config() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_riscv_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_riscv_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).isa as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_config), + "::", + stringify!(isa) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_riscv_core { + pub regs: user_regs_struct, + pub mode: ::std::os::raw::c_ulong, +} +#[test] +fn bindgen_test_layout_kvm_riscv_core() { + assert_eq!( + ::std::mem::size_of::(), + 264usize, + concat!("Size of: ", stringify!(kvm_riscv_core)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_riscv_core)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_core), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mode as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_core), + "::", + stringify!(mode) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_riscv_csr { + pub sstatus: ::std::os::raw::c_ulong, + pub sie: ::std::os::raw::c_ulong, + pub stvec: ::std::os::raw::c_ulong, + pub sscratch: ::std::os::raw::c_ulong, + pub sepc: ::std::os::raw::c_ulong, + pub scause: ::std::os::raw::c_ulong, + pub stval: ::std::os::raw::c_ulong, + pub sip: ::std::os::raw::c_ulong, + pub satp: ::std::os::raw::c_ulong, + pub scounteren: ::std::os::raw::c_ulong, +} +#[test] +fn bindgen_test_layout_kvm_riscv_csr() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_riscv_csr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_riscv_csr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sstatus as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(sstatus) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sie as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(sie) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stvec as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(stvec) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sscratch as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(sscratch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sepc as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(sepc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).scause as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(scause) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stval as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(stval) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sip as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(sip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).satp as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(satp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).scounteren as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_csr), + "::", + stringify!(scounteren) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_riscv_timer { + pub frequency: __u64, + pub time: __u64, + pub compare: __u64, + pub state: __u64, +} +#[test] +fn bindgen_test_layout_kvm_riscv_timer() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_riscv_timer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_riscv_timer)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).frequency as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_timer), + "::", + stringify!(frequency) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).time as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_timer), + "::", + stringify!(time) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).compare as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_timer), + "::", + stringify!(compare) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).state as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_riscv_timer), + "::", + stringify!(state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + 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 kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); +} +impl Default for kvm_irqchip__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + 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 kvm_hyperv_exit { + pub type_: __u32, + pub pad1: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + pub syndbg: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub pad2: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad2 as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(pad2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3 { + pub msr: __u32, + pub pad2: __u32, + pub control: __u64, + pub status: __u64, + pub send_page: __u64, + pub recv_page: __u64, + pub pending_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad2 as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(pad2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).send_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(send_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).recv_page + as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(recv_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending_page + as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(pending_page) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).syndbg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(syndbg) + ) + ); +} +impl Default for kvm_hyperv_exit__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(pad1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + 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 kvm_xen_exit { + pub type_: __u32, + pub u: kvm_xen_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_xen_exit__bindgen_ty_1 { + pub hcall: kvm_xen_exit__bindgen_ty_1__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xen_exit__bindgen_ty_1__bindgen_ty_1 { + pub longmode: __u32, + pub cpl: __u32, + pub input: __u64, + pub result: __u64, + pub params: [__u64; 6usize], +} +#[test] +fn bindgen_test_layout_kvm_xen_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!( + "Size of: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).cpl as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(cpl) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_xen_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_xen_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_xen_exit__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_xen_exit() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_xen_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_xen_exit { + 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 kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub emulation_failure: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_20, + pub hyperv: kvm_hyperv_exit, + pub arm_nisv: kvm_run__bindgen_ty_1__bindgen_ty_21, + pub msr: kvm_run__bindgen_ty_1__bindgen_ty_22, + pub xen: kvm_xen_exit, + pub riscv_sbi: kvm_run__bindgen_ty_1__bindgen_ty_23, + pub padding: [::std::os::raw::c_char; 256usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, + pub cpu: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).cpu as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(cpu) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub suberror: __u32, + pub ndata: __u32, + pub flags: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1 { + pub __bindgen_anon_1: kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1 { + pub insn_size: __u8, + pub insn_bytes: [__u8; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + & (* (:: std :: ptr :: null :: < kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1 > ())) . insn_size as * const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(insn_size) + ) + ); + assert_eq!( + unsafe { + & (* (:: std :: ptr :: null :: < kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1 > ())) . insn_bytes as * const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(insn_bytes) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13__bindgen_ty_1) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_13__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1__bindgen_ty_13 { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_20 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_20() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_20) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_20) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_20), + "::", + stringify!(vector) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_21 { + pub esr_iss: __u64, + pub fault_ipa: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_21() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_21) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_21) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).esr_iss as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_21), + "::", + stringify!(esr_iss) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fault_ipa as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_21), + "::", + stringify!(fault_ipa) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_22 { + pub error: __u8, + pub pad: [__u8; 7usize], + pub reason: __u32, + pub index: __u32, + pub data: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_22() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reason as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22), + "::", + stringify!(reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).index as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_22), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_23 { + pub extension_id: ::std::os::raw::c_ulong, + pub function_id: ::std::os::raw::c_ulong, + pub args: [::std::os::raw::c_ulong; 6usize], + pub ret: [::std::os::raw::c_ulong; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_23() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extension_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23), + "::", + stringify!(extension_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).function_id as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23), + "::", + stringify!(function_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_23), + "::", + stringify!(ret) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emulation_failure as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(emulation_failure) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arm_nisv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(arm_nisv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xen as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(xen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).riscv_sbi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(riscv_sbi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__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() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + 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 kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio_zone__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio_zone__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone { + 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 kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio__bindgen_ty_1, + pub data: [__u8; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_coalesced_mmio { + 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)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +impl Default for kvm_coalesced_mmio_ring { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub __bindgen_anon_1: kvm_s390_mem_op__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_mem_op__bindgen_ty_1 { + pub ar: __u8, + pub sida_offset: __u32, + pub reserved: [__u8; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op__bindgen_ty_1), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sida_offset as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op__bindgen_ty_1), + "::", + stringify!(sida_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_mem_op__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); +} +impl Default for kvm_s390_mem_op { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + 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 kvm_clear_dirty_log { + pub slot: __u32, + pub num_pages: __u32, + pub first_page: __u64, + pub __bindgen_anon_1: kvm_clear_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_clear_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_clear_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_clear_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_clear_dirty_log__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clear_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clear_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_clear_dirty_log__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_clear_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_clear_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clear_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clear_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_pages as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_clear_dirty_log), + "::", + stringify!(num_pages) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first_page as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clear_dirty_log), + "::", + stringify!(first_page) + ) + ); +} +impl Default for kvm_clear_dirty_log { + 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, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: ::std::os::raw::c_uint = 0; +pub const kvm_ioeventfd_flag_nr_pio: ::std::os::raw::c_uint = 1; +pub const kvm_ioeventfd_flag_nr_deassign: ::std::os::raw::c_uint = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: ::std::os::raw::c_uint = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: ::std::os::raw::c_uint = 4; +pub const kvm_ioeventfd_flag_nr_max: ::std::os::raw::c_uint = 5; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + 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, PartialEq)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + 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, PartialEq)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + 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)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad0: __u32, + pub realtime: __u64, + pub host_tsc: __u64, + pub pad: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad0 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).realtime as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(realtime) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_tsc as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(host_tsc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_XIVE: kvm_device_type = 9; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_PV_TIME: kvm_device_type = 10; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 11; +pub type kvm_device_type = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_enc_region { + pub addr: __u64, + pub size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_enc_region() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_enc_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enc_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pv_sec_parm { + pub origin: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_pv_sec_parm() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_pv_sec_parm)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pv_sec_parm)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).origin as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pv_sec_parm), + "::", + stringify!(origin) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pv_sec_parm), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pv_unp { + pub addr: __u64, + pub size: __u64, + pub tweak: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_pv_unp() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_pv_unp)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pv_unp)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pv_unp), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pv_unp), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tweak as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pv_unp), + "::", + stringify!(tweak) + ) + ); +} +pub const pv_cmd_id_KVM_PV_ENABLE: pv_cmd_id = 0; +pub const pv_cmd_id_KVM_PV_DISABLE: pv_cmd_id = 1; +pub const pv_cmd_id_KVM_PV_SET_SEC_PARMS: pv_cmd_id = 2; +pub const pv_cmd_id_KVM_PV_UNPACK: pv_cmd_id = 3; +pub const pv_cmd_id_KVM_PV_VERIFY: pv_cmd_id = 4; +pub const pv_cmd_id_KVM_PV_PREP_RESET: pv_cmd_id = 5; +pub const pv_cmd_id_KVM_PV_UNSHARE_ALL: pv_cmd_id = 6; +pub type pv_cmd_id = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pv_cmd { + pub cmd: __u32, + pub rc: __u16, + pub rrc: __u16, + pub data: __u64, + pub flags: __u32, + pub reserved: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_pv_cmd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_pv_cmd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pv_cmd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(cmd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(rc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rrc as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(rrc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_pv_cmd), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_xen_hvm_attr { + pub type_: __u16, + pub pad: [__u16; 3usize], + pub u: kvm_xen_hvm_attr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_xen_hvm_attr__bindgen_ty_1 { + pub long_mode: __u8, + pub vector: __u8, + pub shared_info: kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1, + pub pad: [__u64; 8usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1 { + pub gfn: __u64, +} +#[test] +fn bindgen_test_layout_kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gfn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(gfn) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_xen_hvm_attr__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_xen_hvm_attr__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_hvm_attr__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).long_mode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1), + "::", + stringify!(long_mode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).shared_info as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1), + "::", + stringify!(shared_info) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_xen_hvm_attr__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_xen_hvm_attr() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_xen_hvm_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_hvm_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_attr), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_xen_hvm_attr { + 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 kvm_xen_vcpu_attr { + pub type_: __u16, + pub pad: [__u16; 3usize], + pub u: kvm_xen_vcpu_attr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_xen_vcpu_attr__bindgen_ty_1 { + pub gpa: __u64, + pub pad: [__u64; 8usize], + pub runstate: kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1 { + pub state: __u64, + pub state_entry_time: __u64, + pub time_running: __u64, + pub time_runnable: __u64, + pub time_blocked: __u64, + pub time_offline: __u64, +} +#[test] +fn bindgen_test_layout_kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!( + "Size of: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).state + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .state_entry_time as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(state_entry_time) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).time_running + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(time_running) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).time_runnable + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(time_runnable) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).time_blocked + as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(time_blocked) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).time_offline + as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(time_offline) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_xen_vcpu_attr__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_xen_vcpu_attr__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_vcpu_attr__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gpa as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1), + "::", + stringify!(gpa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).runstate as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr__bindgen_ty_1), + "::", + stringify!(runstate) + ) + ); +} +impl Default for kvm_xen_vcpu_attr__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_xen_vcpu_attr() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_xen_vcpu_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_vcpu_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_vcpu_attr), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_xen_vcpu_attr { + 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 sev_cmd_id_KVM_SEV_INIT: sev_cmd_id = 0; +pub const sev_cmd_id_KVM_SEV_ES_INIT: sev_cmd_id = 1; +pub const sev_cmd_id_KVM_SEV_LAUNCH_START: sev_cmd_id = 2; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_DATA: sev_cmd_id = 3; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_VMSA: sev_cmd_id = 4; +pub const sev_cmd_id_KVM_SEV_LAUNCH_SECRET: sev_cmd_id = 5; +pub const sev_cmd_id_KVM_SEV_LAUNCH_MEASURE: sev_cmd_id = 6; +pub const sev_cmd_id_KVM_SEV_LAUNCH_FINISH: sev_cmd_id = 7; +pub const sev_cmd_id_KVM_SEV_SEND_START: sev_cmd_id = 8; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_DATA: sev_cmd_id = 9; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_VMSA: sev_cmd_id = 10; +pub const sev_cmd_id_KVM_SEV_SEND_FINISH: sev_cmd_id = 11; +pub const sev_cmd_id_KVM_SEV_RECEIVE_START: sev_cmd_id = 12; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_DATA: sev_cmd_id = 13; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_VMSA: sev_cmd_id = 14; +pub const sev_cmd_id_KVM_SEV_RECEIVE_FINISH: sev_cmd_id = 15; +pub const sev_cmd_id_KVM_SEV_GUEST_STATUS: sev_cmd_id = 16; +pub const sev_cmd_id_KVM_SEV_DBG_DECRYPT: sev_cmd_id = 17; +pub const sev_cmd_id_KVM_SEV_DBG_ENCRYPT: sev_cmd_id = 18; +pub const sev_cmd_id_KVM_SEV_CERT_EXPORT: sev_cmd_id = 19; +pub const sev_cmd_id_KVM_SEV_GET_ATTESTATION_REPORT: sev_cmd_id = 20; +pub const sev_cmd_id_KVM_SEV_SEND_CANCEL: sev_cmd_id = 21; +pub const sev_cmd_id_KVM_SEV_NR_MAX: sev_cmd_id = 22; +pub type sev_cmd_id = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_cmd { + pub id: __u32, + pub data: __u64, + pub error: __u32, + pub sev_fd: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_cmd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).error as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sev_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(sev_fd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_start { + pub handle: __u32, + pub policy: __u32, + pub dh_uaddr: __u64, + pub dh_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_start() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_update_data { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_secret { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_secret() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).trans_len as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_measure { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_measure() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_guest_status { + pub handle: __u32, + pub policy: __u32, + pub state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_guest_status() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).state as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_dbg { + pub src_uaddr: __u64, + pub dst_uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_dbg() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).src_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(src_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dst_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(dst_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_attestation_report { + pub mnonce: [__u8; 16usize], + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_attestation_report() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_sev_attestation_report)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_attestation_report)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mnonce as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_attestation_report), + "::", + stringify!(mnonce) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_attestation_report), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_attestation_report), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_send_start { + pub policy: __u32, + pub pdh_cert_uaddr: __u64, + pub pdh_cert_len: __u32, + pub plat_certs_uaddr: __u64, + pub plat_certs_len: __u32, + pub amd_certs_uaddr: __u64, + pub amd_certs_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_send_start() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_sev_send_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_send_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pdh_cert_uaddr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(pdh_cert_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pdh_cert_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(pdh_cert_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).plat_certs_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(plat_certs_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).plat_certs_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(plat_certs_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).amd_certs_uaddr as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(amd_certs_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).amd_certs_len as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(amd_certs_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).session_len as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_send_update_data { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_send_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_send_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_send_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hdr_len as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_len as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_len as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_send_update_data), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_receive_start { + pub handle: __u32, + pub policy: __u32, + pub pdh_uaddr: __u64, + pub pdh_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_receive_start() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_sev_receive_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_receive_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pdh_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(pdh_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pdh_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(pdh_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_receive_update_data { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_receive_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_receive_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_receive_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hdr_len as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_len as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_len as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_receive_update_data), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + 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 kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__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() + } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + 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, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_eventfd { + pub conn_id: __u32, + pub fd: __s32, + pub flags: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_eventfd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).conn_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(conn_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_gfn { + pub flags: __u32, + pub slot: __u32, + pub offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_gfn() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_gfn)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_gfn)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_gfn), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_gfn), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).offset as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_gfn), + "::", + stringify!(offset) + ) + ); +} +#[doc = " struct kvm_stats_header - Header of per vm/vcpu binary statistics data."] +#[doc = " @flags: Some extra information for header, always 0 for now."] +#[doc = " @name_size: The size in bytes of the memory which contains statistics"] +#[doc = " name string including trailing '\\0'. The memory is allocated"] +#[doc = " at the send of statistics descriptor."] +#[doc = " @num_desc: The number of statistics the vm or vcpu has."] +#[doc = " @id_offset: The offset of the vm/vcpu stats' id string in the file pointed"] +#[doc = " by vm/vcpu stats fd."] +#[doc = " @desc_offset: The offset of the vm/vcpu stats' descriptor block in the file"] +#[doc = " pointd by vm/vcpu stats fd."] +#[doc = " @data_offset: The offset of the vm/vcpu stats' data block in the file"] +#[doc = " pointed by vm/vcpu stats fd."] +#[doc = ""] +#[doc = " This is the header userspace needs to read from stats fd before any other"] +#[doc = " readings. It is used by userspace to discover all the information about the"] +#[doc = " vm/vcpu's binary statistics."] +#[doc = " Userspace reads this header from the start of the vm/vcpu's stats fd."] +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_stats_header { + pub flags: __u32, + pub name_size: __u32, + pub num_desc: __u32, + pub id_offset: __u32, + pub desc_offset: __u32, + pub data_offset: __u32, +} +#[test] +fn bindgen_test_layout_kvm_stats_header() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_stats_header)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_stats_header)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name_size as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(name_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_desc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(num_desc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id_offset as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(id_offset) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).desc_offset as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(desc_offset) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_offset as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_header), + "::", + stringify!(data_offset) + ) + ); +} +#[doc = " struct kvm_stats_desc - Descriptor of a KVM statistics."] +#[doc = " @flags: Annotations of the stats, like type, unit, etc."] +#[doc = " @exponent: Used together with @flags to determine the unit."] +#[doc = " @size: The number of data items for this stats."] +#[doc = " Every data item is of type __u64."] +#[doc = " @offset: The offset of the stats to the start of stat structure in"] +#[doc = " structure kvm or kvm_vcpu."] +#[doc = " @bucket_size: A parameter value used for histogram stats. It is only used"] +#[doc = "\t\tfor linear histogram stats, specifying the size of the bucket;"] +#[doc = " @name: The name string for the stats. Its size is indicated by the"] +#[doc = " &kvm_stats_header->name_size."] +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_stats_desc { + pub flags: __u32, + pub exponent: __s16, + pub size: __u16, + pub offset: __u32, + pub bucket_size: __u32, + pub name: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_kvm_stats_desc() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_stats_desc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_stats_desc)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exponent as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(exponent) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).offset as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(offset) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bucket_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(bucket_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_stats_desc), + "::", + stringify!(name) + ) + ); +} diff --git a/kvm-bindings/src/riscv/mod.rs b/kvm-bindings/src/riscv/mod.rs new file mode 100644 index 000000000..0259d1cf7 --- /dev/null +++ b/kvm-bindings/src/riscv/mod.rs @@ -0,0 +1,9 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#[allow(clippy::all)] +// Keep this until https://github.com/rust-lang/rust-bindgen/issues/1651 is fixed. +#[cfg_attr(test, allow(deref_nullptr))] +pub mod bindings; + +pub use self::bindings::*; diff --git a/kvm-bindings/src/x86/bindings_v4_14_0.rs b/kvm-bindings/src/x86/bindings_v4_14_0.rs new file mode 100644 index 000000000..daa7c00e1 --- /dev/null +++ b/kvm-bindings/src/x86/bindings_v4_14_0.rs @@ -0,0 +1,9622 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const KVM_PIO_PAGE_OFFSET: u32 = 1; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 2; +pub const DE_VECTOR: u32 = 0; +pub const DB_VECTOR: u32 = 1; +pub const BP_VECTOR: u32 = 3; +pub const OF_VECTOR: u32 = 4; +pub const BR_VECTOR: u32 = 5; +pub const UD_VECTOR: u32 = 6; +pub const NM_VECTOR: u32 = 7; +pub const DF_VECTOR: u32 = 8; +pub const TS_VECTOR: u32 = 10; +pub const NP_VECTOR: u32 = 11; +pub const SS_VECTOR: u32 = 12; +pub const GP_VECTOR: u32 = 13; +pub const PF_VECTOR: u32 = 14; +pub const MF_VECTOR: u32 = 16; +pub const AC_VECTOR: u32 = 17; +pub const MC_VECTOR: u32 = 18; +pub const XM_VECTOR: u32 = 19; +pub const VE_VECTOR: u32 = 20; +pub const KVM_NR_INTERRUPTS: u32 = 256; +pub const KVM_IOAPIC_NUM_PINS: u32 = 24; +pub const KVM_IRQCHIP_PIC_MASTER: u32 = 0; +pub const KVM_IRQCHIP_PIC_SLAVE: u32 = 1; +pub const KVM_IRQCHIP_IOAPIC: u32 = 2; +pub const KVM_NR_IRQCHIPS: u32 = 3; +pub const KVM_RUN_X86_SMM: u32 = 1; +pub const KVM_APIC_REG_SIZE: u32 = 1024; +pub const KVM_CPUID_FLAG_SIGNIFCANT_INDEX: u32 = 1; +pub const KVM_CPUID_FLAG_STATEFUL_FUNC: u32 = 2; +pub const KVM_CPUID_FLAG_STATE_READ_NEXT: u32 = 4; +pub const KVM_GUESTDBG_USE_SW_BP: u32 = 65536; +pub const KVM_GUESTDBG_USE_HW_BP: u32 = 131072; +pub const KVM_GUESTDBG_INJECT_DB: u32 = 262144; +pub const KVM_GUESTDBG_INJECT_BP: u32 = 524288; +pub const KVM_PIT_FLAGS_HPET_LEGACY: u32 = 1; +pub const KVM_VCPUEVENT_VALID_NMI_PENDING: u32 = 1; +pub const KVM_VCPUEVENT_VALID_SIPI_VECTOR: u32 = 2; +pub const KVM_VCPUEVENT_VALID_SHADOW: u32 = 4; +pub const KVM_VCPUEVENT_VALID_SMM: u32 = 8; +pub const KVM_X86_SHADOW_INT_MOV_SS: u32 = 1; +pub const KVM_X86_SHADOW_INT_STI: u32 = 2; +pub const KVM_MAX_XCRS: u32 = 16; +pub const KVM_X86_QUIRK_LINT0_REENABLED: u32 = 1; +pub const KVM_X86_QUIRK_CD_NW_CLEARED: u32 = 2; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_REINJECT_CONTROL: u32 = 24; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_MCE: u32 = 31; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_PIT2: u32 = 33; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_PIT_STATE2: u32 = 35; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_XEN_HVM: u32 = 38; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_VCPU_EVENTS: u32 = 41; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_DEBUGREGS: u32 = 50; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_XSAVE: u32 = 55; +pub const KVM_CAP_XCRS: u32 = 56; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_GUEST_MWAIT: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_alias { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub target_phys_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_alias() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_memory_alias)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_alias)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).target_phys_addr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(target_phys_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pic_state { + pub last_irr: __u8, + pub irr: __u8, + pub imr: __u8, + pub isr: __u8, + pub priority_add: __u8, + pub irq_base: __u8, + pub read_reg_select: __u8, + pub poll: __u8, + pub special_mask: __u8, + pub init_state: __u8, + pub auto_eoi: __u8, + pub rotate_on_auto_eoi: __u8, + pub special_fully_nested_mode: __u8, + pub init4: __u8, + pub elcr: __u8, + pub elcr_mask: __u8, +} +#[test] +fn bindgen_test_layout_kvm_pic_state() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_pic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_pic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_irr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(last_irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irr as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).imr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(imr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).isr as *const _ as usize }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(isr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).priority_add as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(priority_add) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq_base as *const _ as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(irq_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).read_reg_select as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(read_reg_select) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).poll as *const _ as usize }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(poll) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).special_mask as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(special_mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).init_state as *const _ as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(init_state) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).auto_eoi as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(auto_eoi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rotate_on_auto_eoi as *const _ as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(rotate_on_auto_eoi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).special_fully_nested_mode as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(special_fully_nested_mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).init4 as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(init4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elcr as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(elcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elcr_mask as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(elcr_mask) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioapic_state { + pub base_address: __u64, + pub ioregsel: __u32, + pub id: __u32, + pub irr: __u32, + pub pad: __u32, + pub redirtbl: [kvm_ioapic_state__bindgen_ty_1; 24usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_ioapic_state__bindgen_ty_1 { + pub bits: __u64, + pub fields: kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 { + pub vector: __u8, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, + pub reserved: [__u8; 4usize], + pub dest_id: __u8, +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved + as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dest_id + as *const _ as usize + }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dest_id) + ) + ); +} +impl kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn delivery_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) } + } + #[inline] + pub fn set_delivery_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 3u8, val as u64) + } + } + #[inline] + pub fn dest_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) } + } + #[inline] + pub fn set_dest_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn delivery_status(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) } + } + #[inline] + pub fn set_delivery_status(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn polarity(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) } + } + #[inline] + pub fn set_polarity(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn remote_irr(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) } + } + #[inline] + pub fn set_remote_irr(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn trig_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) } + } + #[inline] + pub fn set_trig_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn mask(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) } + } + #[inline] + pub fn set_mask(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserve(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 7u8) as u8) } + } + #[inline] + pub fn set_reserve(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 7u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + delivery_mode: __u8, + dest_mode: __u8, + delivery_status: __u8, + polarity: __u8, + remote_irr: __u8, + trig_mode: __u8, + mask: __u8, + reserve: __u8, + ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 3u8, { + let delivery_mode: u8 = unsafe { ::std::mem::transmute(delivery_mode) }; + delivery_mode as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let dest_mode: u8 = unsafe { ::std::mem::transmute(dest_mode) }; + dest_mode as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let delivery_status: u8 = unsafe { ::std::mem::transmute(delivery_status) }; + delivery_status as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let polarity: u8 = unsafe { ::std::mem::transmute(polarity) }; + polarity as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let remote_irr: u8 = unsafe { ::std::mem::transmute(remote_irr) }; + remote_irr as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let trig_mode: u8 = unsafe { ::std::mem::transmute(trig_mode) }; + trig_mode as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let mask: u8 = unsafe { ::std::mem::transmute(mask) }; + mask as u64 + }); + __bindgen_bitfield_unit.set(9usize, 7u8, { + let reserve: u8 = unsafe { ::std::mem::transmute(reserve) }; + reserve as u64 + }); + __bindgen_bitfield_unit + } +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ioapic_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioapic_state__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bits as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fields as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1), + "::", + stringify!(fields) + ) + ); +} +impl Default for kvm_ioapic_state__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state() { + assert_eq!( + ::std::mem::size_of::(), + 216usize, + concat!("Size of: ", stringify!(kvm_ioapic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioapic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(base_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ioregsel as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(ioregsel) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).redirtbl as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(redirtbl) + ) + ); +} +impl Default for kvm_ioapic_state { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub rax: __u64, + pub rbx: __u64, + pub rcx: __u64, + pub rdx: __u64, + pub rsi: __u64, + pub rdi: __u64, + pub rsp: __u64, + pub rbp: __u64, + pub r8: __u64, + pub r9: __u64, + pub r10: __u64, + pub r11: __u64, + pub r12: __u64, + pub r13: __u64, + pub r14: __u64, + pub r15: __u64, + pub rip: __u64, + pub rflags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rax as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rbx as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rbx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rcx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rcx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rdx as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rdx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rsi as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rdi as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rdi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rsp as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rsp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rbp as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rbp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r9) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r10) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r11) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r12) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r13) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r15) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rip as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rflags as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rflags) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_lapic_state { + pub regs: [::std::os::raw::c_char; 1024usize], +} +#[test] +fn bindgen_test_layout_kvm_lapic_state() { + assert_eq!( + ::std::mem::size_of::(), + 1024usize, + concat!("Size of: ", stringify!(kvm_lapic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_lapic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_lapic_state), + "::", + stringify!(regs) + ) + ); +} +impl Default for kvm_lapic_state { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_segment { + pub base: __u64, + pub limit: __u32, + pub selector: __u16, + pub type_: __u8, + pub present: __u8, + pub dpl: __u8, + pub db: __u8, + pub s: __u8, + pub l: __u8, + pub g: __u8, + pub avl: __u8, + pub unusable: __u8, + pub padding: __u8, +} +#[test] +fn bindgen_test_layout_kvm_segment() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_segment)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_segment)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).limit as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(limit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).selector as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(selector) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).present as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(present) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dpl as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(dpl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).db as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(db) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(s) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(l) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).g as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(g) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).avl as *const _ as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(avl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).unusable as *const _ as usize }, + 22usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(unusable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 23usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dtable { + pub base: __u64, + pub limit: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_dtable() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dtable)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dtable)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).limit as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(limit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs { + pub cs: kvm_segment, + pub ds: kvm_segment, + pub es: kvm_segment, + pub fs: kvm_segment, + pub gs: kvm_segment, + pub ss: kvm_segment, + pub tr: kvm_segment, + pub ldt: kvm_segment, + pub gdt: kvm_dtable, + pub idt: kvm_dtable, + pub cr0: __u64, + pub cr2: __u64, + pub cr3: __u64, + pub cr4: __u64, + pub cr8: __u64, + pub efer: __u64, + pub apic_base: __u64, + pub interrupt_bitmap: [__u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 312usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ds) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(es) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(fs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(gs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ss) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tr as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(tr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ldt as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ldt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gdt as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(gdt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).idt as *const _ as usize }, + 208usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(idt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr0 as *const _ as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr3 as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr4 as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).efer as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(efer) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).interrupt_bitmap as *const _ as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(interrupt_bitmap) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu { + pub fpr: [[__u8; 16usize]; 8usize], + pub fcw: __u16, + pub fsw: __u16, + pub ftwx: __u8, + pub pad1: __u8, + pub last_opcode: __u16, + pub last_ip: __u64, + pub last_dp: __u64, + pub xmm: [[__u8; 16usize]; 16usize], + pub mxcsr: __u32, + pub pad2: __u32, +} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 416usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fpr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fcw as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fcw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsw as *const _ as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fsw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ftwx as *const _ as usize }, + 132usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(ftwx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + 133usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(pad1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_opcode as *const _ as usize }, + 134usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_opcode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_ip as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_ip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_dp as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_dp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xmm as *const _ as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(xmm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mxcsr as *const _ as usize }, + 408usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(mxcsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 412usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msr_entry { + pub index: __u32, + pub reserved: __u32, + pub data: __u64, +} +#[test] +fn bindgen_test_layout_kvm_msr_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_msr_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_msr_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).index as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_msrs { + pub nmsrs: __u32, + pub pad: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_msrs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_msrs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_msrs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmsrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(nmsrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_msr_list { + pub nmsrs: __u32, + pub indices: __IncompleteArrayField<__u32>, +} +#[test] +fn bindgen_test_layout_kvm_msr_list() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_msr_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msr_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmsrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_list), + "::", + stringify!(nmsrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).indices as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_list), + "::", + stringify!(indices) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_cpuid_entry { + pub function: __u32, + pub eax: __u32, + pub ebx: __u32, + pub ecx: __u32, + pub edx: __u32, + pub padding: __u32, +} +#[test] +fn bindgen_test_layout_kvm_cpuid_entry() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_cpuid_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).function as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(function) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(eax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(ebx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(ecx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(edx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_cpuid { + pub nent: __u32, + pub padding: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_cpuid() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_cpuid)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nent as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(nent) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_cpuid_entry2 { + pub function: __u32, + pub index: __u32, + pub flags: __u32, + pub eax: __u32, + pub ebx: __u32, + pub ecx: __u32, + pub edx: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_cpuid_entry2() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_cpuid_entry2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid_entry2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).function as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(function) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).index as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(eax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(ebx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(ecx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(edx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_cpuid2 { + pub nent: __u32, + pub padding: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_cpuid2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_cpuid2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nent as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(nent) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_channel_state { + pub count: __u32, + pub latched_count: __u16, + pub count_latched: __u8, + pub status_latched: __u8, + pub status: __u8, + pub read_state: __u8, + pub write_state: __u8, + pub write_latch: __u8, + pub rw_mode: __u8, + pub mode: __u8, + pub bcd: __u8, + pub gate: __u8, + pub count_load_time: __s64, +} +#[test] +fn bindgen_test_layout_kvm_pit_channel_state() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_pit_channel_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_channel_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).latched_count as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(latched_count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count_latched as *const _ as usize + }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count_latched) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status_latched as *const _ as usize + }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(status_latched) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).read_state as *const _ as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(read_state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).write_state as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(write_state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).write_latch as *const _ as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(write_latch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rw_mode as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(rw_mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mode as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bcd as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(bcd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gate as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(gate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count_load_time as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count_load_time) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch { + pub exception: __u32, + pub pad: __u32, + pub pc: __u64, + pub dr6: __u64, + pub dr7: __u64, +} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr6 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(dr6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr7 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(dr7) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch { + pub debugreg: [__u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debugreg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(debugreg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_state { + pub channels: [kvm_pit_channel_state; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_state() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_pit_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).channels as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state), + "::", + stringify!(channels) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_state2 { + pub channels: [kvm_pit_channel_state; 3usize], + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_state2() { + assert_eq!( + ::std::mem::size_of::(), + 112usize, + concat!("Size of: ", stringify!(kvm_pit_state2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_state2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).channels as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(channels) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_reinject_control { + pub pit_reinject: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_reinject_control() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_reinject_control)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_reinject_control)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pit_reinject as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reinject_control), + "::", + stringify!(pit_reinject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_reinject_control), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events { + pub exception: kvm_vcpu_events__bindgen_ty_1, + pub interrupt: kvm_vcpu_events__bindgen_ty_2, + pub nmi: kvm_vcpu_events__bindgen_ty_3, + pub sipi_vector: __u32, + pub flags: __u32, + pub smi: kvm_vcpu_events__bindgen_ty_4, + pub reserved: [__u32; 9usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_1 { + pub injected: __u8, + pub nr: __u8, + pub has_error_code: __u8, + pub pad: __u8, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).has_error_code as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(has_error_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_2 { + pub injected: __u8, + pub nr: __u8, + pub soft: __u8, + pub shadow: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_2)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).soft as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(soft) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).shadow as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(shadow) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_3 { + pub injected: __u8, + pub pending: __u8, + pub masked: __u8, + pub pad: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_3)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).masked as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(masked) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_4 { + pub smm: __u8, + pub pending: __u8, + pub smm_inside_nmi: __u8, + pub latched_init: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_4)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).smm as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(smm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).smm_inside_nmi as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(smm_inside_nmi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).latched_init as *const _ + as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(latched_init) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).interrupt as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(interrupt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmi as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(nmi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sipi_vector as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(sipi_vector) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smi as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(smi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debugregs { + pub db: [__u64; 4usize], + pub dr6: __u64, + pub dr7: __u64, + pub flags: __u64, + pub reserved: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_debugregs() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_debugregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debugregs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).db as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(db) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr6 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(dr6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr7 as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(dr7) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_xsave { + pub region: [__u32; 1024usize], +} +#[test] +fn bindgen_test_layout_kvm_xsave() { + assert_eq!( + ::std::mem::size_of::(), + 4096usize, + concat!("Size of: ", stringify!(kvm_xsave)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_xsave)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).region as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xsave), + "::", + stringify!(region) + ) + ); +} +impl Default for kvm_xsave { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xcr { + pub xcr: __u32, + pub reserved: __u32, + pub value: __u64, +} +#[test] +fn bindgen_test_layout_kvm_xcr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_xcr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xcr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(xcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).value as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(value) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xcrs { + pub nr_xcrs: __u32, + pub flags: __u32, + pub xcrs: [kvm_xcr; 16usize], + pub padding: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_xcrs() { + assert_eq!( + ::std::mem::size_of::(), + 392usize, + concat!("Size of: ", stringify!(kvm_xcrs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xcrs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr_xcrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(nr_xcrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xcrs as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(xcrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs {} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + pub pic: kvm_pic_state, + pub ioapic: kvm_ioapic_state, + _bindgen_union_align: [u64; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pic as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(pic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ioapic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(ioapic) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u8; 2048usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub pad: __u32, + pub data: [__u8; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_x86_mce { + pub status: __u64, + pub addr: __u64, + pub misc: __u64, + pub mcg_status: __u64, + pub bank: __u8, + pub pad1: [__u8; 7usize], + pub pad2: [__u64; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_x86_mce() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_x86_mce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_x86_mce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).misc as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(misc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcg_status as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(mcg_status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bank as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(bank) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(pad1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xen_hvm_config { + pub flags: __u32, + pub msr: __u32, + pub blob_addr_32: __u64, + pub blob_addr_64: __u64, + pub blob_size_32: __u8, + pub blob_size_64: __u8, + pub pad2: [__u8; 30usize], +} +#[test] +fn bindgen_test_layout_kvm_xen_hvm_config() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(kvm_xen_hvm_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_hvm_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_addr_32 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_addr_32) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_addr_64 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_addr_64) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_size_32 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_size_32) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_size_64 as *const _ as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_size_64) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} diff --git a/kvm-bindings/src/x86/bindings_v4_20_0.rs b/kvm-bindings/src/x86/bindings_v4_20_0.rs new file mode 100644 index 000000000..6a1369a76 --- /dev/null +++ b/kvm-bindings/src/x86/bindings_v4_20_0.rs @@ -0,0 +1,10559 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const KVM_PIO_PAGE_OFFSET: u32 = 1; +pub const KVM_COALESCED_MMIO_PAGE_OFFSET: u32 = 2; +pub const DE_VECTOR: u32 = 0; +pub const DB_VECTOR: u32 = 1; +pub const BP_VECTOR: u32 = 3; +pub const OF_VECTOR: u32 = 4; +pub const BR_VECTOR: u32 = 5; +pub const UD_VECTOR: u32 = 6; +pub const NM_VECTOR: u32 = 7; +pub const DF_VECTOR: u32 = 8; +pub const TS_VECTOR: u32 = 10; +pub const NP_VECTOR: u32 = 11; +pub const SS_VECTOR: u32 = 12; +pub const GP_VECTOR: u32 = 13; +pub const PF_VECTOR: u32 = 14; +pub const MF_VECTOR: u32 = 16; +pub const AC_VECTOR: u32 = 17; +pub const MC_VECTOR: u32 = 18; +pub const XM_VECTOR: u32 = 19; +pub const VE_VECTOR: u32 = 20; +pub const KVM_NR_INTERRUPTS: u32 = 256; +pub const KVM_IOAPIC_NUM_PINS: u32 = 24; +pub const KVM_IRQCHIP_PIC_MASTER: u32 = 0; +pub const KVM_IRQCHIP_PIC_SLAVE: u32 = 1; +pub const KVM_IRQCHIP_IOAPIC: u32 = 2; +pub const KVM_NR_IRQCHIPS: u32 = 3; +pub const KVM_RUN_X86_SMM: u32 = 1; +pub const KVM_APIC_REG_SIZE: u32 = 1024; +pub const KVM_CPUID_FLAG_SIGNIFCANT_INDEX: u32 = 1; +pub const KVM_CPUID_FLAG_STATEFUL_FUNC: u32 = 2; +pub const KVM_CPUID_FLAG_STATE_READ_NEXT: u32 = 4; +pub const KVM_GUESTDBG_USE_SW_BP: u32 = 65536; +pub const KVM_GUESTDBG_USE_HW_BP: u32 = 131072; +pub const KVM_GUESTDBG_INJECT_DB: u32 = 262144; +pub const KVM_GUESTDBG_INJECT_BP: u32 = 524288; +pub const KVM_PIT_FLAGS_HPET_LEGACY: u32 = 1; +pub const KVM_VCPUEVENT_VALID_NMI_PENDING: u32 = 1; +pub const KVM_VCPUEVENT_VALID_SIPI_VECTOR: u32 = 2; +pub const KVM_VCPUEVENT_VALID_SHADOW: u32 = 4; +pub const KVM_VCPUEVENT_VALID_SMM: u32 = 8; +pub const KVM_VCPUEVENT_VALID_PAYLOAD: u32 = 16; +pub const KVM_X86_SHADOW_INT_MOV_SS: u32 = 1; +pub const KVM_X86_SHADOW_INT_STI: u32 = 2; +pub const KVM_MAX_XCRS: u32 = 16; +pub const KVM_SYNC_X86_REGS: u32 = 1; +pub const KVM_SYNC_X86_SREGS: u32 = 2; +pub const KVM_SYNC_X86_EVENTS: u32 = 4; +pub const KVM_SYNC_X86_VALID_FIELDS: u32 = 7; +pub const KVM_X86_QUIRK_LINT0_REENABLED: u32 = 1; +pub const KVM_X86_QUIRK_CD_NW_CLEARED: u32 = 2; +pub const KVM_X86_QUIRK_LAPIC_MMIO_HOLE: u32 = 4; +pub const KVM_STATE_NESTED_GUEST_MODE: u32 = 1; +pub const KVM_STATE_NESTED_RUN_PENDING: u32 = 2; +pub const KVM_STATE_NESTED_EVMCS: u32 = 4; +pub const KVM_STATE_NESTED_SMM_GUEST_MODE: u32 = 1; +pub const KVM_STATE_NESTED_SMM_VMXON: u32 = 2; +pub const KVM_API_VERSION: u32 = 12; +pub const KVM_TRC_SHIFT: u32 = 16; +pub const KVM_TRC_ENTRYEXIT: u32 = 65536; +pub const KVM_TRC_HANDLER: u32 = 131072; +pub const KVM_TRC_VMENTRY: u32 = 65537; +pub const KVM_TRC_VMEXIT: u32 = 65538; +pub const KVM_TRC_PAGE_FAULT: u32 = 131073; +pub const KVM_TRC_HEAD_SIZE: u32 = 12; +pub const KVM_TRC_CYCLE_SIZE: u32 = 8; +pub const KVM_TRC_EXTRA_MAX: u32 = 7; +pub const KVM_TRC_INJ_VIRQ: u32 = 131074; +pub const KVM_TRC_REDELIVER_EVT: u32 = 131075; +pub const KVM_TRC_PEND_INTR: u32 = 131076; +pub const KVM_TRC_IO_READ: u32 = 131077; +pub const KVM_TRC_IO_WRITE: u32 = 131078; +pub const KVM_TRC_CR_READ: u32 = 131079; +pub const KVM_TRC_CR_WRITE: u32 = 131080; +pub const KVM_TRC_DR_READ: u32 = 131081; +pub const KVM_TRC_DR_WRITE: u32 = 131082; +pub const KVM_TRC_MSR_READ: u32 = 131083; +pub const KVM_TRC_MSR_WRITE: u32 = 131084; +pub const KVM_TRC_CPUID: u32 = 131085; +pub const KVM_TRC_INTR: u32 = 131086; +pub const KVM_TRC_NMI: u32 = 131087; +pub const KVM_TRC_VMMCALL: u32 = 131088; +pub const KVM_TRC_HLT: u32 = 131089; +pub const KVM_TRC_CLTS: u32 = 131090; +pub const KVM_TRC_LMSW: u32 = 131091; +pub const KVM_TRC_APIC_ACCESS: u32 = 131092; +pub const KVM_TRC_TDP_FAULT: u32 = 131093; +pub const KVM_TRC_GTLB_WRITE: u32 = 131094; +pub const KVM_TRC_STLB_WRITE: u32 = 131095; +pub const KVM_TRC_STLB_INVAL: u32 = 131096; +pub const KVM_TRC_PPC_INSTR: u32 = 131097; +pub const KVM_MEM_LOG_DIRTY_PAGES: u32 = 1; +pub const KVM_MEM_READONLY: u32 = 2; +pub const KVM_PIT_SPEAKER_DUMMY: u32 = 1; +pub const KVM_S390_CMMA_PEEK: u32 = 1; +pub const KVM_EXIT_HYPERV_SYNIC: u32 = 1; +pub const KVM_EXIT_HYPERV_HCALL: u32 = 2; +pub const KVM_S390_GET_SKEYS_NONE: u32 = 1; +pub const KVM_S390_SKEYS_MAX: u32 = 1048576; +pub const KVM_EXIT_UNKNOWN: u32 = 0; +pub const KVM_EXIT_EXCEPTION: u32 = 1; +pub const KVM_EXIT_IO: u32 = 2; +pub const KVM_EXIT_HYPERCALL: u32 = 3; +pub const KVM_EXIT_DEBUG: u32 = 4; +pub const KVM_EXIT_HLT: u32 = 5; +pub const KVM_EXIT_MMIO: u32 = 6; +pub const KVM_EXIT_IRQ_WINDOW_OPEN: u32 = 7; +pub const KVM_EXIT_SHUTDOWN: u32 = 8; +pub const KVM_EXIT_FAIL_ENTRY: u32 = 9; +pub const KVM_EXIT_INTR: u32 = 10; +pub const KVM_EXIT_SET_TPR: u32 = 11; +pub const KVM_EXIT_TPR_ACCESS: u32 = 12; +pub const KVM_EXIT_S390_SIEIC: u32 = 13; +pub const KVM_EXIT_S390_RESET: u32 = 14; +pub const KVM_EXIT_DCR: u32 = 15; +pub const KVM_EXIT_NMI: u32 = 16; +pub const KVM_EXIT_INTERNAL_ERROR: u32 = 17; +pub const KVM_EXIT_OSI: u32 = 18; +pub const KVM_EXIT_PAPR_HCALL: u32 = 19; +pub const KVM_EXIT_S390_UCONTROL: u32 = 20; +pub const KVM_EXIT_WATCHDOG: u32 = 21; +pub const KVM_EXIT_S390_TSCH: u32 = 22; +pub const KVM_EXIT_EPR: u32 = 23; +pub const KVM_EXIT_SYSTEM_EVENT: u32 = 24; +pub const KVM_EXIT_S390_STSI: u32 = 25; +pub const KVM_EXIT_IOAPIC_EOI: u32 = 26; +pub const KVM_EXIT_HYPERV: u32 = 27; +pub const KVM_INTERNAL_ERROR_EMULATION: u32 = 1; +pub const KVM_INTERNAL_ERROR_SIMUL_EX: u32 = 2; +pub const KVM_INTERNAL_ERROR_DELIVERY_EV: u32 = 3; +pub const KVM_EXIT_IO_IN: u32 = 0; +pub const KVM_EXIT_IO_OUT: u32 = 1; +pub const KVM_S390_RESET_POR: u32 = 1; +pub const KVM_S390_RESET_CLEAR: u32 = 2; +pub const KVM_S390_RESET_SUBSYSTEM: u32 = 4; +pub const KVM_S390_RESET_CPU_INIT: u32 = 8; +pub const KVM_S390_RESET_IPL: u32 = 16; +pub const KVM_SYSTEM_EVENT_SHUTDOWN: u32 = 1; +pub const KVM_SYSTEM_EVENT_RESET: u32 = 2; +pub const KVM_SYSTEM_EVENT_CRASH: u32 = 3; +pub const SYNC_REGS_SIZE_BYTES: u32 = 2048; +pub const KVM_S390_MEMOP_LOGICAL_READ: u32 = 0; +pub const KVM_S390_MEMOP_LOGICAL_WRITE: u32 = 1; +pub const KVM_S390_MEMOP_F_CHECK_ONLY: u32 = 1; +pub const KVM_S390_MEMOP_F_INJECT_EXCEPTION: u32 = 2; +pub const KVM_MP_STATE_RUNNABLE: u32 = 0; +pub const KVM_MP_STATE_UNINITIALIZED: u32 = 1; +pub const KVM_MP_STATE_INIT_RECEIVED: u32 = 2; +pub const KVM_MP_STATE_HALTED: u32 = 3; +pub const KVM_MP_STATE_SIPI_RECEIVED: u32 = 4; +pub const KVM_MP_STATE_STOPPED: u32 = 5; +pub const KVM_MP_STATE_CHECK_STOP: u32 = 6; +pub const KVM_MP_STATE_OPERATING: u32 = 7; +pub const KVM_MP_STATE_LOAD: u32 = 8; +pub const KVM_S390_SIGP_STOP: u32 = 4294836224; +pub const KVM_S390_PROGRAM_INT: u32 = 4294836225; +pub const KVM_S390_SIGP_SET_PREFIX: u32 = 4294836226; +pub const KVM_S390_RESTART: u32 = 4294836227; +pub const KVM_S390_INT_PFAULT_INIT: u32 = 4294836228; +pub const KVM_S390_INT_PFAULT_DONE: u32 = 4294836229; +pub const KVM_S390_MCHK: u32 = 4294840320; +pub const KVM_S390_INT_CLOCK_COMP: u32 = 4294905860; +pub const KVM_S390_INT_CPU_TIMER: u32 = 4294905861; +pub const KVM_S390_INT_VIRTIO: u32 = 4294911491; +pub const KVM_S390_INT_SERVICE: u32 = 4294910977; +pub const KVM_S390_INT_EMERGENCY: u32 = 4294906369; +pub const KVM_S390_INT_EXTERNAL_CALL: u32 = 4294906370; +pub const KVM_S390_INT_IO_MIN: u32 = 0; +pub const KVM_S390_INT_IO_MAX: u32 = 4294836223; +pub const KVM_S390_INT_IO_AI_MASK: u32 = 67108864; +pub const KVM_S390_PGM_FLAGS_ILC_VALID: u32 = 1; +pub const KVM_S390_PGM_FLAGS_ILC_0: u32 = 2; +pub const KVM_S390_PGM_FLAGS_ILC_1: u32 = 4; +pub const KVM_S390_PGM_FLAGS_ILC_MASK: u32 = 6; +pub const KVM_S390_PGM_FLAGS_NO_REWIND: u32 = 8; +pub const KVM_S390_STOP_FLAG_STORE_STATUS: u32 = 1; +pub const KVM_GUESTDBG_ENABLE: u32 = 1; +pub const KVM_GUESTDBG_SINGLESTEP: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_MWAIT: u32 = 1; +pub const KVM_X86_DISABLE_EXITS_HLT: u32 = 2; +pub const KVM_X86_DISABLE_EXITS_PAUSE: u32 = 4; +pub const KVM_X86_DISABLE_VALID_EXITS: u32 = 7; +pub const KVM_PPC_PVINFO_FLAGS_EV_IDLE: u32 = 1; +pub const KVM_PPC_PAGE_SIZES_MAX_SZ: u32 = 8; +pub const KVM_PPC_PAGE_SIZES_REAL: u32 = 1; +pub const KVM_PPC_1T_SEGMENTS: u32 = 2; +pub const KVM_PPC_NO_HASH: u32 = 4; +pub const KVMIO: u32 = 174; +pub const KVM_VM_S390_UCONTROL: u32 = 1; +pub const KVM_VM_PPC_HV: u32 = 1; +pub const KVM_VM_PPC_PR: u32 = 2; +pub const KVM_VM_MIPS_TE: u32 = 0; +pub const KVM_VM_MIPS_VZ: u32 = 1; +pub const KVM_S390_SIE_PAGE_OFFSET: u32 = 1; +pub const KVM_VM_TYPE_ARM_IPA_SIZE_MASK: u32 = 255; +pub const KVM_CAP_IRQCHIP: u32 = 0; +pub const KVM_CAP_HLT: u32 = 1; +pub const KVM_CAP_MMU_SHADOW_CACHE_CONTROL: u32 = 2; +pub const KVM_CAP_USER_MEMORY: u32 = 3; +pub const KVM_CAP_SET_TSS_ADDR: u32 = 4; +pub const KVM_CAP_VAPIC: u32 = 6; +pub const KVM_CAP_EXT_CPUID: u32 = 7; +pub const KVM_CAP_CLOCKSOURCE: u32 = 8; +pub const KVM_CAP_NR_VCPUS: u32 = 9; +pub const KVM_CAP_NR_MEMSLOTS: u32 = 10; +pub const KVM_CAP_PIT: u32 = 11; +pub const KVM_CAP_NOP_IO_DELAY: u32 = 12; +pub const KVM_CAP_PV_MMU: u32 = 13; +pub const KVM_CAP_MP_STATE: u32 = 14; +pub const KVM_CAP_COALESCED_MMIO: u32 = 15; +pub const KVM_CAP_SYNC_MMU: u32 = 16; +pub const KVM_CAP_IOMMU: u32 = 18; +pub const KVM_CAP_DESTROY_MEMORY_REGION_WORKS: u32 = 21; +pub const KVM_CAP_USER_NMI: u32 = 22; +pub const KVM_CAP_SET_GUEST_DEBUG: u32 = 23; +pub const KVM_CAP_REINJECT_CONTROL: u32 = 24; +pub const KVM_CAP_IRQ_ROUTING: u32 = 25; +pub const KVM_CAP_IRQ_INJECT_STATUS: u32 = 26; +pub const KVM_CAP_ASSIGN_DEV_IRQ: u32 = 29; +pub const KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: u32 = 30; +pub const KVM_CAP_MCE: u32 = 31; +pub const KVM_CAP_IRQFD: u32 = 32; +pub const KVM_CAP_PIT2: u32 = 33; +pub const KVM_CAP_SET_BOOT_CPU_ID: u32 = 34; +pub const KVM_CAP_PIT_STATE2: u32 = 35; +pub const KVM_CAP_IOEVENTFD: u32 = 36; +pub const KVM_CAP_SET_IDENTITY_MAP_ADDR: u32 = 37; +pub const KVM_CAP_XEN_HVM: u32 = 38; +pub const KVM_CAP_ADJUST_CLOCK: u32 = 39; +pub const KVM_CAP_INTERNAL_ERROR_DATA: u32 = 40; +pub const KVM_CAP_VCPU_EVENTS: u32 = 41; +pub const KVM_CAP_S390_PSW: u32 = 42; +pub const KVM_CAP_PPC_SEGSTATE: u32 = 43; +pub const KVM_CAP_HYPERV: u32 = 44; +pub const KVM_CAP_HYPERV_VAPIC: u32 = 45; +pub const KVM_CAP_HYPERV_SPIN: u32 = 46; +pub const KVM_CAP_PCI_SEGMENT: u32 = 47; +pub const KVM_CAP_PPC_PAIRED_SINGLES: u32 = 48; +pub const KVM_CAP_INTR_SHADOW: u32 = 49; +pub const KVM_CAP_DEBUGREGS: u32 = 50; +pub const KVM_CAP_X86_ROBUST_SINGLESTEP: u32 = 51; +pub const KVM_CAP_PPC_OSI: u32 = 52; +pub const KVM_CAP_PPC_UNSET_IRQ: u32 = 53; +pub const KVM_CAP_ENABLE_CAP: u32 = 54; +pub const KVM_CAP_XSAVE: u32 = 55; +pub const KVM_CAP_XCRS: u32 = 56; +pub const KVM_CAP_PPC_GET_PVINFO: u32 = 57; +pub const KVM_CAP_PPC_IRQ_LEVEL: u32 = 58; +pub const KVM_CAP_ASYNC_PF: u32 = 59; +pub const KVM_CAP_TSC_CONTROL: u32 = 60; +pub const KVM_CAP_GET_TSC_KHZ: u32 = 61; +pub const KVM_CAP_PPC_BOOKE_SREGS: u32 = 62; +pub const KVM_CAP_SPAPR_TCE: u32 = 63; +pub const KVM_CAP_PPC_SMT: u32 = 64; +pub const KVM_CAP_PPC_RMA: u32 = 65; +pub const KVM_CAP_MAX_VCPUS: u32 = 66; +pub const KVM_CAP_PPC_HIOR: u32 = 67; +pub const KVM_CAP_PPC_PAPR: u32 = 68; +pub const KVM_CAP_SW_TLB: u32 = 69; +pub const KVM_CAP_ONE_REG: u32 = 70; +pub const KVM_CAP_S390_GMAP: u32 = 71; +pub const KVM_CAP_TSC_DEADLINE_TIMER: u32 = 72; +pub const KVM_CAP_S390_UCONTROL: u32 = 73; +pub const KVM_CAP_SYNC_REGS: u32 = 74; +pub const KVM_CAP_PCI_2_3: u32 = 75; +pub const KVM_CAP_KVMCLOCK_CTRL: u32 = 76; +pub const KVM_CAP_SIGNAL_MSI: u32 = 77; +pub const KVM_CAP_PPC_GET_SMMU_INFO: u32 = 78; +pub const KVM_CAP_S390_COW: u32 = 79; +pub const KVM_CAP_PPC_ALLOC_HTAB: u32 = 80; +pub const KVM_CAP_READONLY_MEM: u32 = 81; +pub const KVM_CAP_IRQFD_RESAMPLE: u32 = 82; +pub const KVM_CAP_PPC_BOOKE_WATCHDOG: u32 = 83; +pub const KVM_CAP_PPC_HTAB_FD: u32 = 84; +pub const KVM_CAP_S390_CSS_SUPPORT: u32 = 85; +pub const KVM_CAP_PPC_EPR: u32 = 86; +pub const KVM_CAP_ARM_PSCI: u32 = 87; +pub const KVM_CAP_ARM_SET_DEVICE_ADDR: u32 = 88; +pub const KVM_CAP_DEVICE_CTRL: u32 = 89; +pub const KVM_CAP_IRQ_MPIC: u32 = 90; +pub const KVM_CAP_PPC_RTAS: u32 = 91; +pub const KVM_CAP_IRQ_XICS: u32 = 92; +pub const KVM_CAP_ARM_EL1_32BIT: u32 = 93; +pub const KVM_CAP_SPAPR_MULTITCE: u32 = 94; +pub const KVM_CAP_EXT_EMUL_CPUID: u32 = 95; +pub const KVM_CAP_HYPERV_TIME: u32 = 96; +pub const KVM_CAP_IOAPIC_POLARITY_IGNORED: u32 = 97; +pub const KVM_CAP_ENABLE_CAP_VM: u32 = 98; +pub const KVM_CAP_S390_IRQCHIP: u32 = 99; +pub const KVM_CAP_IOEVENTFD_NO_LENGTH: u32 = 100; +pub const KVM_CAP_VM_ATTRIBUTES: u32 = 101; +pub const KVM_CAP_ARM_PSCI_0_2: u32 = 102; +pub const KVM_CAP_PPC_FIXUP_HCALL: u32 = 103; +pub const KVM_CAP_PPC_ENABLE_HCALL: u32 = 104; +pub const KVM_CAP_CHECK_EXTENSION_VM: u32 = 105; +pub const KVM_CAP_S390_USER_SIGP: u32 = 106; +pub const KVM_CAP_S390_VECTOR_REGISTERS: u32 = 107; +pub const KVM_CAP_S390_MEM_OP: u32 = 108; +pub const KVM_CAP_S390_USER_STSI: u32 = 109; +pub const KVM_CAP_S390_SKEYS: u32 = 110; +pub const KVM_CAP_MIPS_FPU: u32 = 111; +pub const KVM_CAP_MIPS_MSA: u32 = 112; +pub const KVM_CAP_S390_INJECT_IRQ: u32 = 113; +pub const KVM_CAP_S390_IRQ_STATE: u32 = 114; +pub const KVM_CAP_PPC_HWRNG: u32 = 115; +pub const KVM_CAP_DISABLE_QUIRKS: u32 = 116; +pub const KVM_CAP_X86_SMM: u32 = 117; +pub const KVM_CAP_MULTI_ADDRESS_SPACE: u32 = 118; +pub const KVM_CAP_GUEST_DEBUG_HW_BPS: u32 = 119; +pub const KVM_CAP_GUEST_DEBUG_HW_WPS: u32 = 120; +pub const KVM_CAP_SPLIT_IRQCHIP: u32 = 121; +pub const KVM_CAP_IOEVENTFD_ANY_LENGTH: u32 = 122; +pub const KVM_CAP_HYPERV_SYNIC: u32 = 123; +pub const KVM_CAP_S390_RI: u32 = 124; +pub const KVM_CAP_SPAPR_TCE_64: u32 = 125; +pub const KVM_CAP_ARM_PMU_V3: u32 = 126; +pub const KVM_CAP_VCPU_ATTRIBUTES: u32 = 127; +pub const KVM_CAP_MAX_VCPU_ID: u32 = 128; +pub const KVM_CAP_X2APIC_API: u32 = 129; +pub const KVM_CAP_S390_USER_INSTR0: u32 = 130; +pub const KVM_CAP_MSI_DEVID: u32 = 131; +pub const KVM_CAP_PPC_HTM: u32 = 132; +pub const KVM_CAP_SPAPR_RESIZE_HPT: u32 = 133; +pub const KVM_CAP_PPC_MMU_RADIX: u32 = 134; +pub const KVM_CAP_PPC_MMU_HASH_V3: u32 = 135; +pub const KVM_CAP_IMMEDIATE_EXIT: u32 = 136; +pub const KVM_CAP_MIPS_VZ: u32 = 137; +pub const KVM_CAP_MIPS_TE: u32 = 138; +pub const KVM_CAP_MIPS_64BIT: u32 = 139; +pub const KVM_CAP_S390_GS: u32 = 140; +pub const KVM_CAP_S390_AIS: u32 = 141; +pub const KVM_CAP_SPAPR_TCE_VFIO: u32 = 142; +pub const KVM_CAP_X86_DISABLE_EXITS: u32 = 143; +pub const KVM_CAP_ARM_USER_IRQ: u32 = 144; +pub const KVM_CAP_S390_CMMA_MIGRATION: u32 = 145; +pub const KVM_CAP_PPC_FWNMI: u32 = 146; +pub const KVM_CAP_PPC_SMT_POSSIBLE: u32 = 147; +pub const KVM_CAP_HYPERV_SYNIC2: u32 = 148; +pub const KVM_CAP_HYPERV_VP_INDEX: u32 = 149; +pub const KVM_CAP_S390_AIS_MIGRATION: u32 = 150; +pub const KVM_CAP_PPC_GET_CPU_CHAR: u32 = 151; +pub const KVM_CAP_S390_BPB: u32 = 152; +pub const KVM_CAP_GET_MSR_FEATURES: u32 = 153; +pub const KVM_CAP_HYPERV_EVENTFD: u32 = 154; +pub const KVM_CAP_HYPERV_TLBFLUSH: u32 = 155; +pub const KVM_CAP_S390_HPAGE_1M: u32 = 156; +pub const KVM_CAP_NESTED_STATE: u32 = 157; +pub const KVM_CAP_ARM_INJECT_SERROR_ESR: u32 = 158; +pub const KVM_CAP_MSR_PLATFORM_INFO: u32 = 159; +pub const KVM_CAP_PPC_NESTED_HV: u32 = 160; +pub const KVM_CAP_HYPERV_SEND_IPI: u32 = 161; +pub const KVM_CAP_COALESCED_PIO: u32 = 162; +pub const KVM_CAP_HYPERV_ENLIGHTENED_VMCS: u32 = 163; +pub const KVM_CAP_EXCEPTION_PAYLOAD: u32 = 164; +pub const KVM_CAP_ARM_VM_IPA_SIZE: u32 = 165; +pub const KVM_IRQ_ROUTING_IRQCHIP: u32 = 1; +pub const KVM_IRQ_ROUTING_MSI: u32 = 2; +pub const KVM_IRQ_ROUTING_S390_ADAPTER: u32 = 3; +pub const KVM_IRQ_ROUTING_HV_SINT: u32 = 4; +pub const KVM_IRQFD_FLAG_DEASSIGN: u32 = 1; +pub const KVM_IRQFD_FLAG_RESAMPLE: u32 = 2; +pub const KVM_CLOCK_TSC_STABLE: u32 = 2; +pub const KVM_MMU_FSL_BOOKE_NOHV: u32 = 0; +pub const KVM_MMU_FSL_BOOKE_HV: u32 = 1; +pub const KVM_REG_ARCH_MASK: i64 = -72057594037927936; +pub const KVM_REG_GENERIC: u32 = 0; +pub const KVM_REG_PPC: u64 = 1152921504606846976; +pub const KVM_REG_X86: u64 = 2305843009213693952; +pub const KVM_REG_IA64: u64 = 3458764513820540928; +pub const KVM_REG_ARM: u64 = 4611686018427387904; +pub const KVM_REG_S390: u64 = 5764607523034234880; +pub const KVM_REG_ARM64: u64 = 6917529027641081856; +pub const KVM_REG_MIPS: u64 = 8070450532247928832; +pub const KVM_REG_SIZE_SHIFT: u32 = 52; +pub const KVM_REG_SIZE_MASK: u64 = 67553994410557440; +pub const KVM_REG_SIZE_U8: u32 = 0; +pub const KVM_REG_SIZE_U16: u64 = 4503599627370496; +pub const KVM_REG_SIZE_U32: u64 = 9007199254740992; +pub const KVM_REG_SIZE_U64: u64 = 13510798882111488; +pub const KVM_REG_SIZE_U128: u64 = 18014398509481984; +pub const KVM_REG_SIZE_U256: u64 = 22517998136852480; +pub const KVM_REG_SIZE_U512: u64 = 27021597764222976; +pub const KVM_REG_SIZE_U1024: u64 = 31525197391593472; +pub const KVM_MSI_VALID_DEVID: u32 = 1; +pub const KVM_CREATE_DEVICE_TEST: u32 = 1; +pub const KVM_DEV_VFIO_GROUP: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_ADD: u32 = 1; +pub const KVM_DEV_VFIO_GROUP_DEL: u32 = 2; +pub const KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: u32 = 3; +pub const KVM_S390_STORE_STATUS_NOADDR: i32 = -1; +pub const KVM_S390_STORE_STATUS_PREFIXED: i32 = -2; +pub const KVM_DEV_ASSIGN_ENABLE_IOMMU: u32 = 1; +pub const KVM_DEV_ASSIGN_PCI_2_3: u32 = 2; +pub const KVM_DEV_ASSIGN_MASK_INTX: u32 = 4; +pub const KVM_DEV_IRQ_HOST_INTX: u32 = 1; +pub const KVM_DEV_IRQ_HOST_MSI: u32 = 2; +pub const KVM_DEV_IRQ_HOST_MSIX: u32 = 4; +pub const KVM_DEV_IRQ_GUEST_INTX: u32 = 256; +pub const KVM_DEV_IRQ_GUEST_MSI: u32 = 512; +pub const KVM_DEV_IRQ_GUEST_MSIX: u32 = 1024; +pub const KVM_DEV_IRQ_HOST_MASK: u32 = 255; +pub const KVM_DEV_IRQ_GUEST_MASK: u32 = 65280; +pub const KVM_MAX_MSIX_PER_DEV: u32 = 256; +pub const KVM_X2APIC_API_USE_32BIT_IDS: u32 = 1; +pub const KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK: u32 = 2; +pub const KVM_ARM_DEV_EL1_VTIMER: u32 = 1; +pub const KVM_ARM_DEV_EL1_PTIMER: u32 = 2; +pub const KVM_ARM_DEV_PMU: u32 = 4; +pub const KVM_HYPERV_CONN_ID_MASK: u32 = 16777215; +pub const KVM_HYPERV_EVENTFD_DEASSIGN: u32 = 1; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_alias { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub target_phys_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_alias() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_memory_alias)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_alias)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).target_phys_addr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_alias), + "::", + stringify!(target_phys_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pic_state { + pub last_irr: __u8, + pub irr: __u8, + pub imr: __u8, + pub isr: __u8, + pub priority_add: __u8, + pub irq_base: __u8, + pub read_reg_select: __u8, + pub poll: __u8, + pub special_mask: __u8, + pub init_state: __u8, + pub auto_eoi: __u8, + pub rotate_on_auto_eoi: __u8, + pub special_fully_nested_mode: __u8, + pub init4: __u8, + pub elcr: __u8, + pub elcr_mask: __u8, +} +#[test] +fn bindgen_test_layout_kvm_pic_state() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_pic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_pic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_irr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(last_irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irr as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).imr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(imr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).isr as *const _ as usize }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(isr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).priority_add as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(priority_add) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq_base as *const _ as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(irq_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).read_reg_select as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(read_reg_select) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).poll as *const _ as usize }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(poll) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).special_mask as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(special_mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).init_state as *const _ as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(init_state) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).auto_eoi as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(auto_eoi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rotate_on_auto_eoi as *const _ as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(rotate_on_auto_eoi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).special_fully_nested_mode as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(special_fully_nested_mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).init4 as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(init4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elcr as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(elcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elcr_mask as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_pic_state), + "::", + stringify!(elcr_mask) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioapic_state { + pub base_address: __u64, + pub ioregsel: __u32, + pub id: __u32, + pub irr: __u32, + pub pad: __u32, + pub redirtbl: [kvm_ioapic_state__bindgen_ty_1; 24usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_ioapic_state__bindgen_ty_1 { + pub bits: __u64, + pub fields: kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 { + pub vector: __u8, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, + pub reserved: [__u8; 4usize], + pub dest_id: __u8, +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved + as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dest_id + as *const _ as usize + }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dest_id) + ) + ); +} +impl kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn delivery_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) } + } + #[inline] + pub fn set_delivery_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 3u8, val as u64) + } + } + #[inline] + pub fn dest_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) } + } + #[inline] + pub fn set_dest_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn delivery_status(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) } + } + #[inline] + pub fn set_delivery_status(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn polarity(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) } + } + #[inline] + pub fn set_polarity(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn remote_irr(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) } + } + #[inline] + pub fn set_remote_irr(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn trig_mode(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) } + } + #[inline] + pub fn set_trig_mode(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn mask(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) } + } + #[inline] + pub fn set_mask(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserve(&self) -> __u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 7u8) as u8) } + } + #[inline] + pub fn set_reserve(&mut self, val: __u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 7u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + delivery_mode: __u8, + dest_mode: __u8, + delivery_status: __u8, + polarity: __u8, + remote_irr: __u8, + trig_mode: __u8, + mask: __u8, + reserve: __u8, + ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 3u8, { + let delivery_mode: u8 = unsafe { ::std::mem::transmute(delivery_mode) }; + delivery_mode as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let dest_mode: u8 = unsafe { ::std::mem::transmute(dest_mode) }; + dest_mode as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let delivery_status: u8 = unsafe { ::std::mem::transmute(delivery_status) }; + delivery_status as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let polarity: u8 = unsafe { ::std::mem::transmute(polarity) }; + polarity as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let remote_irr: u8 = unsafe { ::std::mem::transmute(remote_irr) }; + remote_irr as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let trig_mode: u8 = unsafe { ::std::mem::transmute(trig_mode) }; + trig_mode as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let mask: u8 = unsafe { ::std::mem::transmute(mask) }; + mask as u64 + }); + __bindgen_bitfield_unit.set(9usize, 7u8, { + let reserve: u8 = unsafe { ::std::mem::transmute(reserve) }; + reserve as u64 + }); + __bindgen_bitfield_unit + } +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ioapic_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioapic_state__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bits as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fields as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state__bindgen_ty_1), + "::", + stringify!(fields) + ) + ); +} +impl Default for kvm_ioapic_state__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_ioapic_state() { + assert_eq!( + ::std::mem::size_of::(), + 216usize, + concat!("Size of: ", stringify!(kvm_ioapic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioapic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(base_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ioregsel as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(ioregsel) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(irr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).redirtbl as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioapic_state), + "::", + stringify!(redirtbl) + ) + ); +} +impl Default for kvm_ioapic_state { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_regs { + pub rax: __u64, + pub rbx: __u64, + pub rcx: __u64, + pub rdx: __u64, + pub rsi: __u64, + pub rdi: __u64, + pub rsp: __u64, + pub rbp: __u64, + pub r8: __u64, + pub r9: __u64, + pub r10: __u64, + pub r11: __u64, + pub r12: __u64, + pub r13: __u64, + pub r14: __u64, + pub r15: __u64, + pub rip: __u64, + pub rflags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_regs() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(kvm_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rax as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rbx as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rbx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rcx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rcx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rdx as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rdx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rsi as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rdi as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rdi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rsp as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rsp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rbp as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rbp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r8 as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r9 as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r9) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r10 as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r10) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r11 as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r11) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r12 as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r12) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r13 as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r13) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r14 as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).r15 as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(r15) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rip as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rflags as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(kvm_regs), + "::", + stringify!(rflags) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_lapic_state { + pub regs: [::std::os::raw::c_char; 1024usize], +} +#[test] +fn bindgen_test_layout_kvm_lapic_state() { + assert_eq!( + ::std::mem::size_of::(), + 1024usize, + concat!("Size of: ", stringify!(kvm_lapic_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_lapic_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_lapic_state), + "::", + stringify!(regs) + ) + ); +} +impl Default for kvm_lapic_state { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_segment { + pub base: __u64, + pub limit: __u32, + pub selector: __u16, + pub type_: __u8, + pub present: __u8, + pub dpl: __u8, + pub db: __u8, + pub s: __u8, + pub l: __u8, + pub g: __u8, + pub avl: __u8, + pub unusable: __u8, + pub padding: __u8, +} +#[test] +fn bindgen_test_layout_kvm_segment() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_segment)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_segment)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).limit as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(limit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).selector as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(selector) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).present as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(present) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dpl as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(dpl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).db as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(db) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(s) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(l) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).g as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(g) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).avl as *const _ as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(avl) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).unusable as *const _ as usize }, + 22usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(unusable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 23usize, + concat!( + "Offset of field: ", + stringify!(kvm_segment), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dtable { + pub base: __u64, + pub limit: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_dtable() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dtable)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dtable)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).limit as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(limit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_dtable), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sregs { + pub cs: kvm_segment, + pub ds: kvm_segment, + pub es: kvm_segment, + pub fs: kvm_segment, + pub gs: kvm_segment, + pub ss: kvm_segment, + pub tr: kvm_segment, + pub ldt: kvm_segment, + pub gdt: kvm_dtable, + pub idt: kvm_dtable, + pub cr0: __u64, + pub cr2: __u64, + pub cr3: __u64, + pub cr4: __u64, + pub cr8: __u64, + pub efer: __u64, + pub apic_base: __u64, + pub interrupt_bitmap: [__u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_sregs() { + assert_eq!( + ::std::mem::size_of::(), + 312usize, + concat!("Size of: ", stringify!(kvm_sregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sregs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ds as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ds) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).es as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(es) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fs as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(fs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gs as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(gs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ss) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tr as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(tr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ldt as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(ldt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gdt as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(gdt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).idt as *const _ as usize }, + 208usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(idt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr0 as *const _ as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr2 as *const _ as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr3 as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr4 as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr4) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).efer as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(efer) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).interrupt_bitmap as *const _ as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(kvm_sregs), + "::", + stringify!(interrupt_bitmap) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_fpu { + pub fpr: [[__u8; 16usize]; 8usize], + pub fcw: __u16, + pub fsw: __u16, + pub ftwx: __u8, + pub pad1: __u8, + pub last_opcode: __u16, + pub last_ip: __u64, + pub last_dp: __u64, + pub xmm: [[__u8; 16usize]; 16usize], + pub mxcsr: __u32, + pub pad2: __u32, +} +#[test] +fn bindgen_test_layout_kvm_fpu() { + assert_eq!( + ::std::mem::size_of::(), + 416usize, + concat!("Size of: ", stringify!(kvm_fpu)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_fpu)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fpr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fpr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fcw as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fcw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsw as *const _ as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(fsw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ftwx as *const _ as usize }, + 132usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(ftwx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + 133usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(pad1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_opcode as *const _ as usize }, + 134usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_opcode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_ip as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_ip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last_dp as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(last_dp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xmm as *const _ as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(xmm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mxcsr as *const _ as usize }, + 408usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(mxcsr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 412usize, + concat!( + "Offset of field: ", + stringify!(kvm_fpu), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msr_entry { + pub index: __u32, + pub reserved: __u32, + pub data: __u64, +} +#[test] +fn bindgen_test_layout_kvm_msr_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_msr_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_msr_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).index as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_entry), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_msrs { + pub nmsrs: __u32, + pub pad: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_msrs() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_msrs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_msrs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmsrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(nmsrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msrs), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_msr_list { + pub nmsrs: __u32, + pub indices: __IncompleteArrayField<__u32>, +} +#[test] +fn bindgen_test_layout_kvm_msr_list() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_msr_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msr_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmsrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_list), + "::", + stringify!(nmsrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).indices as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msr_list), + "::", + stringify!(indices) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_cpuid_entry { + pub function: __u32, + pub eax: __u32, + pub ebx: __u32, + pub ecx: __u32, + pub edx: __u32, + pub padding: __u32, +} +#[test] +fn bindgen_test_layout_kvm_cpuid_entry() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_cpuid_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).function as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(function) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(eax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(ebx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(ecx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(edx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_cpuid { + pub nent: __u32, + pub padding: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_cpuid() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_cpuid)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nent as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(nent) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_cpuid_entry2 { + pub function: __u32, + pub index: __u32, + pub flags: __u32, + pub eax: __u32, + pub ebx: __u32, + pub ecx: __u32, + pub edx: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_cpuid_entry2() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_cpuid_entry2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid_entry2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).function as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(function) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).index as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eax as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(eax) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ebx as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(ebx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ecx as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(ecx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).edx as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(edx) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid_entry2), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_cpuid2 { + pub nent: __u32, + pub padding: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_cpuid2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_cpuid2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_cpuid2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nent as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(nent) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_cpuid2), + "::", + stringify!(entries) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_channel_state { + pub count: __u32, + pub latched_count: __u16, + pub count_latched: __u8, + pub status_latched: __u8, + pub status: __u8, + pub read_state: __u8, + pub write_state: __u8, + pub write_latch: __u8, + pub rw_mode: __u8, + pub mode: __u8, + pub bcd: __u8, + pub gate: __u8, + pub count_load_time: __s64, +} +#[test] +fn bindgen_test_layout_kvm_pit_channel_state() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_pit_channel_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_channel_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).latched_count as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(latched_count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count_latched as *const _ as usize + }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count_latched) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status_latched as *const _ as usize + }, + 7usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(status_latched) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).read_state as *const _ as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(read_state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).write_state as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(write_state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).write_latch as *const _ as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(write_latch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rw_mode as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(rw_mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mode as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(mode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bcd as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(bcd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gate as *const _ as usize }, + 15usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(gate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count_load_time as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_channel_state), + "::", + stringify!(count_load_time) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_exit_arch { + pub exception: __u32, + pub pad: __u32, + pub pc: __u64, + pub dr6: __u64, + pub dr7: __u64, +} +#[test] +fn bindgen_test_layout_kvm_debug_exit_arch() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_exit_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(pc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr6 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(dr6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr7 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_exit_arch), + "::", + stringify!(dr7) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug_arch { + pub debugreg: [__u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_guest_debug_arch() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug_arch)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debugreg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug_arch), + "::", + stringify!(debugreg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_state { + pub channels: [kvm_pit_channel_state; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_state() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_pit_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).channels as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state), + "::", + stringify!(channels) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_state2 { + pub channels: [kvm_pit_channel_state; 3usize], + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_state2() { + assert_eq!( + ::std::mem::size_of::(), + 112usize, + concat!("Size of: ", stringify!(kvm_pit_state2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_pit_state2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).channels as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(channels) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_state2), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_reinject_control { + pub pit_reinject: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_reinject_control() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_reinject_control)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_reinject_control)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pit_reinject as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reinject_control), + "::", + stringify!(pit_reinject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_reinject_control), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events { + pub exception: kvm_vcpu_events__bindgen_ty_1, + pub interrupt: kvm_vcpu_events__bindgen_ty_2, + pub nmi: kvm_vcpu_events__bindgen_ty_3, + pub sipi_vector: __u32, + pub flags: __u32, + pub smi: kvm_vcpu_events__bindgen_ty_4, + pub reserved: [__u8; 27usize], + pub exception_has_payload: __u8, + pub exception_payload: __u64, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_1 { + pub injected: __u8, + pub nr: __u8, + pub has_error_code: __u8, + pub pending: __u8, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).has_error_code as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(has_error_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_1), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_2 { + pub injected: __u8, + pub nr: __u8, + pub soft: __u8, + pub shadow: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_2)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).soft as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(soft) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).shadow as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_2), + "::", + stringify!(shadow) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_3 { + pub injected: __u8, + pub pending: __u8, + pub masked: __u8, + pub pad: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_3)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).injected as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(injected) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).masked as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(masked) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_3), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vcpu_events__bindgen_ty_4 { + pub smm: __u8, + pub pending: __u8, + pub smm_inside_nmi: __u8, + pub latched_init: __u8, +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_vcpu_events__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events__bindgen_ty_4)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).smm as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(smm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pending as *const _ as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(pending) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).smm_inside_nmi as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(smm_inside_nmi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).latched_init as *const _ + as usize + }, + 3usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events__bindgen_ty_4), + "::", + stringify!(latched_init) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_vcpu_events() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vcpu_events)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exception as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).interrupt as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(interrupt) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nmi as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(nmi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sipi_vector as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(sipi_vector) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smi as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(smi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception_has_payload as *const _ as usize + }, + 55usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception_has_payload) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception_payload as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_vcpu_events), + "::", + stringify!(exception_payload) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debugregs { + pub db: [__u64; 4usize], + pub dr6: __u64, + pub dr7: __u64, + pub flags: __u64, + pub reserved: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_debugregs() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_debugregs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debugregs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).db as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(db) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr6 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(dr6) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dr7 as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(dr7) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_debugregs), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_xsave { + pub region: [__u32; 1024usize], +} +#[test] +fn bindgen_test_layout_kvm_xsave() { + assert_eq!( + ::std::mem::size_of::(), + 4096usize, + concat!("Size of: ", stringify!(kvm_xsave)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_xsave)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).region as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xsave), + "::", + stringify!(region) + ) + ); +} +impl Default for kvm_xsave { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xcr { + pub xcr: __u32, + pub reserved: __u32, + pub value: __u64, +} +#[test] +fn bindgen_test_layout_kvm_xcr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_xcr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xcr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(xcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).value as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcr), + "::", + stringify!(value) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xcrs { + pub nr_xcrs: __u32, + pub flags: __u32, + pub xcrs: [kvm_xcr; 16usize], + pub padding: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_xcrs() { + assert_eq!( + ::std::mem::size_of::(), + 392usize, + concat!("Size of: ", stringify!(kvm_xcrs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xcrs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr_xcrs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(nr_xcrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).xcrs as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(xcrs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(kvm_xcrs), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sync_regs { + pub regs: kvm_regs, + pub sregs: kvm_sregs, + pub events: kvm_vcpu_events, +} +#[test] +fn bindgen_test_layout_kvm_sync_regs() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sync_regs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sregs as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(sregs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + 456usize, + concat!( + "Offset of field: ", + stringify!(kvm_sync_regs), + "::", + stringify!(events) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vmx_nested_state { + pub vmxon_pa: __u64, + pub vmcs_pa: __u64, + pub smm: kvm_vmx_nested_state__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vmx_nested_state__bindgen_ty_1 { + pub flags: __u16, +} +#[test] +fn bindgen_test_layout_kvm_vmx_nested_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_vmx_nested_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!( + "Alignment of ", + stringify!(kvm_vmx_nested_state__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vmx_nested_state__bindgen_ty_1), + "::", + stringify!(flags) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_vmx_nested_state() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_vmx_nested_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vmx_nested_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vmxon_pa as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vmx_nested_state), + "::", + stringify!(vmxon_pa) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vmcs_pa as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_vmx_nested_state), + "::", + stringify!(vmcs_pa) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smm as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_vmx_nested_state), + "::", + stringify!(smm) + ) + ); +} +#[repr(C)] +pub struct kvm_nested_state { + pub flags: __u16, + pub format: __u16, + pub size: __u32, + pub __bindgen_anon_1: kvm_nested_state__bindgen_ty_1, + pub data: __IncompleteArrayField<__u8>, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_nested_state__bindgen_ty_1 { + pub vmx: kvm_vmx_nested_state, + pub pad: [__u8; 120usize], + _bindgen_union_align: [u64; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_nested_state__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(kvm_nested_state__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_nested_state__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vmx as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state__bindgen_ty_1), + "::", + stringify!(vmx) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_nested_state__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_nested_state() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_nested_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_nested_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(kvm_nested_state), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_nested_state { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_user_trace_setup { + pub buf_size: __u32, + pub buf_nr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_user_trace_setup() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_user_trace_setup)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_size as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_user_trace_setup), + "::", + stringify!(buf_nr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_breakpoint { + pub enabled: __u32, + pub padding: __u32, + pub address: __u64, +} +#[test] +fn bindgen_test_layout_kvm_breakpoint() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_breakpoint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(padding) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_breakpoint), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_debug_guest { + pub enabled: __u32, + pub pad: __u32, + pub breakpoints: [kvm_breakpoint; 4usize], + pub singlestep: __u32, +} +#[test] +fn bindgen_test_layout_kvm_debug_guest() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_debug_guest)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).breakpoints as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(breakpoints) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).singlestep as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(kvm_debug_guest), + "::", + stringify!(singlestep) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_memory_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memory_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_memory_region), + "::", + stringify!(memory_size) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_userspace_memory_region { + pub slot: __u32, + pub flags: __u32, + pub guest_phys_addr: __u64, + pub memory_size: __u64, + pub userspace_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_userspace_memory_region() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_userspace_memory_region)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slot as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_phys_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(guest_phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).memory_size as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(memory_size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).userspace_addr as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_userspace_memory_region), + "::", + stringify!(userspace_addr) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_level { + pub __bindgen_anon_1: kvm_irq_level__bindgen_ty_1, + pub level: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_level__bindgen_ty_1 { + pub irq: __u32, + pub status: __s32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_level__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(irq) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).status as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level__bindgen_ty_1), + "::", + stringify!(status) + ) + ); +} +impl Default for kvm_irq_level__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_level() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_level)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_level)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_level), + "::", + stringify!(level) + ) + ); +} +impl Default for kvm_irq_level { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irqchip { + pub chip_id: __u32, + pub pad: __u32, + pub chip: kvm_irqchip__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irqchip__bindgen_ty_1 { + pub dummy: [::std::os::raw::c_char; 512usize], + pub pic: kvm_pic_state, + pub ioapic: kvm_ioapic_state, + _bindgen_union_align: [u64; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 512usize, + concat!("Size of: ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irqchip__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dummy as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(dummy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pic as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(pic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ioapic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip__bindgen_ty_1), + "::", + stringify!(ioapic) + ) + ); +} +impl Default for kvm_irqchip__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 520usize, + concat!("Size of: ", stringify!(kvm_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).chip as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqchip), + "::", + stringify!(chip) + ) + ); +} +impl Default for kvm_irqchip { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_pit_config { + pub flags: __u32, + pub pad: [__u32; 15usize], +} +#[test] +fn bindgen_test_layout_kvm_pit_config() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_pit_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_pit_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_pit_config), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_skeys { + pub start_gfn: __u64, + pub count: __u64, + pub skeydata_addr: __u64, + pub flags: __u32, + pub reserved: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_skeys() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_skeys)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).skeydata_addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(skeydata_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_skeys), + "::", + stringify!(reserved) + ) + ); +} +#[doc = " kvm_s390_cmma_log - Used for CMMA migration."] +#[doc = ""] +#[doc = " Used both for input and output."] +#[doc = ""] +#[doc = " @start_gfn: Guest page number to start from."] +#[doc = " @count: Size of the result buffer."] +#[doc = " @flags: Control operation mode via KVM_S390_CMMA_* flags"] +#[doc = " @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty"] +#[doc = " pages are still remaining."] +#[doc = " @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set"] +#[doc = " in the PGSTE."] +#[doc = " @values: Pointer to the values buffer."] +#[doc = ""] +#[doc = " Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_cmma_log { + pub start_gfn: __u64, + pub count: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_s390_cmma_log__bindgen_ty_1, + pub values: __u64, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_cmma_log__bindgen_ty_1 { + pub remaining: __u64, + pub mask: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).remaining as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(remaining) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log__bindgen_ty_1), + "::", + stringify!(mask) + ) + ); +} +impl Default for kvm_s390_cmma_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_cmma_log() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_cmma_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).start_gfn as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(start_gfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).values as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_cmma_log), + "::", + stringify!(values) + ) + ); +} +impl Default for kvm_s390_cmma_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_hyperv_exit { + pub type_: __u32, + pub u: kvm_hyperv_exit__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_hyperv_exit__bindgen_ty_1 { + pub synic: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1, + pub hcall: kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1 { + pub msr: __u32, + pub control: __u64, + pub evt_page: __u64, + pub msg_page: __u64, +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).control + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).evt_page + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(evt_page) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msg_page + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(msg_page) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2 { + pub input: __u64, + pub result: __u64, + pub params: [__u64; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).input + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(input) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).result + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).params + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(params) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).synic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(synic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit__bindgen_ty_1), + "::", + stringify!(hcall) + ) + ); +} +impl Default for kvm_hyperv_exit__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_hyperv_exit() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_hyperv_exit)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_exit), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_hyperv_exit { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_run { + pub request_interrupt_window: __u8, + pub immediate_exit: __u8, + pub padding1: [__u8; 6usize], + pub exit_reason: __u32, + pub ready_for_interrupt_injection: __u8, + pub if_flag: __u8, + pub flags: __u16, + pub cr8: __u64, + pub apic_base: __u64, + pub __bindgen_anon_1: kvm_run__bindgen_ty_1, + pub kvm_valid_regs: __u64, + pub kvm_dirty_regs: __u64, + pub s: kvm_run__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_1 { + pub hw: kvm_run__bindgen_ty_1__bindgen_ty_1, + pub fail_entry: kvm_run__bindgen_ty_1__bindgen_ty_2, + pub ex: kvm_run__bindgen_ty_1__bindgen_ty_3, + pub io: kvm_run__bindgen_ty_1__bindgen_ty_4, + pub debug: kvm_run__bindgen_ty_1__bindgen_ty_5, + pub mmio: kvm_run__bindgen_ty_1__bindgen_ty_6, + pub hypercall: kvm_run__bindgen_ty_1__bindgen_ty_7, + pub tpr_access: kvm_run__bindgen_ty_1__bindgen_ty_8, + pub s390_sieic: kvm_run__bindgen_ty_1__bindgen_ty_9, + pub s390_reset_flags: __u64, + pub s390_ucontrol: kvm_run__bindgen_ty_1__bindgen_ty_10, + pub dcr: kvm_run__bindgen_ty_1__bindgen_ty_11, + pub internal: kvm_run__bindgen_ty_1__bindgen_ty_12, + pub osi: kvm_run__bindgen_ty_1__bindgen_ty_13, + pub papr_hcall: kvm_run__bindgen_ty_1__bindgen_ty_14, + pub s390_tsch: kvm_run__bindgen_ty_1__bindgen_ty_15, + pub epr: kvm_run__bindgen_ty_1__bindgen_ty_16, + pub system_event: kvm_run__bindgen_ty_1__bindgen_ty_17, + pub s390_stsi: kvm_run__bindgen_ty_1__bindgen_ty_18, + pub eoi: kvm_run__bindgen_ty_1__bindgen_ty_19, + pub hyperv: kvm_hyperv_exit, + pub padding: [::std::os::raw::c_char; 256usize], + _bindgen_union_align: [u64; 32usize], +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_1 { + pub hardware_exit_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hardware_exit_reason + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(hardware_exit_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_2 { + pub hardware_entry_failure_reason: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .hardware_entry_failure_reason as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(hardware_entry_failure_reason) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_3 { + pub exception: __u32, + pub error_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).exception as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(exception) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).error_code as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(error_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_4 { + pub direction: __u8, + pub size: __u8, + pub port: __u16, + pub count: __u32, + pub data_offset: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_4() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).direction as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(direction) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).size as *const _ + as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).port as *const _ + as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(port) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).count as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(count) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_offset as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(data_offset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_5 { + pub arch: kvm_debug_exit_arch, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_5() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).arch as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(arch) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_6 { + pub phys_addr: __u64, + pub data: [__u8; 8usize], + pub len: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_6() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_7 { + pub nr: __u64, + pub args: [__u64; 6usize], + pub ret: __u64, + pub longmode: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_7() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).longmode as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(longmode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_7), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_8 { + pub rip: __u64, + pub is_write: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_8() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).rip as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(rip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(is_write) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_8), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_9 { + pub icptcode: __u8, + pub ipa: __u16, + pub ipb: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_9() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).icptcode as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(icptcode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipa as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipa) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_9), + "::", + stringify!(ipb) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_10 { + pub trans_exc_code: __u64, + pub pgm_code: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_10() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pgm_code as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_10), + "::", + stringify!(pgm_code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_11 { + pub dcrn: __u32, + pub data: __u32, + pub is_write: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_11() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dcrn as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(dcrn) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).is_write as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_11), + "::", + stringify!(is_write) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_12 { + pub suberror: __u32, + pub ndata: __u32, + pub data: [__u64; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_12() { + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).suberror as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(suberror) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ndata as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(ndata) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_12), + "::", + stringify!(data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_13 { + pub gprs: [__u64; 32usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_13() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).gprs as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_13), + "::", + stringify!(gprs) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_14 { + pub nr: __u64, + pub ret: __u64, + pub args: [__u64; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_14() { + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).nr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ret as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(ret) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).args as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_14), + "::", + stringify!(args) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_15 { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, + pub ipb: __u32, + pub dequeued: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_15() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_id + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).subchannel_nr + as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_parm as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).io_int_word as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(io_int_word) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ipb as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(ipb) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dequeued as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_15), + "::", + stringify!(dequeued) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_16 { + pub epr: __u32, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_16() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).epr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_16), + "::", + stringify!(epr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_17 { + pub type_: __u32, + pub flags: __u64, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_17() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).flags as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_17), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_18 { + pub addr: __u64, + pub ar: __u8, + pub reserved: __u8, + pub fc: __u8, + pub sel1: __u8, + pub sel2: __u16, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_18() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).addr as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 9usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fc as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(fc) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel1 as *const _ + as usize + }, + 11usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).sel2 as *const _ + as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_18), + "::", + stringify!(sel2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_run__bindgen_ty_1__bindgen_ty_19 { + pub vector: __u8, +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1__bindgen_ty_19() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1__bindgen_ty_19), + "::", + stringify!(vector) + ) + ); +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hw as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hw) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).fail_entry as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(fail_entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ex as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(ex) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).debug as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(debug) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmio as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(mmio) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hypercall as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hypercall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).tpr_access as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(tpr_access) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_sieic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_sieic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_reset_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_reset_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).s390_ucontrol as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_ucontrol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dcr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(dcr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).internal as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(internal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).osi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(osi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).papr_hcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(papr_hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_tsch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_tsch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).epr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(epr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).system_event as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(system_event) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s390_stsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(s390_stsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).eoi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(eoi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hyperv as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(hyperv) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_1), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_run__bindgen_ty_2 { + pub regs: kvm_sync_regs, + pub padding: [::std::os::raw::c_char; 2048usize], + _bindgen_union_align: [u64; 256usize], +} +#[test] +fn bindgen_test_layout_kvm_run__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 2048usize, + concat!("Size of: ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).regs as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run__bindgen_ty_2), + "::", + stringify!(padding) + ) + ); +} +impl Default for kvm_run__bindgen_ty_2 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_run() { + assert_eq!( + ::std::mem::size_of::(), + 2352usize, + concat!("Size of: ", stringify!(kvm_run)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_run)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).request_interrupt_window as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(request_interrupt_window) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).immediate_exit as *const _ as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(immediate_exit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(padding1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exit_reason as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(exit_reason) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ready_for_interrupt_injection as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(ready_for_interrupt_injection) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).if_flag as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(if_flag) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr8 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(cr8) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).apic_base as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(apic_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_valid_regs as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_valid_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).kvm_dirty_regs as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(kvm_dirty_regs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(kvm_run), + "::", + stringify!(s) + ) + ); +} +impl Default for kvm_run { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio_zone { + pub addr: __u64, + pub size: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio_zone__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio_zone__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_zone() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_zone)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_zone), + "::", + stringify!(size) + ) + ); +} +impl Default for kvm_coalesced_mmio_zone { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_coalesced_mmio { + pub phys_addr: __u64, + pub len: __u32, + pub __bindgen_anon_1: kvm_coalesced_mmio__bindgen_ty_1, + pub data: [__u8; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_coalesced_mmio__bindgen_ty_1 { + pub pad: __u32, + pub pio: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pio as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio__bindgen_ty_1), + "::", + stringify!(pio) + ) + ); +} +impl Default for kvm_coalesced_mmio__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(phys_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_coalesced_mmio { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_coalesced_mmio_ring { + pub first: __u32, + pub last: __u32, + pub coalesced_mmio: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_coalesced_mmio_ring() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_coalesced_mmio_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).first as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(first) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).coalesced_mmio as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_coalesced_mmio_ring), + "::", + stringify!(coalesced_mmio) + ) + ); +} +impl Default for kvm_coalesced_mmio_ring { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_translation { + pub linear_address: __u64, + pub physical_address: __u64, + pub valid: __u8, + pub writeable: __u8, + pub usermode: __u8, + pub pad: [__u8; 5usize], +} +#[test] +fn bindgen_test_layout_kvm_translation() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_translation)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_translation)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).linear_address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(linear_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).physical_address as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(physical_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).valid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(valid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).writeable as *const _ as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(writeable) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usermode as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(usermode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 19usize, + concat!( + "Offset of field: ", + stringify!(kvm_translation), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mem_op { + pub gaddr: __u64, + pub flags: __u64, + pub size: __u32, + pub op: __u32, + pub buf: __u64, + pub ar: __u8, + pub reserved: [__u8; 31usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mem_op() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mem_op)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(gaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(op) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(ar) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mem_op), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_interrupt { + pub irq: __u32, +} +#[test] +fn bindgen_test_layout_kvm_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irq as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_interrupt), + "::", + stringify!(irq) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_dirty_log { + pub slot: __u32, + pub padding1: __u32, + pub __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_dirty_log__bindgen_ty_1 { + pub dirty_bitmap: *mut ::std::os::raw::c_void, + pub padding2: __u64, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_kvm_dirty_log__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dirty_bitmap as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(dirty_bitmap) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).padding2 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log__bindgen_ty_1), + "::", + stringify!(padding2) + ) + ); +} +impl Default for kvm_dirty_log__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_dirty_log() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_log)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_log), + "::", + stringify!(padding1) + ) + ); +} +impl Default for kvm_dirty_log { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_signal_mask { + pub len: __u32, + pub sigset: __IncompleteArrayField<__u8>, +} +#[test] +fn bindgen_test_layout_kvm_signal_mask() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_signal_mask)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sigset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_signal_mask), + "::", + stringify!(sigset) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_tpr_access_ctl { + pub enabled: __u32, + pub flags: __u32, + pub reserved: [__u32; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_tpr_access_ctl() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_tpr_access_ctl)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enabled as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(enabled) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_tpr_access_ctl), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vapic_addr { + pub vapic_addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_vapic_addr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_vapic_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vapic_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vapic_addr), + "::", + stringify!(vapic_addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_mp_state { + pub mp_state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_mp_state() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_mp_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_mp_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mp_state as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_mp_state), + "::", + stringify!(mp_state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_psw { + pub mask: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_psw() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_psw)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(mask) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_psw), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_interrupt { + pub type_: __u32, + pub parm: __u32, + pub parm64: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_interrupt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_interrupt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).parm64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_interrupt), + "::", + stringify!(parm64) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_io_info { + pub subchannel_id: __u16, + pub subchannel_nr: __u16, + pub io_int_parm: __u32, + pub io_int_word: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_io_info() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_io_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).subchannel_nr as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(subchannel_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_parm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_parm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io_int_word as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_io_info), + "::", + stringify!(io_int_word) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ext_info { + pub ext_params: __u32, + pub pad: __u32, + pub ext_params2: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ext_info() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ext_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext_params2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ext_info), + "::", + stringify!(ext_params2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_pgm_info { + pub trans_exc_code: __u64, + pub mon_code: __u64, + pub per_address: __u64, + pub data_exc_code: __u32, + pub code: __u16, + pub mon_class_nr: __u16, + pub per_code: __u8, + pub per_atmid: __u8, + pub exc_access_id: __u8, + pub per_access_id: __u8, + pub op_access_id: __u8, + pub flags: __u8, + pub pad: [__u8; 2usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_pgm_info() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_pgm_info)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_exc_code as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(trans_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_address as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_address) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_exc_code as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(data_exc_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mon_class_nr as *const _ as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(mon_class_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_code as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_atmid as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_atmid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).exc_access_id as *const _ as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(exc_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).per_access_id as *const _ as usize }, + 35usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(per_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).op_access_id as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(op_access_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_pgm_info), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_prefix_info { + pub address: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_prefix_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_prefix_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_prefix_info), + "::", + stringify!(address) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_extcall_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_extcall_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_extcall_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_extcall_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_emerg_info { + pub code: __u16, +} +#[test] +fn bindgen_test_layout_kvm_s390_emerg_info() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(kvm_s390_emerg_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).code as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_emerg_info), + "::", + stringify!(code) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_stop_info { + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_s390_stop_info() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_s390_stop_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_stop_info), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_mchk_info { + pub cr14: __u64, + pub mcic: __u64, + pub failing_storage_address: __u64, + pub ext_damage_code: __u32, + pub pad: __u32, + pub fixed_logout: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_mchk_info() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_mchk_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cr14 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(cr14) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcic as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(mcic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).failing_storage_address as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(failing_storage_address) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ext_damage_code as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(ext_damage_code) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fixed_logout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_mchk_info), + "::", + stringify!(fixed_logout) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_s390_irq { + pub type_: __u64, + pub u: kvm_s390_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_s390_irq__bindgen_ty_1 { + pub io: kvm_s390_io_info, + pub ext: kvm_s390_ext_info, + pub pgm: kvm_s390_pgm_info, + pub emerg: kvm_s390_emerg_info, + pub extcall: kvm_s390_extcall_info, + pub prefix: kvm_s390_prefix_info, + pub stop: kvm_s390_stop_info, + pub mchk: kvm_s390_mchk_info, + pub reserved: [::std::os::raw::c_char; 64usize], + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).io as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(io) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ext as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(ext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pgm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(pgm) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).emerg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(emerg) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).extcall as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(extcall) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).prefix as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(prefix) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stop as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(stop) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mchk as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(mchk) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_s390_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_s390_irq() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_s390_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_irq_state { + pub buf: __u64, + pub flags: __u32, + pub len: __u32, + pub reserved: [__u32; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_s390_irq_state() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_irq_state)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buf as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(buf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_irq_state), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_guest_debug { + pub control: __u32, + pub pad: __u32, + pub arch: kvm_guest_debug_arch, +} +#[test] +fn bindgen_test_layout_kvm_guest_debug() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_guest_debug)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).control as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arch as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_guest_debug), + "::", + stringify!(arch) + ) + ); +} +pub const kvm_ioeventfd_flag_nr_datamatch: _bindgen_ty_1 = 0; +pub const kvm_ioeventfd_flag_nr_pio: _bindgen_ty_1 = 1; +pub const kvm_ioeventfd_flag_nr_deassign: _bindgen_ty_1 = 2; +pub const kvm_ioeventfd_flag_nr_virtio_ccw_notify: _bindgen_ty_1 = 3; +pub const kvm_ioeventfd_flag_nr_fast_mmio: _bindgen_ty_1 = 4; +pub const kvm_ioeventfd_flag_nr_max: _bindgen_ty_1 = 5; +pub type _bindgen_ty_1 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ioeventfd { + pub datamatch: __u64, + pub addr: __u64, + pub len: __u32, + pub fd: __s32, + pub flags: __u32, + pub pad: [__u8; 36usize], +} +#[test] +fn bindgen_test_layout_kvm_ioeventfd() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ioeventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).datamatch as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(datamatch) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_ioeventfd), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ioeventfd { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_enable_cap { + pub cap: __u32, + pub flags: __u32, + pub args: [__u64; 4usize], + pub pad: [__u8; 64usize], +} +#[test] +fn bindgen_test_layout_kvm_enable_cap() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enable_cap)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(cap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).args as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(args) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_enable_cap), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_enable_cap { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_ppc_pvinfo { + pub flags: __u32, + pub hcall: [__u32; 4usize], + pub pad: [__u8; 108usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_pvinfo() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_pvinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hcall as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(hcall) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_pvinfo), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_ppc_pvinfo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_page_size { + pub page_shift: __u32, + pub pte_enc: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pte_enc as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_page_size), + "::", + stringify!(pte_enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_one_seg_page_size { + pub page_shift: __u32, + pub slb_enc: __u32, + pub enc: [kvm_ppc_one_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_one_seg_page_size() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_ppc_one_seg_page_size)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).page_shift as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(page_shift) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).slb_enc as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(slb_enc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).enc as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_one_seg_page_size), + "::", + stringify!(enc) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_smmu_info { + pub flags: __u64, + pub slb_size: __u32, + pub data_keys: __u16, + pub instr_keys: __u16, + pub sps: [kvm_ppc_one_seg_page_size; 8usize], +} +#[test] +fn bindgen_test_layout_kvm_ppc_smmu_info() { + assert_eq!( + ::std::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_smmu_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).slb_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(slb_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data_keys as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(data_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instr_keys as *const _ as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(instr_keys) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sps as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_smmu_info), + "::", + stringify!(sps) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_ppc_resize_hpt { + pub flags: __u64, + pub shift: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_kvm_ppc_resize_hpt() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_ppc_resize_hpt)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).shift as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(shift) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_ppc_resize_hpt), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_irqchip { + pub irqchip: __u32, + pub pin: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_irqchip() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_irqchip)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).irqchip as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pin as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_irqchip), + "::", + stringify!(pin) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub __bindgen_anon_1: kvm_irq_routing_msi__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_msi__bindgen_ty_1 { + pub pad: __u32, + pub devid: __u32, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).devid as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi__bindgen_ty_1), + "::", + stringify!(devid) + ) + ); +} +impl Default for kvm_irq_routing_msi__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_msi() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_msi), + "::", + stringify!(data) + ) + ); +} +impl Default for kvm_irq_routing_msi { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_s390_adapter { + pub ind_addr: __u64, + pub summary_addr: __u64, + pub ind_offset: __u64, + pub summary_offset: __u32, + pub adapter_id: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_s390_adapter() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_s390_adapter)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_addr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_addr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_addr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ind_offset as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(ind_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).summary_offset as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(summary_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter_id as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_s390_adapter), + "::", + stringify!(adapter_id) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irq_routing_hv_sint { + pub vcpu: __u32, + pub sint: __u32, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_hv_sint() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_hv_sint)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(vcpu) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sint as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_hv_sint), + "::", + stringify!(sint) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_irq_routing_entry { + pub gsi: __u32, + pub type_: __u32, + pub flags: __u32, + pub pad: __u32, + pub u: kvm_irq_routing_entry__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_irq_routing_entry__bindgen_ty_1 { + pub irqchip: kvm_irq_routing_irqchip, + pub msi: kvm_irq_routing_msi, + pub adapter: kvm_irq_routing_s390_adapter, + pub hv_sint: kvm_irq_routing_hv_sint, + pub pad: [__u32; 8usize], + _bindgen_union_align: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).irqchip as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(irqchip) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).msi as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(msi) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).adapter as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(adapter) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).hv_sint as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(hv_sint) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pad as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry__bindgen_ty_1), + "::", + stringify!(pad) + ) + ); +} +impl Default for kvm_irq_routing_entry__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_irq_routing_entry() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing_entry)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing_entry), + "::", + stringify!(u) + ) + ); +} +impl Default for kvm_irq_routing_entry { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct kvm_irq_routing { + pub nr: __u32, + pub flags: __u32, + pub entries: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_kvm_irq_routing() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_irq_routing)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entries as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irq_routing), + "::", + stringify!(entries) + ) + ); +} +impl Default for kvm_irq_routing { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_x86_mce { + pub status: __u64, + pub addr: __u64, + pub misc: __u64, + pub mcg_status: __u64, + pub bank: __u8, + pub pad1: [__u8; 7usize], + pub pad2: [__u64; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_x86_mce() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_x86_mce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_x86_mce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).misc as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(misc) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mcg_status as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(mcg_status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bank as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(bank) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(pad1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_x86_mce), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_xen_hvm_config { + pub flags: __u32, + pub msr: __u32, + pub blob_addr_32: __u64, + pub blob_addr_64: __u64, + pub blob_size_32: __u8, + pub blob_size_64: __u8, + pub pad2: [__u8; 30usize], +} +#[test] +fn bindgen_test_layout_kvm_xen_hvm_config() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(kvm_xen_hvm_config)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_xen_hvm_config)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(msr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_addr_32 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_addr_32) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_addr_64 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_addr_64) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_size_32 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_size_32) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).blob_size_64 as *const _ as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(blob_size_64) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(kvm_xen_hvm_config), + "::", + stringify!(pad2) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_irqfd { + pub fd: __u32, + pub gsi: __u32, + pub flags: __u32, + pub resamplefd: __u32, + pub pad: [__u8; 16usize], +} +#[test] +fn bindgen_test_layout_kvm_irqfd() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_irqfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_irqfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).resamplefd as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(resamplefd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_irqfd), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_clock_data { + pub clock: __u64, + pub flags: __u32, + pub pad: [__u32; 9usize], +} +#[test] +fn bindgen_test_layout_kvm_clock_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_clock_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_clock_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clock as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(clock) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_clock_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_config_tlb { + pub params: __u64, + pub array: __u64, + pub mmu_type: __u32, + pub array_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_config_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_config_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).params as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(params) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mmu_type as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(mmu_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).array_len as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_config_tlb), + "::", + stringify!(array_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_dirty_tlb { + pub bitmap: __u64, + pub num_dirty: __u32, +} +#[test] +fn bindgen_test_layout_kvm_dirty_tlb() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_dirty_tlb)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bitmap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(bitmap) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_dirty as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_dirty_tlb), + "::", + stringify!(num_dirty) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct kvm_reg_list { + pub n: __u64, + pub reg: __IncompleteArrayField<__u64>, +} +#[test] +fn bindgen_test_layout_kvm_reg_list() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_reg_list)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_reg_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(n) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reg as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_reg_list), + "::", + stringify!(reg) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_one_reg { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_one_reg() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_one_reg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_one_reg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_one_reg), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_msi { + pub address_lo: __u32, + pub address_hi: __u32, + pub data: __u32, + pub flags: __u32, + pub devid: __u32, + pub pad: [__u8; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_msi() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(kvm_msi)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_msi)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_lo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_lo) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).address_hi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(address_hi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(devid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_msi), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_arm_device_addr { + pub id: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_arm_device_addr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_arm_device_addr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_arm_device_addr), + "::", + stringify!(addr) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_create_device { + pub type_: __u32, + pub fd: __u32, + pub flags: __u32, +} +#[test] +fn bindgen_test_layout_kvm_create_device() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_create_device)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_create_device)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_create_device), + "::", + stringify!(flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_device_attr { + pub flags: __u32, + pub group: __u32, + pub attr: __u64, + pub addr: __u64, +} +#[test] +fn bindgen_test_layout_kvm_device_attr() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_device_attr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_device_attr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(group) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).attr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(attr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_device_attr), + "::", + stringify!(addr) + ) + ); +} +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20: kvm_device_type = 1; +pub const kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_42: kvm_device_type = 2; +pub const kvm_device_type_KVM_DEV_TYPE_XICS: kvm_device_type = 3; +pub const kvm_device_type_KVM_DEV_TYPE_VFIO: kvm_device_type = 4; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2: kvm_device_type = 5; +pub const kvm_device_type_KVM_DEV_TYPE_FLIC: kvm_device_type = 6; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3: kvm_device_type = 7; +pub const kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_ITS: kvm_device_type = 8; +pub const kvm_device_type_KVM_DEV_TYPE_MAX: kvm_device_type = 9; +pub type kvm_device_type = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_vfio_spapr_tce { + pub groupfd: __s32, + pub tablefd: __s32, +} +#[test] +fn bindgen_test_layout_kvm_vfio_spapr_tce() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_vfio_spapr_tce)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).groupfd as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(groupfd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).tablefd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_vfio_spapr_tce), + "::", + stringify!(tablefd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_s390_ucas_mapping { + pub user_addr: __u64, + pub vcpu_addr: __u64, + pub length: __u64, +} +#[test] +fn bindgen_test_layout_kvm_s390_ucas_mapping() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_s390_ucas_mapping)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).user_addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(user_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vcpu_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(vcpu_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_s390_ucas_mapping), + "::", + stringify!(length) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_enc_region { + pub addr: __u64, + pub size: __u64, +} +#[test] +fn bindgen_test_layout_kvm_enc_region() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_enc_region)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_enc_region)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_enc_region), + "::", + stringify!(size) + ) + ); +} +pub const sev_cmd_id_KVM_SEV_INIT: sev_cmd_id = 0; +pub const sev_cmd_id_KVM_SEV_ES_INIT: sev_cmd_id = 1; +pub const sev_cmd_id_KVM_SEV_LAUNCH_START: sev_cmd_id = 2; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_DATA: sev_cmd_id = 3; +pub const sev_cmd_id_KVM_SEV_LAUNCH_UPDATE_VMSA: sev_cmd_id = 4; +pub const sev_cmd_id_KVM_SEV_LAUNCH_SECRET: sev_cmd_id = 5; +pub const sev_cmd_id_KVM_SEV_LAUNCH_MEASURE: sev_cmd_id = 6; +pub const sev_cmd_id_KVM_SEV_LAUNCH_FINISH: sev_cmd_id = 7; +pub const sev_cmd_id_KVM_SEV_SEND_START: sev_cmd_id = 8; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_DATA: sev_cmd_id = 9; +pub const sev_cmd_id_KVM_SEV_SEND_UPDATE_VMSA: sev_cmd_id = 10; +pub const sev_cmd_id_KVM_SEV_SEND_FINISH: sev_cmd_id = 11; +pub const sev_cmd_id_KVM_SEV_RECEIVE_START: sev_cmd_id = 12; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_DATA: sev_cmd_id = 13; +pub const sev_cmd_id_KVM_SEV_RECEIVE_UPDATE_VMSA: sev_cmd_id = 14; +pub const sev_cmd_id_KVM_SEV_RECEIVE_FINISH: sev_cmd_id = 15; +pub const sev_cmd_id_KVM_SEV_GUEST_STATUS: sev_cmd_id = 16; +pub const sev_cmd_id_KVM_SEV_DBG_DECRYPT: sev_cmd_id = 17; +pub const sev_cmd_id_KVM_SEV_DBG_ENCRYPT: sev_cmd_id = 18; +pub const sev_cmd_id_KVM_SEV_CERT_EXPORT: sev_cmd_id = 19; +pub const sev_cmd_id_KVM_SEV_NR_MAX: sev_cmd_id = 20; +pub type sev_cmd_id = u32; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_cmd { + pub id: __u32, + pub data: __u64, + pub error: __u32, + pub sev_fd: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_cmd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_cmd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).error as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sev_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_cmd), + "::", + stringify!(sev_fd) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_start { + pub handle: __u32, + pub policy: __u32, + pub dh_uaddr: __u64, + pub dh_len: __u32, + pub session_uaddr: __u64, + pub session_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_start() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_start)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dh_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(dh_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_uaddr as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_uaddr) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).session_len as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_start), + "::", + stringify!(session_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_update_data { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_update_data() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_update_data)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uaddr as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_update_data), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_secret { + pub hdr_uaddr: __u64, + pub hdr_len: __u32, + pub guest_uaddr: __u64, + pub guest_len: __u32, + pub trans_uaddr: __u64, + pub trans_len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_secret() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_secret)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(hdr_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).guest_uaddr as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(guest_len) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).trans_uaddr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).trans_len as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_secret), + "::", + stringify!(trans_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_launch_measure { + pub uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_launch_measure() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_launch_measure)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_launch_measure), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_guest_status { + pub handle: __u32, + pub policy: __u32, + pub state: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_guest_status() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_sev_guest_status)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(handle) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).policy as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).state as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_guest_status), + "::", + stringify!(state) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_sev_dbg { + pub src_uaddr: __u64, + pub dst_uaddr: __u64, + pub len: __u32, +} +#[test] +fn bindgen_test_layout_kvm_sev_dbg() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(kvm_sev_dbg)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).src_uaddr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(src_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).dst_uaddr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(dst_uaddr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_sev_dbg), + "::", + stringify!(len) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_pci_dev { + pub assigned_dev_id: __u32, + pub busnr: __u32, + pub devfn: __u32, + pub flags: __u32, + pub segnr: __u32, + pub __bindgen_anon_1: kvm_assigned_pci_dev__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_pci_dev__bindgen_ty_1 { + pub reserved: [__u32; 11usize], + _bindgen_union_align: [u32; 11usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_pci_dev__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_pci_dev() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_pci_dev)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).busnr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(busnr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).devfn as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(devfn) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).segnr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_pci_dev), + "::", + stringify!(segnr) + ) + ); +} +impl Default for kvm_assigned_pci_dev { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct kvm_assigned_irq { + pub assigned_dev_id: __u32, + pub host_irq: __u32, + pub guest_irq: __u32, + pub flags: __u32, + pub __bindgen_anon_1: kvm_assigned_irq__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union kvm_assigned_irq__bindgen_ty_1 { + pub reserved: [__u32; 12usize], + _bindgen_union_align: [u32; 12usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq__bindgen_ty_1)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); +} +impl Default for kvm_assigned_irq__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_kvm_assigned_irq() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_irq)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).host_irq as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(host_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guest_irq as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(guest_irq) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_irq), + "::", + stringify!(flags) + ) + ); +} +impl Default for kvm_assigned_irq { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_nr { + pub assigned_dev_id: __u32, + pub entry_nr: __u16, + pub padding: __u16, +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_nr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_nr)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry_nr as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(entry_nr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_nr), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_assigned_msix_entry { + pub assigned_dev_id: __u32, + pub gsi: __u32, + pub entry: __u16, + pub padding: [__u16; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_assigned_msix_entry() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_assigned_msix_entry)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).assigned_dev_id as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(assigned_dev_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gsi as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(gsi) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).entry as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(entry) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(kvm_assigned_msix_entry), + "::", + stringify!(padding) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq)] +pub struct kvm_hyperv_eventfd { + pub conn_id: __u32, + pub fd: __s32, + pub flags: __u32, + pub padding: [__u32; 3usize], +} +#[test] +fn bindgen_test_layout_kvm_hyperv_eventfd() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(kvm_hyperv_eventfd)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).conn_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(conn_id) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).padding as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(kvm_hyperv_eventfd), + "::", + stringify!(padding) + ) + ); +} diff --git a/kvm-bindings/src/x86/fam_wrappers.rs b/kvm-bindings/src/x86/fam_wrappers.rs new file mode 100644 index 000000000..55315b717 --- /dev/null +++ b/kvm-bindings/src/x86/fam_wrappers.rs @@ -0,0 +1,64 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +use vmm_sys_util::fam::{FamStruct, FamStructWrapper}; + +use x86::bindings::*; + +/// Maximum number of CPUID entries that can be returned by a call to KVM ioctls. +/// +/// See arch/x86/include/asm/kvm_host.h +pub const KVM_MAX_CPUID_ENTRIES: usize = 80; + +/// Maximum number of MSRs KVM supports (See arch/x86/kvm/x86.c). +pub const KVM_MAX_MSR_ENTRIES: usize = 256; + +// Implement the FamStruct trait for kvm_cpuid2. +generate_fam_struct_impl!( + kvm_cpuid2, + kvm_cpuid_entry2, + entries, + u32, + nent, + KVM_MAX_CPUID_ENTRIES +); + +/// Wrapper over the `kvm_cpuid2` structure. +/// +/// The `kvm_cpuid2` structure contains a flexible array member. For details check the +/// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) +/// documentation on `kvm_cpuid2`. To provide safe access to +/// the array elements, this type is implemented using +/// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html). +pub type CpuId = FamStructWrapper; + +// Implement the FamStruct trait for kvm_msrs. +generate_fam_struct_impl!( + kvm_msrs, + kvm_msr_entry, + entries, + u32, + nmsrs, + KVM_MAX_MSR_ENTRIES +); + +/// Wrapper over the `kvm_msrs` structure. +/// +/// The `kvm_msrs` structure contains a flexible array member. For details check the +/// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) +/// documentation on `kvm_msrs`. To provide safe access to +/// the array elements, this type is implemented using +/// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html). +pub type Msrs = FamStructWrapper; + +// Implement the FamStruct trait for kvm_msr_list. +generate_fam_struct_impl!(kvm_msr_list, u32, indices, u32, nmsrs, KVM_MAX_MSR_ENTRIES); + +/// Wrapper over the `kvm_msr_list` structure. +/// +/// The `kvm_msr_list` structure contains a flexible array member. For details check the +/// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) +/// documentation on `kvm_msr_list`. To provide safe access to +/// the array elements, this type is implemented using +/// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html). +pub type MsrList = FamStructWrapper; diff --git a/kvm-bindings/src/x86/mod.rs b/kvm-bindings/src/x86/mod.rs new file mode 100644 index 000000000..f449c6fc5 --- /dev/null +++ b/kvm-bindings/src/x86/mod.rs @@ -0,0 +1,33 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#[cfg(feature = "fam-wrappers")] +mod fam_wrappers; + +// Export 4.14 bindings when the feature kvm-v4_20_0 is not specified. +#[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] +#[allow(clippy::all)] +mod bindings_v4_14_0; + +// Export 4.20 bindings when kvm-v4_20_0 is specified or no kernel version +// related features are specified. +#[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) +))] +#[allow(clippy::all)] +mod bindings_v4_20_0; + +pub mod bindings { + #[cfg(all(feature = "kvm-v4_14_0", not(feature = "kvm-v4_20_0")))] + pub use super::bindings_v4_14_0::*; + + #[cfg(any( + feature = "kvm-v4_20_0", + all(not(feature = "kvm-v4_14_0"), not(feature = "kvm-v4_20_0")) + ))] + pub use super::bindings_v4_20_0::*; + + #[cfg(feature = "fam-wrappers")] + pub use super::fam_wrappers::*; +} diff --git a/kvm-ioctls/.cargo/config b/kvm-ioctls/.cargo/config new file mode 100644 index 000000000..ba63e46b3 --- /dev/null +++ b/kvm-ioctls/.cargo/config @@ -0,0 +1,3 @@ +[target.aarch64-unknown-linux-musl] +rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] + diff --git a/kvm-ioctls/.gitignore b/kvm-ioctls/.gitignore new file mode 100644 index 000000000..ac6209e0e --- /dev/null +++ b/kvm-ioctls/.gitignore @@ -0,0 +1,6 @@ +Cargo.lock +/target +.idea +**/*.rs.bk +**/.pytest_cache/ +**/__pycache__/* diff --git a/kvm-ioctls/.gitmodules b/kvm-ioctls/.gitmodules new file mode 100644 index 000000000..bda97eb35 --- /dev/null +++ b/kvm-ioctls/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rust-vmm-ci"] + path = rust-vmm-ci + url = https://github.com/rust-vmm/rust-vmm-ci.git diff --git a/kvm-ioctls/CHANGELOG.md b/kvm-ioctls/CHANGELOG.md new file mode 100644 index 000000000..f6044e828 --- /dev/null +++ b/kvm-ioctls/CHANGELOG.md @@ -0,0 +1,112 @@ +# v0.6.0 + +## Added +- Support for the vcpu ioctls: `KVM_SET_GUEST_DEBUG`, `KVM_KVMCLOCK_CTRL`, and + `KVM_GET_REG_LIST`. +- Support for the vm ioctl `KVM_GET_DEVICE_ATTR`. +- Support for the device ioctl `KVM_HAS_DEVICE_ATTR`. +- Support for `VcpuExit::Debug`. +- Support for enabling vcpu capabilities using `Vcpu::enable_cap`. +- Support for checking Hyper-V (`HypervSynic` and `HypervSynic2`), MSI + (`MsiDevid`), and IPA Size (`ArmVmIPASize`) capabilities. + using `kvm.check_extension`. +- Support for checking the VM capabilities via `Vm::check_extension`. +- Create a VM with flexible IPA size using `Kvm::create_vm_with_ipa_size`. + +## Removed +- Removed `Kvm::new_with_fd_number`. The same functionality is offered by the + `Kvm` [FromRawFd](https://doc.rust-lang.org/std/os/unix/io/trait.FromRawFd.html) + trait implementation. + +## Changed +- The VM ioctl `unregister_ioevent` now correctly unregisters the events that + correspond to the data match passed as a parameter. +- The `SystemEvent` Vcpu Exit now also contains the relevant type and flags. +- Updated `get_dirty_log` such that it does not assume the page size is 4K, + but instead reads it using `libc::sysconf`. + +# v0.5.0 + +## Added +- Support for the vcpu ioctls `KVM_GET/SET_VCPU_EVENTS` and `KVM_GET_DIRTY_LOG` + on `aarch64`. +- Support for the vcpu ioctl `KVM_IRQ_LINE`. + +# v0.4.0 + +## Added +- Support for unregistering ioeventfds through `KVM_IOEVENTFD`. + +## Changed +- Functions working with event FDs now require + vmm_sys_util::eventfd::EventFd in their interface instead of + RawFd. +- Functions working with FAM structs kvm_msr_list and kvm_msrs, were + changed to work with their respective safe counterparts MsrList and + respectively Msrs. +- Now exporting kvm_ioctls::Error type definition so that users of this + crate can create their own wrapping errors without having to know the + Error type used internally by this crate. +- No longer exporting kvm_ioctls::Result. Users of this crate should + not have to use kvm_ioctls::Result outside the crate. +- kvm_ioctls::Error now works with errno::Error instead of io::Error. + +## Removed +- CpuId safe wrapper over FAM struct kvm_cpuid2. The safe wrapper is + now provided by the kvm_bindings crate starting with v0.2.0. +- KVM_MAX_MSR_ENTRIES and MAX_KVM_CPUID_ENTRIES. Equivalent constants + are provided by the kvm_bindings crate starting with v0.2.0. + +# v0.3.0 + +## Added +- Support for setting vcpu `kvm_immediate_exit` flag +- Support for the vcpu ioctl `KVM_GET_CPUID2` +- Support for the vcpu ioctl `KVM_GET_MP_STATE` +- Support for the vcpu ioctl `KVM_SET_MP_STATE` +- Support for the vcpu ioctl `KVM_GET_VCPU_EVENTS` +- Support for the vcpu ioctl `KVM_SET_VCPU_EVENTS` +- Support for the vcpu ioctl `KVM_GET_DEBUGREGS` +- Support for the vcpu ioctl `KVM_SET_DEBUGREGS` +- Support for the vcpu ioctl `KVM_GET_XSAVE` +- Support for the vcpu ioctl `KVM_SET_XSAVE` +- Support for the vcpu ioctl `KVM_GET_XCRS` +- Support for the vcpu ioctl `KVM_SET_XCRS` +- Support for the vm ioctl `KVM_GET_IRQCHIP` +- Support for the vm ioctl `KVM_SET_IRQCHIP` +- Support for the vm ioctl `KVM_GET_CLOCK` +- Support for the vm ioctl `KVM_SET_CLOCK` +- Support for the vm ioctl `KVM_GET_PIT2` +- Support for the vm ioctl `KVM_SET_PIT2` +- Support for the vcpu ioctl `KVM_GET_ONE_REG` + +## Changed +- Function offering support for `KVM_SET_MSRS` also returns the number + of MSR entries successfully written. + +# v0.2.0 + +## Added +- Add support for `KVM_ENABLE_CAP`. +- Add support for `KVM_SIGNAL_MSI`. + +## Fixed +- Fix bug in KvmRunWrapper. The memory for kvm_run struct was not unmapped + after the KvmRunWrapper object got out of scope. +- Return proper value when receiving the EOI KVM exit. +- Mark set_user_memory_region as unsafe. + +# v0.1.0 + +First release of the kvm-ioctls crate. + +The kvm-ioctls crate provides safe wrappers over the KVM API, a set of ioctls +used for creating and configuring Virtual Machines (VMs) on Linux. +The ioctls are accessible through four structures: +- Kvm - wrappers over system ioctls +- VmFd - wrappers over VM ioctls +- VcpuFd - wrappers over vCPU ioctls +- DeviceFd - wrappers over device ioctls + +The kvm-ioctls can be used on x86_64 and aarch64. Right now the aarch64 +support is considered experimental. diff --git a/kvm-ioctls/CODEOWNERS b/kvm-ioctls/CODEOWNERS new file mode 100644 index 000000000..b2c60d335 --- /dev/null +++ b/kvm-ioctls/CODEOWNERS @@ -0,0 +1,3 @@ +# These owners will be the default owners for everything in +# the repo. +* @acatangiu @aghecenco @andreeaflorescu @sameo diff --git a/kvm-ioctls/Cargo.toml b/kvm-ioctls/Cargo.toml new file mode 100644 index 000000000..32636ed1c --- /dev/null +++ b/kvm-ioctls/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "kvm-ioctls" +version = "0.6.0" +authors = ["Amazon Firecracker Team "] +description = "Safe wrappers over KVM ioctls" +repository = "https://github.com/rust-vmm/kvm-ioctls" +readme = "README.md" +keywords = ["kvm"] +license = "Apache-2.0 OR MIT" + +[dependencies] +libc = ">=0.2.39" +kvm-bindings = { path = "../kvm-bindings", features = ["fam-wrappers"] } +vmm-sys-util = ">=0.2.1" + +[dev-dependencies] +byteorder = ">=1.2.1" diff --git a/kvm-ioctls/LICENSE-APACHE b/kvm-ioctls/LICENSE-APACHE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/kvm-ioctls/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/kvm-ioctls/LICENSE-MIT b/kvm-ioctls/LICENSE-MIT new file mode 100644 index 000000000..5c6a64610 --- /dev/null +++ b/kvm-ioctls/LICENSE-MIT @@ -0,0 +1,24 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + diff --git a/kvm-ioctls/README.md b/kvm-ioctls/README.md new file mode 100644 index 000000000..862117fe7 --- /dev/null +++ b/kvm-ioctls/README.md @@ -0,0 +1,47 @@ +[![Build Status](https://badge.buildkite.com/9e0e6c88972a3248a0908506d6946624da84e4e18c0870c4d0.svg)](https://buildkite.com/rust-vmm/kvm-ioctls-ci) +![crates.io](https://img.shields.io/crates/v/kvm-ioctls.svg) + +# kvm-ioctls + +The kvm-ioctls crate provides safe wrappers over the +[KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt), a set +of ioctls used for creating and configuring Virtual Machines (VMs) on Linux. +The ioctls are accessible through four structures: +- `Kvm` - wrappers over system ioctls +- `VmFd` - wrappers over VM ioctls +- `VcpuFd` - wrappers over vCPU ioctls +- `DeviceFd` - wrappers over device ioctls + +For further details check the +[KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) as well +as the code documentation. + +## Supported Platforms + +The kvm-ioctls can be used on x86_64 and aarch64. Right now the aarch64 support +is considered experimental. For a production ready version, please check the +progress in the corresponding +[GitHub issue](https://github.com/rust-vmm/kvm-ioctls/issues/8). + +## Running the tests + +Our Continuous Integration (CI) pipeline is implemented on top of +[Buildkite](https://buildkite.com/). +For the complete list of tests, check our +[CI pipeline](https://buildkite.com/rust-vmm/kvm-ioctls-ci). + +Each individual test runs in a container. To reproduce a test locally, you can +use the dev-container on both x86 and arm64. + +```bash +docker run --device=/dev/kvm \ + -it \ + --security-opt seccomp=unconfined \ + --volume $(pwd)/kvm-ioctls:/kvm-ioctls \ + rustvmm/dev:v5 +cd kvm-ioctls/ +cargo test +``` + +For more details about the integration tests that are run for `kvm-ioctls`, +check the [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) readme. diff --git a/kvm-ioctls/THIRD-PARTY b/kvm-ioctls/THIRD-PARTY new file mode 100644 index 000000000..8bafca303 --- /dev/null +++ b/kvm-ioctls/THIRD-PARTY @@ -0,0 +1,27 @@ +// Copyright 2017 The Chromium OS Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/kvm-ioctls/coverage_config_aarch64.json b/kvm-ioctls/coverage_config_aarch64.json new file mode 100644 index 000000000..27587e41a --- /dev/null +++ b/kvm-ioctls/coverage_config_aarch64.json @@ -0,0 +1,5 @@ +{ + "coverage_score": 77.1, + "exclude_path": "", + "crate_features": "" +} diff --git a/kvm-ioctls/coverage_config_x86_64.json b/kvm-ioctls/coverage_config_x86_64.json new file mode 100644 index 000000000..debc8fb40 --- /dev/null +++ b/kvm-ioctls/coverage_config_x86_64.json @@ -0,0 +1,5 @@ +{ + "coverage_score": 91.2, + "exclude_path": "", + "crate_features": "" +} diff --git a/kvm-ioctls/src/cap.rs b/kvm-ioctls/src/cap.rs new file mode 100644 index 000000000..483c87f50 --- /dev/null +++ b/kvm-ioctls/src/cap.rs @@ -0,0 +1,154 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. + +use kvm_bindings::*; + +/// Capabilities exposed by KVM. +/// +/// The capabilities list can be used in conjunction with +/// [Kvm::check_extension()](struct.Kvm.html#method.check_extension) to check if a particular +/// capability is available. +/// +/// The list of capabilities is based on the the KVM_CAP_* defines from the +/// [Linux KVM header](https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/kvm.h). +/// +#[derive(Clone, Copy, Debug)] +#[repr(u32)] +// We are allowing docs to be missing here because this enum is a wrapper +// over auto-generated code. +#[allow(missing_docs)] +pub enum Cap { + Irqchip = KVM_CAP_IRQCHIP, + Hlt = KVM_CAP_HLT, + MmuShadowCacheControl = KVM_CAP_MMU_SHADOW_CACHE_CONTROL, + UserMemory = KVM_CAP_USER_MEMORY, + SetTssAddr = KVM_CAP_SET_TSS_ADDR, + Vapic = KVM_CAP_VAPIC, + ExtCpuid = KVM_CAP_EXT_CPUID, + Clocksource = KVM_CAP_CLOCKSOURCE, + NrVcpus = KVM_CAP_NR_VCPUS, + NrMemslots = KVM_CAP_NR_MEMSLOTS, + Pit = KVM_CAP_PIT, + NopIoDelay = KVM_CAP_NOP_IO_DELAY, + PvMmu = KVM_CAP_PV_MMU, + MpState = KVM_CAP_MP_STATE, + CoalescedMmio = KVM_CAP_COALESCED_MMIO, + SyncMmu = KVM_CAP_SYNC_MMU, + Iommu = KVM_CAP_IOMMU, + DestroyMemoryRegionWorks = KVM_CAP_DESTROY_MEMORY_REGION_WORKS, + UserNmi = KVM_CAP_USER_NMI, + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390" + ))] + SetGuestDebug = KVM_CAP_SET_GUEST_DEBUG, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + ReinjectControl = KVM_CAP_REINJECT_CONTROL, + IrqRouting = KVM_CAP_IRQ_ROUTING, + IrqInjectStatus = KVM_CAP_IRQ_INJECT_STATUS, + AssignDevIrq = KVM_CAP_ASSIGN_DEV_IRQ, + JoinMemoryRegionsWorks = KVM_CAP_JOIN_MEMORY_REGIONS_WORKS, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + Mce = KVM_CAP_MCE, + Irqfd = KVM_CAP_IRQFD, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + Pit2 = KVM_CAP_PIT2, + SetBootCpuId = KVM_CAP_SET_BOOT_CPU_ID, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + PitState2 = KVM_CAP_PIT_STATE2, + Ioeventfd = KVM_CAP_IOEVENTFD, + SetIdentityMapAddr = KVM_CAP_SET_IDENTITY_MAP_ADDR, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + XenHvm = KVM_CAP_XEN_HVM, + AdjustClock = KVM_CAP_ADJUST_CLOCK, + InternalErrorData = KVM_CAP_INTERNAL_ERROR_DATA, + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + VcpuEvents = KVM_CAP_VCPU_EVENTS, + S390Psw = KVM_CAP_S390_PSW, + PpcSegstate = KVM_CAP_PPC_SEGSTATE, + Hyperv = KVM_CAP_HYPERV, + HypervVapic = KVM_CAP_HYPERV_VAPIC, + HypervSpin = KVM_CAP_HYPERV_SPIN, + PciSegment = KVM_CAP_PCI_SEGMENT, + PpcPairedSingles = KVM_CAP_PPC_PAIRED_SINGLES, + IntrShadow = KVM_CAP_INTR_SHADOW, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + Debugregs = KVM_CAP_DEBUGREGS, + X86RobustSinglestep = KVM_CAP_X86_ROBUST_SINGLESTEP, + PpcOsi = KVM_CAP_PPC_OSI, + PpcUnsetIrq = KVM_CAP_PPC_UNSET_IRQ, + EnableCap = KVM_CAP_ENABLE_CAP, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + Xsave = KVM_CAP_XSAVE, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + Xcrs = KVM_CAP_XCRS, + PpcGetPvinfo = KVM_CAP_PPC_GET_PVINFO, + PpcIrqLevel = KVM_CAP_PPC_IRQ_LEVEL, + AsyncPf = KVM_CAP_ASYNC_PF, + TscControl = KVM_CAP_TSC_CONTROL, + GetTscKhz = KVM_CAP_GET_TSC_KHZ, + PpcBookeSregs = KVM_CAP_PPC_BOOKE_SREGS, + SpaprTce = KVM_CAP_SPAPR_TCE, + PpcSmt = KVM_CAP_PPC_SMT, + PpcRma = KVM_CAP_PPC_RMA, + MaxVcpus = KVM_CAP_MAX_VCPUS, + PpcHior = KVM_CAP_PPC_HIOR, + PpcPapr = KVM_CAP_PPC_PAPR, + SwTlb = KVM_CAP_SW_TLB, + OneReg = KVM_CAP_ONE_REG, + S390Gmap = KVM_CAP_S390_GMAP, + TscDeadlineTimer = KVM_CAP_TSC_DEADLINE_TIMER, + S390Ucontrol = KVM_CAP_S390_UCONTROL, + SyncRegs = KVM_CAP_SYNC_REGS, + Pci23 = KVM_CAP_PCI_2_3, + KvmclockCtrl = KVM_CAP_KVMCLOCK_CTRL, + SignalMsi = KVM_CAP_SIGNAL_MSI, + PpcGetSmmuInfo = KVM_CAP_PPC_GET_SMMU_INFO, + S390Cow = KVM_CAP_S390_COW, + PpcAllocHtab = KVM_CAP_PPC_ALLOC_HTAB, + ReadonlyMem = KVM_CAP_READONLY_MEM, + IrqfdResample = KVM_CAP_IRQFD_RESAMPLE, + PpcBookeWatchdog = KVM_CAP_PPC_BOOKE_WATCHDOG, + PpcHtabFd = KVM_CAP_PPC_HTAB_FD, + S390CssSupport = KVM_CAP_S390_CSS_SUPPORT, + PpcEpr = KVM_CAP_PPC_EPR, + ArmPsci = KVM_CAP_ARM_PSCI, + ArmSetDeviceAddr = KVM_CAP_ARM_SET_DEVICE_ADDR, + DeviceCtrl = KVM_CAP_DEVICE_CTRL, + IrqMpic = KVM_CAP_IRQ_MPIC, + PpcRtas = KVM_CAP_PPC_RTAS, + IrqXics = KVM_CAP_IRQ_XICS, + ArmEl132bit = KVM_CAP_ARM_EL1_32BIT, + SpaprMultitce = KVM_CAP_SPAPR_MULTITCE, + ExtEmulCpuid = KVM_CAP_EXT_EMUL_CPUID, + HypervTime = KVM_CAP_HYPERV_TIME, + IoapicPolarityIgnored = KVM_CAP_IOAPIC_POLARITY_IGNORED, + EnableCapVm = KVM_CAP_ENABLE_CAP_VM, + S390Irqchip = KVM_CAP_S390_IRQCHIP, + IoeventfdNoLength = KVM_CAP_IOEVENTFD_NO_LENGTH, + VmAttributes = KVM_CAP_VM_ATTRIBUTES, + ArmPsci02 = KVM_CAP_ARM_PSCI_0_2, + PpcFixupHcall = KVM_CAP_PPC_FIXUP_HCALL, + PpcEnableHcall = KVM_CAP_PPC_ENABLE_HCALL, + CheckExtensionVm = KVM_CAP_CHECK_EXTENSION_VM, + S390UserSigp = KVM_CAP_S390_USER_SIGP, + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + SplitIrqchip = KVM_CAP_SPLIT_IRQCHIP, + ImmediateExit = KVM_CAP_IMMEDIATE_EXIT, + ArmVmIPASize = KVM_CAP_ARM_VM_IPA_SIZE, + MsiDevid = KVM_CAP_MSI_DEVID, + HypervSynic = KVM_CAP_HYPERV_SYNIC, + HypervSynic2 = KVM_CAP_HYPERV_SYNIC2, +} diff --git a/kvm-ioctls/src/ioctls/device.rs b/kvm-ioctls/src/ioctls/device.rs new file mode 100644 index 000000000..7d64bb9e2 --- /dev/null +++ b/kvm-ioctls/src/ioctls/device.rs @@ -0,0 +1,311 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use std::fs::File; +use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; + +use ioctls::Result; +use kvm_bindings::kvm_device_attr; +use kvm_ioctls::{KVM_GET_DEVICE_ATTR, KVM_HAS_DEVICE_ATTR, KVM_SET_DEVICE_ATTR}; +use vmm_sys_util::errno; +use vmm_sys_util::ioctl::{ioctl_with_mut_ref, ioctl_with_ref}; + +/// Wrapper over the file descriptor obtained when creating an emulated device in the kernel. +pub struct DeviceFd { + fd: File, +} + +impl DeviceFd { + /// Tests whether a device supports a particular attribute. + /// + /// See the documentation for `KVM_HAS_DEVICE_ATTR`. + /// # Arguments + /// + /// * `device_attr` - The device attribute to be tested. `addr` field is ignored. + /// + pub fn has_device_attr(&self, device_attr: &kvm_device_attr) -> Result<()> { + let ret = unsafe { ioctl_with_ref(self, KVM_HAS_DEVICE_ATTR(), device_attr) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Sets a specified piece of device configuration and/or state. + /// + /// See the documentation for `KVM_SET_DEVICE_ATTR`. + /// # Arguments + /// + /// * `device_attr` - The device attribute to be set. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::{ + /// kvm_device_type_KVM_DEV_TYPE_VFIO, + /// KVM_DEV_VFIO_GROUP, KVM_DEV_VFIO_GROUP_ADD, KVM_CREATE_DEVICE_TEST + /// }; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// let mut device = kvm_bindings::kvm_create_device { + /// type_: kvm_device_type_KVM_DEV_TYPE_VFIO, + /// fd: 0, + /// flags: KVM_CREATE_DEVICE_TEST, + /// }; + /// + /// let device_fd = vm + /// .create_device(&mut device) + /// .expect("Cannot create KVM device"); + /// + /// let dist_attr = kvm_bindings::kvm_device_attr { + /// group: KVM_DEV_VFIO_GROUP, + /// attr: u64::from(KVM_DEV_VFIO_GROUP_ADD), + /// addr: 0x0, + /// flags: 0, + /// }; + /// + /// if (device_fd.has_device_attr(&dist_attr).is_ok()) { + /// device_fd.set_device_attr(&dist_attr).unwrap(); + /// } + /// ``` + /// + pub fn set_device_attr(&self, device_attr: &kvm_device_attr) -> Result<()> { + let ret = unsafe { ioctl_with_ref(self, KVM_SET_DEVICE_ATTR(), device_attr) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Gets a specified piece of device configuration and/or state. + /// + /// See the documentation for `KVM_GET_DEVICE_ATTR`. + /// + /// # Arguments + /// + /// * `device_attr` - The device attribute to be get. + /// Note: This argument serves as both input and output. + /// When calling this function, the user should explicitly provide + /// valid values for the `group` and the `attr` field of the + /// `kvm_device_attr` structure, and a valid userspace address + /// (i.e. the `addr` field) to access the returned device attribute + /// data. + /// + /// # Returns + /// + /// * Returns the last occured `errno` wrapped in an `Err`. + /// * `device_attr` - The `addr` field of the `device_attr` structure will point to + /// the device attribute data. + /// + /// # Examples + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// // As on x86_64, `get_device_attr` is not necessarily needed. Therefore here + /// // the code example is only for AArch64. + /// #[cfg(any(target_arch = "aarch64"))] + /// { + /// use kvm_bindings::{ + /// KVM_DEV_ARM_VGIC_GRP_NR_IRQS, kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2, + /// kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + /// }; + /// + /// // Create a GIC device. + /// let mut gic_device = kvm_bindings::kvm_create_device { + /// type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + /// fd: 0, + /// flags: 0, + /// }; + /// let device_fd = match vm.create_device(&mut gic_device) { + /// Ok(fd) => fd, + /// Err(_) => { + /// gic_device.type_ = kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2; + /// vm.create_device(&mut gic_device) + /// .expect("Cannot create KVM vGIC device") + /// } + /// }; + /// + /// let mut data: u32 = 0; + /// let mut gic_attr = kvm_bindings::kvm_device_attr::default(); + /// gic_attr.group = KVM_DEV_ARM_VGIC_GRP_NR_IRQS; + /// gic_attr.addr = &mut data as *const u32 as u64; + /// + /// device_fd.get_device_attr(&mut gic_attr).unwrap(); + /// } + /// ``` + /// + pub fn get_device_attr(&self, device_attr: &mut kvm_device_attr) -> Result<()> { + let ret = unsafe { ioctl_with_mut_ref(self, KVM_GET_DEVICE_ATTR(), device_attr) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } +} + +/// Helper function for creating a new device. +pub fn new_device(dev_fd: File) -> DeviceFd { + DeviceFd { fd: dev_fd } +} + +impl AsRawFd for DeviceFd { + fn as_raw_fd(&self) -> RawFd { + self.fd.as_raw_fd() + } +} + +impl FromRawFd for DeviceFd { + /// # Safety + /// + /// This function is unsafe as the primitives currently returned have the contract that + /// they are the sole owner of the file descriptor they are wrapping. Usage of this function + /// could accidentally allow violating this contract which can cause memory unsafety in code + /// that relies on it being true. + unsafe fn from_raw_fd(fd: RawFd) -> Self { + DeviceFd { + fd: File::from_raw_fd(fd), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use ioctls::system::Kvm; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + use kvm_bindings::{ + kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, kvm_device_type_KVM_DEV_TYPE_VFIO, + KVM_DEV_VFIO_GROUP, KVM_DEV_VFIO_GROUP_ADD, + }; + #[cfg(target_arch = "aarch64")] + use kvm_bindings::{ + KVM_DEV_ARM_VGIC_CTRL_INIT, KVM_DEV_ARM_VGIC_GRP_CTRL, KVM_DEV_VFIO_GROUP, + KVM_DEV_VFIO_GROUP_ADD, + }; + + use kvm_bindings::KVM_CREATE_DEVICE_TEST; + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_create_device() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + + let mut gic_device = kvm_bindings::kvm_create_device { + type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + fd: 0, + flags: KVM_CREATE_DEVICE_TEST, + }; + // This fails on x86_64 because there is no VGIC there. + assert!(vm.create_device(&mut gic_device).is_err()); + + gic_device.type_ = kvm_device_type_KVM_DEV_TYPE_VFIO; + + let device_fd = vm + .create_device(&mut gic_device) + .expect("Cannot create KVM device"); + + // Following lines to re-construct device_fd are used to test + // DeviceFd::from_raw_fd() and DeviceFd::as_raw_fd(). + let raw_fd = unsafe { libc::dup(device_fd.as_raw_fd()) }; + assert!(raw_fd >= 0); + let device_fd = unsafe { DeviceFd::from_raw_fd(raw_fd) }; + + let dist_attr = kvm_bindings::kvm_device_attr { + group: KVM_DEV_VFIO_GROUP, + attr: u64::from(KVM_DEV_VFIO_GROUP_ADD), + addr: 0x0, + flags: 0, + }; + + let mut dist_attr_mut = dist_attr; + + // We are just creating a test device. Creating a real device would make the CI dependent + // on host configuration (like having /dev/vfio). We expect this to fail. + assert!(device_fd.has_device_attr(&dist_attr).is_err()); + assert!(device_fd.get_device_attr(&mut dist_attr_mut).is_err()); + assert!(device_fd.set_device_attr(&dist_attr).is_err()); + assert_eq!(errno::Error::last().errno(), 25); + } + + #[test] + #[cfg(target_arch = "aarch64")] + fn test_create_device() { + use ioctls::vm::{create_gic_device, set_supported_nr_irqs}; + use kvm_bindings::{ + kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, + }; + use vmm_sys_util::errno::Error; + + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + + let mut gic_device = kvm_bindings::kvm_create_device { + type_: kvm_device_type_KVM_DEV_TYPE_FSL_MPIC_20, + fd: 0, + flags: KVM_CREATE_DEVICE_TEST, + }; + // This fails on aarch64 as it does not use MPIC (MultiProcessor Interrupt Controller), + // it uses the VGIC. + assert!(vm.create_device(&mut gic_device).is_err()); + + let device_fd = create_gic_device(&vm, 0); + + // Following lines to re-construct device_fd are used to test + // DeviceFd::from_raw_fd() and DeviceFd::as_raw_fd(). + let raw_fd = unsafe { libc::dup(device_fd.as_raw_fd()) }; + assert!(raw_fd >= 0); + let device_fd = unsafe { DeviceFd::from_raw_fd(raw_fd) }; + + // Set some attribute that does not apply to VGIC, expect the test to fail. + let dist_attr = kvm_bindings::kvm_device_attr { + group: KVM_DEV_VFIO_GROUP, + attr: u64::from(KVM_DEV_VFIO_GROUP_ADD), + addr: 0x0, + flags: 0, + }; + assert!(device_fd.has_device_attr(&dist_attr).is_err()); + + // Set maximum supported number of IRQs of the vGIC device to 128. + set_supported_nr_irqs(&device_fd, 128); + + // Following attribute works with VGIC, they should be accepted. + let dist_attr = kvm_bindings::kvm_device_attr { + group: KVM_DEV_ARM_VGIC_GRP_CTRL, + attr: u64::from(KVM_DEV_ARM_VGIC_CTRL_INIT), + addr: 0x0, + flags: 0, + }; + + assert!(device_fd.has_device_attr(&dist_attr).is_ok()); + assert!(device_fd.set_device_attr(&dist_attr).is_ok()); + + // Test `get_device_attr`. Here we try to extract the maximum supported number of IRQs. + // This value should be saved in the address provided to the ioctl. + let mut data: u32 = 0; + + let mut gic_attr = kvm_bindings::kvm_device_attr::default(); + gic_attr.group = KVM_DEV_ARM_VGIC_GRP_NR_IRQS; + gic_attr.addr = data as u64; + + // Without properly providing the address to where the + // value will be stored, the ioctl fails with EFAULT. + let res = device_fd.get_device_attr(&mut gic_attr); + assert_eq!(res, Err(Error::new(libc::EFAULT))); + + gic_attr.addr = &mut data as *const u32 as u64; + assert!(device_fd.get_device_attr(&mut gic_attr).is_ok()); + // The maximum supported number of IRQs should be 128, same as the value + // when we initialize the GIC. + assert_eq!(data, 128); + } +} diff --git a/kvm-ioctls/src/ioctls/mod.rs b/kvm-ioctls/src/ioctls/mod.rs new file mode 100644 index 000000000..e28fc0fb1 --- /dev/null +++ b/kvm-ioctls/src/ioctls/mod.rs @@ -0,0 +1,96 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. + +use std::os::unix::io::AsRawFd; +use std::ptr::null_mut; + +use kvm_bindings::kvm_run; +use vmm_sys_util::errno; + +/// Wrappers over KVM device ioctls. +pub mod device; +/// Wrappers over KVM system ioctls. +pub mod system; +/// Wrappers over KVM VCPU ioctls. +pub mod vcpu; +/// Wrappers over KVM Virtual Machine ioctls. +pub mod vm; + +/// A specialized `Result` type for KVM ioctls. +/// +/// This typedef is generally used to avoid writing out errno::Error directly and +/// is otherwise a direct mapping to Result. +pub type Result = std::result::Result; + +/// Safe wrapper over the `kvm_run` struct. +/// +/// The wrapper is needed for sending the pointer to `kvm_run` between +/// threads as raw pointers do not implement `Send` and `Sync`. +pub struct KvmRunWrapper { + kvm_run_ptr: *mut u8, + // This field is need so we can `munmap` the memory mapped to hold `kvm_run`. + mmap_size: usize, +} + +// Send and Sync aren't automatically inherited for the raw address pointer. +// Accessing that pointer is only done through the stateless interface which +// allows the object to be shared by multiple threads without a decrease in +// safety. +unsafe impl Send for KvmRunWrapper {} +unsafe impl Sync for KvmRunWrapper {} + +impl KvmRunWrapper { + /// Maps the first `size` bytes of the given `fd`. + /// + /// # Arguments + /// * `fd` - File descriptor to mmap from. + /// * `size` - Size of memory region in bytes. + pub fn mmap_from_fd(fd: &dyn AsRawFd, size: usize) -> Result { + // This is safe because we are creating a mapping in a place not already used by any other + // area in this process. + let addr = unsafe { + libc::mmap( + null_mut(), + size, + libc::PROT_READ | libc::PROT_WRITE, + libc::MAP_SHARED, + fd.as_raw_fd(), + 0, + ) + }; + if addr == libc::MAP_FAILED { + return Err(errno::Error::last()); + } + + Ok(KvmRunWrapper { + kvm_run_ptr: addr as *mut u8, + mmap_size: size, + }) + } + + /// Returns a mutable reference to `kvm_run`. + /// + #[allow(clippy::mut_from_ref)] + pub fn as_mut_ref(&self) -> &mut kvm_run { + // Safe because we know we mapped enough memory to hold the kvm_run struct because the + // kernel told us how large it was. + #[allow(clippy::cast_ptr_alignment)] + unsafe { + &mut *(self.kvm_run_ptr as *mut kvm_run) + } + } +} + +impl Drop for KvmRunWrapper { + fn drop(&mut self) { + // This is safe because we mmap the area at kvm_run_ptr ourselves, + // and nobody else is holding a reference to it. + unsafe { + libc::munmap(self.kvm_run_ptr as *mut libc::c_void, self.mmap_size); + } + } +} diff --git a/kvm-ioctls/src/ioctls/system.rs b/kvm-ioctls/src/ioctls/system.rs new file mode 100644 index 000000000..18d7d57e5 --- /dev/null +++ b/kvm-ioctls/src/ioctls/system.rs @@ -0,0 +1,652 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. +use libc::{open, O_CLOEXEC, O_RDWR}; +use std::fs::File; +use std::os::raw::{c_char, c_ulong}; +use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; + +use cap::Cap; +use ioctls::vm::{new_vmfd, VmFd}; +use ioctls::Result; +#[cfg(any(target_arch = "aarch64"))] +use kvm_bindings::KVM_VM_TYPE_ARM_IPA_SIZE_MASK; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use kvm_bindings::{CpuId, MsrList, KVM_MAX_MSR_ENTRIES}; +use kvm_ioctls::*; +use vmm_sys_util::errno; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use vmm_sys_util::ioctl::ioctl_with_mut_ptr; +use vmm_sys_util::ioctl::{ioctl, ioctl_with_val}; + +/// Wrapper over KVM system ioctls. +pub struct Kvm { + kvm: File, +} + +impl Kvm { + /// Opens `/dev/kvm` and returns a `Kvm` object on success. + /// + /// # Example + /// + /// ``` + /// use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// ``` + /// + #[allow(clippy::new_ret_no_self)] + pub fn new() -> Result { + // Open `/dev/kvm` using `O_CLOEXEC` flag. + let fd = Self::open_with_cloexec(true)?; + // Safe because we verify that the fd is valid in `open_with_cloexec` and we own the fd. + Ok(unsafe { Self::from_raw_fd(fd) }) + } + + /// Opens `/dev/kvm` and returns the fd number on success. + /// + /// One usecase for this method is opening `/dev/kvm` before exec-ing into a + /// process with seccomp filters enabled that blacklist the `sys_open` syscall. + /// For this usecase `open_with_cloexec` must be called with the `close_on_exec` + /// parameter set to false. + /// + /// # Arguments + /// + /// * `close_on_exec`: If true opens `/dev/kvm` using the `O_CLOEXEC` flag. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// # use std::os::unix::io::FromRawFd; + /// let kvm_fd = Kvm::open_with_cloexec(false).unwrap(); + /// // The `kvm_fd` can now be passed to another process where we can use + /// // `from_raw_fd` for creating a `Kvm` object: + /// let kvm = unsafe { Kvm::from_raw_fd(kvm_fd) }; + /// ``` + /// + pub fn open_with_cloexec(close_on_exec: bool) -> Result { + let open_flags = O_RDWR | if close_on_exec { O_CLOEXEC } else { 0 }; + // Safe because we give a constant nul-terminated string and verify the result. + let ret = unsafe { open("/dev/kvm\0".as_ptr() as *const c_char, open_flags) }; + if ret < 0 { + Err(errno::Error::last()) + } else { + Ok(ret) + } + } + + /// Returns the KVM API version. + /// + /// See the documentation for `KVM_GET_API_VERSION`. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// assert_eq!(kvm.get_api_version(), 12); + /// ``` + /// + pub fn get_api_version(&self) -> i32 { + // Safe because we know that our file is a KVM fd and that the request is one of the ones + // defined by kernel. + unsafe { ioctl(self, KVM_GET_API_VERSION()) } + } + + /// AArch64 specific call to get the host Intermediate Physical Address space limit. + /// + /// Returns 0 if the capability is not available and an integer larger than 32 otherwise. + #[cfg(any(target_arch = "aarch64"))] + pub fn get_host_ipa_limit(&self) -> i32 { + self.check_extension_int(Cap::ArmVmIPASize) + } + + /// Wrapper over `KVM_CHECK_EXTENSION`. + /// + /// Returns 0 if the capability is not available and a positive integer otherwise. + fn check_extension_int(&self, c: Cap) -> i32 { + // Safe because we know that our file is a KVM fd and that the extension is one of the ones + // defined by kernel. + unsafe { ioctl_with_val(self, KVM_CHECK_EXTENSION(), c as c_ulong) } + } + + /// Checks if a particular `Cap` is available. + /// + /// Returns true if the capability is supported and false otherwise. + /// See the documentation for `KVM_CHECK_EXTENSION`. + /// + /// # Arguments + /// + /// * `c` - KVM capability to check. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// use kvm_ioctls::Cap; + /// + /// let kvm = Kvm::new().unwrap(); + /// // Check if `KVM_CAP_USER_MEMORY` is supported. + /// assert!(kvm.check_extension(Cap::UserMemory)); + /// ``` + /// + pub fn check_extension(&self, c: Cap) -> bool { + self.check_extension_int(c) > 0 + } + + /// Returns the size of the memory mapping required to use the vcpu's `kvm_run` structure. + /// + /// See the documentation for `KVM_GET_VCPU_MMAP_SIZE`. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// assert!(kvm.get_vcpu_mmap_size().unwrap() > 0); + /// ``` + /// + pub fn get_vcpu_mmap_size(&self) -> Result { + // Safe because we know that our file is a KVM fd and we verify the return result. + let res = unsafe { ioctl(self, KVM_GET_VCPU_MMAP_SIZE()) }; + if res > 0 { + Ok(res as usize) + } else { + Err(errno::Error::last()) + } + } + + /// Gets the recommended number of VCPUs per VM. + /// + /// See the documentation for `KVM_CAP_NR_VCPUS`. + /// Default to 4 when `KVM_CAP_NR_VCPUS` is not implemented. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// // We expect the number of vCPUs to be > 0 as per KVM API documentation. + /// assert!(kvm.get_nr_vcpus() > 0); + /// ``` + /// + pub fn get_nr_vcpus(&self) -> usize { + let x = self.check_extension_int(Cap::NrVcpus); + if x > 0 { + x as usize + } else { + 4 + } + } + + /// Returns the maximum allowed memory slots per VM. + /// + /// KVM reports the number of available memory slots (`KVM_CAP_NR_MEMSLOTS`) + /// using the extension interface. Both x86 and s390 implement this, ARM + /// and powerpc do not yet enable it. + /// Default to 32 when `KVM_CAP_NR_MEMSLOTS` is not implemented. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// assert!(kvm.get_nr_memslots() > 0); + /// ``` + /// + pub fn get_nr_memslots(&self) -> usize { + let x = self.check_extension_int(Cap::NrMemslots); + if x > 0 { + x as usize + } else { + 32 + } + } + + /// Gets the recommended maximum number of VCPUs per VM. + /// + /// See the documentation for `KVM_CAP_MAX_VCPUS`. + /// Returns [get_nr_vcpus()](struct.Kvm.html#method.get_nr_vcpus) when + /// `KVM_CAP_MAX_VCPUS` is not implemented. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// assert!(kvm.get_max_vcpus() > 0); + /// ``` + /// + pub fn get_max_vcpus(&self) -> usize { + match self.check_extension_int(Cap::MaxVcpus) { + 0 => self.get_nr_vcpus(), + x => x as usize, + } + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn get_cpuid(&self, kind: u64, max_entries_count: usize) -> Result { + let mut cpuid = CpuId::new(max_entries_count); + + let ret = unsafe { + // ioctl is unsafe. The kernel is trusted not to write beyond the bounds of the memory + // allocated for the struct. The limit is read from nent, which is set to the allocated + // size(max_entries_count) above. + ioctl_with_mut_ptr(self, kind, cpuid.as_mut_fam_struct_ptr()) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + + Ok(cpuid) + } + + /// X86 specific call to get the system emulated CPUID values. + /// + /// See the documentation for `KVM_GET_EMULATED_CPUID`. + /// + /// # Arguments + /// + /// * `max_entries_count` - Maximum number of CPUID entries. This function can return less than + /// this when the hardware does not support so many CPUID entries. + /// + /// # Example + /// + /// ``` + /// extern crate kvm_bindings; + /// use kvm_bindings::KVM_MAX_CPUID_ENTRIES; + /// use kvm_ioctls::Kvm; + /// + /// let kvm = Kvm::new().unwrap(); + /// let mut cpuid = kvm.get_emulated_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + /// let cpuid_entries = cpuid.as_mut_slice(); + /// assert!(cpuid_entries.len() <= KVM_MAX_CPUID_ENTRIES); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_emulated_cpuid(&self, max_entries_count: usize) -> Result { + self.get_cpuid(KVM_GET_EMULATED_CPUID(), max_entries_count) + } + + /// X86 specific call to get the system supported CPUID values. + /// + /// See the documentation for `KVM_GET_SUPPORTED_CPUID`. + /// + /// # Arguments + /// + /// * `max_entries_count` - Maximum number of CPUID entries. This function can return less than + /// this when the hardware does not support so many CPUID entries. + /// + /// # Example + /// + /// ``` + /// extern crate kvm_bindings; + /// use kvm_bindings::KVM_MAX_CPUID_ENTRIES; + /// use kvm_ioctls::Kvm; + /// + /// let kvm = Kvm::new().unwrap(); + /// let mut cpuid = kvm.get_emulated_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + /// let cpuid_entries = cpuid.as_mut_slice(); + /// assert!(cpuid_entries.len() <= KVM_MAX_CPUID_ENTRIES); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_supported_cpuid(&self, max_entries_count: usize) -> Result { + self.get_cpuid(KVM_GET_SUPPORTED_CPUID(), max_entries_count) + } + + /// X86 specific call to get list of supported MSRS + /// + /// See the documentation for `KVM_GET_MSR_INDEX_LIST`. + /// + /// # Example + /// + /// ``` + /// use kvm_ioctls::Kvm; + /// + /// let kvm = Kvm::new().unwrap(); + /// let msr_index_list = kvm.get_msr_index_list().unwrap(); + /// ``` + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_msr_index_list(&self) -> Result { + let mut msr_list = MsrList::new(KVM_MAX_MSR_ENTRIES); + + let ret = unsafe { + // ioctl is unsafe. The kernel is trusted not to write beyond the bounds of the memory + // allocated for the struct. The limit is read from nmsrs, which is set to the allocated + // size (MAX_KVM_MSR_ENTRIES) above. + ioctl_with_mut_ptr( + self, + KVM_GET_MSR_INDEX_LIST(), + msr_list.as_mut_fam_struct_ptr(), + ) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + + // The ioctl will also update the internal `nmsrs` with the actual count. + Ok(msr_list) + } + + /// Creates a VM fd using the KVM fd. + /// + /// See the documentation for `KVM_CREATE_VM`. + /// A call to this function will also initialize the size of the vcpu mmap area using the + /// `KVM_GET_VCPU_MMAP_SIZE` ioctl. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // Check that the VM mmap size is the same reported by `KVM_GET_VCPU_MMAP_SIZE`. + /// assert!(vm.run_size() == kvm.get_vcpu_mmap_size().unwrap()); + /// ``` + /// + pub fn create_vm(&self) -> Result { + // Safe because we know `self.kvm` is a real KVM fd as this module is the only one that + // create Kvm objects. + let ret = unsafe { ioctl(&self.kvm, KVM_CREATE_VM()) }; + if ret >= 0 { + // Safe because we verify the value of ret and we are the owners of the fd. + let vm_file = unsafe { File::from_raw_fd(ret) }; + let run_mmap_size = self.get_vcpu_mmap_size()?; + Ok(new_vmfd(vm_file, run_mmap_size)) + } else { + Err(errno::Error::last()) + } + } + + /// AArch64 specific function to create a VM fd using the KVM fd with flexible IPA size. + /// + /// See the arm64 section of KVM documentation for `KVM_CREATE_VM`. + /// A call to this function will also initialize the size of the vcpu mmap area using the + /// `KVM_GET_VCPU_MMAP_SIZE` ioctl. + /// + /// Note: `Cap::ArmVmIPASize` should be checked using `check_extension` before calling + /// this function to determine if the host machine supports the IPA size capability. + /// + /// # Arguments + /// + /// * `ipa_size` - Guest VM IPA size, 32 <= ipa_size <= Host_IPA_Limit. + /// The value of `Host_IPA_Limit` may be different between hardware + /// implementations and can be extracted by calling `get_host_ipa_limit`. + /// Possible values can be found in documentation of registers `TCR_EL2` + /// and `VTCR_EL2`. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::{Kvm, Cap}; + /// let kvm = Kvm::new().unwrap(); + /// // Check if the ArmVmIPASize cap is supported. + /// if kvm.check_extension(Cap::ArmVmIPASize) { + /// let host_ipa_limit = kvm.get_host_ipa_limit(); + /// let vm = kvm.create_vm_with_ipa_size(host_ipa_limit as u32).unwrap(); + /// // Check that the VM mmap size is the same reported by `KVM_GET_VCPU_MMAP_SIZE`. + /// assert!(vm.run_size() == kvm.get_vcpu_mmap_size().unwrap()); + /// } + /// ``` + /// + #[cfg(any(target_arch = "aarch64"))] + pub fn create_vm_with_ipa_size(&self, ipa_size: u32) -> Result { + // Safe because we know `self.kvm` is a real KVM fd as this module is the only one that + // create Kvm objects. + let ret = unsafe { + ioctl_with_val( + &self.kvm, + KVM_CREATE_VM(), + (ipa_size & KVM_VM_TYPE_ARM_IPA_SIZE_MASK).into(), + ) + }; + if ret >= 0 { + // Safe because we verify the value of ret and we are the owners of the fd. + let vm_file = unsafe { File::from_raw_fd(ret) }; + let run_mmap_size = self.get_vcpu_mmap_size()?; + Ok(new_vmfd(vm_file, run_mmap_size)) + } else { + Err(errno::Error::last()) + } + } + + /// Creates a VmFd object from a VM RawFd. + /// + /// # Arguments + /// + /// * `fd` - the RawFd used for creating the VmFd object. + /// + /// # Safety + /// + /// This function is unsafe as the primitives currently returned have the contract that + /// they are the sole owner of the file descriptor they are wrapping. Usage of this function + /// could accidentally allow violating this contract which can cause memory unsafety in code + /// that relies on it being true. + /// + /// The caller of this method must make sure the fd is valid and nothing else uses it. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use std::os::unix::io::AsRawFd; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let rawfd = unsafe { libc::dup(vm.as_raw_fd()) }; + /// assert!(rawfd >= 0); + /// let vm = unsafe { kvm.create_vmfd_from_rawfd(rawfd).unwrap() }; + /// ``` + /// + pub unsafe fn create_vmfd_from_rawfd(&self, fd: RawFd) -> Result { + let run_mmap_size = self.get_vcpu_mmap_size()?; + Ok(new_vmfd(File::from_raw_fd(fd), run_mmap_size)) + } +} + +impl AsRawFd for Kvm { + fn as_raw_fd(&self) -> RawFd { + self.kvm.as_raw_fd() + } +} + +impl FromRawFd for Kvm { + /// Creates a new Kvm object assuming `fd` represents an existing open file descriptor + /// associated with `/dev/kvm`. + /// + /// For usage examples check [open_with_cloexec()](struct.Kvm.html#method.open_with_cloexec). + /// + /// # Arguments + /// + /// * `fd` - File descriptor for `/dev/kvm`. + /// + /// # Safety + /// + /// This function is unsafe as the primitives currently returned have the contract that + /// they are the sole owner of the file descriptor they are wrapping. Usage of this function + /// could accidentally allow violating this contract which can cause memory unsafety in code + /// that relies on it being true. + /// + /// The caller of this method must make sure the fd is valid and nothing else uses it. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// # use std::os::unix::io::FromRawFd; + /// let kvm_fd = Kvm::open_with_cloexec(true).unwrap(); + /// // Safe because we verify that the fd is valid in `open_with_cloexec` and we own the fd. + /// let kvm = unsafe { Kvm::from_raw_fd(kvm_fd) }; + /// ``` + /// + unsafe fn from_raw_fd(fd: RawFd) -> Self { + Kvm { + kvm: File::from_raw_fd(fd), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + use kvm_bindings::KVM_MAX_CPUID_ENTRIES; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + use vmm_sys_util::fam::FamStruct; + + #[test] + fn test_kvm_new() { + Kvm::new().unwrap(); + } + + #[test] + fn test_kvm_api_version() { + let kvm = Kvm::new().unwrap(); + assert_eq!(kvm.get_api_version(), 12); + assert!(kvm.check_extension(Cap::UserMemory)); + } + + #[test] + #[cfg(any(target_arch = "aarch64"))] + fn test_get_host_ipa_limit() { + let kvm = Kvm::new().unwrap(); + let host_ipa_limit = kvm.get_host_ipa_limit(); + + if host_ipa_limit > 0 { + assert!(host_ipa_limit >= 32); + } else { + // if unsupported, the return value should be 0. + assert_eq!(host_ipa_limit, 0); + } + } + + #[test] + fn test_kvm_getters() { + let kvm = Kvm::new().unwrap(); + + // vCPU related getters + let nr_vcpus = kvm.get_nr_vcpus(); + assert!(nr_vcpus >= 4); + + assert!(kvm.get_max_vcpus() >= nr_vcpus); + + // Memory related getters + assert!(kvm.get_vcpu_mmap_size().unwrap() > 0); + assert!(kvm.get_nr_memslots() >= 32); + } + + #[test] + fn test_create_vm() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + + // Test create_vmfd_from_rawfd() + let rawfd = unsafe { libc::dup(vm.as_raw_fd()) }; + assert!(rawfd >= 0); + let vm = unsafe { kvm.create_vmfd_from_rawfd(rawfd).unwrap() }; + + assert_eq!(vm.run_size(), kvm.get_vcpu_mmap_size().unwrap()); + } + + #[test] + #[cfg(any(target_arch = "aarch64"))] + fn test_create_vm_with_ipa_size() { + let kvm = Kvm::new().unwrap(); + if kvm.check_extension(Cap::ArmVmIPASize) { + let host_ipa_limit = kvm.get_host_ipa_limit(); + // Here we test with the maximum value that the host supports to both test the + // discoverability of supported IPA sizes and likely some other values than 40. + kvm.create_vm_with_ipa_size(host_ipa_limit as u32).unwrap(); + // Test invalid input values + // Case 1: IPA size is smaller than 32. + assert!(kvm.create_vm_with_ipa_size(31).is_err()); + // Case 2: IPA size is bigger than Host_IPA_Limit. + assert!(kvm + .create_vm_with_ipa_size((host_ipa_limit + 1) as u32) + .is_err()); + } else { + // Unsupported, here we can test with the default value 40. + assert!(kvm.create_vm_with_ipa_size(40).is_err()); + } + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn test_get_supported_cpuid() { + let kvm = Kvm::new().unwrap(); + let mut cpuid = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + let cpuid_entries = cpuid.as_mut_slice(); + assert!(!cpuid_entries.is_empty()); + assert!(cpuid_entries.len() <= KVM_MAX_CPUID_ENTRIES); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_get_emulated_cpuid() { + let kvm = Kvm::new().unwrap(); + let mut cpuid = kvm.get_emulated_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + let cpuid_entries = cpuid.as_mut_slice(); + assert!(!cpuid_entries.is_empty()); + assert!(cpuid_entries.len() <= KVM_MAX_CPUID_ENTRIES); + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn test_cpuid_clone() { + let kvm = Kvm::new().unwrap(); + + // Test from_raw_fd() + let rawfd = unsafe { libc::dup(kvm.as_raw_fd()) }; + assert!(rawfd >= 0); + let kvm = unsafe { Kvm::from_raw_fd(rawfd) }; + + let cpuid_1 = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + let cpuid_2 = CpuId::new(cpuid_1.as_fam_struct_ref().len()); + assert!(cpuid_1 != cpuid_2); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn get_msr_index_list() { + let kvm = Kvm::new().unwrap(); + let msr_list = kvm.get_msr_index_list().unwrap(); + assert!(msr_list.as_slice().len() >= 2); + } + + #[test] + fn test_bad_kvm_fd() { + let badf_errno = libc::EBADF; + + let faulty_kvm = Kvm { + kvm: unsafe { File::from_raw_fd(-1) }, + }; + + assert_eq!( + faulty_kvm.get_vcpu_mmap_size().unwrap_err().errno(), + badf_errno + ); + assert_eq!(faulty_kvm.get_nr_vcpus(), 4); + assert_eq!(faulty_kvm.get_nr_memslots(), 32); + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + { + assert_eq!( + faulty_kvm.get_emulated_cpuid(4).err().unwrap().errno(), + badf_errno + ); + assert_eq!( + faulty_kvm.get_supported_cpuid(4).err().unwrap().errno(), + badf_errno + ); + + assert_eq!( + faulty_kvm.get_msr_index_list().err().unwrap().errno(), + badf_errno + ); + } + assert_eq!(faulty_kvm.create_vm().err().unwrap().errno(), badf_errno); + } +} diff --git a/kvm-ioctls/src/ioctls/vcpu.rs b/kvm-ioctls/src/ioctls/vcpu.rs new file mode 100644 index 000000000..edd69272e --- /dev/null +++ b/kvm-ioctls/src/ioctls/vcpu.rs @@ -0,0 +1,2186 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. + +use kvm_bindings::*; +use libc::EINVAL; +use std::fs::File; +use std::os::unix::io::{AsRawFd, RawFd}; + +use ioctls::{KvmRunWrapper, Result}; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use kvm_bindings::{CpuId, Msrs}; +use kvm_ioctls::*; +use vmm_sys_util::errno; +use vmm_sys_util::ioctl::{ioctl, ioctl_with_mut_ref, ioctl_with_ref}; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use vmm_sys_util::ioctl::{ioctl_with_mut_ptr, ioctl_with_ptr}; + +/// Reasons for vCPU exits. +/// +/// The exit reasons are mapped to the `KVM_EXIT_*` defines in the +/// [Linux KVM header](https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/kvm.h). +/// +#[derive(Debug)] +pub enum VcpuExit<'a> { + /// An out port instruction was run on the given port with the given data. + IoOut(u16 /* port */, &'a [u8] /* data */), + /// An in port instruction was run on the given port. + /// + /// The given slice should be filled in before [run()](struct.VcpuFd.html#method.run) + /// is called again. + IoIn(u16 /* port */, &'a mut [u8] /* data */), + /// A read instruction was run against the given MMIO address. + /// + /// The given slice should be filled in before [run()](struct.VcpuFd.html#method.run) + /// is called again. + MmioRead(u64 /* address */, &'a mut [u8]), + /// A write instruction was run against the given MMIO address with the given data. + MmioWrite(u64 /* address */, &'a [u8]), + /// Corresponds to KVM_EXIT_UNKNOWN. + Unknown, + /// Corresponds to KVM_EXIT_EXCEPTION. + Exception, + /// Corresponds to KVM_EXIT_HYPERCALL. + Hypercall, + /// Corresponds to KVM_EXIT_DEBUG. + Debug, + /// Corresponds to KVM_EXIT_HLT. + Hlt, + /// Corresponds to KVM_EXIT_IRQ_WINDOW_OPEN. + IrqWindowOpen, + /// Corresponds to KVM_EXIT_SHUTDOWN. + Shutdown, + /// Corresponds to KVM_EXIT_FAIL_ENTRY. + FailEntry, + /// Corresponds to KVM_EXIT_INTR. + Intr, + /// Corresponds to KVM_EXIT_SET_TPR. + SetTpr, + /// Corresponds to KVM_EXIT_TPR_ACCESS. + TprAccess, + /// Corresponds to KVM_EXIT_S390_SIEIC. + S390Sieic, + /// Corresponds to KVM_EXIT_S390_RESET. + S390Reset, + /// Corresponds to KVM_EXIT_DCR. + Dcr, + /// Corresponds to KVM_EXIT_NMI. + Nmi, + /// Corresponds to KVM_EXIT_INTERNAL_ERROR. + InternalError, + /// Corresponds to KVM_EXIT_OSI. + Osi, + /// Corresponds to KVM_EXIT_PAPR_HCALL. + PaprHcall, + /// Corresponds to KVM_EXIT_S390_UCONTROL. + S390Ucontrol, + /// Corresponds to KVM_EXIT_WATCHDOG. + Watchdog, + /// Corresponds to KVM_EXIT_S390_TSCH. + S390Tsch, + /// Corresponds to KVM_EXIT_EPR. + Epr, + /// Corresponds to KVM_EXIT_SYSTEM_EVENT. + SystemEvent(u32 /* type */, u64 /* flags */), + /// Corresponds to KVM_EXIT_S390_STSI. + S390Stsi, + /// Corresponds to KVM_EXIT_IOAPIC_EOI. + IoapicEoi(u8 /* vector */), + /// Corresponds to KVM_EXIT_HYPERV. + Hyperv, +} + +/// Wrapper over KVM vCPU ioctls. +pub struct VcpuFd { + vcpu: File, + kvm_run_ptr: KvmRunWrapper, +} + +impl VcpuFd { + /// Returns the vCPU general purpose registers. + /// + /// The registers are returned in a `kvm_regs` structure as defined in the + /// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// See documentation for `KVM_GET_REGS`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + /// let regs = vcpu.get_regs().unwrap(); + /// ``` + /// + #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + pub fn get_regs(&self) -> Result { + // Safe because we know that our file is a vCPU fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let mut regs = unsafe { std::mem::zeroed() }; + let ret = unsafe { ioctl_with_mut_ref(self, KVM_GET_REGS(), &mut regs) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(regs) + } + + /// Sets the vCPU general purpose registers using the `KVM_SET_REGS` ioctl. + /// + /// # Arguments + /// + /// * `regs` - general purpose registers. For details check the `kvm_regs` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] { + /// // Get the current vCPU registers. + /// let mut regs = vcpu.get_regs().unwrap(); + /// // Set a new value for the Instruction Pointer. + /// regs.rip = 0x100; + /// vcpu.set_regs(®s).unwrap(); + /// } + /// ``` + /// + #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + pub fn set_regs(&self, regs: &kvm_regs) -> Result<()> { + // Safe because we know that our file is a vCPU fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_SET_REGS(), regs) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns the vCPU special registers. + /// + /// The registers are returned in a `kvm_sregs` structure as defined in the + /// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// See documentation for `KVM_GET_SREGS`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + /// let sregs = vcpu.get_sregs().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_sregs(&self) -> Result { + // Safe because we know that our file is a vCPU fd, we know the kernel will only write the + // correct amount of memory to our pointer, and we verify the return result. + let mut regs = kvm_sregs::default(); + + let ret = unsafe { ioctl_with_mut_ref(self, KVM_GET_SREGS(), &mut regs) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(regs) + } + + /// Sets the vCPU special registers using the `KVM_SET_SREGS` ioctl. + /// + /// # Arguments + /// + /// * `sregs` - Special registers. For details check the `kvm_sregs` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] { + /// let mut sregs = vcpu.get_sregs().unwrap(); + /// // Update the code segment (cs). + /// sregs.cs.base = 0; + /// sregs.cs.selector = 0; + /// vcpu.set_sregs(&sregs).unwrap(); + /// } + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_sregs(&self, sregs: &kvm_sregs) -> Result<()> { + // Safe because we know that our file is a vCPU fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_SET_SREGS(), sregs) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns the floating point state (FPU) from the vCPU. + /// + /// The state is returned in a `kvm_fpu` structure as defined in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// See the documentation for `KVM_GET_FPU`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// let fpu = vcpu.get_fpu().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_fpu(&self) -> Result { + let mut fpu = kvm_fpu::default(); + + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_fpu struct. + ioctl_with_mut_ref(self, KVM_GET_FPU(), &mut fpu) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(fpu) + } + + /// Set the floating point state (FPU) of a vCPU using the `KVM_SET_FPU` ioct. + /// + /// # Arguments + /// + /// * `fpu` - FPU configuration. For details check the `kvm_fpu` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::kvm_fpu; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + /// let KVM_FPU_CWD: u16 = 0x37f; + /// let fpu = kvm_fpu { + /// fcw: KVM_FPU_CWD, + /// ..Default::default() + /// }; + /// vcpu.set_fpu(&fpu).unwrap(); + /// } + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_fpu(&self, fpu: &kvm_fpu) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_fpu struct. + ioctl_with_ref(self, KVM_SET_FPU(), fpu) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// X86 specific call to setup the CPUID registers. + /// + /// See the documentation for `KVM_SET_CPUID2`. + /// + /// # Arguments + /// + /// * `cpuid` - CPUID registers. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_bindings::KVM_MAX_CPUID_ENTRIES; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let mut kvm_cpuid = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// // Update the CPUID entries to disable the EPB feature. + /// const ECX_EPB_SHIFT: u32 = 3; + /// { + /// let entries = kvm_cpuid.as_mut_slice(); + /// for entry in entries.iter_mut() { + /// match entry.function { + /// 6 => entry.ecx &= !(1 << ECX_EPB_SHIFT), + /// _ => (), + /// } + /// } + /// } + /// + /// vcpu.set_cpuid2(&kvm_cpuid).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_cpuid2(&self, cpuid: &CpuId) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_cpuid2 struct. + ioctl_with_ptr(self, KVM_SET_CPUID2(), cpuid.as_fam_struct_ptr()) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// X86 specific call to retrieve the CPUID registers. + /// + /// It requires knowledge of how many `kvm_cpuid_entry2` entries there are to get. + /// See the documentation for `KVM_GET_CPUID2` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `num_entries` - Number of CPUID entries to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_bindings::KVM_MAX_CPUID_ENTRIES; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let cpuid = vcpu.get_cpuid2(KVM_MAX_CPUID_ENTRIES).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_cpuid2(&self, num_entries: usize) -> Result { + let mut cpuid = CpuId::new(num_entries); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_cpuid2 struct. + ioctl_with_mut_ptr(self, KVM_GET_CPUID2(), cpuid.as_mut_fam_struct_ptr()) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(cpuid) + } + + /// + /// See the documentation for `KVM_ENABLE_CAP`. + /// + /// # Arguments + /// + /// * kvm_enable_cap - KVM capability structure. For details check the `kvm_enable_cap` + /// structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_bindings::{kvm_enable_cap, KVM_MAX_CPUID_ENTRIES, KVM_CAP_HYPERV_SYNIC, KVM_CAP_SPLIT_IRQCHIP}; + /// # use kvm_ioctls::{Kvm, Cap}; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let mut cap: kvm_enable_cap = Default::default(); + /// if cfg!(target_arch = "x86") || cfg!(target_arch = "x86_64") { + /// // KVM_CAP_HYPERV_SYNIC needs KVM_CAP_SPLIT_IRQCHIP enabled + /// cap.cap = KVM_CAP_SPLIT_IRQCHIP; + /// cap.args[0] = 24; + /// vm.enable_cap(&cap).unwrap(); + /// + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// if kvm.check_extension(Cap::HypervSynic) { + /// let mut cap: kvm_enable_cap = Default::default(); + /// cap.cap = KVM_CAP_HYPERV_SYNIC; + /// vcpu.enable_cap(&cap).unwrap(); + /// } + /// } + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn enable_cap(&self, cap: &kvm_enable_cap) -> Result<()> { + // The ioctl is safe because we allocated the struct and we know the + // kernel will write exactly the size of the struct. + let ret = unsafe { ioctl_with_ref(self, KVM_ENABLE_CAP(), cap) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Returns the state of the LAPIC (Local Advanced Programmable Interrupt Controller). + /// + /// The state is returned in a `kvm_lapic_state` structure as defined in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// See the documentation for `KVM_GET_LAPIC`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // For `get_lapic` to work, you first need to create a IRQ chip before creating the vCPU. + /// vm.create_irq_chip().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let lapic = vcpu.get_lapic().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_lapic(&self) -> Result { + let mut klapic = kvm_lapic_state::default(); + + let ret = unsafe { + // The ioctl is unsafe unless you trust the kernel not to write past the end of the + // local_apic struct. + ioctl_with_mut_ref(self, KVM_GET_LAPIC(), &mut klapic) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(klapic) + } + + /// Sets the state of the LAPIC (Local Advanced Programmable Interrupt Controller). + /// + /// See the documentation for `KVM_SET_LAPIC`. + /// + /// # Arguments + /// + /// * `klapic` - LAPIC state. For details check the `kvm_lapic_state` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// use std::io::Write; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // For `get_lapic` to work, you first need to create a IRQ chip before creating the vCPU. + /// vm.create_irq_chip().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let mut lapic = vcpu.get_lapic().unwrap(); + /// + /// // Write to APIC_ICR offset the value 2. + /// let apic_icr_offset = 0x300; + /// let write_value: &[u8] = &[2, 0, 0, 0]; + /// let mut apic_icr_slice = + /// unsafe { &mut *(&mut lapic.regs[apic_icr_offset..] as *mut [i8] as *mut [u8]) }; + /// apic_icr_slice.write(write_value).unwrap(); + /// + /// // Update the value of LAPIC. + ///vcpu.set_lapic(&lapic).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_lapic(&self, klapic: &kvm_lapic_state) -> Result<()> { + let ret = unsafe { + // The ioctl is safe because the kernel will only read from the klapic struct. + ioctl_with_ref(self, KVM_SET_LAPIC(), klapic) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns the model-specific registers (MSR) for this vCPU. + /// + /// It emulates `KVM_GET_MSRS` ioctl's behavior by returning the number of MSRs + /// successfully read upon success or the last error number in case of failure. + /// The MSRs are returned in the `msr` method argument. + /// + /// # Arguments + /// + /// * `msrs` - MSRs (input/output). For details check the `kvm_msrs` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::{kvm_msr_entry, Msrs}; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// // Configure the struct to say which entries we want to get. + /// let mut msrs = Msrs::from_entries(&[ + /// kvm_msr_entry { + /// index: 0x0000_0174, + /// ..Default::default() + /// }, + /// kvm_msr_entry { + /// index: 0x0000_0175, + /// ..Default::default() + /// }, + /// ]); + /// let read = vcpu.get_msrs(&mut msrs).unwrap(); + /// assert_eq!(read, 2); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_msrs(&self, msrs: &mut Msrs) -> Result { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_msrs struct. + ioctl_with_mut_ptr(self, KVM_GET_MSRS(), msrs.as_mut_fam_struct_ptr()) + }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(ret as usize) + } + + /// Setup the model-specific registers (MSR) for this vCPU. + /// Returns the number of MSR entries actually written. + /// + /// See the documentation for `KVM_SET_MSRS`. + /// + /// # Arguments + /// + /// * `msrs` - MSRs. For details check the `kvm_msrs` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::{kvm_msr_entry, Msrs}; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// // Configure the entries we want to set. + /// let mut msrs = Msrs::from_entries(&[ + /// kvm_msr_entry { + /// index: 0x0000_0174, + /// ..Default::default() + /// }, + /// ]); + /// let written = vcpu.set_msrs(&msrs).unwrap(); + /// assert_eq!(written, 1); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_msrs(&self, msrs: &Msrs) -> Result { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_msrs struct. + ioctl_with_ptr(self, KVM_SET_MSRS(), msrs.as_fam_struct_ptr()) + }; + // KVM_SET_MSRS actually returns the number of msr entries written. + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(ret as usize) + } + + /// Returns the vcpu's current "multiprocessing state". + /// + /// See the documentation for `KVM_GET_MP_STATE` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_mp_state` - multiprocessing state to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let mp_state = vcpu.get_mp_state().unwrap(); + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390", + target_arch = "riscv64" + ))] + pub fn get_mp_state(&self) -> Result { + let mut mp_state = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_mp_state struct. + ioctl_with_mut_ref(self, KVM_GET_MP_STATE(), &mut mp_state) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(mp_state) + } + + /// Sets the vcpu's current "multiprocessing state". + /// + /// See the documentation for `KVM_SET_MP_STATE` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_mp_state` - multiprocessing state to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let mp_state = Default::default(); + /// // Your `mp_state` manipulation here. + /// vcpu.set_mp_state(mp_state).unwrap(); + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390", + target_arch = "riscv64" + ))] + pub fn set_mp_state(&self, mp_state: kvm_mp_state) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_mp_state struct. + ioctl_with_ref(self, KVM_SET_MP_STATE(), &mp_state) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// X86 specific call that returns the vcpu's current "xsave struct". + /// + /// See the documentation for `KVM_GET_XSAVE` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_xsave` - xsave struct to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let xsave = vcpu.get_xsave().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_xsave(&self) -> Result { + let mut xsave = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_xsave struct. + ioctl_with_mut_ref(self, KVM_GET_XSAVE(), &mut xsave) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(xsave) + } + + /// X86 specific call that sets the vcpu's current "xsave struct". + /// + /// See the documentation for `KVM_SET_XSAVE` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_xsave` - xsave struct to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let xsave = Default::default(); + /// // Your `xsave` manipulation here. + /// vcpu.set_xsave(&xsave).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_xsave(&self, xsave: &kvm_xsave) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_xsave struct. + ioctl_with_ref(self, KVM_SET_XSAVE(), xsave) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// X86 specific call that returns the vcpu's current "xcrs". + /// + /// See the documentation for `KVM_GET_XCRS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_xcrs` - xcrs to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let xcrs = vcpu.get_xcrs().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_xcrs(&self) -> Result { + let mut xcrs = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_xcrs struct. + ioctl_with_mut_ref(self, KVM_GET_XCRS(), &mut xcrs) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(xcrs) + } + + /// X86 specific call that sets the vcpu's current "xcrs". + /// + /// See the documentation for `KVM_SET_XCRS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_xcrs` - xcrs to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let xcrs = Default::default(); + /// // Your `xcrs` manipulation here. + /// vcpu.set_xcrs(&xcrs).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_xcrs(&self, xcrs: &kvm_xcrs) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_xcrs struct. + ioctl_with_ref(self, KVM_SET_XCRS(), xcrs) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// X86 specific call that returns the vcpu's current "debug registers". + /// + /// See the documentation for `KVM_GET_DEBUGREGS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_debugregs` - debug registers to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let debug_regs = vcpu.get_debug_regs().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_debug_regs(&self) -> Result { + let mut debug_regs = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_debugregs struct. + ioctl_with_mut_ref(self, KVM_GET_DEBUGREGS(), &mut debug_regs) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(debug_regs) + } + + /// X86 specific call that sets the vcpu's current "debug registers". + /// + /// See the documentation for `KVM_SET_DEBUGREGS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_debugregs` - debug registers to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let debug_regs = Default::default(); + /// // Your `debug_regs` manipulation here. + /// vcpu.set_debug_regs(&debug_regs).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_debug_regs(&self, debug_regs: &kvm_debugregs) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_debugregs struct. + ioctl_with_ref(self, KVM_SET_DEBUGREGS(), debug_regs) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns currently pending exceptions, interrupts, and NMIs as well as related + /// states of the vcpu. + /// + /// See the documentation for `KVM_GET_VCPU_EVENTS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_vcpu_events` - vcpu events to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::{Kvm, Cap}; + /// let kvm = Kvm::new().unwrap(); + /// if kvm.check_extension(Cap::VcpuEvents) { + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let vcpu_events = vcpu.get_vcpu_events().unwrap(); + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn get_vcpu_events(&self) -> Result { + let mut vcpu_events = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_vcpu_events struct. + ioctl_with_mut_ref(self, KVM_GET_VCPU_EVENTS(), &mut vcpu_events) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(vcpu_events) + } + + /// Sets pending exceptions, interrupts, and NMIs as well as related states of the vcpu. + /// + /// See the documentation for `KVM_SET_VCPU_EVENTS` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `kvm_vcpu_events` - vcpu events to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::{Kvm, Cap}; + /// let kvm = Kvm::new().unwrap(); + /// if kvm.check_extension(Cap::VcpuEvents) { + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let vcpu_events = Default::default(); + /// // Your `vcpu_events` manipulation here. + /// vcpu.set_vcpu_events(&vcpu_events).unwrap(); + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + + pub fn set_vcpu_events(&self, vcpu_events: &kvm_vcpu_events) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_vcpu_events struct. + ioctl_with_ref(self, KVM_SET_VCPU_EVENTS(), vcpu_events) + }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Sets the type of CPU to be exposed to the guest and optional features. + /// + /// This initializes an ARM vCPU to the specified type with the specified features + /// and resets the values of all of its registers to defaults. See the documentation for + /// `KVM_ARM_VCPU_INIT`. + /// + /// # Arguments + /// + /// * `kvi` - information about preferred CPU target type and recommended features for it. + /// For details check the `kvm_vcpu_init` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_vcpu_init; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// let mut kvi = kvm_vcpu_init::default(); + /// vm.get_preferred_target(&mut kvi).unwrap(); + /// vcpu.vcpu_init(&kvi).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + pub fn vcpu_init(&self, kvi: &kvm_vcpu_init) -> Result<()> { + // This is safe because we allocated the struct and we know the kernel will read + // exactly the size of the struct. + let ret = unsafe { ioctl_with_ref(self, KVM_ARM_VCPU_INIT(), kvi) }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns the guest registers that are supported for the + /// KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. + /// + /// # Arguments + /// + /// * `reg_list` - list of registers (input/output). For details check the `kvm_reg_list` + /// structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::RegList; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// // KVM_GET_REG_LIST demands that the vcpus be initalized. + /// let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + /// vm.get_preferred_target(&mut kvi).unwrap(); + /// vcpu.vcpu_init(&kvi).expect("Cannot initialize vcpu"); + /// + /// let mut reg_list = RegList::new(500); + /// vcpu.get_reg_list(&mut reg_list).unwrap(); + /// assert!(reg_list.as_fam_struct_ref().n > 0); + /// ``` + /// + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + pub fn get_reg_list(&self, reg_list: &mut RegList) -> Result<()> { + let ret = + unsafe { ioctl_with_mut_ref(self, KVM_GET_REG_LIST(), reg_list.as_mut_fam_struct()) }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Sets processor-specific debug registers and configures the vcpu for handling + /// certain guest debug events using the `KVM_SET_GUEST_DEBUG` ioctl. + /// + /// # Arguments + /// + /// * `debug_struct` - control bitfields and debug registers, depending on the specific architecture. + /// For details check the `kvm_guest_debug` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// # use kvm_bindings::{ + /// # KVM_GUESTDBG_ENABLE, KVM_GUESTDBG_USE_SW_BP, kvm_guest_debug_arch, kvm_guest_debug + /// # }; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + /// let debug_struct = kvm_guest_debug { + /// // Configure the vcpu so that a KVM_DEBUG_EXIT would be generated + /// // when encountering a software breakpoint during execution + /// control: KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP, + /// pad: 0, + /// // Reset all x86-specific debug registers + /// arch: kvm_guest_debug_arch { + /// debugreg: [0, 0, 0, 0, 0, 0, 0, 0], + /// }, + /// }; + /// + /// vcpu.set_guest_debug(&debug_struct).unwrap(); + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm64", + target_arch = "s390", + target_arch = "ppc" + ))] + pub fn set_guest_debug(&self, debug_struct: &kvm_guest_debug) -> Result<()> { + let ret = unsafe { ioctl_with_ref(self, KVM_SET_GUEST_DEBUG(), debug_struct) }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Sets the value of one register for this vCPU. + /// + /// The id of the register is encoded as specified in the kernel documentation + /// for `KVM_SET_ONE_REG`. + /// + /// # Arguments + /// + /// * `reg_id` - ID of the register for which we are setting the value. + /// * `data` - value for the specified register. + /// + #[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))] + pub fn set_one_reg(&self, reg_id: u64, data: u64) -> Result<()> { + let data_ref = &data as *const u64; + let onereg = kvm_one_reg { + id: reg_id, + addr: data_ref as u64, + }; + // This is safe because we allocated the struct and we know the kernel will read + // exactly the size of the struct. + let ret = unsafe { ioctl_with_ref(self, KVM_SET_ONE_REG(), &onereg) }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Returns the value of the specified vCPU register. + /// + /// The id of the register is encoded as specified in the kernel documentation + /// for `KVM_GET_ONE_REG`. + /// + /// # Arguments + /// + /// * `reg_id` - ID of the register. + /// + #[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))] + pub fn get_one_reg(&self, reg_id: u64) -> Result { + let mut reg_value = 0; + let mut onereg = kvm_one_reg { + id: reg_id, + addr: &mut reg_value as *mut u64 as u64, + }; + + let ret = unsafe { ioctl_with_mut_ref(self, KVM_GET_ONE_REG(), &mut onereg) }; + if ret < 0 { + return Err(errno::Error::last()); + } + Ok(reg_value) + } + + /// This sets pending external interrupt for a virtual CPU + /// + /// see documentation for 'KVM_INTERRUPT' in the + /// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) + #[cfg(any(target_arch = "riscv64"))] + pub fn set_interrupt(&self) -> Result<()> { + let interrupt = kvm_interrupt { + irq: KVM_INTERRUPT_SET as u32, + }; + let ret = unsafe { ioctl_with_ref(self, KVM_INTERRUPT(), &interrupt) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// This unsets pending external interrupt for a virtual CPU + /// + /// see documentation for 'KVM_INTERRUPT' in the + /// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) + #[cfg(any(target_arch = "riscv64"))] + pub fn unset_interrupt(&self) -> Result<()> { + let interrupt = kvm_interrupt { + irq: KVM_INTERRUPT_UNSET as u32, + }; + let ret = unsafe { ioctl_with_ref(self, KVM_INTERRUPT(), &interrupt) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + /// Notify the guest about the vCPU being paused. + /// + /// See the documentation for `KVM_KVMCLOCK_CTRL` in the + /// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn kvmclock_ctrl(&self) -> Result<()> { + // Safe because we know that our file is a KVM fd and that the request + // is one of the ones defined by kernel. + let ret = unsafe { ioctl(self, KVM_KVMCLOCK_CTRL()) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Triggers the running of the current virtual CPU returning an exit reason. + /// + /// See documentation for `KVM_RUN`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use std::io::Write; + /// # use std::ptr::null_mut; + /// # use std::slice; + /// # use kvm_ioctls::{Kvm, VcpuExit}; + /// # use kvm_bindings::{kvm_userspace_memory_region, KVM_MEM_LOG_DIRTY_PAGES}; + /// # let kvm = Kvm::new().unwrap(); + /// # let vm = kvm.create_vm().unwrap(); + /// // This is a dummy example for running on x86 based on https://lwn.net/Articles/658511/. + /// #[cfg(target_arch = "x86_64")] { + /// let mem_size = 0x4000; + /// let guest_addr: u64 = 0x1000; + /// let load_addr: *mut u8 = unsafe { + /// libc::mmap( + /// null_mut(), + /// mem_size, + /// libc::PROT_READ | libc::PROT_WRITE, + /// libc::MAP_ANONYMOUS | libc::MAP_SHARED | libc::MAP_NORESERVE, + /// -1, + /// 0, + /// ) as *mut u8 + /// }; + /// + /// let mem_region = kvm_userspace_memory_region { + /// slot: 0, + /// guest_phys_addr: guest_addr, + /// memory_size: mem_size as u64, + /// userspace_addr: load_addr as u64, + /// flags: 0, + /// }; + /// unsafe { vm.set_user_memory_region(mem_region).unwrap() }; + /// + /// // Dummy x86 code that just calls halt. + /// let x86_code = [ + /// 0xf4, /* hlt */ + /// ]; + /// + /// // Write the code in the guest memory. This will generate a dirty page. + /// unsafe { + /// let mut slice = slice::from_raw_parts_mut(load_addr, mem_size); + /// slice.write(&x86_code).unwrap(); + /// } + /// + /// let vcpu_fd = vm.create_vcpu(0).unwrap(); + /// + /// let mut vcpu_sregs = vcpu_fd.get_sregs().unwrap(); + /// vcpu_sregs.cs.base = 0; + /// vcpu_sregs.cs.selector = 0; + /// vcpu_fd.set_sregs(&vcpu_sregs).unwrap(); + /// + /// let mut vcpu_regs = vcpu_fd.get_regs().unwrap(); + /// // Set the Instruction Pointer to the guest address where we loaded the code. + /// vcpu_regs.rip = guest_addr; + /// vcpu_regs.rax = 2; + /// vcpu_regs.rbx = 3; + /// vcpu_regs.rflags = 2; + /// vcpu_fd.set_regs(&vcpu_regs).unwrap(); + /// + /// loop { + /// match vcpu_fd.run().expect("run failed") { + /// VcpuExit::Hlt => { + /// break; + /// } + /// exit_reason => panic!("unexpected exit reason: {:?}", exit_reason), + /// } + /// } + /// } + /// ``` + /// + pub fn run(&self) -> Result { + // Safe because we know that our file is a vCPU fd and we verify the return result. + let ret = unsafe { ioctl(self, KVM_RUN()) }; + if ret == 0 { + let run = self.kvm_run_ptr.as_mut_ref(); + match run.exit_reason { + // make sure you treat all possible exit reasons from include/uapi/linux/kvm.h corresponding + // when upgrading to a different kernel version + KVM_EXIT_UNKNOWN => Ok(VcpuExit::Unknown), + KVM_EXIT_EXCEPTION => Ok(VcpuExit::Exception), + KVM_EXIT_IO => { + let run_start = run as *mut kvm_run as *mut u8; + // Safe because the exit_reason (which comes from the kernel) told us which + // union field to use. + let io = unsafe { run.__bindgen_anon_1.io }; + let port = io.port; + let data_size = io.count as usize * io.size as usize; + // The data_offset is defined by the kernel to be some number of bytes into the + // kvm_run stucture, which we have fully mmap'd. + let data_ptr = unsafe { run_start.offset(io.data_offset as isize) }; + // The slice's lifetime is limited to the lifetime of this vCPU, which is equal + // to the mmap of the `kvm_run` struct that this is slicing from. + let data_slice = unsafe { + std::slice::from_raw_parts_mut::(data_ptr as *mut u8, data_size) + }; + match u32::from(io.direction) { + KVM_EXIT_IO_IN => Ok(VcpuExit::IoIn(port, data_slice)), + KVM_EXIT_IO_OUT => Ok(VcpuExit::IoOut(port, data_slice)), + _ => Err(errno::Error::new(EINVAL)), + } + } + KVM_EXIT_HYPERCALL => Ok(VcpuExit::Hypercall), + KVM_EXIT_DEBUG => Ok(VcpuExit::Debug), + KVM_EXIT_HLT => Ok(VcpuExit::Hlt), + KVM_EXIT_MMIO => { + // Safe because the exit_reason (which comes from the kernel) told us which + // union field to use. + let mmio = unsafe { &mut run.__bindgen_anon_1.mmio }; + let addr = mmio.phys_addr; + let len = mmio.len as usize; + let data_slice = &mut mmio.data[..len]; + if mmio.is_write != 0 { + Ok(VcpuExit::MmioWrite(addr, data_slice)) + } else { + Ok(VcpuExit::MmioRead(addr, data_slice)) + } + } + KVM_EXIT_IRQ_WINDOW_OPEN => Ok(VcpuExit::IrqWindowOpen), + KVM_EXIT_SHUTDOWN => Ok(VcpuExit::Shutdown), + KVM_EXIT_FAIL_ENTRY => Ok(VcpuExit::FailEntry), + KVM_EXIT_INTR => Ok(VcpuExit::Intr), + KVM_EXIT_SET_TPR => Ok(VcpuExit::SetTpr), + KVM_EXIT_TPR_ACCESS => Ok(VcpuExit::TprAccess), + KVM_EXIT_S390_SIEIC => Ok(VcpuExit::S390Sieic), + KVM_EXIT_S390_RESET => Ok(VcpuExit::S390Reset), + KVM_EXIT_DCR => Ok(VcpuExit::Dcr), + KVM_EXIT_NMI => Ok(VcpuExit::Nmi), + KVM_EXIT_INTERNAL_ERROR => Ok(VcpuExit::InternalError), + KVM_EXIT_OSI => Ok(VcpuExit::Osi), + KVM_EXIT_PAPR_HCALL => Ok(VcpuExit::PaprHcall), + KVM_EXIT_S390_UCONTROL => Ok(VcpuExit::S390Ucontrol), + KVM_EXIT_WATCHDOG => Ok(VcpuExit::Watchdog), + KVM_EXIT_S390_TSCH => Ok(VcpuExit::S390Tsch), + KVM_EXIT_EPR => Ok(VcpuExit::Epr), + KVM_EXIT_SYSTEM_EVENT => { + // Safe because the exit_reason (which comes from the kernel) told us which + // union field to use. + let system_event = unsafe { &mut run.__bindgen_anon_1.system_event }; + Ok(VcpuExit::SystemEvent( + system_event.type_, + system_event.flags, + )) + } + KVM_EXIT_S390_STSI => Ok(VcpuExit::S390Stsi), + KVM_EXIT_IOAPIC_EOI => { + // Safe because the exit_reason (which comes from the kernel) told us which + // union field to use. + let eoi = unsafe { &mut run.__bindgen_anon_1.eoi }; + Ok(VcpuExit::IoapicEoi(eoi.vector)) + } + KVM_EXIT_HYPERV => Ok(VcpuExit::Hyperv), + r => panic!("unknown kvm exit reason: {}", r), + } + } else { + Err(errno::Error::last()) + } + } + + /// Sets the `immediate_exit` flag on the `kvm_run` struct associated with this vCPU to `val`. + pub fn set_kvm_immediate_exit(&self, val: u8) { + let kvm_run = self.kvm_run_ptr.as_mut_ref(); + kvm_run.immediate_exit = val; + } +} + +/// Helper function to create a new `VcpuFd`. +/// +/// This should not be exported as a public function because the preferred way is to use +/// `create_vcpu` from `VmFd`. The function cannot be part of the `VcpuFd` implementation because +/// then it would be exported with the public `VcpuFd` interface. +pub fn new_vcpu(vcpu: File, kvm_run_ptr: KvmRunWrapper) -> VcpuFd { + VcpuFd { vcpu, kvm_run_ptr } +} + +impl AsRawFd for VcpuFd { + fn as_raw_fd(&self) -> RawFd { + self.vcpu.as_raw_fd() + } +} + +#[cfg(test)] +mod tests { + extern crate byteorder; + + use super::*; + use ioctls::system::Kvm; + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + use Cap; + + // Helper function for memory mapping `size` bytes of anonymous memory. + // Panics if the mmap fails. + fn mmap_anonymous(size: usize) -> *mut u8 { + use std::ptr::null_mut; + + let addr = unsafe { + libc::mmap( + null_mut(), + size, + libc::PROT_READ | libc::PROT_WRITE, + libc::MAP_ANONYMOUS | libc::MAP_SHARED | libc::MAP_NORESERVE, + -1, + 0, + ) + }; + if addr == libc::MAP_FAILED { + panic!("mmap failed."); + } + + addr as *mut u8 + } + + #[test] + fn test_create_vcpu() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + + assert!(vm.create_vcpu(0).is_ok()); + } + + #[cfg(target_arch = "x86_64")] + #[test] + fn test_get_cpuid() { + let kvm = Kvm::new().unwrap(); + if kvm.check_extension(Cap::ExtCpuid) { + let vm = kvm.create_vm().unwrap(); + let cpuid = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + let ncpuids = cpuid.as_slice().len(); + assert!(ncpuids <= KVM_MAX_CPUID_ENTRIES); + let nr_vcpus = kvm.get_nr_vcpus(); + for cpu_idx in 0..nr_vcpus { + let vcpu = vm.create_vcpu(cpu_idx as u8).unwrap(); + vcpu.set_cpuid2(&cpuid).unwrap(); + let retrieved_cpuid = vcpu.get_cpuid2(ncpuids).unwrap(); + // Only check the first few leafs as some (e.g. 13) are reserved. + assert_eq!(cpuid.as_slice()[..3], retrieved_cpuid.as_slice()[..3]); + } + } + } + + #[cfg(target_arch = "x86_64")] + #[test] + fn test_set_cpuid() { + let kvm = Kvm::new().unwrap(); + if kvm.check_extension(Cap::ExtCpuid) { + let vm = kvm.create_vm().unwrap(); + let mut cpuid = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap(); + let ncpuids = cpuid.as_slice().len(); + assert!(ncpuids <= KVM_MAX_CPUID_ENTRIES); + let vcpu = vm.create_vcpu(0).unwrap(); + + // Setting Manufacturer ID + { + let entries = cpuid.as_mut_slice(); + for entry in entries.iter_mut() { + match entry.function { + 0 => { + // " KVMKVMKVM " + entry.ebx = 0x4b4d564b; + entry.ecx = 0x564b4d56; + entry.edx = 0x4d; + } + _ => (), + } + } + } + vcpu.set_cpuid2(&cpuid).unwrap(); + let cpuid_0 = vcpu.get_cpuid2(ncpuids).unwrap(); + for entry in cpuid_0.as_slice() { + match entry.function { + 0 => { + assert_eq!(entry.ebx, 0x4b4d564b); + assert_eq!(entry.ecx, 0x564b4d56); + assert_eq!(entry.edx, 0x4d); + } + _ => (), + } + } + + // Disabling Intel SHA extensions. + const EBX_SHA_SHIFT: u32 = 29; + let mut ebx_sha_off = 0u32; + { + let entries = cpuid.as_mut_slice(); + for entry in entries.iter_mut() { + match entry.function { + 7 => { + if entry.ecx == 0 { + entry.ebx &= !(1 << EBX_SHA_SHIFT); + ebx_sha_off = entry.ebx; + } + } + _ => (), + } + } + } + vcpu.set_cpuid2(&cpuid).unwrap(); + let cpuid_1 = vcpu.get_cpuid2(ncpuids).unwrap(); + for entry in cpuid_1.as_slice() { + match entry.function { + 7 => { + if entry.ecx == 0 { + assert_eq!(entry.ebx, ebx_sha_off); + } + } + _ => (), + } + } + } + } + + #[cfg(target_arch = "x86_64")] + #[allow(non_snake_case)] + #[test] + fn test_fpu() { + // as per https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/fpu/internal.h + let KVM_FPU_CWD: usize = 0x37f; + let KVM_FPU_MXCSR: usize = 0x1f80; + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let mut fpu: kvm_fpu = kvm_fpu { + fcw: KVM_FPU_CWD as u16, + mxcsr: KVM_FPU_MXCSR as u32, + ..Default::default() + }; + + fpu.fcw = KVM_FPU_CWD as u16; + fpu.mxcsr = KVM_FPU_MXCSR as u32; + + vcpu.set_fpu(&fpu).unwrap(); + assert_eq!(vcpu.get_fpu().unwrap().fcw, KVM_FPU_CWD as u16); + } + + #[cfg(target_arch = "x86_64")] + #[test] + fn lapic_test() { + use std::io::Cursor; + // We might get read of byteorder if we replace mem::transmute with something safer. + use self::byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; + // As per https://github.com/torvalds/linux/arch/x86/kvm/lapic.c + // Try to write and read the APIC_ICR (0x300) register which is non-read only and + // one can simply write to it. + let kvm = Kvm::new().unwrap(); + assert!(kvm.check_extension(Cap::Irqchip)); + let vm = kvm.create_vm().unwrap(); + // The get_lapic ioctl will fail if there is no irqchip created beforehand. + assert!(vm.create_irq_chip().is_ok()); + let vcpu = vm.create_vcpu(0).unwrap(); + let mut klapic: kvm_lapic_state = vcpu.get_lapic().unwrap(); + + let reg_offset = 0x300; + let value = 2 as u32; + //try to write and read the APIC_ICR 0x300 + let write_slice = + unsafe { &mut *(&mut klapic.regs[reg_offset..] as *mut [i8] as *mut [u8]) }; + let mut writer = Cursor::new(write_slice); + writer.write_u32::(value).unwrap(); + vcpu.set_lapic(&klapic).unwrap(); + klapic = vcpu.get_lapic().unwrap(); + let read_slice = unsafe { &*(&klapic.regs[reg_offset..] as *const [i8] as *const [u8]) }; + let mut reader = Cursor::new(read_slice); + assert_eq!(reader.read_u32::().unwrap(), value); + } + + #[cfg(target_arch = "x86_64")] + #[test] + fn msrs_test() { + use vmm_sys_util::fam::FamStruct; + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + + // Set the following MSRs. + let msrs_to_set = [ + kvm_msr_entry { + index: 0x0000_0174, + data: 0x0, + ..Default::default() + }, + kvm_msr_entry { + index: 0x0000_0175, + data: 0x1, + ..Default::default() + }, + ]; + let msrs_wrapper = Msrs::from_entries(&msrs_to_set); + vcpu.set_msrs(&msrs_wrapper).unwrap(); + + // Now test that GET_MSRS returns the same. + // Configure the struct to say which entries we want. + let mut returned_kvm_msrs = Msrs::from_entries(&[ + kvm_msr_entry { + index: 0x0000_0174, + ..Default::default() + }, + kvm_msr_entry { + index: 0x0000_0175, + ..Default::default() + }, + ]); + let nmsrs = vcpu.get_msrs(&mut returned_kvm_msrs).unwrap(); + + // Verify the lengths match. + assert_eq!(nmsrs, msrs_to_set.len()); + assert_eq!(nmsrs, returned_kvm_msrs.as_fam_struct_ref().len() as usize); + + // Verify the contents match. + let returned_kvm_msr_entries = returned_kvm_msrs.as_slice(); + for (i, entry) in returned_kvm_msr_entries.iter().enumerate() { + assert_eq!(entry, &msrs_to_set[i]); + } + } + + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390" + ))] + #[test] + fn mpstate_test() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let mp_state = vcpu.get_mp_state().unwrap(); + vcpu.set_mp_state(mp_state).unwrap(); + let other_mp_state = vcpu.get_mp_state().unwrap(); + assert_eq!(mp_state, other_mp_state); + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn xsave_test() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let xsave = vcpu.get_xsave().unwrap(); + vcpu.set_xsave(&xsave).unwrap(); + let other_xsave = vcpu.get_xsave().unwrap(); + assert_eq!(&xsave.region[..], &other_xsave.region[..]); + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn xcrs_test() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let xcrs = vcpu.get_xcrs().unwrap(); + vcpu.set_xcrs(&xcrs).unwrap(); + let other_xcrs = vcpu.get_xcrs().unwrap(); + assert_eq!(xcrs, other_xcrs); + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn debugregs_test() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let debugregs = vcpu.get_debug_regs().unwrap(); + vcpu.set_debug_regs(&debugregs).unwrap(); + let other_debugregs = vcpu.get_debug_regs().unwrap(); + assert_eq!(debugregs, other_debugregs); + } + + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + #[test] + fn vcpu_events_test() { + let kvm = Kvm::new().unwrap(); + if kvm.check_extension(Cap::VcpuEvents) { + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + let vcpu_events = vcpu.get_vcpu_events().unwrap(); + vcpu.set_vcpu_events(&vcpu_events).unwrap(); + let other_vcpu_events = vcpu.get_vcpu_events().unwrap(); + assert_eq!(vcpu_events, other_vcpu_events); + } + } + + #[cfg(target_arch = "aarch64")] + #[test] + fn test_run_code() { + use std::io::Write; + + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + #[rustfmt::skip] + let code = [ + 0x40, 0x20, 0x80, 0x52, /* mov w0, #0x102 */ + 0x00, 0x01, 0x00, 0xb9, /* str w0, [x8]; test physical memory write */ + 0x81, 0x60, 0x80, 0x52, /* mov w1, #0x304 */ + 0x02, 0x00, 0x80, 0x52, /* mov w2, #0x0 */ + 0x20, 0x01, 0x40, 0xb9, /* ldr w0, [x9]; test MMIO read */ + 0x1f, 0x18, 0x14, 0x71, /* cmp w0, #0x506 */ + 0x20, 0x00, 0x82, 0x1a, /* csel w0, w1, w2, eq */ + 0x20, 0x01, 0x00, 0xb9, /* str w0, [x9]; test MMIO write */ + 0x00, 0x80, 0xb0, 0x52, /* mov w0, #0x84000000 */ + 0x00, 0x00, 0x1d, 0x32, /* orr w0, w0, #0x08 */ + 0x02, 0x00, 0x00, 0xd4, /* hvc #0x0 */ + 0x00, 0x00, 0x00, 0x14, /* b ; shouldn't get here, but if so loop forever */ + ]; + + let mem_size = 0x20000; + let load_addr = mmap_anonymous(mem_size); + let guest_addr: u64 = 0x10000; + let slot: u32 = 0; + let mem_region = kvm_userspace_memory_region { + slot, + guest_phys_addr: guest_addr, + memory_size: mem_size as u64, + userspace_addr: load_addr as u64, + flags: KVM_MEM_LOG_DIRTY_PAGES, + }; + unsafe { + vm.set_user_memory_region(mem_region).unwrap(); + } + + unsafe { + // Get a mutable slice of `mem_size` from `load_addr`. + // This is safe because we mapped it before. + let mut slice = std::slice::from_raw_parts_mut(load_addr, mem_size); + slice.write(&code).unwrap(); + } + + let vcpu_fd = vm.create_vcpu(0).unwrap(); + let mut kvi = kvm_bindings::kvm_vcpu_init::default(); + vm.get_preferred_target(&mut kvi).unwrap(); + kvi.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; + vcpu_fd.vcpu_init(&kvi).unwrap(); + + let core_reg_base: u64 = 0x6030_0000_0010_0000; + let mmio_addr: u64 = guest_addr + mem_size as u64; + + // Set the PC to the guest address where we loaded the code. + vcpu_fd + .set_one_reg(core_reg_base + 2 * 32, guest_addr) + .unwrap(); + + // Set x8 and x9 to the addresses the guest test code needs + vcpu_fd + .set_one_reg(core_reg_base + 2 * 8, guest_addr + 0x10000) + .unwrap(); + vcpu_fd + .set_one_reg(core_reg_base + 2 * 9, mmio_addr) + .unwrap(); + + loop { + match vcpu_fd.run().expect("run failed") { + VcpuExit::MmioRead(addr, data) => { + assert_eq!(addr, mmio_addr); + assert_eq!(data.len(), 4); + data[3] = 0x0; + data[2] = 0x0; + data[1] = 0x5; + data[0] = 0x6; + } + VcpuExit::MmioWrite(addr, data) => { + assert_eq!(addr, mmio_addr); + assert_eq!(data.len(), 4); + assert_eq!(data[3], 0x0); + assert_eq!(data[2], 0x0); + assert_eq!(data[1], 0x3); + assert_eq!(data[0], 0x4); + // The code snippet dirties one page at guest_addr + 0x10000. + // The code page should not be dirty, as it's not written by the guest. + let dirty_pages_bitmap = vm.get_dirty_log(slot, mem_size).unwrap(); + let dirty_pages = dirty_pages_bitmap + .into_iter() + .map(|page| page.count_ones()) + .fold(0, |dirty_page_count, i| dirty_page_count + i); + assert_eq!(dirty_pages, 1); + } + VcpuExit::SystemEvent(type_, flags) => { + assert_eq!(type_, KVM_SYSTEM_EVENT_SHUTDOWN); + assert_eq!(flags, 0); + break; + } + r => panic!("unexpected exit reason: {:?}", r), + } + } + } + + #[cfg(target_arch = "x86_64")] + #[test] + fn test_run_code() { + use std::io::Write; + + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + // This example is based on https://lwn.net/Articles/658511/ + #[rustfmt::skip] + let code = [ + 0xba, 0xf8, 0x03, /* mov $0x3f8, %dx */ + 0x00, 0xd8, /* add %bl, %al */ + 0x04, b'0', /* add $'0', %al */ + 0xee, /* out %al, %dx */ + 0xec, /* in %dx, %al */ + 0xc6, 0x06, 0x00, 0x80, 0x00, /* movl $0, (0x8000); This generates a MMIO Write.*/ + 0x8a, 0x16, 0x00, 0x80, /* movl (0x8000), %dl; This generates a MMIO Read.*/ + 0xc6, 0x06, 0x00, 0x20, 0x00, /* movl $0, (0x2000); Dirty one page in guest mem. */ + 0xf4, /* hlt */ + ]; + let expected_rips: [u64; 3] = [0x1003, 0x1005, 0x1007]; + + let mem_size = 0x4000; + let load_addr = mmap_anonymous(mem_size); + let guest_addr: u64 = 0x1000; + let slot: u32 = 0; + let mem_region = kvm_userspace_memory_region { + slot, + guest_phys_addr: guest_addr, + memory_size: mem_size as u64, + userspace_addr: load_addr as u64, + flags: KVM_MEM_LOG_DIRTY_PAGES, + }; + unsafe { + vm.set_user_memory_region(mem_region).unwrap(); + } + + unsafe { + // Get a mutable slice of `mem_size` from `load_addr`. + // This is safe because we mapped it before. + let mut slice = std::slice::from_raw_parts_mut(load_addr, mem_size); + slice.write_all(&code).unwrap(); + } + + let vcpu_fd = vm.create_vcpu(0).unwrap(); + + let mut vcpu_sregs = vcpu_fd.get_sregs().unwrap(); + assert_ne!(vcpu_sregs.cs.base, 0); + assert_ne!(vcpu_sregs.cs.selector, 0); + vcpu_sregs.cs.base = 0; + vcpu_sregs.cs.selector = 0; + vcpu_fd.set_sregs(&vcpu_sregs).unwrap(); + + let mut vcpu_regs = vcpu_fd.get_regs().unwrap(); + // Set the Instruction Pointer to the guest address where we loaded the code. + vcpu_regs.rip = guest_addr; + vcpu_regs.rax = 2; + vcpu_regs.rbx = 3; + vcpu_regs.rflags = 2; + vcpu_fd.set_regs(&vcpu_regs).unwrap(); + + let mut debug_struct = kvm_guest_debug { + control: KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP, + pad: 0, + arch: kvm_guest_debug_arch { + debugreg: [0, 0, 0, 0, 0, 0, 0, 0], + }, + }; + vcpu_fd.set_guest_debug(&debug_struct).unwrap(); + + let mut instr_idx = 0; + loop { + match vcpu_fd.run().expect("run failed") { + VcpuExit::IoIn(addr, data) => { + assert_eq!(addr, 0x3f8); + assert_eq!(data.len(), 1); + } + VcpuExit::IoOut(addr, data) => { + assert_eq!(addr, 0x3f8); + assert_eq!(data.len(), 1); + assert_eq!(data[0], b'5'); + } + VcpuExit::MmioRead(addr, data) => { + assert_eq!(addr, 0x8000); + assert_eq!(data.len(), 1); + } + VcpuExit::MmioWrite(addr, data) => { + assert_eq!(addr, 0x8000); + assert_eq!(data.len(), 1); + assert_eq!(data[0], 0); + } + VcpuExit::Debug => { + if instr_idx == expected_rips.len() - 1 { + // Disabling debugging/single-stepping + debug_struct.control = 0; + vcpu_fd.set_guest_debug(&debug_struct).unwrap(); + } else { + if instr_idx >= expected_rips.len() { + assert!(false); + } + } + let vcpu_regs = vcpu_fd.get_regs().unwrap(); + assert_eq!(vcpu_regs.rip, expected_rips[instr_idx]); + instr_idx += 1; + } + VcpuExit::Hlt => { + // The code snippet dirties 2 pages: + // * one when the code itself is loaded in memory; + // * and one more from the `movl` that writes to address 0x8000 + let dirty_pages_bitmap = vm.get_dirty_log(slot, mem_size).unwrap(); + let dirty_pages: u32 = dirty_pages_bitmap + .into_iter() + .map(|page| page.count_ones()) + .sum(); + assert_eq!(dirty_pages, 2); + break; + } + r => panic!("unexpected exit reason: {:?}", r), + } + } + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_faulty_vcpu_fd() { + use std::os::unix::io::FromRawFd; + + let badf_errno = libc::EBADF; + + let faulty_vcpu_fd = VcpuFd { + vcpu: unsafe { File::from_raw_fd(-1) }, + kvm_run_ptr: KvmRunWrapper { + kvm_run_ptr: mmap_anonymous(10), + mmap_size: 10, + }, + }; + + assert_eq!(faulty_vcpu_fd.get_regs().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vcpu_fd + .set_regs(&unsafe { std::mem::zeroed() }) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vcpu_fd.get_sregs().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vcpu_fd + .set_sregs(&unsafe { std::mem::zeroed() }) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vcpu_fd.get_fpu().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vcpu_fd + .set_fpu(&unsafe { std::mem::zeroed() }) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .set_cpuid2( + &Kvm::new() + .unwrap() + .get_supported_cpuid(KVM_MAX_CPUID_ENTRIES) + .unwrap() + ) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.get_cpuid2(1).err().unwrap().errno(), + badf_errno + ); + // `kvm_lapic_state` does not implement debug by default so we cannot + // use unwrap_err here. + assert!(faulty_vcpu_fd.get_lapic().is_err()); + assert_eq!( + faulty_vcpu_fd + .set_lapic(&unsafe { std::mem::zeroed() }) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .get_msrs(&mut Msrs::new(1)) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.set_msrs(&Msrs::new(1)).unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.get_mp_state().unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .set_mp_state(kvm_mp_state::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.get_xsave().err().unwrap().errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .set_xsave(&kvm_xsave::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vcpu_fd.get_xcrs().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vcpu_fd + .set_xcrs(&kvm_xcrs::default()) + .err() + .unwrap() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.get_debug_regs().unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .set_debug_regs(&kvm_debugregs::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd.get_vcpu_events().unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vcpu_fd + .set_vcpu_events(&kvm_vcpu_events::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vcpu_fd.run().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vcpu_fd.kvmclock_ctrl().unwrap_err().errno(), + badf_errno + ); + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_get_preferred_target() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + + let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + assert!(vcpu.vcpu_init(&kvi).is_err()); + + vm.get_preferred_target(&mut kvi) + .expect("Cannot get preferred target"); + assert!(vcpu.vcpu_init(&kvi).is_ok()); + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_set_one_reg() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + + let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + vm.get_preferred_target(&mut kvi) + .expect("Cannot get preferred target"); + vcpu.vcpu_init(&kvi).expect("Cannot initialize vcpu"); + let data: u64 = 0; + let reg_id: u64 = 0; + + assert!(vcpu.set_one_reg(reg_id, data).is_err()); + // Exercising KVM_SET_ONE_REG by trying to alter the data inside the PSTATE register (which is a + // specific aarch64 register). + const PSTATE_REG_ID: u64 = 0x6030_0000_0010_0042; + vcpu.set_one_reg(PSTATE_REG_ID, data) + .expect("Failed to set pstate register"); + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_get_one_reg() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + + let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + vm.get_preferred_target(&mut kvi) + .expect("Cannot get preferred target"); + vcpu.vcpu_init(&kvi).expect("Cannot initialize vcpu"); + + // PSR (Processor State Register) bits. + // Taken from arch/arm64/include/uapi/asm/ptrace.h. + const PSR_MODE_EL1H: u64 = 0x0000_0005; + const PSR_F_BIT: u64 = 0x0000_0040; + const PSR_I_BIT: u64 = 0x0000_0080; + const PSR_A_BIT: u64 = 0x0000_0100; + const PSR_D_BIT: u64 = 0x0000_0200; + const PSTATE_FAULT_BITS_64: u64 = + PSR_MODE_EL1H | PSR_A_BIT | PSR_F_BIT | PSR_I_BIT | PSR_D_BIT; + let data: u64 = PSTATE_FAULT_BITS_64; + const PSTATE_REG_ID: u64 = 0x6030_0000_0010_0042; + vcpu.set_one_reg(PSTATE_REG_ID, data) + .expect("Failed to set pstate register"); + + assert_eq!( + vcpu.get_one_reg(PSTATE_REG_ID) + .expect("Failed to get pstate register"), + PSTATE_FAULT_BITS_64 + ); + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_get_reg_list() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + + let mut reg_list = RegList::new(1); + // KVM_GET_REG_LIST demands that the vcpus be initalized, so we expect this to fail. + let err = vcpu.get_reg_list(&mut reg_list).unwrap_err(); + assert!(err.errno() == libc::ENOEXEC); + + let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + vm.get_preferred_target(&mut kvi) + .expect("Cannot get preferred target"); + vcpu.vcpu_init(&kvi).expect("Cannot initialize vcpu"); + + // KVM_GET_REG_LIST offers us a number of registers for which we have + // not allocated memory, so the first time it fails. + let err = vcpu.get_reg_list(&mut reg_list).unwrap_err(); + assert!(err.errno() == libc::E2BIG); + assert!(reg_list.as_mut_fam_struct().n > 0); + + // We make use of the number of registers returned to allocate memory and + // try one more time. + let mut reg_list = RegList::new(reg_list.as_mut_fam_struct().n as usize); + assert!(vcpu.get_reg_list(&mut reg_list).is_ok()); + } + + #[test] + fn set_kvm_immediate_exit() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let vcpu = vm.create_vcpu(0).unwrap(); + assert_eq!(vcpu.kvm_run_ptr.as_mut_ref().immediate_exit, 0); + vcpu.set_kvm_immediate_exit(1); + assert_eq!(vcpu.kvm_run_ptr.as_mut_ref().immediate_exit, 1); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_enable_cap() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let mut cap: kvm_enable_cap = Default::default(); + // KVM_CAP_HYPERV_SYNIC needs KVM_CAP_SPLIT_IRQCHIP enabled + cap.cap = KVM_CAP_SPLIT_IRQCHIP; + cap.args[0] = 24; + vm.enable_cap(&cap).unwrap(); + + let vcpu = vm.create_vcpu(0).unwrap(); + if kvm.check_extension(Cap::HypervSynic) { + let mut cap: kvm_enable_cap = Default::default(); + cap.cap = KVM_CAP_HYPERV_SYNIC; + vcpu.enable_cap(&cap).unwrap(); + } + } +} diff --git a/kvm-ioctls/src/ioctls/vm.rs b/kvm-ioctls/src/ioctls/vm.rs new file mode 100644 index 000000000..1de0c000a --- /dev/null +++ b/kvm-ioctls/src/ioctls/vm.rs @@ -0,0 +1,1804 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. + +use kvm_bindings::*; +use std::fs::File; +use std::os::raw::c_void; +use std::os::raw::{c_int, c_ulong}; +use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; + +use cap::Cap; +use ioctls::device::new_device; +use ioctls::device::DeviceFd; +use ioctls::vcpu::new_vcpu; +use ioctls::vcpu::VcpuFd; +use ioctls::{KvmRunWrapper, Result}; +use kvm_ioctls::*; +use vmm_sys_util::errno; +use vmm_sys_util::eventfd::EventFd; +use vmm_sys_util::ioctl::{ioctl, ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_val}; + +/// An address either in programmable I/O space or in memory mapped I/O space. +/// +/// The `IoEventAddress` is used for specifying the type when registering an event +/// in [register_ioevent](struct.VmFd.html#method.register_ioevent). +/// +pub enum IoEventAddress { + /// Representation of an programmable I/O address. + Pio(u64), + /// Representation of an memory mapped I/O address. + Mmio(u64), +} + +/// Helper structure for disabling datamatch. +/// +/// The structure can be used as a parameter to +/// [`register_ioevent`](struct.VmFd.html#method.register_ioevent) +/// to disable filtering of events based on the datamatch flag. For details check the +/// [KVM API documentation](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). +/// +pub struct NoDatamatch; +impl Into for NoDatamatch { + fn into(self) -> u64 { + 0 + } +} + +/// Wrapper over KVM VM ioctls. +pub struct VmFd { + vm: File, + run_size: usize, +} + +impl VmFd { + /// Creates/modifies a guest physical memory slot. + /// + /// See the documentation for `KVM_SET_USER_MEMORY_REGION`. + /// + /// # Arguments + /// + /// * `user_memory_region` - Guest physical memory slot. For details check the + /// `kvm_userspace_memory_region` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Safety + /// + /// This function is unsafe because there is no guarantee `userspace_addr` points to a valid + /// memory region, nor the memory region lives as long as the kernel needs it to. + /// + /// The caller of this method must make sure that: + /// - the raw pointer (`userspace_addr`) points to valid memory + /// - the regions provided to KVM are not overlapping other memory regions. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate kvm_bindings; + /// + /// use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_userspace_memory_region; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let mem_region = kvm_userspace_memory_region { + /// slot: 0, + /// guest_phys_addr: 0x10000 as u64, + /// memory_size: 0x10000 as u64, + /// userspace_addr: 0x0 as u64, + /// flags: 0, + /// }; + /// unsafe { + /// vm.set_user_memory_region(mem_region).unwrap(); + /// }; + /// ``` + /// + pub unsafe fn set_user_memory_region( + &self, + user_memory_region: kvm_userspace_memory_region, + ) -> Result<()> { + let ret = ioctl_with_ref(self, KVM_SET_USER_MEMORY_REGION(), &user_memory_region); + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Sets the address of the three-page region in the VM's address space. + /// + /// See the documentation for `KVM_SET_TSS_ADDR`. + /// + /// # Arguments + /// + /// * `offset` - Physical address of a three-page region in the guest's physical address space. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// vm.set_tss_address(0xfffb_d000).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_tss_address(&self, offset: usize) -> Result<()> { + // Safe because we know that our file is a VM fd and we verify the return result. + let ret = unsafe { ioctl_with_val(self, KVM_SET_TSS_ADDR(), offset as c_ulong) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Creates an in-kernel interrupt controller. + /// + /// See the documentation for `KVM_CREATE_IRQCHIP`. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// vm.create_irq_chip().unwrap(); + /// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] { + /// use kvm_bindings::{kvm_create_device, + /// kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2, KVM_CREATE_DEVICE_TEST}; + /// let mut gic_device = kvm_bindings::kvm_create_device { + /// type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2, + /// fd: 0, + /// flags: KVM_CREATE_DEVICE_TEST, + /// }; + /// if vm.create_device(&mut gic_device).is_ok() { + /// vm.create_irq_chip().unwrap(); + /// } + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn create_irq_chip(&self) -> Result<()> { + // Safe because we know that our file is a VM fd and we verify the return result. + let ret = unsafe { ioctl(self, KVM_CREATE_IRQCHIP()) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to retrieve the state of a kernel interrupt controller. + /// + /// See the documentation for `KVM_GET_IRQCHIP` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `irqchip` - `kvm_irqchip` (input/output) to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_bindings; + /// # extern crate kvm_ioctls; + /// # use kvm_bindings::{kvm_irqchip, KVM_IRQCHIP_PIC_MASTER}; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// vm.create_irq_chip().unwrap(); + /// let mut irqchip = kvm_irqchip::default(); + /// irqchip.chip_id = KVM_IRQCHIP_PIC_MASTER; + /// vm.get_irqchip(&mut irqchip).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_irqchip(&self, irqchip: &mut kvm_irqchip) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_irqchip struct. + ioctl_with_mut_ref(self, KVM_GET_IRQCHIP(), irqchip) + }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to set the state of a kernel interrupt controller. + /// + /// See the documentation for `KVM_SET_IRQCHIP` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `irqchip` - `kvm_irqchip` (input/output) to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_bindings; + /// # extern crate kvm_ioctls; + /// # use kvm_bindings::{kvm_irqchip, KVM_IRQCHIP_PIC_MASTER}; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// vm.create_irq_chip().unwrap(); + /// let mut irqchip = kvm_irqchip::default(); + /// irqchip.chip_id = KVM_IRQCHIP_PIC_MASTER; + /// // Your `irqchip` manipulation here. + /// vm.set_irqchip(&mut irqchip).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_irqchip(&self, irqchip: &kvm_irqchip) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_irqchip struct. + ioctl_with_ref(self, KVM_SET_IRQCHIP(), irqchip) + }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Creates a PIT as per the `KVM_CREATE_PIT2` ioctl. + /// + /// # Arguments + /// + /// * pit_config - PIT configuration. For details check the `kvm_pit_config` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_pit_config; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let pit_config = kvm_pit_config::default(); + /// vm.create_pit2(pit_config).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn create_pit2(&self, pit_config: kvm_pit_config) -> Result<()> { + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_CREATE_PIT2(), &pit_config) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to retrieve the state of the in-kernel PIT model. + /// + /// See the documentation for `KVM_GET_PIT2` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `pitstate` - `kvm_pit_state2` to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_bindings; + /// # extern crate kvm_ioctls; + /// # use kvm_bindings::kvm_pit_config; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// let pit_config = kvm_pit_config::default(); + /// vm.create_pit2(pit_config).unwrap(); + /// let pitstate = vm.get_pit2().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_pit2(&self) -> Result { + let mut pitstate = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_pit_state2 struct. + ioctl_with_mut_ref(self, KVM_GET_PIT2(), &mut pitstate) + }; + if ret == 0 { + Ok(pitstate) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to set the state of the in-kernel PIT model. + /// + /// See the documentation for `KVM_SET_PIT2` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `pitstate` - `kvm_pit_state2` to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_bindings; + /// # extern crate kvm_ioctls; + /// # use kvm_bindings::{kvm_pit_config, kvm_pit_state2}; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// let pit_config = kvm_pit_config::default(); + /// vm.create_pit2(pit_config).unwrap(); + /// let mut pitstate = kvm_pit_state2::default(); + /// // Your `pitstate` manipulation here. + /// vm.set_pit2(&mut pitstate).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_pit2(&self, pitstate: &kvm_pit_state2) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_pit_state2 struct. + ioctl_with_ref(self, KVM_SET_PIT2(), pitstate) + }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to retrieve the current timestamp of kvmclock. + /// + /// See the documentation for `KVM_GET_CLOCK` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `clock` - `kvm_clock_data` to be read. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let clock = vm.get_clock().unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn get_clock(&self) -> Result { + let mut clock = Default::default(); + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_clock_data struct. + ioctl_with_mut_ref(self, KVM_GET_CLOCK(), &mut clock) + }; + if ret == 0 { + Ok(clock) + } else { + Err(errno::Error::last()) + } + } + + /// X86 specific call to set the current timestamp of kvmclock. + /// + /// See the documentation for `KVM_SET_CLOCK` in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Arguments + /// + /// * `clock` - `kvm_clock_data` to be written. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_bindings; + /// # extern crate kvm_ioctls; + /// # use kvm_bindings::kvm_clock_data; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let mut clock = kvm_clock_data::default(); + /// vm.set_clock(&mut clock).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn set_clock(&self, clock: &kvm_clock_data) -> Result<()> { + let ret = unsafe { + // Here we trust the kernel not to read past the end of the kvm_clock_data struct. + ioctl_with_ref(self, KVM_SET_CLOCK(), clock) + }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Directly injects a MSI message as per the `KVM_SIGNAL_MSI` ioctl. + /// + /// See the documentation for `KVM_SIGNAL_MSI`. + /// + /// This ioctl returns > 0 when the MSI is successfully delivered and 0 + /// when the guest blocked the MSI. + /// + /// # Arguments + /// + /// * kvm_msi - MSI message configuration. For details check the `kvm_msi` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// # Example + /// + /// In this example, the important function signal_msi() calling into + /// the actual ioctl is commented out. The reason is that MSI vectors are + /// not chosen from the HW side (VMM). The guest OS (or anything that runs + /// inside the VM) is supposed to allocate the MSI vectors, and usually + /// communicate back through PCI configuration space. Sending a random MSI + /// vector through this signal_msi() function will always result in a + /// failure, which is why it needs to be commented out. + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_msi; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let msi = kvm_msi::default(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// vm.create_irq_chip().unwrap(); + /// //vm.signal_msi(msi).unwrap(); + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn signal_msi(&self, msi: kvm_msi) -> Result { + // Safe because we allocated the structure and we know the kernel + // will read exactly the size of the structure. + let ret = unsafe { ioctl_with_ref(self, KVM_SIGNAL_MSI(), &msi) }; + if ret >= 0 { + Ok(ret) + } else { + Err(errno::Error::last()) + } + } + + /// Sets the GSI routing table entries, overwriting any previously set + /// entries, as per the `KVM_SET_GSI_ROUTING` ioctl. + /// + /// See the documentation for `KVM_SET_GSI_ROUTING`. + /// + /// Returns an io::Error when the table could not be updated. + /// + /// # Arguments + /// + /// * kvm_irq_routing - IRQ routing configuration. Describe all routes + /// associated with GSI entries. For details check + /// the `kvm_irq_routing` and `kvm_irq_routing_entry` + /// structures in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_irq_routing; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// vm.create_irq_chip().unwrap(); + /// + /// let irq_routing = kvm_irq_routing::default(); + /// vm.set_gsi_routing(&irq_routing).unwrap(); + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn set_gsi_routing(&self, irq_routing: &kvm_irq_routing) -> Result<()> { + // Safe because we allocated the structure and we know the kernel + // will read exactly the size of the structure. + let ret = unsafe { ioctl_with_ref(self, KVM_SET_GSI_ROUTING(), irq_routing) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Registers an event to be signaled whenever a certain address is written to. + /// + /// See the documentation for `KVM_IOEVENTFD`. + /// + /// # Arguments + /// + /// * `fd` - `EventFd` which will be signaled. When signaling, the usual `vmexit` to userspace + /// is prevented. + /// * `addr` - Address being written to. + /// * `datamatch` - Limits signaling `fd` to only the cases where the value being written is + /// equal to this parameter. The size of `datamatch` is important and it must + /// match the expected size of the guest's write. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate libc; + /// extern crate vmm_sys_util; + /// # use kvm_ioctls::{IoEventAddress, Kvm, NoDatamatch}; + /// use libc::{eventfd, EFD_NONBLOCK}; + /// use vmm_sys_util::eventfd::EventFd; + /// let kvm = Kvm::new().unwrap(); + /// let vm_fd = kvm.create_vm().unwrap(); + /// let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + /// vm_fd + /// .register_ioevent(&evtfd, &IoEventAddress::Pio(0xf4), NoDatamatch) + /// .unwrap(); + /// vm_fd + /// .register_ioevent(&evtfd, &IoEventAddress::Mmio(0x1000), NoDatamatch) + /// .unwrap(); + /// ``` + /// + pub fn register_ioevent>( + &self, + fd: &EventFd, + addr: &IoEventAddress, + datamatch: T, + ) -> Result<()> { + let mut flags = 0; + if std::mem::size_of::() > 0 { + flags |= 1 << kvm_ioeventfd_flag_nr_datamatch + } + if let IoEventAddress::Pio(_) = *addr { + flags |= 1 << kvm_ioeventfd_flag_nr_pio + } + + let ioeventfd = kvm_ioeventfd { + datamatch: datamatch.into(), + len: std::mem::size_of::() as u32, + addr: match addr { + IoEventAddress::Pio(ref p) => *p as u64, + IoEventAddress::Mmio(ref m) => *m, + }, + fd: fd.as_raw_fd(), + flags, + ..Default::default() + }; + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_IOEVENTFD(), &ioeventfd) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Unregisters an event from a certain address it has been previously registered to. + /// + /// See the documentation for `KVM_IOEVENTFD`. + /// + /// # Arguments + /// + /// * `fd` - FD which will be unregistered. + /// * `addr` - Address being written to. + /// + /// # Safety + /// + /// This function is unsafe because it relies on RawFd. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate libc; + /// extern crate vmm_sys_util; + /// # use kvm_ioctls::{IoEventAddress, Kvm, NoDatamatch}; + /// use libc::EFD_NONBLOCK; + /// use vmm_sys_util::eventfd::EventFd; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm_fd = kvm.create_vm().unwrap(); + /// let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + /// let pio_addr = IoEventAddress::Pio(0xf4); + /// let mmio_addr = IoEventAddress::Mmio(0x1000); + /// vm_fd + /// .register_ioevent(&evtfd, &pio_addr, NoDatamatch) + /// .unwrap(); + /// vm_fd + /// .register_ioevent(&evtfd, &mmio_addr, 0x1234u32) + /// .unwrap(); + /// vm_fd + /// .unregister_ioevent(&evtfd, &pio_addr, NoDatamatch) + /// .unwrap(); + /// vm_fd + /// .unregister_ioevent(&evtfd, &mmio_addr, 0x1234u32) + /// .unwrap(); + /// ``` + /// + pub fn unregister_ioevent>( + &self, + fd: &EventFd, + addr: &IoEventAddress, + datamatch: T, + ) -> Result<()> { + let mut flags = 1 << kvm_ioeventfd_flag_nr_deassign; + if std::mem::size_of::() > 0 { + flags |= 1 << kvm_ioeventfd_flag_nr_datamatch + } + if let IoEventAddress::Pio(_) = *addr { + flags |= 1 << kvm_ioeventfd_flag_nr_pio + } + + let ioeventfd = kvm_ioeventfd { + datamatch: datamatch.into(), + len: std::mem::size_of::() as u32, + addr: match addr { + IoEventAddress::Pio(ref p) => *p as u64, + IoEventAddress::Mmio(ref m) => *m, + }, + fd: fd.as_raw_fd(), + flags, + ..Default::default() + }; + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_IOEVENTFD(), &ioeventfd) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Gets the bitmap of pages dirtied since the last call of this function. + /// + /// Leverages the dirty page logging feature in KVM. As a side-effect, this also resets the + /// bitmap inside the kernel. For the dirty log to be available, you have to set the flag + /// `KVM_MEM_LOG_DIRTY_PAGES` when creating guest memory regions. + /// + /// Check the documentation for `KVM_GET_DIRTY_LOG`. + /// + /// # Arguments + /// + /// * `slot` - Guest memory slot identifier. + /// * `memory_size` - Size of the memory region. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use std::io::Write; + /// # use std::ptr::null_mut; + /// # use std::slice; + /// # use kvm_ioctls::{Kvm, VcpuExit}; + /// # use kvm_bindings::{kvm_userspace_memory_region, KVM_MEM_LOG_DIRTY_PAGES}; + /// # let kvm = Kvm::new().unwrap(); + /// # let vm = kvm.create_vm().unwrap(); + /// // This example is based on https://lwn.net/Articles/658511/. + /// let mem_size = 0x4000; + /// let guest_addr: u64 = 0x1000; + /// let load_addr: *mut u8 = unsafe { + /// libc::mmap( + /// null_mut(), + /// mem_size, + /// libc::PROT_READ | libc::PROT_WRITE, + /// libc::MAP_ANONYMOUS | libc::MAP_SHARED | libc::MAP_NORESERVE, + /// -1, + /// 0, + /// ) as *mut u8 + /// }; + /// + /// // Initialize a guest memory region using the flag `KVM_MEM_LOG_DIRTY_PAGES`. + /// let mem_region = kvm_userspace_memory_region { + /// slot: 0, + /// guest_phys_addr: guest_addr, + /// memory_size: mem_size as u64, + /// userspace_addr: load_addr as u64, + /// flags: KVM_MEM_LOG_DIRTY_PAGES, + /// }; + /// unsafe { vm.set_user_memory_region(mem_region).unwrap() }; + /// + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// // ASM code that just forces a MMIO Write. + /// let asm_code = [ + /// 0xc6, 0x06, 0x00, 0x80, 0x00, + /// ]; + /// #[cfg(target_arch = "aarch64")] + /// let asm_code = [ + /// 0x01, 0x00, 0x00, 0x10, /* adr x1, */ + /// 0x22, 0x10, 0x00, 0xb9, /* str w2, [x1, #16]; write to this page */ + /// 0x02, 0x00, 0x00, 0xb9, /* str w2, [x0]; force MMIO exit */ + /// 0x00, 0x00, 0x00, 0x14, /* b ; shouldn't get here, but if so loop forever */ + /// ]; + /// + /// // Write the code in the guest memory. This will generate a dirty page. + /// unsafe { + /// let mut slice = slice::from_raw_parts_mut(load_addr, mem_size); + /// slice.write(&asm_code).unwrap(); + /// } + /// + /// let vcpu_fd = vm.create_vcpu(0).unwrap(); + /// + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// { + /// // x86_64 specific registry setup. + /// let mut vcpu_sregs = vcpu_fd.get_sregs().unwrap(); + /// vcpu_sregs.cs.base = 0; + /// vcpu_sregs.cs.selector = 0; + /// vcpu_fd.set_sregs(&vcpu_sregs).unwrap(); + /// + /// let mut vcpu_regs = vcpu_fd.get_regs().unwrap(); + /// // Set the Instruction Pointer to the guest address where we loaded the code. + /// vcpu_regs.rip = guest_addr; + /// vcpu_regs.rax = 2; + /// vcpu_regs.rbx = 3; + /// vcpu_regs.rflags = 2; + /// vcpu_fd.set_regs(&vcpu_regs).unwrap(); + /// } + /// + /// #[cfg(target_arch = "aarch64")] + /// { + /// // aarch64 specific registry setup. + /// let mut kvi = kvm_bindings::kvm_vcpu_init::default(); + /// vm.get_preferred_target(&mut kvi).unwrap(); + /// vcpu_fd.vcpu_init(&kvi).unwrap(); + /// + /// let core_reg_base: u64 = 0x6030_0000_0010_0000; + /// let mmio_addr: u64 = guest_addr + mem_size as u64; + /// vcpu_fd.set_one_reg(core_reg_base + 2 * 32, guest_addr); // set PC + /// vcpu_fd.set_one_reg(core_reg_base + 2 * 0, mmio_addr); // set X0 + /// } + /// + /// loop { + /// match vcpu_fd.run().expect("run failed") { + /// VcpuExit::MmioWrite(addr, data) => { + /// // On x86_64, the code snippet dirties 1 page when loading the code in memory + /// // while on aarch64 the dirty bit comes from writing to guest_addr (current PC). + /// let dirty_pages_bitmap = vm.get_dirty_log(0, mem_size).unwrap(); + /// let dirty_pages = dirty_pages_bitmap + /// .into_iter() + /// .map(|page| page.count_ones()) + /// .fold(0, |dirty_page_count, i| dirty_page_count + i); + /// assert_eq!(dirty_pages, 1); + /// break; + /// } + /// exit_reason => panic!("unexpected exit reason: {:?}", exit_reason), + /// } + /// } + /// ``` + /// + pub fn get_dirty_log(&self, slot: u32, memory_size: usize) -> Result> { + // Compute the length of the bitmap needed for all dirty pages in one memory slot. + // One memory page is `page_size` bytes and `KVM_GET_DIRTY_LOG` returns one dirty bit for + // each page. + let page_size = match unsafe { libc::sysconf(libc::_SC_PAGESIZE) } { + -1 => return Err(errno::Error::last()), + ps => ps as usize, + }; + + // For ease of access we are saving the bitmap in a u64 vector. We are using ceil to + // make sure we count all dirty pages even when `memory_size` is not a multiple of + // `page_size * 64`. + let div_ceil = |dividend, divisor| (dividend + divisor - 1) / divisor; + let bitmap_size = div_ceil(memory_size, page_size * 64); + let mut bitmap = vec![0u64; bitmap_size]; + let dirtylog = kvm_dirty_log { + slot, + padding1: 0, + __bindgen_anon_1: kvm_dirty_log__bindgen_ty_1 { + dirty_bitmap: bitmap.as_mut_ptr() as *mut c_void, + }, + }; + // Safe because we know that our file is a VM fd, and we know that the amount of memory + // we allocated for the bitmap is at least one bit per page. + let ret = unsafe { ioctl_with_ref(self, KVM_GET_DIRTY_LOG(), &dirtylog) }; + if ret == 0 { + Ok(bitmap) + } else { + Err(errno::Error::last()) + } + } + + /// Registers an event that will, when signaled, trigger the `gsi` IRQ. + /// + /// # Arguments + /// + /// * `fd` - `EventFd` to be signaled. + /// * `gsi` - IRQ to be triggered. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate libc; + /// # extern crate vmm_sys_util; + /// # use kvm_ioctls::Kvm; + /// # use libc::EFD_NONBLOCK; + /// # use vmm_sys_util::eventfd::EventFd; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + /// vm.create_irq_chip().unwrap(); + /// vm.register_irqfd(&evtfd, 0).unwrap(); + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn register_irqfd(&self, fd: &EventFd, gsi: u32) -> Result<()> { + let irqfd = kvm_irqfd { + fd: fd.as_raw_fd() as u32, + gsi, + ..Default::default() + }; + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_IRQFD(), &irqfd) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Unregisters an event that will, when signaled, trigger the `gsi` IRQ. + /// + /// # Arguments + /// + /// * `fd` - `EventFd` to be signaled. + /// * `gsi` - IRQ to be triggered. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate libc; + /// # extern crate vmm_sys_util; + /// # use kvm_ioctls::Kvm; + /// # use libc::EFD_NONBLOCK; + /// # use vmm_sys_util::eventfd::EventFd; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + /// vm.create_irq_chip().unwrap(); + /// vm.register_irqfd(&evtfd, 0).unwrap(); + /// vm.unregister_irqfd(&evtfd, 0).unwrap(); + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn unregister_irqfd(&self, fd: &EventFd, gsi: u32) -> Result<()> { + let irqfd = kvm_irqfd { + fd: fd.as_raw_fd() as u32, + gsi, + flags: KVM_IRQFD_FLAG_DEASSIGN, + ..Default::default() + }; + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_IRQFD(), &irqfd) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Sets the level on the given irq to 1 if `active` is true, and 0 otherwise. + /// + /// # Arguments + /// + /// * `irq` - IRQ to be set. + /// * `active` - Level of the IRQ input. + /// + /// # Errors + /// + /// Returns an io::Error when the irq field is invalid + /// + /// # Examples + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate libc; + /// # extern crate vmm_sys_util; + /// # use kvm_ioctls::{Kvm, VmFd}; + /// # use libc::EFD_NONBLOCK; + /// # use vmm_sys_util::eventfd::EventFd; + /// fn arch_setup(vm_fd: &VmFd) { + /// // Arch-specific setup: + /// // For x86 architectures, it simply means calling vm.create_irq_chip().unwrap(). + /// # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// # vm_fd.create_irq_chip().unwrap(); + /// // For Arm architectures, the IRQ controllers need to be setup first. + /// // Details please refer to the kernel documentation. + /// // https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt + /// # #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] { + /// # vm_fd.create_vcpu(0).unwrap(); + /// # // ... rest of setup for Arm goes here + /// # } + /// } + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// arch_setup(&vm); + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + /// vm.set_irq_line(4, true); + /// // ... + /// } + /// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] { + /// vm.set_irq_line(0x01_00_0020, true); + /// // .... + /// } + /// ``` + /// + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + pub fn set_irq_line(&self, irq: u32, active: bool) -> Result<()> { + let mut irq_level = kvm_irq_level::default(); + irq_level.__bindgen_anon_1.irq = irq; + irq_level.level = if active { 1 } else { 0 }; + + // Safe because we know that our file is a VM fd, we know the kernel will only read the + // correct amount of memory from our pointer, and we verify the return result. + let ret = unsafe { ioctl_with_ref(self, KVM_IRQ_LINE(), &irq_level) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Creates a new KVM vCPU file descriptor and maps the memory corresponding + /// its `kvm_run` structure. + /// + /// See the documentation for `KVM_CREATE_VCPU`. + /// + /// # Arguments + /// + /// * `id` - The vCPU ID. + /// + /// # Errors + /// + /// Returns an io::Error when the VM fd is invalid or the vCPU memory cannot + /// be mapped correctly. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // Create one vCPU with the ID=0. + /// let vcpu = vm.create_vcpu(0); + /// ``` + /// + pub fn create_vcpu(&self, id: u8) -> Result { + // Safe because we know that vm is a VM fd and we verify the return result. + #[allow(clippy::cast_lossless)] + let vcpu_fd = unsafe { ioctl_with_val(&self.vm, KVM_CREATE_VCPU(), id as c_ulong) }; + if vcpu_fd < 0 { + return Err(errno::Error::last()); + } + + // Wrap the vCPU now in case the following ? returns early. This is safe because we verified + // the value of the fd and we own the fd. + let vcpu = unsafe { File::from_raw_fd(vcpu_fd) }; + + let kvm_run_ptr = KvmRunWrapper::mmap_from_fd(&vcpu, self.run_size)?; + + Ok(new_vcpu(vcpu, kvm_run_ptr)) + } + + /// Creates a VcpuFd object from a vcpu RawFd. + /// + /// # Arguments + /// + /// * `fd` - the RawFd used for creating the VcpuFd object. + /// + /// # Safety + /// + /// This function is unsafe as the primitives currently returned have the contract that + /// they are the sole owner of the file descriptor they are wrapping. Usage of this function + /// could accidentally allow violating this contract which can cause memory unsafety in code + /// that relies on it being true. + /// + /// The caller of this method must make sure the fd is valid and nothing else uses it. + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # use std::os::unix::io::AsRawFd; + /// # use kvm_ioctls::Kvm; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // Create one vCPU with the ID=0. + /// let vcpu = vm.create_vcpu(0).unwrap(); + /// let rawfd = unsafe { libc::dup(vcpu.as_raw_fd()) }; + /// assert!(rawfd >= 0); + /// let vcpu = unsafe { vm.create_vcpu_from_rawfd(rawfd).unwrap() }; + /// ``` + /// + pub unsafe fn create_vcpu_from_rawfd(&self, fd: RawFd) -> Result { + let vcpu = File::from_raw_fd(fd); + let kvm_run_ptr = KvmRunWrapper::mmap_from_fd(&vcpu, self.run_size)?; + Ok(new_vcpu(vcpu, kvm_run_ptr)) + } + + /// Creates an emulated device in the kernel. + /// + /// See the documentation for `KVM_CREATE_DEVICE`. + /// + /// # Arguments + /// + /// * `device`: device configuration. For details check the `kvm_create_device` structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::{ + /// kvm_device_type_KVM_DEV_TYPE_VFIO, + /// kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2, + /// kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + /// KVM_CREATE_DEVICE_TEST, + /// }; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// + /// // Creating a device with the KVM_CREATE_DEVICE_TEST flag to check + /// // whether the device type is supported. This will not create the device. + /// // To create the device the flag needs to be removed. + /// let mut device = kvm_bindings::kvm_create_device { + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// type_: kvm_device_type_KVM_DEV_TYPE_VFIO, + /// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + /// type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + /// fd: 0, + /// flags: KVM_CREATE_DEVICE_TEST, + /// }; + /// // On ARM, creating VGICv3 may fail due to hardware dependency. + /// // Retry to create VGICv2 in that case. + /// let device_fd = vm.create_device(&mut device).unwrap_or_else(|_| { + /// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + /// panic!("Cannot create VFIO device."); + /// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + /// { + /// device.type_ = kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2; + /// vm.create_device(&mut device).expect("Cannot create vGIC device") + /// } + /// }); + /// ``` + /// + pub fn create_device(&self, device: &mut kvm_create_device) -> Result { + let ret = unsafe { ioctl_with_ref(self, KVM_CREATE_DEVICE(), device) }; + if ret == 0 { + Ok(new_device(unsafe { File::from_raw_fd(device.fd as i32) })) + } else { + Err(errno::Error::last()) + } + } + + /// Returns the preferred CPU target type which can be emulated by KVM on underlying host. + /// + /// The preferred CPU target is returned in the `kvi` parameter. + /// See documentation for `KVM_ARM_PREFERRED_TARGET`. + /// + /// # Arguments + /// * `kvi` - CPU target configuration (out). For details check the `kvm_vcpu_init` + /// structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// # extern crate kvm_bindings; + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::kvm_vcpu_init; + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let mut kvi = kvm_vcpu_init::default(); + /// vm.get_preferred_target(&mut kvi).unwrap(); + /// ``` + /// + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + pub fn get_preferred_target(&self, kvi: &mut kvm_vcpu_init) -> Result<()> { + // The ioctl is safe because we allocated the struct and we know the + // kernel will write exactly the size of the struct. + let ret = unsafe { ioctl_with_mut_ref(self, KVM_ARM_PREFERRED_TARGET(), kvi) }; + if ret != 0 { + return Err(errno::Error::last()); + } + Ok(()) + } + + /// Enable the specified capability as per the `KVM_ENABLE_CAP` ioctl. + /// + /// See the documentation for `KVM_ENABLE_CAP`. + /// + /// Returns an io::Error when the capability could not be enabled. + /// + /// # Arguments + /// + /// * kvm_enable_cap - KVM capability structure. For details check the `kvm_enable_cap` + /// structure in the + /// [KVM API doc](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt). + /// + /// # Example + /// + /// ```rust + /// # extern crate kvm_ioctls; + /// extern crate kvm_bindings; + /// + /// # use kvm_ioctls::Kvm; + /// use kvm_bindings::{kvm_enable_cap, KVM_CAP_SPLIT_IRQCHIP}; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// let mut cap: kvm_enable_cap = Default::default(); + /// // This example cannot enable an arm/aarch64 capability since there + /// // is no capability available for these architectures. + /// if cfg!(target_arch = "x86") || cfg!(target_arch = "x86_64") { + /// cap.cap = KVM_CAP_SPLIT_IRQCHIP; + /// // As per the KVM documentation, KVM_CAP_SPLIT_IRQCHIP only emulates + /// // the local APIC in kernel, expecting that a userspace IOAPIC will + /// // be implemented by the VMM. + /// // Along with this capability, the user needs to specify the number + /// // of pins reserved for the userspace IOAPIC. This number needs to be + /// // provided through the first argument of the capability structure, as + /// // specified in KVM documentation: + /// // args[0] - number of routes reserved for userspace IOAPICs + /// // + /// // Because an IOAPIC supports 24 pins, that's the reason why this test + /// // picked this number as reference. + /// cap.args[0] = 24; + /// vm.enable_cap(&cap).unwrap(); + /// } + /// ``` + /// + #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + pub fn enable_cap(&self, cap: &kvm_enable_cap) -> Result<()> { + // The ioctl is safe because we allocated the struct and we know the + // kernel will write exactly the size of the struct. + let ret = unsafe { ioctl_with_ref(self, KVM_ENABLE_CAP(), cap) }; + if ret == 0 { + Ok(()) + } else { + Err(errno::Error::last()) + } + } + + /// Get the `kvm_run` size. + pub fn run_size(&self) -> usize { + self.run_size + } + + /// Wrapper over `KVM_CHECK_EXTENSION`. + /// + /// Returns 0 if the capability is not available and a positive integer otherwise. + fn check_extension_int(&self, c: Cap) -> i32 { + // Safe because we know that our file is a VM fd and that the extension is one of the ones + // defined by kernel. + unsafe { ioctl_with_val(self, KVM_CHECK_EXTENSION(), c as c_ulong) } + } + + /// Checks if a particular `Cap` is available. + /// + /// Returns true if the capability is supported and false otherwise. + /// See the documentation for `KVM_CHECK_EXTENSION`. + /// + /// # Arguments + /// + /// * `c` - VM capability to check. + /// + /// # Example + /// + /// ``` + /// # use kvm_ioctls::Kvm; + /// use kvm_ioctls::Cap; + /// + /// let kvm = Kvm::new().unwrap(); + /// let vm = kvm.create_vm().unwrap(); + /// // Check if `KVM_CAP_MP_STATE` is supported. + /// assert!(vm.check_extension(Cap::MpState)); + /// ``` + /// + pub fn check_extension(&self, c: Cap) -> bool { + self.check_extension_int(c) > 0 + } +} + +/// Helper function to create a new `VmFd`. +/// +/// This should not be exported as a public function because the preferred way is to use +/// `create_vm` from `Kvm`. The function cannot be part of the `VmFd` implementation because +/// then it would be exported with the public `VmFd` interface. +pub fn new_vmfd(vm: File, run_size: usize) -> VmFd { + VmFd { vm, run_size } +} + +impl AsRawFd for VmFd { + fn as_raw_fd(&self) -> RawFd { + self.vm.as_raw_fd() + } +} + +/// Create a dummy GIC device. +/// +/// # Arguments +/// +/// * `vm` - The vm file descriptor. +/// * `flags` - Flags to be passed to `KVM_CREATE_DEVICE`. +/// +#[cfg(test)] +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +pub(crate) fn create_gic_device(vm: &VmFd, flags: u32) -> DeviceFd { + let mut gic_device = kvm_bindings::kvm_create_device { + type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V3, + fd: 0, + flags, + }; + let device_fd = match vm.create_device(&mut gic_device) { + Ok(fd) => fd, + Err(_) => { + gic_device.type_ = kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2; + vm.create_device(&mut gic_device) + .expect("Cannot create KVM vGIC device") + } + }; + device_fd +} + +/// Set supported number of IRQs for vGIC. +/// +/// # Arguments +/// +/// * `vgic` - The vGIC file descriptor. +/// * `nr_irqs` - Number of IRQs. +/// +#[cfg(test)] +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +pub(crate) fn set_supported_nr_irqs(vgic: &DeviceFd, nr_irqs: u32) { + let vgic_attr = kvm_bindings::kvm_device_attr { + group: kvm_bindings::KVM_DEV_ARM_VGIC_GRP_NR_IRQS, + attr: 0, + addr: &nr_irqs as *const u32 as u64, + flags: 0, + }; + assert!(vgic.set_device_attr(&vgic_attr).is_ok()); +} + +/// Request the initialization of the vGIC. +/// +/// # Arguments +/// +/// * `vgic` - The vGIC file descriptor. +/// +#[cfg(test)] +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +pub(crate) fn request_gic_init(vgic: &DeviceFd) { + let vgic_attr = kvm_bindings::kvm_device_attr { + group: kvm_bindings::KVM_DEV_ARM_VGIC_GRP_CTRL, + attr: u64::from(kvm_bindings::KVM_DEV_ARM_VGIC_CTRL_INIT), + addr: 0, + flags: 0, + }; + assert!(vgic.set_device_attr(&vgic_attr).is_ok()); +} + +#[cfg(test)] +mod tests { + use super::*; + use Kvm; + + use libc::EFD_NONBLOCK; + + #[test] + fn test_set_invalid_memory() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let invalid_mem_region = kvm_userspace_memory_region { + slot: 0, + guest_phys_addr: 0, + memory_size: 0, + userspace_addr: 0, + flags: 0, + }; + assert!(unsafe { vm.set_user_memory_region(invalid_mem_region) }.is_err()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_set_tss_address() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + assert!(vm.set_tss_address(0xfffb_d000).is_ok()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_irq_chip() { + use Cap; + + let kvm = Kvm::new().unwrap(); + assert!(kvm.check_extension(Cap::Irqchip)); + let vm = kvm.create_vm().unwrap(); + assert!(vm.create_irq_chip().is_ok()); + + let mut irqchip = kvm_irqchip::default(); + irqchip.chip_id = KVM_IRQCHIP_PIC_MASTER; + // Set the irq_base to a non-default value to check that set & get work. + irqchip.chip.pic.irq_base = 10; + assert!(vm.set_irqchip(&irqchip).is_ok()); + + // We initialize a dummy irq chip (`other_irqchip`) in which the + // function `get_irqchip` returns its result. + let mut other_irqchip = kvm_irqchip::default(); + other_irqchip.chip_id = KVM_IRQCHIP_PIC_MASTER; + assert!(vm.get_irqchip(&mut other_irqchip).is_ok()); + + // Safe because we know that the irqchip type is PIC. + unsafe { assert_eq!(irqchip.chip.pic, other_irqchip.chip.pic) }; + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_irq_chip() { + use Cap; + + let kvm = Kvm::new().unwrap(); + assert!(kvm.check_extension(Cap::Irqchip)); + + let vm = kvm.create_vm().unwrap(); + + // On ARM/arm64, a GICv2 is created. It's better to check ahead whether GICv2 + // can be emulated or not. + let mut gic_device = kvm_bindings::kvm_create_device { + type_: kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2, + fd: 0, + flags: KVM_CREATE_DEVICE_TEST, + }; + + let vgic_v2_supported = vm.create_device(&mut gic_device).is_ok(); + assert_eq!(vm.create_irq_chip().is_ok(), vgic_v2_supported); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_pit2() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + assert!(vm.create_pit2(kvm_pit_config::default()).is_ok()); + + let pit2 = vm.get_pit2().unwrap(); + vm.set_pit2(&pit2).unwrap(); + let mut other_pit2 = vm.get_pit2().unwrap(); + // Load time will differ, let's overwrite it so we can test equality. + other_pit2.channels[0].count_load_time = pit2.channels[0].count_load_time; + other_pit2.channels[1].count_load_time = pit2.channels[1].count_load_time; + other_pit2.channels[2].count_load_time = pit2.channels[2].count_load_time; + assert_eq!(pit2, other_pit2); + } + + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn test_clock() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + + // Get current time. + let orig = vm.get_clock().unwrap(); + + // Reset time. + let mut fudged = kvm_clock_data::default(); + fudged.clock = 10; + vm.set_clock(&fudged).unwrap(); + + // Get new time. + let new = vm.get_clock().unwrap(); + + // Verify new time has progressed but is smaller than orig time. + assert!(fudged.clock < new.clock); + assert!(new.clock < orig.clock); + } + + #[test] + fn test_register_ioevent() { + assert_eq!(std::mem::size_of::(), 0); + + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Pio(0xf4), NoDatamatch) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Mmio(0x1000), NoDatamatch) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Pio(0xc1), 0x7fu8) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Pio(0xc2), 0x1337u16) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Pio(0xc4), 0xdead_beefu32) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &IoEventAddress::Pio(0xc8), 0xdead_beef_dead_beefu64) + .is_ok()); + } + + #[test] + fn test_unregister_ioevent() { + assert_eq!(std::mem::size_of::(), 0); + + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); + let pio_addr = IoEventAddress::Pio(0xf4); + let mmio_addr = IoEventAddress::Mmio(0x1000); + + // First try to unregister addresses which have not been registered. + assert!(vm_fd + .unregister_ioevent(&evtfd, &pio_addr, NoDatamatch) + .is_err()); + assert!(vm_fd + .unregister_ioevent(&evtfd, &mmio_addr, NoDatamatch) + .is_err()); + + // Now register the addresses + assert!(vm_fd + .register_ioevent(&evtfd, &pio_addr, NoDatamatch) + .is_ok()); + assert!(vm_fd + .register_ioevent(&evtfd, &mmio_addr, 0x1337u16) + .is_ok()); + + // Try again unregistering the addresses. This time it should work + // since they have been previously registered. + assert!(vm_fd + .unregister_ioevent(&evtfd, &pio_addr, NoDatamatch) + .is_ok()); + assert!(vm_fd + .unregister_ioevent(&evtfd, &mmio_addr, 0x1337u16) + .is_ok()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_register_unregister_irqfd() { + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + let evtfd1 = EventFd::new(EFD_NONBLOCK).unwrap(); + let evtfd2 = EventFd::new(EFD_NONBLOCK).unwrap(); + let evtfd3 = EventFd::new(EFD_NONBLOCK).unwrap(); + + assert!(vm_fd.create_irq_chip().is_ok()); + + assert!(vm_fd.register_irqfd(&evtfd1, 4).is_ok()); + assert!(vm_fd.register_irqfd(&evtfd2, 8).is_ok()); + assert!(vm_fd.register_irqfd(&evtfd3, 4).is_ok()); + assert!(vm_fd.unregister_irqfd(&evtfd2, 8).is_ok()); + // KVM irqfd doesn't report failure on this case:( + assert!(vm_fd.unregister_irqfd(&evtfd2, 8).is_ok()); + + // Duplicated eventfd registration. + // On x86_64 this fails as the event fd was already matched with a GSI. + assert!(vm_fd.register_irqfd(&evtfd3, 4).is_err()); + assert!(vm_fd.register_irqfd(&evtfd3, 5).is_err()); + // KVM irqfd doesn't report failure on this case:( + assert!(vm_fd.unregister_irqfd(&evtfd3, 5).is_ok()); + } + + #[test] + #[cfg(target_arch = "aarch64")] + fn test_register_unregister_irqfd() { + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + let evtfd1 = EventFd::new(EFD_NONBLOCK).unwrap(); + let evtfd2 = EventFd::new(EFD_NONBLOCK).unwrap(); + let evtfd3 = EventFd::new(EFD_NONBLOCK).unwrap(); + + // Create the vGIC device. + let vgic_fd = create_gic_device(&vm_fd, 0); + + // Set supported number of IRQs. + set_supported_nr_irqs(&vgic_fd, 128); + // Request the initialization of the vGIC. + request_gic_init(&vgic_fd); + + assert!(vm_fd.register_irqfd(&evtfd1, 4).is_ok()); + assert!(vm_fd.register_irqfd(&evtfd2, 8).is_ok()); + assert!(vm_fd.register_irqfd(&evtfd3, 4).is_ok()); + assert!(vm_fd.unregister_irqfd(&evtfd2, 8).is_ok()); + // KVM irqfd doesn't report failure on this case:( + assert!(vm_fd.unregister_irqfd(&evtfd2, 8).is_ok()); + + // Duplicated eventfd registration. + // On aarch64, this fails because setting up the interrupt controller is mandatory before + // registering any IRQ. + assert!(vm_fd.register_irqfd(&evtfd3, 4).is_err()); + assert!(vm_fd.register_irqfd(&evtfd3, 5).is_err()); + // KVM irqfd doesn't report failure on this case:( + assert!(vm_fd.unregister_irqfd(&evtfd3, 5).is_ok()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_set_irq_line() { + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + + assert!(vm_fd.create_irq_chip().is_ok()); + + assert!(vm_fd.set_irq_line(4, true).is_ok()); + assert!(vm_fd.set_irq_line(4, false).is_ok()); + assert!(vm_fd.set_irq_line(4, true).is_ok()); + } + + #[test] + #[cfg(target_arch = "aarch64")] + fn test_set_irq_line() { + let kvm = Kvm::new().unwrap(); + let vm_fd = kvm.create_vm().unwrap(); + // Create a vcpu for test case 2 of the KVM_IRQ_LINE API on aarch64. + vm_fd.create_vcpu(0).unwrap(); + + // Create the vGIC device. + let vgic_fd = create_gic_device(&vm_fd, 0); + // Set supported number of IRQs. + set_supported_nr_irqs(&vgic_fd, 128); + // Request the initialization of the vGIC. + request_gic_init(&vgic_fd); + + // On arm/aarch64, irq field is interpreted like this: + // bits: | 31 ... 24 | 23 ... 16 | 15 ... 0 | + // field: | irq_type | vcpu_index | irq_id | + // The irq_type field has the following values: + // - irq_type[0]: out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ + // - irq_type[1]: in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.) (the vcpu_index field is ignored) + // - irq_type[2]: in-kernel GIC: PPI, irq_id between 16 and 31 (incl.) + // Hence, using irq_type = 1, irq_id = 32 (decimal), the irq field in hex is: 0x01_00_0020 + assert!(vm_fd.set_irq_line(0x01_00_0020, true).is_ok()); + assert!(vm_fd.set_irq_line(0x01_00_0020, false).is_ok()); + assert!(vm_fd.set_irq_line(0x01_00_0020, true).is_ok()); + + // Case 2: using irq_type = 2, vcpu_index = 0, irq_id = 16 (decimal), the irq field in hex is: 0x02_00_0010 + assert!(vm_fd.set_irq_line(0x02_00_0010, true).is_ok()); + assert!(vm_fd.set_irq_line(0x02_00_0010, false).is_ok()); + assert!(vm_fd.set_irq_line(0x02_00_0010, true).is_ok()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_faulty_vm_fd() { + let badf_errno = libc::EBADF; + + let faulty_vm_fd = VmFd { + vm: unsafe { File::from_raw_fd(-1) }, + run_size: 0, + }; + + let invalid_mem_region = kvm_userspace_memory_region { + slot: 0, + guest_phys_addr: 0, + memory_size: 0, + userspace_addr: 0, + flags: 0, + }; + + assert_eq!( + unsafe { + faulty_vm_fd + .set_user_memory_region(invalid_mem_region) + .unwrap_err() + .errno() + }, + badf_errno + ); + assert_eq!( + faulty_vm_fd.set_tss_address(0).unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vm_fd.create_irq_chip().unwrap_err().errno(), + badf_errno + ); + assert_eq!( + faulty_vm_fd + .create_pit2(kvm_pit_config::default()) + .unwrap_err() + .errno(), + badf_errno + ); + let event_fd = EventFd::new(EFD_NONBLOCK).unwrap(); + assert_eq!( + faulty_vm_fd + .register_ioevent(&event_fd, &IoEventAddress::Pio(0), 0u64) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vm_fd + .get_irqchip(&mut kvm_irqchip::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vm_fd + .set_irqchip(&kvm_irqchip::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vm_fd.get_clock().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vm_fd + .set_clock(&kvm_clock_data::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!(faulty_vm_fd.get_pit2().unwrap_err().errno(), badf_errno); + assert_eq!( + faulty_vm_fd + .set_pit2(&kvm_pit_state2::default()) + .unwrap_err() + .errno(), + badf_errno + ); + assert_eq!( + faulty_vm_fd + .register_irqfd(&event_fd, 0) + .unwrap_err() + .errno(), + badf_errno + ); + + assert_eq!( + faulty_vm_fd.create_vcpu(0).err().unwrap().errno(), + badf_errno + ); + + assert_eq!( + faulty_vm_fd.get_dirty_log(0, 0).unwrap_err().errno(), + badf_errno + ); + } + + #[test] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + fn test_get_preferred_target() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + assert!(vm.get_preferred_target(&mut kvi).is_ok()); + } + + /// As explained in the example code related to signal_msi(), sending + /// a random MSI vector will always fail because no vector has been + /// previously allocated from the guest itself. + #[test] + #[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" + ))] + fn test_signal_msi_failure() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let msi = kvm_msi::default(); + assert!(vm.signal_msi(msi).is_err()); + } + + #[test] + #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + fn test_enable_cap_failure() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let cap: kvm_enable_cap = Default::default(); + // Providing the `kvm_enable_cap` structure filled with default() should + // always result in a failure as it is not a valid capability. + assert!(vm.enable_cap(&cap).is_err()); + } + + #[test] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn test_enable_split_irqchip_cap() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + let mut cap: kvm_enable_cap = Default::default(); + cap.cap = KVM_CAP_SPLIT_IRQCHIP; + // As per the KVM documentation, KVM_CAP_SPLIT_IRQCHIP only emulates + // the local APIC in kernel, expecting that a userspace IOAPIC will + // be implemented by the VMM. + // Along with this capability, the user needs to specify the number + // of pins reserved for the userspace IOAPIC. This number needs to be + // provided through the first argument of the capability structure, as + // specified in KVM documentation: + // args[0] - number of routes reserved for userspace IOAPICs + // + // Because an IOAPIC supports 24 pins, that's the reason why this test + // picked this number as reference. + cap.args[0] = 24; + assert!(vm.enable_cap(&cap).is_ok()); + } + + #[test] + fn test_set_gsi_routing() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + if cfg!(target_arch = "x86") || cfg!(target_arch = "x86_64") { + let irq_routing = kvm_irq_routing::default(); + // Expect failure for x86 since the irqchip is not created yet. + assert!(vm.set_gsi_routing(&irq_routing).is_err()); + vm.create_irq_chip().unwrap(); + } + let irq_routing = kvm_irq_routing::default(); + assert!(vm.set_gsi_routing(&irq_routing).is_ok()); + } + + #[test] + fn test_check_extension() { + let kvm = Kvm::new().unwrap(); + let vm = kvm.create_vm().unwrap(); + assert!(vm.check_extension(Cap::MpState)); + } +} diff --git a/kvm-ioctls/src/kvm_ioctls.rs b/kvm-ioctls/src/kvm_ioctls.rs new file mode 100644 index 000000000..4206e341d --- /dev/null +++ b/kvm-ioctls/src/kvm_ioctls.rs @@ -0,0 +1,279 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. + +//! Declares necessary ioctls specific to their platform. + +use kvm_bindings::*; + +// Ioctls for /dev/kvm. + +ioctl_io_nr!(KVM_GET_API_VERSION, KVMIO, 0x00); +ioctl_io_nr!(KVM_CREATE_VM, KVMIO, 0x01); +ioctl_io_nr!(KVM_CHECK_EXTENSION, KVMIO, 0x03); +ioctl_io_nr!(KVM_GET_VCPU_MMAP_SIZE, KVMIO, 0x04); +/* Available with KVM_CAP_EXT_CPUID */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_SUPPORTED_CPUID, KVMIO, 0x05, kvm_cpuid2); +/* Available with KVM_CAP_EXT_EMUL_CPUID */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_EMULATED_CPUID, KVMIO, 0x09, kvm_cpuid2); + +// Ioctls for VM fds. + +ioctl_io_nr!(KVM_CREATE_VCPU, KVMIO, 0x41); +ioctl_iow_nr!(KVM_GET_DIRTY_LOG, KVMIO, 0x42, kvm_dirty_log); +/* Available with KVM_CAP_USER_MEMORY */ +ioctl_iow_nr!( + KVM_SET_USER_MEMORY_REGION, + KVMIO, + 0x46, + kvm_userspace_memory_region +); +/* Available with KVM_CAP_SET_TSS_ADDR */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_io_nr!(KVM_SET_TSS_ADDR, KVMIO, 0x47); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390" +))] +ioctl_io_nr!(KVM_CREATE_IRQCHIP, KVMIO, 0x60); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" +))] +ioctl_iow_nr!(KVM_IRQ_LINE, KVMIO, 0x61, kvm_irq_level); +/* Available with KVM_CAP_IRQ_ROUTING */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" +))] +ioctl_iow_nr!(KVM_SET_GSI_ROUTING, KVMIO, 0x6a, kvm_irq_routing); +/* Available with KVM_CAP_IRQFD */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390" +))] +ioctl_iow_nr!(KVM_IRQFD, KVMIO, 0x76, kvm_irqfd); +/* Available with KVM_CAP_PIT2 */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_CREATE_PIT2, KVMIO, 0x77, kvm_pit_config); +/* Available with KVM_CAP_IOEVENTFD */ +ioctl_iow_nr!(KVM_IOEVENTFD, KVMIO, 0x79, kvm_ioeventfd); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_IRQCHIP, KVMIO, 0x62, kvm_irqchip); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_SET_IRQCHIP, KVMIO, 0x63, kvm_irqchip); +/* Available with KVM_CAP_ADJUST_CLOCK */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_CLOCK, KVMIO, 0x7b, kvm_clock_data); +/* Available with KVM_CAP_ADJUST_CLOCK */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_CLOCK, KVMIO, 0x7c, kvm_clock_data); +/* Available with KVM_CAP_PIT_STATE2 */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_PIT2, KVMIO, 0x9f, kvm_pit_state2); +/* Available with KVM_CAP_PIT_STATE2 */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_PIT2, KVMIO, 0xa0, kvm_pit_state2); + +// Ioctls for VCPU fds. +ioctl_iow_nr!(KVM_INTERRUPT, KVMIO, 0x86, kvm_interrupt); +ioctl_io_nr!(KVM_RUN, KVMIO, 0x80); +#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] +ioctl_ior_nr!(KVM_GET_REGS, KVMIO, 0x81, kvm_regs); +#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] +ioctl_iow_nr!(KVM_SET_REGS, KVMIO, 0x82, kvm_regs); +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "powerpc", + target_arch = "powerpc64" +))] +ioctl_ior_nr!(KVM_GET_SREGS, KVMIO, 0x83, kvm_sregs); +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "powerpc", + target_arch = "powerpc64" +))] +ioctl_iow_nr!(KVM_SET_SREGS, KVMIO, 0x84, kvm_sregs); +/* Available with KVM_CAP_GET_MSR_FEATURES */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_MSR_INDEX_LIST, KVMIO, 0x02, kvm_msr_list); +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_MSRS, KVMIO, 0x88, kvm_msrs); +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_MSRS, KVMIO, 0x89, kvm_msrs); +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_FPU, KVMIO, 0x8c, kvm_fpu); +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_FPU, KVMIO, 0x8d, kvm_fpu); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_LAPIC, KVMIO, 0x8e, kvm_lapic_state); +/* Available with KVM_CAP_IRQCHIP */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_LAPIC, KVMIO, 0x8f, kvm_lapic_state); +/* Available with KVM_CAP_EXT_CPUID */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_CPUID2, KVMIO, 0x90, kvm_cpuid2); +/* Available with KVM_CAP_EXT_CPUID */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iowr_nr!(KVM_GET_CPUID2, KVMIO, 0x91, kvm_cpuid2); +/* Available with KVM_CAP_MP_STATE */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390", + target_arch = "riscv64" +))] +ioctl_ior_nr!(KVM_GET_MP_STATE, KVMIO, 0x98, kvm_mp_state); +/* Available with KVM_CAP_MP_STATE */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64", + target_arch = "s390", + target_arch = "riscv64" +))] +ioctl_iow_nr!(KVM_SET_MP_STATE, KVMIO, 0x99, kvm_mp_state); +/* Available with KVM_CAP_VCPU_EVENTS */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" +))] +ioctl_ior_nr!(KVM_GET_VCPU_EVENTS, KVMIO, 0x9f, kvm_vcpu_events); +/* Available with KVM_CAP_VCPU_EVENTS */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" +))] +ioctl_iow_nr!(KVM_SET_VCPU_EVENTS, KVMIO, 0xa0, kvm_vcpu_events); +/* Available with KVM_CAP_DEBUGREGS */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_DEBUGREGS, KVMIO, 0xa1, kvm_debugregs); +/* Available with KVM_CAP_DEBUGREGS */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_DEBUGREGS, KVMIO, 0xa2, kvm_debugregs); +/* Available with KVM_CAP_XSAVE */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_XSAVE, KVMIO, 0xa4, kvm_xsave); +/* Available with KVM_CAP_XSAVE */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_XSAVE, KVMIO, 0xa5, kvm_xsave); +/* Available with KVM_CAP_XCRS */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_ior_nr!(KVM_GET_XCRS, KVMIO, 0xa6, kvm_xcrs); +/* Available with KVM_CAP_XCRS */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_iow_nr!(KVM_SET_XCRS, KVMIO, 0xa7, kvm_xcrs); +/* Available with KVM_CAP_KVMCLOCK_CTRL */ +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +ioctl_io_nr!(KVM_KVMCLOCK_CTRL, KVMIO, 0xad); + +/* Available with KVM_CAP_ENABLE_CAP */ +#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] +ioctl_iow_nr!(KVM_ENABLE_CAP, KVMIO, 0xa3, kvm_enable_cap); +/* Available with KVM_CAP_SIGNAL_MSI */ +#[cfg(any( + target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64" +))] +ioctl_iow_nr!(KVM_SIGNAL_MSI, KVMIO, 0xa5, kvm_msi); +/* Available with KVM_CAP_ONE_REG */ +#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))] +ioctl_iow_nr!(KVM_GET_ONE_REG, KVMIO, 0xab, kvm_one_reg); +#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))] +ioctl_iow_nr!(KVM_SET_ONE_REG, KVMIO, 0xac, kvm_one_reg); +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +ioctl_iow_nr!(KVM_ARM_VCPU_INIT, KVMIO, 0xae, kvm_vcpu_init); +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +ioctl_ior_nr!(KVM_ARM_PREFERRED_TARGET, KVMIO, 0xaf, kvm_vcpu_init); +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +ioctl_iowr_nr!(KVM_GET_REG_LIST, KVMIO, 0xb0, kvm_reg_list); + +/* Available with KVM_CAP_SET_GUEST_DEBUG */ +ioctl_iow_nr!(KVM_SET_GUEST_DEBUG, KVMIO, 0x9b, kvm_guest_debug); + +// Device ioctls. + +/* Available with KVM_CAP_DEVICE_CTRL */ +ioctl_iowr_nr!(KVM_CREATE_DEVICE, KVMIO, 0xe0, kvm_create_device); +/* Available with KVM_CAP_DEVICE_CTRL */ +ioctl_iow_nr!(KVM_SET_DEVICE_ATTR, KVMIO, 0xe1, kvm_device_attr); +/* Available with KVM_CAP_DEVICE_CTRL */ +ioctl_iow_nr!(KVM_GET_DEVICE_ATTR, KVMIO, 0xe2, kvm_device_attr); +/* Available with KVM_CAP_DEVICE_CTRL */ +ioctl_iow_nr!(KVM_HAS_DEVICE_ATTR, KVMIO, 0xe3, kvm_device_attr); + +#[cfg(test)] +mod tests { + use std::fs::File; + use std::os::unix::io::FromRawFd; + + use libc::{c_char, open, O_RDWR}; + use vmm_sys_util::ioctl::{ioctl, ioctl_with_val}; + + use super::*; + const KVM_PATH: &str = "/dev/kvm\0"; + + #[test] + fn get_version() { + let sys_fd = unsafe { open(KVM_PATH.as_ptr() as *const c_char, O_RDWR) }; + assert!(sys_fd >= 0); + + let ret = unsafe { ioctl(&File::from_raw_fd(sys_fd), KVM_GET_API_VERSION()) }; + assert_eq!(ret as u32, KVM_API_VERSION); + } + + #[test] + fn create_vm_fd() { + let sys_fd = unsafe { open(KVM_PATH.as_ptr() as *const c_char, O_RDWR) }; + assert!(sys_fd >= 0); + + let vm_fd = unsafe { ioctl(&File::from_raw_fd(sys_fd), KVM_CREATE_VM()) }; + assert!(vm_fd >= 0); + } + + #[test] + fn check_vm_extension() { + let sys_fd = unsafe { open(KVM_PATH.as_ptr() as *const c_char, O_RDWR) }; + assert!(sys_fd >= 0); + + let has_user_memory = unsafe { + ioctl_with_val( + &File::from_raw_fd(sys_fd), + KVM_CHECK_EXTENSION(), + KVM_CAP_USER_MEMORY.into(), + ) + }; + assert_eq!(has_user_memory, 1); + } +} diff --git a/kvm-ioctls/src/lib.rs b/kvm-ioctls/src/lib.rs new file mode 100644 index 000000000..10c3cbae3 --- /dev/null +++ b/kvm-ioctls/src/lib.rs @@ -0,0 +1,235 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// Portions Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the THIRD-PARTY file. +#![deny(missing_docs)] + +//! A safe wrapper around the kernel's KVM interface. +//! +//! This crate offers safe wrappers for: +//! - [system ioctls](struct.Kvm.html) using the `Kvm` structure +//! - [VM ioctls](struct.VmFd.html) using the `VmFd` structure +//! - [vCPU ioctls](struct.VcpuFd.html) using the `VcpuFd` structure +//! - [device ioctls](struct.DeviceFd.html) using the `DeviceFd` structure +//! +//! # Platform support +//! +//! - x86_64 +//! - arm64 (experimental) +//! +//! **NOTE:** The list of available ioctls is not extensive. +//! +//! # Example - Running a VM on x86_64 +//! +//! In this example we are creating a Virtual Machine (VM) with one vCPU. +//! On the vCPU we are running machine specific code. This example is based on +//! the [LWN article](https://lwn.net/Articles/658511/) on using the KVM API. +//! The aarch64 example was modified accordingly. +//! +//! To get code running on the vCPU we are going through the following steps: +//! +//! 1. Instantiate KVM. This is used for running +//! [system specific ioctls](struct.Kvm.html). +//! 2. Use the KVM object to create a VM. The VM is used for running +//! [VM specific ioctls](struct.VmFd.html). +//! 3. Initialize the guest memory for the created VM. In this dummy example we +//! are adding only one memory region and write the code in one memory page. +//! 4. Create a vCPU using the VM object. The vCPU is used for running +//! [vCPU specific ioctls](struct.VcpuFd.html). +//! 5. Setup architectural specific general purpose registers and special registers. For +//! details about how and why these registers are set, please check the +//! [LWN article](https://lwn.net/Articles/658511/) on which this example is +//! built. +//! 6. Run the vCPU code in a loop and check the +//! [exit reasons](enum.VcpuExit.html). +//! +//! +//! ```rust +//! extern crate kvm_ioctls; +//! extern crate kvm_bindings; +//! +//! use kvm_ioctls::{Kvm, VmFd, VcpuFd}; +//! use kvm_ioctls::VcpuExit; +//! +//! fn main(){ +//! use std::io::Write; +//! use std::slice; +//! use std::ptr::null_mut; +//! +//! use kvm_bindings::KVM_MEM_LOG_DIRTY_PAGES; +//! use kvm_bindings::kvm_userspace_memory_region; +//! +//! let mem_size = 0x4000; +//! let guest_addr = 0x1000; +//! let asm_code: &[u8]; +//! +//! // Setting up architectural dependent values. +//! #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +//! { +//! asm_code = &[ +//! 0xba, 0xf8, 0x03, /* mov $0x3f8, %dx */ +//! 0x00, 0xd8, /* add %bl, %al */ +//! 0x04, b'0', /* add $'0', %al */ +//! 0xee, /* out %al, %dx */ +//! 0xec, /* in %dx, %al */ +//! 0xc6, 0x06, 0x00, 0x80, 0x00, /* movl $0, (0x8000); This generates a MMIO Write.*/ +//! 0x8a, 0x16, 0x00, 0x80, /* movl (0x8000), %dl; This generates a MMIO Read.*/ +//! 0xf4, /* hlt */ +//! ]; +//! } +//! #[cfg(target_arch = "aarch64")] +//! { +//! asm_code = &[ +//! 0x01, 0x00, 0x00, 0x10, /* adr x1, */ +//! 0x22, 0x10, 0x00, 0xb9, /* str w2, [x1, #16]; write to this page */ +//! 0x02, 0x00, 0x00, 0xb9, /* str w2, [x0]; This generates a MMIO Write.*/ +//! 0x00, 0x00, 0x00, 0x14, /* b ; shouldn't get here, but if so loop forever */ +//! ]; +//! } +//! +//! // 1. Instantiate KVM. +//! let kvm = Kvm::new().unwrap(); +//! +//! // 2. Create a VM. +//! let vm = kvm.create_vm().unwrap(); +//! +//! // 3. Initialize Guest Memory. +//! let load_addr: *mut u8 = unsafe { +//! libc::mmap( +//! null_mut(), +//! mem_size, +//! libc::PROT_READ | libc::PROT_WRITE, +//! libc::MAP_ANONYMOUS | libc::MAP_SHARED | libc::MAP_NORESERVE, +//! -1, +//! 0, +//! ) as *mut u8 +//! }; +//! +//! let slot = 0; +//! // When initializing the guest memory slot specify the +//! // `KVM_MEM_LOG_DIRTY_PAGES` to enable the dirty log. +//! let mem_region = kvm_userspace_memory_region { +//! slot, +//! guest_phys_addr: guest_addr, +//! memory_size: mem_size as u64, +//! userspace_addr: load_addr as u64, +//! flags: KVM_MEM_LOG_DIRTY_PAGES, +//! }; +//! unsafe { vm.set_user_memory_region(mem_region).unwrap() }; +//! +//! // Write the code in the guest memory. This will generate a dirty page. +//! unsafe { +//! let mut slice = slice::from_raw_parts_mut(load_addr, mem_size); +//! slice.write(&asm_code).unwrap(); +//! } +//! +//! // 4. Create one vCPU. +//! let vcpu_fd = vm.create_vcpu(0).unwrap(); +//! +//! // 5. Initialize general purpose and special registers. +//! #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +//! { +//! // x86_64 specific registry setup. +//! let mut vcpu_sregs = vcpu_fd.get_sregs().unwrap(); +//! vcpu_sregs.cs.base = 0; +//! vcpu_sregs.cs.selector = 0; +//! vcpu_fd.set_sregs(&vcpu_sregs).unwrap(); +//! +//! let mut vcpu_regs = vcpu_fd.get_regs().unwrap(); +//! vcpu_regs.rip = guest_addr; +//! vcpu_regs.rax = 2; +//! vcpu_regs.rbx = 3; +//! vcpu_regs.rflags = 2; +//! vcpu_fd.set_regs(&vcpu_regs).unwrap(); +//! } +//! +//! #[cfg(target_arch = "aarch64")] +//! { +//! // aarch64 specific registry setup. +//! let mut kvi = kvm_bindings::kvm_vcpu_init::default(); +//! vm.get_preferred_target(&mut kvi).unwrap(); +//! vcpu_fd.vcpu_init(&kvi).unwrap(); +//! +//! let core_reg_base: u64 = 0x6030_0000_0010_0000; +//! let mmio_addr: u64 = guest_addr + mem_size as u64; +//! vcpu_fd.set_one_reg(core_reg_base + 2 * 32, guest_addr); // set PC +//! vcpu_fd.set_one_reg(core_reg_base + 2 * 0, mmio_addr); // set X0 +//! } +//! +//! // 6. Run code on the vCPU. +//! loop { +//! match vcpu_fd.run().expect("run failed") { +//! VcpuExit::IoIn(addr, data) => { +//! println!( +//! "Received an I/O in exit. Address: {:#x}. Data: {:#x}", +//! addr, +//! data[0], +//! ); +//! } +//! VcpuExit::IoOut(addr, data) => { +//! println!( +//! "Received an I/O out exit. Address: {:#x}. Data: {:#x}", +//! addr, +//! data[0], +//! ); +//! } +//! VcpuExit::MmioRead(addr, data) => { +//! println!( +//! "Received an MMIO Read Request for the address {:#x}.", +//! addr, +//! ); +//! } +//! VcpuExit::MmioWrite(addr, data) => { +//! println!( +//! "Received an MMIO Write Request to the address {:#x}.", +//! addr, +//! ); +//! // The code snippet dirties 1 page when it is loaded in memory +//! let dirty_pages_bitmap = vm.get_dirty_log(slot, mem_size).unwrap(); +//! let dirty_pages = dirty_pages_bitmap +//! .into_iter() +//! .map(|page| page.count_ones()) +//! .fold(0, |dirty_page_count, i| dirty_page_count + i); +//! assert_eq!(dirty_pages, 1); +//! // Since on aarch64 there is not halt instruction, +//! // we break immediately after the last known instruction +//! // of the asm code example so that we avoid an infinite loop. +//! #[cfg(target_arch = "aarch64")] +//! break; +//! } +//! VcpuExit::Hlt => { +//! break; +//! } +//! r => panic!("Unexpected exit reason: {:?}", r), +//! } +//! } +//! } +//! ``` + +extern crate kvm_bindings; +extern crate libc; +#[macro_use] +extern crate vmm_sys_util; + +#[macro_use] +mod kvm_ioctls; +mod cap; +mod ioctls; + +pub use cap::Cap; +pub use ioctls::device::DeviceFd; +pub use ioctls::system::Kvm; +pub use ioctls::vcpu::{VcpuExit, VcpuFd}; +pub use ioctls::vm::{IoEventAddress, NoDatamatch, VmFd}; +// The following example is used to verify that our public +// structures are exported properly. +/// # Example +/// +/// ``` +/// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +/// use kvm_ioctls::{KvmRunWrapper, Error}; +/// ``` +pub use ioctls::KvmRunWrapper; +pub use vmm_sys_util::errno::Error; -- Gitee From 5b3de0a0fb65486e88666efdb073f065af3a0f20 Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 07:04:46 +0000 Subject: [PATCH 3/6] Add RISC-V CPU and Memory Modules CPU module: The CPU module primarily includes the ability to read and write access to Riscv64CoreRegs, Riscv64ConfigRegs, and Riscv64Timer. Additionally, the reset_vcpu function has been implemented to prepare the VCPU's registers before startup. Memory module: The memory module implements the specific memory address space for the riscv64 architecture. This includes defining the IRQCHIP, MMIO, and RAM regions and specifying their default sizes. --- src/arch/mod.rs | 8 + src/arch/riscv64/cpu/mod.rs | 320 +++++++++++++++++++++++++++++++++ src/arch/riscv64/memory/mod.rs | 25 +++ src/arch/riscv64/mod.rs | 2 + 4 files changed, 355 insertions(+) create mode 100644 src/arch/riscv64/cpu/mod.rs create mode 100644 src/arch/riscv64/memory/mod.rs create mode 100644 src/arch/riscv64/mod.rs diff --git a/src/arch/mod.rs b/src/arch/mod.rs index 8092a8699..576c8831b 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -37,3 +37,11 @@ pub use x86_64::device::serial::*; #[cfg(target_arch = "x86_64")] pub use x86_64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; +#[cfg(target_arch = "riscv64")] +mod riscv64; +#[cfg(target_arch = "riscv64")] +pub use riscv64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; +#[cfg(target_arch = "riscv64")] +pub use riscv64::cpu::Riscv64CPUBootConfig as CPUBootConfig; +#[cfg(target_arch = "riscv64")] +pub use riscv64::cpu::CPUState; diff --git a/src/arch/riscv64/cpu/mod.rs b/src/arch/riscv64/cpu/mod.rs new file mode 100644 index 000000000..12f242dd1 --- /dev/null +++ b/src/arch/riscv64/cpu/mod.rs @@ -0,0 +1,320 @@ +// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. +// +// StratoVirt is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. +// You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +use std::convert::Into; +use std::mem; +use std::sync::{Arc, Mutex}; + +use kvm_bindings::{ + user_regs_struct, kvm_riscv_core,kvm_riscv_config,kvm_riscv_timer, + KVM_REG_RISCV, KVM_REG_RISCV_CORE, KVM_REG_SIZE_U64, KVM_REG_RISCV_CONFIG, KVM_REG_RISCV_TIMER, +}; +use kvm_ioctls::{VcpuFd, VmFd}; + +use crate::offset_of; + +// Processor Multiprocessor status. +#[allow(non_upper_case_globals)] +const KVM_MP_STATE_STOPPED: u32 = 5; +// riscv64 cpu core register +#[allow(non_camel_case_types)] +#[allow(dead_code)] +pub enum Riscv64CoreRegs{ + PC, + RA, + SP, + GP, + TP, + T0, + T1, + T2, + S0, + S1, + A0, + A1, + A2, + A3, + A4, + A5, + A6, + A7, + S2, + S3, + S4, + S5, + S6, + S7, + S8, + S9, + S10, + S11, + T3, + T4, + T5, + T6, + MODE, +} + +#[allow(clippy::zero_ptr)] +impl Into for Riscv64CoreRegs{ + fn into(self) -> u64 { + let reg_offset = match self { + Riscv64CoreRegs::PC => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, pc) + } + Riscv64CoreRegs::RA => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, ra) + } + Riscv64CoreRegs::SP => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, sp) + } + Riscv64CoreRegs::GP => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, gp) + } + Riscv64CoreRegs::TP => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, tp) + } + Riscv64CoreRegs::T0 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t0) + } + Riscv64CoreRegs::T1 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t1) + } + Riscv64CoreRegs::T2 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t2) + } + Riscv64CoreRegs::S0 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s0) + } + Riscv64CoreRegs::S1 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s1) + } + Riscv64CoreRegs::A0 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a0) + } + Riscv64CoreRegs::A1 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a1) + } + Riscv64CoreRegs::A2 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a2) + } + Riscv64CoreRegs::A3 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a3) + } + Riscv64CoreRegs::A4 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a4) + } + Riscv64CoreRegs::A5 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a5) + } + Riscv64CoreRegs::A6 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a6) + } + Riscv64CoreRegs::A7 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, a7) + } + Riscv64CoreRegs::S2 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s2) + } + Riscv64CoreRegs::S3 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s3) + } + Riscv64CoreRegs::S4 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s4) + } + Riscv64CoreRegs::S5 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s5) + } + Riscv64CoreRegs::S6 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s6) + } + Riscv64CoreRegs::S7 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s7) + } + Riscv64CoreRegs::S8 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s8) + } + Riscv64CoreRegs::S9 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s9) + } + Riscv64CoreRegs::S10 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s10) + } + Riscv64CoreRegs::S11 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, s11) + } + Riscv64CoreRegs::T3 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t3) + } + Riscv64CoreRegs::T4 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t4) + } + Riscv64CoreRegs::T5 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t5) + } + Riscv64CoreRegs::T6 => { + offset_of!(kvm_riscv_core, regs, user_regs_struct, t6) + } + Riscv64CoreRegs::MODE => { + offset_of!(kvm_riscv_core, mode) + } + }; + KVM_REG_RISCV as u64 + | KVM_REG_SIZE_U64 as u64 + | u64::from(KVM_REG_RISCV_CORE) + | (reg_offset / mem::size_of::()) as u64 + } +} + +#[allow(non_camel_case_types)] +#[allow(dead_code)] +pub enum Riscv64ConfigRegs{ + ISA, + ZICBOM_BLOCK_SIZE, + MVENDORID, + MARCHID, + MIMPID, + ZICBOZ_BLOCK_SIZE, + SATP_MODE, +} +#[allow(clippy::zero_ptr)] +impl Into for Riscv64ConfigRegs{ + fn into(self) -> u64 { + let reg_offset = match self { + Riscv64ConfigRegs::ISA => { + offset_of!(kvm_riscv_config, isa) + } + Riscv64ConfigRegs::ZICBOM_BLOCK_SIZE => { + offset_of!(kvm_riscv_config, zicbom_block_size) + } + Riscv64ConfigRegs::MVENDORID => { + offset_of!(kvm_riscv_config, mvendorid) + } + Riscv64ConfigRegs::MARCHID => { + offset_of!(kvm_riscv_config, marchid) + } + Riscv64ConfigRegs::MIMPID => { + offset_of!(kvm_riscv_config, mimpid) + } + Riscv64ConfigRegs::ZICBOZ_BLOCK_SIZE => { + offset_of!(kvm_riscv_config, zicboz_block_size) + } + Riscv64ConfigRegs::SATP_MODE => { + offset_of!(kvm_riscv_config, satp_mode) + } + }; + KVM_REG_RISCV as u64 + | KVM_REG_SIZE_U64 as u64 + | u64::from(KVM_REG_RISCV_CONFIG) + | (reg_offset / mem::size_of::()) as u64 + } +} + + +#[allow(non_camel_case_types)] +#[allow(dead_code)] +pub enum Riscv64Timer{ + FREQUENCY, + TIME, + COMPARE, + STATE, +} +#[allow(clippy::zero_ptr)] +impl Into for Riscv64Timer{ + fn into(self) -> u64 { + let reg_offset = match self { + Riscv64Timer::FREQUENCY => { + offset_of!(kvm_riscv_timer, frequency) + } + Riscv64Timer::TIME => { + offset_of!(kvm_riscv_timer, time) + } + Riscv64Timer::COMPARE => { + offset_of!(kvm_riscv_timer, compare) + } + Riscv64Timer::STATE => { + offset_of!(kvm_riscv_timer, state) + } + }; + KVM_REG_RISCV as u64 + | KVM_REG_SIZE_U64 as u64 + | u64::from(KVM_REG_RISCV_TIMER) + | (reg_offset / mem::size_of::()) as u64 + } +} +/// Riscv64 CPU booting configure information +/// +/// Before jumping into the kernel, primary CPU general-purpose +/// register `a1` need to setting to physical address of device +/// tree blob (dtb) in system RAM, a0 need to setting to hartid. +/// +#[derive(Default, Copy, Clone)] +pub struct Riscv64CPUBootConfig { + pub fdt_addr: u64, + pub kernel_addr: u64, +} + +/// AArch64 CPU architect information +#[derive(Default, Clone)] +pub struct CPUState { + /// The vcpu id, `0` means primary CPU. + pub vcpu_id: u32, + /// The guest physical address of kernel start point. + boot_ip: u64, + /// The guest physical address of device tree blob (dtb). + fdt_addr: u64, + + pub nr_vcpus: u32, + pub isa: u64, + pub frequency: u64, + pub satp_mode: u64, +} + +impl CPUState { + pub fn new(vcpu_id: u32, nr_vcpus: u32) -> Self { + CPUState { + vcpu_id, + boot_ip: 0, + fdt_addr: 0, + nr_vcpus, + isa: 0, + frequency: 0, + satp_mode: 0, + } + } + + pub fn set_boot_config( + &mut self, + vm_fd: &Arc, + vcpu_fd: &VcpuFd, + boot_config: &Riscv64CPUBootConfig, + ) { + self.boot_ip = boot_config.kernel_addr; + self.fdt_addr = boot_config.fdt_addr; + self.isa = vcpu_fd.get_one_reg(Riscv64ConfigRegs::ISA.into()).unwrap(); + self.satp_mode = vcpu_fd.get_one_reg(Riscv64ConfigRegs::SATP_MODE.into()).unwrap(); + self.frequency = vcpu_fd.get_one_reg(Riscv64Timer::FREQUENCY.into()).unwrap(); + } + + pub fn reset_vcpu(&self, vcpu: &VcpuFd) { + let mp_state = vcpu.get_mp_state().unwrap(); + if mp_state.mp_state == KVM_MP_STATE_STOPPED { + return; + } + vcpu.set_one_reg(Riscv64CoreRegs::PC.into(), self.boot_ip) + .expect("Failed to set PC register"); + vcpu.set_one_reg(Riscv64CoreRegs::A0.into(), self.vcpu_id as u64) + .expect("Failed to set hartid to a0"); + vcpu.set_one_reg(Riscv64CoreRegs::A1.into(), self.fdt_addr) + .expect("Failed to set fdt to a1"); + } +} diff --git a/src/arch/riscv64/memory/mod.rs b/src/arch/riscv64/memory/mod.rs new file mode 100644 index 000000000..6dbcdb011 --- /dev/null +++ b/src/arch/riscv64/memory/mod.rs @@ -0,0 +1,25 @@ + +/// The type of memory layout entry on riscv64 +#[repr(usize)] +pub enum LayoutEntryType { + IrqChip = 0_usize, + Mmio, + Mem, +} + +/// Layout of riscv64 + +pub const MEM_LAYOUT: &[(u64, u64)] = &[ + (0x0800_0000, 0x0800_0000), // IRQ_CHIP: 128M + (0x1000_0000, 0x2000_0000), // Mmio: 512M + (0x8000_0000, 0x0800_0000), // Mem: max: (1 << 40)-MemStart, default: 128M +]; + +/// +pub fn arch_add_ram_ranges(mem_size: u64, ranges: &mut Vec<(u64, u64)>) { + if mem_size < ( 1 << 40 ) - MEM_LAYOUT[LayoutEntryType::Mem as usize].0 { + ranges.push((MEM_LAYOUT[LayoutEntryType::Mem as usize].0, mem_size)); + }else { + ranges.push((MEM_LAYOUT[LayoutEntryType::Mem as usize].0, MEM_LAYOUT[LayoutEntryType::Mem as usize].1)); + } +} diff --git a/src/arch/riscv64/mod.rs b/src/arch/riscv64/mod.rs new file mode 100644 index 000000000..dd6c6eb05 --- /dev/null +++ b/src/arch/riscv64/mod.rs @@ -0,0 +1,2 @@ +pub mod cpu; +pub mod memory; -- Gitee From 8b296fff434821303860a3d193f554e4042cf44c Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 07:20:33 +0000 Subject: [PATCH 4/6] Add RISC-V Bootloader, KVM, Device Tree, and Device Modules Bootloader and Kvm module: The bootloader module is responsible for loading the kernel and initrd into the guest's virtual memory according to the configuration provided by the kvm module. It aligns the addresses of the kernel, fdt, and initrd according to the riscv64 requirements. After loading, it initializes the CPU parameters based on the loaded addresses, preparing the VCPU for a reset before it begins execution. Device_tree: The device_tree module remains unchanged and continues to be consistent with the aarch64 architecture. Device: The device module includes the fdt component, which generates the device tree. When generating the device tree, it considers the specific requirements of the riscv64 architecture and uses the register elements provided by the CPU module to create riscv64-specific CPU device tree content. --- src/arch/mod.rs | 8 ++ src/arch/riscv64/boot_loader/mod.rs | 120 ++++++++++++++++++ src/arch/riscv64/device/fdt.rs | 103 +++++++++++++++ src/arch/riscv64/device/mod.rs | 21 ++++ src/arch/riscv64/device_tree/mod.rs | 186 ++++++++++++++++++++++++++++ src/arch/riscv64/kvm/mod.rs | 20 +++ src/arch/riscv64/mod.rs | 5 + 7 files changed, 463 insertions(+) create mode 100644 src/arch/riscv64/boot_loader/mod.rs create mode 100644 src/arch/riscv64/device/fdt.rs create mode 100644 src/arch/riscv64/device/mod.rs create mode 100644 src/arch/riscv64/device_tree/mod.rs create mode 100644 src/arch/riscv64/kvm/mod.rs diff --git a/src/arch/mod.rs b/src/arch/mod.rs index 576c8831b..ea19ae657 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -45,3 +45,11 @@ pub use riscv64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; pub use riscv64::cpu::Riscv64CPUBootConfig as CPUBootConfig; #[cfg(target_arch = "riscv64")] pub use riscv64::cpu::CPUState; +#[cfg(target_arch = "riscv64")] +pub use riscv64::kvm::*; +#[cfg(target_arch = "riscv64")] +pub use riscv64::boot_loader::{ + load_kernel, kvm_load_kernel,Riscv64BootLoader as BootLoader, Riscv64BootLoaderConfig as BootLoaderConfig, +}; +#[cfg(target_arch = "riscv64")] +pub use riscv64::device::kvm_setup_fireware; diff --git a/src/arch/riscv64/boot_loader/mod.rs b/src/arch/riscv64/boot_loader/mod.rs new file mode 100644 index 000000000..d120d8ab9 --- /dev/null +++ b/src/arch/riscv64/boot_loader/mod.rs @@ -0,0 +1,120 @@ +// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. +// +// StratoVirt is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. +// You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +use std::fs::File; +use std::path::PathBuf; +use std::sync::Arc; + +use kvm_ioctls::VmFd; + +use crate::arch::riscv64::device_tree::*; +use crate::arch::CPUBootConfig; +use crate::cpu::CPU; +use crate::memory::GuestMemory; + +use super::kvm::load_boot_source; + +const RISCV64_KERNEL_OFFSET: u64 = 0x20_0000; +const FDT_ALIGN: u64 = 0x40_0000; +const INITRD_ALIGN: u64 = 0x8; + +/// Boot loader config used for riscv64. +#[derive(Default, Debug)] +pub struct Riscv64BootLoaderConfig { + /// Path of kernel image. + pub kernel: PathBuf, + /// Path of initrd image. + pub initrd: PathBuf, + /// Start address of guest memory. + pub mem_start: u64, +} + +/// The start address for `kernel image`, `initrd image` and `dtb` in guest memory. +pub struct Riscv64BootLoader { + /// Start address for `kernel` execute binary in guest memory. + pub kernel_start: u64, + /// Start address for `initrd image` in guest memory. + pub initrd_start: u64, + /// Initrd file size, 0 means no initrd file. + pub initrd_size: u64, + /// Start address for `dtb` in guest memory. + pub dtb_start: u64, +} + +/// Load PE(vmlinux.bin) linux kernel and other boot source to Guest Memory. +/// +/// # Steps +/// +/// 1. Prepare for linux kernel boot env, return guest memory layout. +/// 2. According guest memory layout, load linux kernel to guest memory. +/// 3. According guest memory layout, load initrd image to guest memory. +/// +/// # Arguments +/// +/// * `config` - boot source config, contains kernel, initrd. +/// * `sys_mem` - guest memory. +/// +/// # Errors +/// +/// Load kernel, initrd to guest memory failed. Boot source is broken or +/// guest memory is abnormal. +pub fn load_kernel( + config: &Riscv64BootLoaderConfig, + sys_mem: &Arc, +) -> Riscv64BootLoader { + // align KERNEL ALIGN + let kernel_start = config.mem_start + RISCV64_KERNEL_OFFSET; + let mut kernel_image = File::open(&config.kernel).expect("Failed to open kernel file"); + let kernel_size = kernel_image.metadata().unwrap().len(); + let kernel_end = kernel_start + kernel_size; + sys_mem + .write(&mut kernel_image, kernel_start, kernel_size) + .expect("Failed to load kernel image to memory"); + + // align FDT ALIGN + let dtb_addr = (kernel_end + (FDT_ALIGN - 1)) & (!(FDT_ALIGN - 1)); + if dtb_addr + u64::from(FDT_MAX_SIZE) >= sys_mem.memory_end_address() { + panic!("no memory to load DTB") + } + let mut initrd_image = File::open(&config.initrd).expect("Failed to open initrd file"); + let initrd_size = initrd_image.metadata().unwrap().len(); + + // align initrd ALIAGN + let initrd_start = dtb_addr + u64::from(FDT_MAX_SIZE); + if initrd_start + u64::from(initrd_size) >= sys_mem.memory_end_address() { + panic!("no memory to load initrd image") + } + + sys_mem + .write(&mut initrd_image, initrd_start, initrd_size) + .expect("Failed to load initrd to memory"); + + Riscv64BootLoader { + kernel_start, + initrd_start, + initrd_size, + dtb_start: dtb_addr, + } +} + +pub fn kvm_load_kernel(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc) -> Riscv64BootLoader{ + + let layout = load_boot_source(guest_memory); + let cpu_boot_cfg = CPUBootConfig { + fdt_addr: layout.dtb_start, + kernel_addr: layout.kernel_start, + }; + vcpu.realize(&vm_fd, cpu_boot_cfg); + + + layout +} diff --git a/src/arch/riscv64/device/fdt.rs b/src/arch/riscv64/device/fdt.rs new file mode 100644 index 000000000..981d36efb --- /dev/null +++ b/src/arch/riscv64/device/fdt.rs @@ -0,0 +1,103 @@ +use crate::arch::riscv64::device_tree::*; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::cpu::CPU; +use crate::memory::GuestMemory; +use std::sync::{Mutex, Arc}; + +pub fn generate_fdt( + sys_mem: &Arc, + initrd_range: (u64, u64), + cmdline: &str, + cpu: &CPU, + fdt_addr: u64, +) { + let mut fdt = vec![0; FDT_MAX_SIZE as usize]; + + create_device_tree(&mut fdt); + set_property_string(&mut fdt, "/", "compatible", "linux,dummy-virt"); + set_property_u32(&mut fdt, "/", "#address-cells", 0x2); + set_property_u32(&mut fdt, "/", "#size-cells", 0x2); + + generate_chosen_node(&mut fdt, cmdline, initrd_range.0, initrd_range.1); + println!("chosen fdt node complete!"); + generate_memory_node(&mut fdt, sys_mem); + println!("mem node complete!"); + generate_cpu_node(&mut fdt, cpu); + println!("cpu node complete!"); + + let fdt_len = fdt.len() as u64; + sys_mem + .write(&mut fdt.as_slice(), fdt_addr, fdt_len) + .expect("Failed to load fdt to memory"); + + dump_dtb(&fdt, "/tmp/stratovirt.dtb"); +} + +fn generate_memory_node(fdt: &mut Vec, sys_mem: &Arc) { + let mem_base = MEM_LAYOUT[LayoutEntryType::Mem as usize].0; + let mem_size = sys_mem.memory_end_address() - mem_base; + let node = "/memory"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "device_type", "memory"); + set_property_array_u64(fdt, node, "reg", &[mem_base, mem_size as u64]); +} + + +fn generate_cpu_node(fdt: &mut Vec, cpu: &CPU) { + let node = "/cpus"; + add_sub_node(fdt, node); + set_property_u32(fdt, node, "#address-cells", 0x01); + set_property_u32(fdt, node, "#size-cells", 0x00); + let state_guard = cpu; + set_property_u32(fdt, node, "timebase-frequency", state_guard.state.frequency as u32); + + for num in 0..state_guard.state.nr_vcpus { + let node = format!("/cpus/cpu@{:x}", num); + add_sub_node(fdt, &node); + set_property_string(fdt, &node, "device_type", "cpu"); + set_property_string(fdt, &node, "compatible", "riscv"); + let mmu_type = match state_guard.state.satp_mode { + 10 => "riscv,sv57", + 9 => "riscv,sv48", + 8 => "riscv,sv39", + _ => "riscv,none", + }; + set_property_string(fdt, &node, "mmu-type", mmu_type); + let valid_isa_order = "IEMAFDQCLBJTPVNSUHKORWXYZG"; + let mut cpu_isa = String::from("rv64"); + for i in 0..valid_isa_order.len() { + let index = valid_isa_order.as_bytes()[i] as u32 - 65; + if state_guard.state.isa & (1 << index) != 0 { + let char_to_add = ((index as u8) + b'a') as char; + cpu_isa.push(char_to_add); + } + } + set_property_string(fdt, &node, "riscv,isa", &cpu_isa); + set_property_u32(fdt, &node, "reg", num); + set_property_string(fdt, &node, "status", "okay"); + + let node = format!("/cpus/cpu@{:x}/interrupt-controller", num); + add_sub_node(fdt, &node); + set_property_string(fdt, &node, "compatible", "riscv,cpu-intc"); + set_property_u32(fdt, &node, "#interrupt-cells", 0x01); + set_property(fdt, &node, "interrupt-controller", None); + set_property_u32( + fdt, + &node, + "phandle", + u32::from(num) + CPU_PHANDLE_START, + ); + } +} + + + +fn generate_chosen_node(fdt: &mut Vec, cmdline: &str, initrd_addr: u64, initrd_size: u64) { + let node = "/chosen"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "bootargs", cmdline); + set_property_string(fdt, node, "stdout-path", "serial0"); + set_property_u64(fdt, node, "linux,initrd-start", initrd_addr); + set_property_u64(fdt, node, "linux,initrd-end", initrd_addr + initrd_size); +} + diff --git a/src/arch/riscv64/device/mod.rs b/src/arch/riscv64/device/mod.rs new file mode 100644 index 000000000..89081c18b --- /dev/null +++ b/src/arch/riscv64/device/mod.rs @@ -0,0 +1,21 @@ +mod fdt; +use crate::arch::CPUState; +use crate::device::Result; +use kvm_ioctls::VmFd; + +use crate::{arch::riscv64::boot_loader::Riscv64BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; +use std::sync::{Arc, Mutex}; +pub fn kvm_setup_fireware(guest_memory: &Arc, vcpus: &mut CPU, vm_fd: &Arc, layout : &Riscv64BootLoader) { + let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; + let initrd_range = (layout.initrd_start, layout.initrd_size); + let fdt_addr = layout.dtb_start; + fdt::generate_fdt( + guest_memory, + initrd_range, + cmdline, + vcpus, + fdt_addr, + ); + println!("generate fdt node complete!"); +} + diff --git a/src/arch/riscv64/device_tree/mod.rs b/src/arch/riscv64/device_tree/mod.rs new file mode 100644 index 000000000..b88a0537b --- /dev/null +++ b/src/arch/riscv64/device_tree/mod.rs @@ -0,0 +1,186 @@ +// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. +// +// StratoVirt is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. +// You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +use libc::{c_char, c_int, c_void}; +use std::ffi::CString; + +pub const PHANDLE_RESERVED: u32 = 0; +pub const PHANDLE_PLIC: u32 = 1; +pub const CPU_PHANDLE_START: u32 = 4; + +pub const FDT_MAX_SIZE: u32 = 0x1_0000; + +extern "C" { + fn fdt_create(buf: *mut c_void, bufsize: c_int) -> c_int; + fn fdt_finish_reservemap(fdt: *mut c_void) -> c_int; + fn fdt_begin_node(fdt: *mut c_void, name: *const c_char) -> c_int; + fn fdt_end_node(fdt: *mut c_void) -> c_int; + fn fdt_finish(fdt: *const c_void) -> c_int; + fn fdt_open_into(fdt: *const c_void, buf: *mut c_void, size: c_int) -> c_int; + + fn fdt_path_offset(fdt: *const c_void, path: *const c_char) -> c_int; + fn fdt_add_subnode(fdt: *mut c_void, offset: c_int, name: *const c_char) -> c_int; + fn fdt_setprop( + fdt: *mut c_void, + offset: c_int, + name: *const c_char, + val: *const c_void, + len: c_int, + ) -> c_int; +} + +pub fn create_device_tree(fdt: &mut Vec) { + let mut ret = unsafe { fdt_create(fdt.as_mut_ptr() as *mut c_void, FDT_MAX_SIZE as c_int) }; + if ret < 0 { + panic!("Failed to fdt_create, return {}.", ret); + } + + ret = unsafe { fdt_finish_reservemap(fdt.as_mut_ptr() as *mut c_void) }; + if ret < 0 { + panic!("Failed to fdt_finish_reservemap, return {}.", ret); + } + + let c_str = CString::new("").unwrap(); + ret = unsafe { fdt_begin_node(fdt.as_mut_ptr() as *mut c_void, c_str.as_ptr()) }; + if ret < 0 { + panic!("Failed to fdt_begin_node, return {}.", ret); + } + + ret = unsafe { fdt_end_node(fdt.as_mut_ptr() as *mut c_void) }; + if ret < 0 { + panic!("Failed to fdt_end_node, return {}.", ret); + } + + ret = unsafe { fdt_finish(fdt.as_mut_ptr() as *mut c_void) }; + if ret < 0 { + panic!("Failed to fdt_finish, return {}.", ret); + } + + ret = unsafe { + fdt_open_into( + fdt.as_ptr() as *mut c_void, + fdt.as_mut_ptr() as *mut c_void, + FDT_MAX_SIZE as c_int, + ) + }; + if ret < 0 { + panic!("Failed to fdt_open_into, return {}.", ret); + } +} + +pub fn add_sub_node(fdt: &mut Vec, node_path: &str) { + let names: Vec<&str> = node_path.split('/').collect(); + if names.len() < 2 { + panic!("Failed to add sub node, node_path: {} invalid.", node_path); + } + + let node_name = names[names.len() - 1]; + let pare_name = names[0..names.len() - 1].join("/"); + + let c_str = if pare_name.is_empty() { + CString::new("/").unwrap() + } else { + CString::new(pare_name).unwrap() + }; + + let offset = unsafe { fdt_path_offset(fdt.as_ptr() as *const c_void, c_str.as_ptr()) }; + if offset < 0 { + panic!("Failed to fdt_path_offset, return {}.", offset); + } + + let c_str = CString::new(node_name).unwrap(); + let ret = unsafe { fdt_add_subnode(fdt.as_mut_ptr() as *mut c_void, offset, c_str.as_ptr()) }; + if ret < 0 { + panic!("Failed to fdt_add_subnode, return {}.", ret); + } +} + +pub fn set_property(fdt: &mut Vec, node_path: &str, prop: &str, val: Option<&[u8]>) { + let c_str = CString::new(node_path).unwrap(); + let offset = unsafe { fdt_path_offset(fdt.as_ptr() as *const c_void, c_str.as_ptr()) }; + if offset < 0 { + panic!("Failed to fdt_path_offset, return {}.", offset); + } + + let (ptr, len) = if let Some(val) = val { + (val.as_ptr() as *const c_void, val.len() as i32) + } else { + (std::ptr::null::(), 0) + }; + + let c_str = CString::new(prop).unwrap(); + let ret = unsafe { + fdt_setprop( + fdt.as_mut_ptr() as *mut c_void, + offset, + c_str.as_ptr(), + ptr, + len, + ) + }; + if ret < 0 { + panic!("Failed to fdt_setprop, return {}.", ret); + } +} + +pub fn set_property_string(fdt: &mut Vec, node_path: &str, prop: &str, val: &str) { + set_property( + fdt, + node_path, + prop, + Some(&([val.as_bytes(), &[0_u8]].concat())), + ) +} + +pub fn set_property_u32(fdt: &mut Vec, node_path: &str, prop: &str, val: u32) { + set_property(fdt, node_path, prop, Some(&val.to_be_bytes())) +} + +pub fn set_property_u64(fdt: &mut Vec, node_path: &str, prop: &str, val: u64) { + set_property(fdt, node_path, prop, Some(&val.to_be_bytes())) +} + +pub fn set_property_array_u32(fdt: &mut Vec, node_path: &str, prop: &str, array: &[u32]) { + let mut bytes: Vec = Vec::new(); + for &val in array { + bytes.append(&mut val.to_be_bytes().to_vec()); + } + set_property(fdt, node_path, prop, Some(&bytes)) +} + +pub fn set_property_array_u64(fdt: &mut Vec, node_path: &str, prop: &str, array: &[u64]) { + let mut bytes: Vec = Vec::new(); + for &val in array { + bytes.append(&mut val.to_be_bytes().to_vec()); + } + set_property(fdt, node_path, prop, Some(&bytes)) +} + +pub fn dump_dtb(fdt: &[u8], file_path: &str) { + use std::fs::File; + use std::io::Write; + + let mut f = File::create(file_path).unwrap(); + for i in fdt.iter() { + f.write_all(&[*i]).expect("Unable to write data"); + } +} + +/// Trait for devices to be added to the Flattened Device Tree. +pub trait CompileFDT { + /// function to generate fdt node + /// + /// # Arguments + /// + /// * `fdt` - the fdt slice to be expended. + fn generate_fdt_node(&self, fdt: &mut Vec); +} diff --git a/src/arch/riscv64/kvm/mod.rs b/src/arch/riscv64/kvm/mod.rs new file mode 100644 index 000000000..b481384e3 --- /dev/null +++ b/src/arch/riscv64/kvm/mod.rs @@ -0,0 +1,20 @@ +use std::path::PathBuf; +use std::sync::Arc; +use kvm_ioctls::VmFd; + +use crate::memory::{GuestMemory }; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::arch::{load_kernel, BootLoader, BootLoaderConfig}; +pub fn load_boot_source(guest_memory: &Arc) -> BootLoader { + let initrd_path = PathBuf::from("/tmp/initramfs.cpio.gz"); + let boot_cfg = BootLoaderConfig { + kernel: PathBuf::from("/tmp/vmlinux.bin"), + initrd: initrd_path, + mem_start: MEM_LAYOUT[LayoutEntryType::Mem as usize].0, + }; + load_kernel(&boot_cfg, &guest_memory) +} + +pub fn arch_init_based_dev(vm_fd: &Arc) { + +} diff --git a/src/arch/riscv64/mod.rs b/src/arch/riscv64/mod.rs index dd6c6eb05..aef78cd3e 100644 --- a/src/arch/riscv64/mod.rs +++ b/src/arch/riscv64/mod.rs @@ -1,2 +1,7 @@ +pub mod kvm; pub mod cpu; pub mod memory; +pub mod device_tree; +pub mod device; +pub mod boot_loader; + -- Gitee From 0cc6bc88b14606d6be5d92faf71f4a9d6f4a6ac0 Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 07:27:07 +0000 Subject: [PATCH 5/6] Add libgcc and libfdt linking for RISC-V builds Provide nessary libs for rust linker, the device_tree module now utilizes functions related to fdt provided by the Linux kernel. --- .cargo/config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.cargo/config b/.cargo/config index 0b1372f02..385060853 100644 --- a/.cargo/config +++ b/.cargo/config @@ -17,3 +17,8 @@ rustflags = [ "-C", "link-arg=-lgcc", "-C", "link-arg=-lfdt", ] +[target.'cfg(any(target_arch="riscv64"))'] +rustflags = [ + "-C", "link-arg=-lgcc", + "-C", "link-arg=-lfdt", +] -- Gitee From c2f25061f52cf8cb48d25462bbc5b1a455c5144f Mon Sep 17 00:00:00 2001 From: sts Date: Mon, 16 Sep 2024 07:36:06 +0000 Subject: [PATCH 6/6] Add PLIC and Serial for RISC-V PLIC module: The PLIC interrupt controller is implemented in the plic.rs file within the device module's submodules. It is responsible for simulating the PLIC, providing a mechanism for the serial to trigger interrupts, and triggering external interrupts on the VCPU when interrupts occur. Serial module: The serial device, under the riscv64 architecture, triggers interrupts through the PLIC interface. Due to the specific requirements of the riscv64 architecture regarding PLIC, adjustments were made to the parameters of the serial code, CPU-related sections, and other relevant parts. --- src/arch/aarch64/cpu/mod.rs | 7 +- src/arch/aarch64/device/fdt.rs | 2 +- src/arch/aarch64/device/gicv3.rs | 4 +- src/arch/aarch64/device/mod.rs | 27 +- src/arch/aarch64/device/serial.rs | 15 +- src/arch/mod.rs | 54 ++-- src/arch/riscv64/boot_loader/mod.rs | 6 +- src/arch/riscv64/cpu/mod.rs | 10 +- src/arch/riscv64/device/fdt.rs | 32 ++- src/arch/riscv64/device/mod.rs | 29 ++- src/arch/riscv64/device/plic.rs | 381 ++++++++++++++++++++++++++++ src/arch/riscv64/device/serial.rs | 28 ++ src/arch/riscv64/memory/mod.rs | 4 +- src/arch/riscv64/mod.rs | 3 +- src/arch/x86_64/cpu/mod.rs | 17 +- src/arch/x86_64/device/mod.rs | 34 ++- src/arch/x86_64/device/serial.rs | 17 +- src/arch/x86_64/kvm/mod.rs | 14 +- src/cpu/mod.rs | 48 ++-- src/device/mod.rs | 4 + src/device/serial.rs | 32 ++- src/main.rs | 7 +- 22 files changed, 669 insertions(+), 106 deletions(-) create mode 100644 src/arch/riscv64/device/plic.rs create mode 100644 src/arch/riscv64/device/serial.rs diff --git a/src/arch/aarch64/cpu/mod.rs b/src/arch/aarch64/cpu/mod.rs index 55ccc17f1..9e5f2d880 100644 --- a/src/arch/aarch64/cpu/mod.rs +++ b/src/arch/aarch64/cpu/mod.rs @@ -173,7 +173,7 @@ impl CPUState { pub fn set_boot_config( &mut self, vm_fd: &Arc, - vcpu_fd: &VcpuFd, + vcpu_fd: Arc, boot_config: &AArch64CPUBootConfig, ) { self.boot_ip = boot_config.kernel_addr; @@ -195,8 +195,7 @@ impl CPUState { vcpu_fd.vcpu_init(&kvi).expect("Failed to init kvm vcpu"); self.get_mpidr(vcpu_fd); } - - pub fn get_mpidr(&mut self, vcpu_fd: &VcpuFd) -> u64 { + pub fn get_mpidr(&mut self, vcpu_fd: Arc) -> u64 { if self.mpidr == UNINIT_MPIDR { self.mpidr = match vcpu_fd.get_one_reg(SYS_MPIDR_EL1) { Ok(mpidr) => mpidr as u64, @@ -206,7 +205,7 @@ impl CPUState { self.mpidr } - pub fn reset_vcpu(&self, vcpu: &VcpuFd) { + pub fn reset_vcpu(&self, vcpu: Arc) { // Configure PSTATE(Processor State), mask all interrupts. let data: u64 = PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | PSR_MODE_EL1h; vcpu.set_one_reg(Arm64CoreRegs::USER_PT_REG_PSTATE.into(), data) diff --git a/src/arch/aarch64/device/fdt.rs b/src/arch/aarch64/device/fdt.rs index 6b61f69be..69afbffcd 100644 --- a/src/arch/aarch64/device/fdt.rs +++ b/src/arch/aarch64/device/fdt.rs @@ -52,7 +52,7 @@ fn generate_cpu_node(fdt: &mut Vec, cpu: &mut CPU) { set_property_u32(fdt, node, "#address-cells", 0x02); set_property_u32(fdt, node, "#size-cells", 0x0); - let mpidr = cpu.state.get_mpidr(&cpu.fd); + let mpidr = cpu.state.get_mpidr(cpu.fd.clone()); let node = format!("/cpus/cpu@{:x}", mpidr); add_sub_node(fdt, &node); set_property_u32( diff --git a/src/arch/aarch64/device/gicv3.rs b/src/arch/aarch64/device/gicv3.rs index ab66a2c28..d4ca063b4 100644 --- a/src/arch/aarch64/device/gicv3.rs +++ b/src/arch/aarch64/device/gicv3.rs @@ -127,11 +127,11 @@ impl GICv3 { fd: 0, flags: 0, }; - + println!("vm create gicv3 device!"); let gic_fd = vm .create_device(&mut gic_device) .map_err(Error::CreateKvmDevice)?; - + println!("vm create gicv3 coomplete"); Ok(GICv3 { fd: gic_fd, nr_irqs: max_irq, diff --git a/src/arch/aarch64/device/mod.rs b/src/arch/aarch64/device/mod.rs index 0dec42943..229208322 100644 --- a/src/arch/aarch64/device/mod.rs +++ b/src/arch/aarch64/device/mod.rs @@ -1,20 +1,23 @@ pub mod gicv3; pub mod serial; mod fdt; +use crate::arch::CPUState; +use crate::device::{Error, Result}; use gicv3::GICv3; use kvm_ioctls::VmFd; use crate::{arch::aarch64::boot_loader::AArch64BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; use std::sync::Arc; -use crate::arch::CPUState; -pub fn kvm_setup_fireware(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc, layout : &AArch64BootLoader) { +pub fn kvm_setup_fireware(guest_memory: &Arc, vcpus : &mut Vec<&mut CPU>, vm_fd: &Arc, layout : &AArch64BootLoader) { - let vcpu_count = vcpu.state.nr_vcpus; + let vcpu_count = vcpus[0].state.nr_vcpus; let gic = GICv3::new(&vm_fd, vcpu_count as u64, 192).expect("Failed to create GICv3 device"); gic.realize().expect("Failed to realize GICv3 device"); - let serial = Serial::new(&vm_fd); - vcpu.set_serial_dev(serial); + let serial = Serial::new(&vm_fd, None); + for i in 0..vcpus.len() { + vcpus[i].set_serial_dev(serial.clone()); + } let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; let initrd_range = (layout.initrd_start, layout.initrd_size); @@ -24,7 +27,17 @@ pub fn kvm_setup_fireware(guest_memory: &Arc, vcpu : &mut CPU, vm_f &gic, initrd_range, cmdline, - vcpu, + vcpus[0], fdt_addr, ); -} \ No newline at end of file +} +pub fn judge_other_addr(_addr: u64) -> Option { + None +} + +pub fn write_other_addr(_state: &CPUState, _addr: u64, _data: u32) -> Result<()> { + Err(Error::MMIoError()) +} +pub fn read_other_addr(_state: &CPUState, _addr: u64) -> Result { + Err(Error::MMIoError()) +} diff --git a/src/arch/aarch64/device/serial.rs b/src/arch/aarch64/device/serial.rs index c90c53278..63aa57c31 100644 --- a/src/arch/aarch64/device/serial.rs +++ b/src/arch/aarch64/device/serial.rs @@ -1,4 +1,17 @@ +use kvm_ioctls::VmFd; +use vmm_sys_util::eventfd::EventFd; use crate::arch::{LayoutEntryType, MEM_LAYOUT}; pub const MMIO_SERIAL_IRQ: u32 = 32; pub const MMIO_SERIAL_ADDR: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].0; -pub const MMIO_SERIAL_ADDR_SIZE: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].1; \ No newline at end of file +pub const MMIO_SERIAL_ADDR_SIZE: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].1; +pub fn serial_register_irqfd(vm_fd: &VmFd, evt_fd: &EventFd) { + vm_fd + .register_irqfd(&evt_fd, MMIO_SERIAL_IRQ) + .expect("Failed to register irq fd for serial"); +} + +pub struct SerialControl {} + +impl SerialControl { + pub fn interrupt_trigger(&self) {} +} diff --git a/src/arch/mod.rs b/src/arch/mod.rs index ea19ae657..49098529c 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -1,55 +1,61 @@ #[cfg(target_arch = "aarch64")] mod aarch64; #[cfg(target_arch = "aarch64")] -pub use aarch64::kvm::*; +pub use aarch64::boot_loader::{ + kvm_load_kernel, load_kernel, AArch64BootLoader as BootLoader, + AArch64BootLoaderConfig as BootLoaderConfig, +}; #[cfg(target_arch = "aarch64")] pub use aarch64::cpu::AArch64CPUBootConfig as CPUBootConfig; #[cfg(target_arch = "aarch64")] pub use aarch64::cpu::CPUState; #[cfg(target_arch = "aarch64")] -pub use aarch64::boot_loader::{ - load_kernel, kvm_load_kernel,AArch64BootLoader as BootLoader, AArch64BootLoaderConfig as BootLoaderConfig, -}; -#[cfg(target_arch = "aarch64")] -pub use aarch64::device::kvm_setup_fireware; +pub use aarch64::device::{judge_other_addr, kvm_setup_fireware, read_other_addr, write_other_addr}; #[cfg(target_arch = "aarch64")] pub use aarch64::device::serial::*; #[cfg(target_arch = "aarch64")] -pub use aarch64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; - +pub use aarch64::kvm::*; +#[cfg(target_arch = "aarch64")] +pub use aarch64::memory::{arch_add_ram_ranges, LayoutEntryType, MEM_LAYOUT}; #[cfg(target_arch = "x86_64")] mod x86_64; #[cfg(target_arch = "x86_64")] -pub use x86_64::kvm::*; -#[cfg(target_arch = "x86_64")] -pub use x86_64::cpu::X86CPUBootConfig as CPUBootConfig; -#[cfg(target_arch = "x86_64")] -pub use x86_64::cpu::CPUState; -#[cfg(target_arch = "x86_64")] pub use x86_64::boot_loader::{ - load_kernel, kvm_load_kernel,X86BootLoader as BootLoader, X86BootLoaderConfig as BootLoaderConfig, + kvm_load_kernel, load_kernel, X86BootLoader as BootLoader, + X86BootLoaderConfig as BootLoaderConfig, }; #[cfg(target_arch = "x86_64")] -pub use x86_64::device::kvm_setup_fireware; +pub use x86_64::cpu::CPUState; +#[cfg(target_arch = "x86_64")] +pub use x86_64::cpu::X86CPUBootConfig as CPUBootConfig; #[cfg(target_arch = "x86_64")] pub use x86_64::device::serial::*; #[cfg(target_arch = "x86_64")] -pub use x86_64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; +pub use x86_64::device::{judge_other_addr, kvm_setup_fireware, read_other_addr, write_other_addr}; +#[cfg(target_arch = "x86_64")] +pub use x86_64::kvm::*; +#[cfg(target_arch = "x86_64")] +pub use x86_64::memory::{arch_add_ram_ranges, LayoutEntryType, MEM_LAYOUT}; #[cfg(target_arch = "riscv64")] mod riscv64; #[cfg(target_arch = "riscv64")] -pub use riscv64::memory::{LayoutEntryType, MEM_LAYOUT, arch_add_ram_ranges}; +pub use riscv64::boot_loader::{ + kvm_load_kernel, load_kernel, Riscv64BootLoader as BootLoader, + Riscv64BootLoaderConfig as BootLoaderConfig, +}; #[cfg(target_arch = "riscv64")] pub use riscv64::cpu::Riscv64CPUBootConfig as CPUBootConfig; #[cfg(target_arch = "riscv64")] -pub use riscv64::cpu::CPUState; +pub use riscv64::cpu::{CPUState, Riscv64CoreRegs}; #[cfg(target_arch = "riscv64")] -pub use riscv64::kvm::*; +pub use riscv64::device::plic::judge_plic_addr as judge_other_addr; #[cfg(target_arch = "riscv64")] -pub use riscv64::boot_loader::{ - load_kernel, kvm_load_kernel,Riscv64BootLoader as BootLoader, Riscv64BootLoaderConfig as BootLoaderConfig, -}; +pub use riscv64::device::serial::*; +#[cfg(target_arch = "riscv64")] +pub use riscv64::device::{kvm_setup_fireware, read_other_addr, write_other_addr}; +#[cfg(target_arch = "riscv64")] +pub use riscv64::kvm::*; #[cfg(target_arch = "riscv64")] -pub use riscv64::device::kvm_setup_fireware; +pub use riscv64::memory::{arch_add_ram_ranges, LayoutEntryType, MEM_LAYOUT}; diff --git a/src/arch/riscv64/boot_loader/mod.rs b/src/arch/riscv64/boot_loader/mod.rs index d120d8ab9..8cffd73df 100644 --- a/src/arch/riscv64/boot_loader/mod.rs +++ b/src/arch/riscv64/boot_loader/mod.rs @@ -27,7 +27,7 @@ const RISCV64_KERNEL_OFFSET: u64 = 0x20_0000; const FDT_ALIGN: u64 = 0x40_0000; const INITRD_ALIGN: u64 = 0x8; -/// Boot loader config used for riscv64. +/// Boot loader config used for aarch64. #[derive(Default, Debug)] pub struct Riscv64BootLoaderConfig { /// Path of kernel image. @@ -71,7 +71,6 @@ pub fn load_kernel( config: &Riscv64BootLoaderConfig, sys_mem: &Arc, ) -> Riscv64BootLoader { - // align KERNEL ALIGN let kernel_start = config.mem_start + RISCV64_KERNEL_OFFSET; let mut kernel_image = File::open(&config.kernel).expect("Failed to open kernel file"); let kernel_size = kernel_image.metadata().unwrap().len(); @@ -87,8 +86,7 @@ pub fn load_kernel( } let mut initrd_image = File::open(&config.initrd).expect("Failed to open initrd file"); let initrd_size = initrd_image.metadata().unwrap().len(); - - // align initrd ALIAGN + let initrd_start = dtb_addr + u64::from(FDT_MAX_SIZE); if initrd_start + u64::from(initrd_size) >= sys_mem.memory_end_address() { panic!("no memory to load initrd image") diff --git a/src/arch/riscv64/cpu/mod.rs b/src/arch/riscv64/cpu/mod.rs index 12f242dd1..f738334a2 100644 --- a/src/arch/riscv64/cpu/mod.rs +++ b/src/arch/riscv64/cpu/mod.rs @@ -13,6 +13,7 @@ use std::convert::Into; use std::mem; use std::sync::{Arc, Mutex}; +use crate::arch::riscv64::device::plic::PlicState; use kvm_bindings::{ user_regs_struct, kvm_riscv_core,kvm_riscv_config,kvm_riscv_timer, @@ -277,6 +278,7 @@ pub struct CPUState { pub isa: u64, pub frequency: u64, pub satp_mode: u64, + pub interrupt_controller: Option>> } impl CPUState { @@ -289,13 +291,14 @@ impl CPUState { isa: 0, frequency: 0, satp_mode: 0, + interrupt_controller: None } } pub fn set_boot_config( &mut self, vm_fd: &Arc, - vcpu_fd: &VcpuFd, + vcpu_fd: Arc, boot_config: &Riscv64CPUBootConfig, ) { self.boot_ip = boot_config.kernel_addr; @@ -305,7 +308,10 @@ impl CPUState { self.frequency = vcpu_fd.get_one_reg(Riscv64Timer::FREQUENCY.into()).unwrap(); } - pub fn reset_vcpu(&self, vcpu: &VcpuFd) { + pub fn set_plic(&mut self, plic: Arc>) { + self.interrupt_controller = Some(plic); + } + pub fn reset_vcpu(&self, vcpu: Arc) { let mp_state = vcpu.get_mp_state().unwrap(); if mp_state.mp_state == KVM_MP_STATE_STOPPED { return; diff --git a/src/arch/riscv64/device/fdt.rs b/src/arch/riscv64/device/fdt.rs index 981d36efb..a941d7e19 100644 --- a/src/arch/riscv64/device/fdt.rs +++ b/src/arch/riscv64/device/fdt.rs @@ -2,12 +2,15 @@ use crate::arch::riscv64::device_tree::*; use crate::arch::{LayoutEntryType, MEM_LAYOUT}; use crate::cpu::CPU; use crate::memory::GuestMemory; +use super::plic::PlicState; use std::sync::{Mutex, Arc}; +use crate::arch::{MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ}; pub fn generate_fdt( sys_mem: &Arc, initrd_range: (u64, u64), cmdline: &str, + plic: Arc>, cpu: &CPU, fdt_addr: u64, ) { @@ -24,6 +27,12 @@ pub fn generate_fdt( println!("mem node complete!"); generate_cpu_node(&mut fdt, cpu); println!("cpu node complete!"); + plic.lock().unwrap().generate_fdt_node(&mut fdt); + println!("plic node complete!"); + generate_devices_node(&mut fdt); + println!("serial node complete!"); + generate_aliases_node(&mut fdt); + println!("aliases node complete!"); let fdt_len = fdt.len() as u64; sys_mem @@ -90,6 +99,22 @@ fn generate_cpu_node(fdt: &mut Vec, cpu: &CPU) { } } +fn generate_devices_node(fdt: &mut Vec) { + let node = "/smb"; + add_sub_node(fdt, node); + set_property_string(fdt, node, "compatible", "simple-bus"); + set_property_u32(fdt, node, "#address-cells", 0x02); + set_property_u32(fdt, node, "#size-cells", 0x02); + set_property_u32(fdt, node, "interrupt-parent", PHANDLE_PLIC); + set_property(fdt, node, "ranges", None); + + let node = format!("/smb/U6_16550A@{:x}", MMIO_SERIAL_ADDR); + add_sub_node(fdt, &node); + set_property_string(fdt, &node, "compatible", "ns16550a"); + set_property_array_u64(fdt, &node, "reg", &[MMIO_SERIAL_ADDR, 8]); + set_property_u32(fdt, &node, "interrupts", MMIO_SERIAL_IRQ); + set_property_u32(fdt, &node, "clock-frequency", 0x1c2000); +} fn generate_chosen_node(fdt: &mut Vec, cmdline: &str, initrd_addr: u64, initrd_size: u64) { @@ -100,4 +125,9 @@ fn generate_chosen_node(fdt: &mut Vec, cmdline: &str, initrd_addr: u64, init set_property_u64(fdt, node, "linux,initrd-start", initrd_addr); set_property_u64(fdt, node, "linux,initrd-end", initrd_addr + initrd_size); } - +fn generate_aliases_node(fdt: &mut Vec) { + let node = "/aliases"; + add_sub_node(fdt, node); + let serial0 = format!("/smb/U6_16550A@{:x}", MMIO_SERIAL_ADDR); + set_property_string(fdt, node, "serial0", &serial0); +} diff --git a/src/arch/riscv64/device/mod.rs b/src/arch/riscv64/device/mod.rs index 89081c18b..c7d2c0f64 100644 --- a/src/arch/riscv64/device/mod.rs +++ b/src/arch/riscv64/device/mod.rs @@ -1,11 +1,25 @@ +pub mod serial; +pub mod plic; mod fdt; +use plic::*; +use serial::SerialControl; use crate::arch::CPUState; use crate::device::Result; use kvm_ioctls::VmFd; use crate::{arch::riscv64::boot_loader::Riscv64BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; use std::sync::{Arc, Mutex}; -pub fn kvm_setup_fireware(guest_memory: &Arc, vcpus: &mut CPU, vm_fd: &Arc, layout : &Riscv64BootLoader) { +pub fn kvm_setup_fireware(guest_memory: &Arc, vcpus : &mut Vec<&mut CPU>, vm_fd: &Arc, layout : &Riscv64BootLoader) { + + let vcpu_count = vcpus[0].state.nr_vcpus; + let plic = PlicState::new(&vcpus, vcpu_count); + + let serial = Serial::new(&vm_fd, Some(SerialControl::new(plic.clone()))); + for i in 0..vcpus.len(){ + vcpus[i].set_serial_dev(serial.clone()); + vcpus[i].state.set_plic(plic.clone()); + } + println!("set plic and serial for vcpu!"); let cmdline = "console=ttyS0 panic=1 reboot=k root=/dev/ram rdinit=/bin/sh"; let initrd_range = (layout.initrd_start, layout.initrd_size); let fdt_addr = layout.dtb_start; @@ -13,9 +27,20 @@ pub fn kvm_setup_fireware(guest_memory: &Arc, vcpus: &mut CPU, vm_f guest_memory, initrd_range, cmdline, - vcpus, + plic.clone(), + vcpus[0], fdt_addr, ); println!("generate fdt node complete!"); } +pub fn read_other_addr(state: &mut CPUState, addr: u64) -> Result{ + let mut plic_guard = state.interrupt_controller.as_ref().unwrap().lock().unwrap(); + let res = plic_guard.mmio_read(addr); + Ok(res) +} +pub fn write_other_addr(state: &mut CPUState, addr: u64, data: u32) -> Result<()>{ + let mut plic_guard = state.interrupt_controller.as_ref().unwrap().lock().unwrap(); + plic_guard.mmio_write(addr, data); + Ok(()) +} diff --git a/src/arch/riscv64/device/plic.rs b/src/arch/riscv64/device/plic.rs new file mode 100644 index 000000000..6117d63d7 --- /dev/null +++ b/src/arch/riscv64/device/plic.rs @@ -0,0 +1,381 @@ +use crate::arch::riscv64::device_tree::*; +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::cpu::CPU; +use kvm_ioctls::{VcpuFd, VmFd}; +use std::sync::{Arc, Mutex}; + +const MAX_DEVICES: u32 = 1024; +const MAX_CONTEXTS: u32 = 15872; + +// interrupt source priority regs +const PRIORITY_BASE: u64 = 0; +const PRIORITY_PER_ID: u32 = 4; +// interrupt enable bit +const ENABLE_BASE: u64 = 0x2000; +const ENABLE_PER_HART: u32 = 0x80; +// interrupt threshold and claim/complete reg +const CONTEXT_BASE: u64 = 0x200000; +const CONTEXT_PER_HART: u32 = 0x1000; +const CONTEXT_THRESHOLD: u32 = 0; +const CONTEXT_CLAIM: u32 = 4; +const REG_SIZE: u64 = 0x1000000; + +struct PlicContext { + num: u32, + vcpu: Arc, + irq_priority_threshold: u8, + irq_enable: [u32; (MAX_DEVICES / 32) as usize], + irq_pending: [u32; (MAX_DEVICES / 32) as usize], + irq_pending_priority: [u8; MAX_DEVICES as usize], + irq_claimed: [u32; (MAX_DEVICES / 32) as usize], + irq_autoclear: [u32; (MAX_DEVICES / 32) as usize], +} + +pub struct PlicState { + ready: bool, + num_irq: u32, + num_irq_word: u32, + max_prio: u32, + num_context: u32, + contexts: Vec, + irq_priority: [u8; (MAX_DEVICES) as usize], + irq_level: [u32; (MAX_DEVICES / 32) as usize], +} + +impl PlicState { + pub fn new(vcpus: &Vec<&mut CPU>, vcpu_nr: u32) -> Arc> { + let mut contexts: Vec = Vec::new(); + for i in 0..vcpu_nr * 2 { + let context = PlicContext { + num: i as u32, + vcpu: vcpus[(i / 2) as usize].fd.clone(), + irq_priority_threshold: 0 as u8, + irq_enable: [0; (MAX_DEVICES / 32) as usize], + irq_pending: [0; (MAX_DEVICES / 32) as usize], + irq_pending_priority: [0; MAX_DEVICES as usize], + irq_claimed: [0; (MAX_DEVICES / 32) as usize], + irq_autoclear: [0; (MAX_DEVICES / 32) as usize], + }; + contexts.push(context); + } + let state = PlicState { + ready: true, + num_irq: MAX_DEVICES, + num_irq_word: MAX_DEVICES / 32, + max_prio: (1 << PRIORITY_PER_ID) - 1, + num_context: vcpu_nr * 2, + contexts, + irq_priority: [0; MAX_DEVICES as usize], + irq_level: [0; (MAX_DEVICES / 32) as usize], + }; + return Arc::new(Mutex::new(state)); + } + + pub fn generate_fdt_node(&self, fdt: &mut Vec) { + let node = format!( + "/interrupt-controller@{:x}", + MEM_LAYOUT[LayoutEntryType::IrqChip as usize].0 + ); + add_sub_node(fdt, &node); + set_property_string(fdt, &node, "compatible", "riscv,plic0"); + set_property_array_u32( + fdt, + &node, + "reg", + &[ + 0x0, + MEM_LAYOUT[LayoutEntryType::IrqChip as usize].0 as u32, + 0x0, + MEM_LAYOUT[LayoutEntryType::IrqChip as usize].1 as u32, + ], + ); + set_property_u32(fdt, &node, "#interrupt-cells", 1); + set_property(fdt, &node, "interrupt-controller", None); + set_property_u32(fdt, &node, "riscv,max-priority", (1 << PRIORITY_PER_ID) - 1); + set_property_u32(fdt, &node, "riscv,ndev", MAX_DEVICES - 1); + set_property_u32(fdt, &node, "phandle", PHANDLE_PLIC); + let mut interrupt_extend: Vec = Vec::new(); + for i in 0..self.num_context / 2 { + interrupt_extend.push(CPU_PHANDLE_START + i); + interrupt_extend.push(0xffffffff); + interrupt_extend.push(CPU_PHANDLE_START + i); + interrupt_extend.push(0x9); + } + set_property_array_u32(fdt, &node, "interrupts-extended", &interrupt_extend[..]); + } + fn __plic_context_best_pending_irq(&self, context_idx: u32) -> u32 { + let mut best_irq_prio: u8 = 0; + let mut irq: u32 = 0; + let mut best_irq: u32 = 0; + for i in 0..self.num_irq_word { + if self.contexts[context_idx as usize].irq_pending[i as usize] == 0 { + continue; + } + for j in 0..32 { + irq = i * 32 + j; + if self.num_irq <= irq + || (self.contexts[context_idx as usize].irq_pending[i as usize] & (1 << j)) == 0 + || (self.contexts[context_idx as usize].irq_claimed[i as usize] & (1 << j)) != 0 + { + continue; + } + if best_irq == 0 + || best_irq_prio + < self.contexts[context_idx as usize].irq_pending_priority[irq as usize] + { + best_irq = irq; + best_irq_prio = + self.contexts[context_idx as usize].irq_pending_priority[irq as usize]; + } + } + } + best_irq + } + + fn __plic_context_irq_update(&self, context_idx: u32) { + let irq: u32 = self.__plic_context_best_pending_irq(context_idx); + if irq == 0 { + self.contexts[context_idx as usize] + .vcpu + .unset_interrupt() + .expect("Failed to unset interrupt"); + } else { + self.contexts[context_idx as usize] + .vcpu + .set_interrupt() + .expect("Failed to set interrupt"); + } + } + + fn __plic_context_irq_claim(&mut self, context_idx: u32) -> u32 { + let best_irq: u32 = self.__plic_context_best_pending_irq(context_idx); + let best_irq_word: u32 = best_irq / 32; + let best_irq_mask: u32 = 1 << (best_irq % 32); + + self.contexts[context_idx as usize] + .vcpu + .unset_interrupt() + .expect("Failed to unset interrupt in irq claim!"); + + if best_irq != 0 { + if self.contexts[context_idx as usize].irq_autoclear[best_irq_word as usize] + & best_irq_mask + != 0 + { + self.contexts[context_idx as usize].irq_pending[best_irq_word as usize] &= + !best_irq_mask; + self.contexts[context_idx as usize].irq_pending_priority[best_irq as usize] = 0; + self.contexts[context_idx as usize].irq_claimed[best_irq_word as usize] &= + !best_irq_mask; + self.contexts[context_idx as usize].irq_autoclear[best_irq_word as usize] &= + !best_irq_mask; + } else { + self.contexts[context_idx as usize].irq_claimed[best_irq_word as usize] |= + best_irq_mask; + } + } + self.__plic_context_irq_update(context_idx); + best_irq + } + + pub fn plic__irq_trig(&mut self, irq: u32, level: bool, edge: bool) { + let mut irq_marked: bool = false; + let (irq_prio, irq_word): (u8, u8); + let irq_mask: u32; + + if !self.ready { + return; + } + if irq < 0 || self.num_irq <= irq { + return; + } + irq_prio = self.irq_priority[irq as usize]; + irq_word = (irq / 32) as u8; + irq_mask = 1 << (irq % 32); + + if level { + self.irq_level[irq_word as usize] |= irq_mask; + } else { + self.irq_level[irq_word as usize] &= !irq_mask; + } + + for i in 0..self.num_context { + let mut context = &mut self.contexts[i as usize]; + if (context.irq_enable[irq_word as usize] & irq_mask) != 0 { + if level { + context.irq_pending[irq_word as usize] |= irq_mask; + context.irq_pending_priority[irq as usize] = irq_prio; + if edge { + context.irq_autoclear[irq_word as usize] |= irq_mask; + } + } else { + context.irq_pending[irq_word as usize] &= !irq_mask; + context.irq_pending_priority[irq as usize] = 0; + context.irq_claimed[irq_word as usize] &= !irq_mask; + context.irq_autoclear[irq_word as usize] &= !irq_mask; + } + self.__plic_context_irq_update(i); + irq_marked = true; + } + if irq_marked { + break; + } + } + } + + fn plic__priority_read(&self, offset: u64) -> u32 { + let irq: u32 = (offset >> 2) as u32; + if irq == 0 || irq >= self.num_irq { + return 0; + } + self.irq_priority[irq as usize] as u32 + } + + fn plic__priority_write(&mut self, offset: u64, data: u32) { + let irq: u32 = (offset >> 2) as u32; + + if irq == 0 || irq >= self.num_irq { + return; + } + let val: u32 = data & ((1 << PRIORITY_PER_ID) - 1); + self.irq_priority[irq as usize] = data as u8; + } + + fn plic__context_enable_read(&mut self, context_idx: u32, offset: u64) -> u32 { + let irq_word: u32 = (offset >> 2) as u32; + if self.num_irq_word < irq_word { + return 0; + } + self.contexts[context_idx as usize].irq_enable[irq_word as usize] + } + + fn plic__context_enable_write(&mut self, context_idx: u32, offset: u64, data: u32) { + let mut irq_prio: u8; + let mut irq: u32 = 0; + let mut irq_mask: u32 = 0; + let mut old_val: u32 = 0; + let mut new_val: u32 = 0; + let mut xor_val: u32 = 0; + let irq_word: u32 = (offset >> 2) as u32; + if self.num_irq_word < irq_word { + return; + } + old_val = self.contexts[context_idx as usize].irq_enable[irq_word as usize]; + new_val = data; + if irq_word == 0 { + new_val &= !0x1; + } + self.contexts[context_idx as usize].irq_enable[irq_word as usize] = new_val; + xor_val = old_val ^ new_val; + for i in 0..32 { + irq = irq_word * 32 + i; + irq_mask = 1 << i; + irq_prio = self.irq_priority[irq as usize]; + if (xor_val & irq_mask) == 0 { + continue; + } + if (new_val & irq_mask) != 0 && (self.irq_level[irq_word as usize] & irq_mask) != 0 { + self.contexts[context_idx as usize].irq_pending[irq_word as usize] |= irq_mask; + self.contexts[context_idx as usize].irq_pending_priority[irq as usize] = irq_prio; + } else if (new_val & irq_mask) == 0 { + self.contexts[context_idx as usize].irq_pending[irq_word as usize] &= !irq_mask; + self.contexts[context_idx as usize].irq_pending_priority[irq as usize] = 0; + self.contexts[context_idx as usize].irq_claimed[irq_word as usize] &= !irq_mask; + } + } + self.__plic_context_irq_update(context_idx); + } + + fn plic__context_read(&mut self, context_idx: u32, offset: u64) -> u32 { + match offset { + 0 => self.contexts[context_idx as usize].irq_priority_threshold as u32, + 4 => self.__plic_context_irq_claim(context_idx), + _ => 0, + } + } + + fn plic__context_write(&mut self, context_idx: u32, offset: u64, data: u32) { + let mut val: u32; + let mut irq_word: u32; + let mut irq_mask: u32; + let mut irq_update: bool = false; + match offset { + 0 => { + val = data & ((1 << PRIORITY_PER_ID) - 1); + if data <= self.max_prio { + self.contexts[context_idx as usize].irq_priority_threshold = data as u8; + } else { + irq_update = true; + } + } + 4 => { + irq_word = data / 32; + irq_mask = 1 << (data % 32); + if data < self.num_irq + && (self.contexts[context_idx as usize].irq_enable[irq_word as usize] + & irq_mask) + != 0 + { + self.contexts[context_idx as usize].irq_claimed[irq_word as usize] &= !irq_mask; + irq_update = true; + } + } + _ => { + irq_update = true; + } + } + if irq_update { + self.__plic_context_irq_update(context_idx); + } + } + pub fn mmio_write(&mut self, addr: u64, data: u32) { + let mut address = addr & !0x3; + address -= MEM_LAYOUT[LayoutEntryType::IrqChip as usize].0; + if PRIORITY_BASE <= address && address < ENABLE_BASE { + self.plic__priority_write(address, data); + }else if ENABLE_BASE <= address && address < CONTEXT_BASE { + let cntx = ((address - ENABLE_BASE) as u32) / ENABLE_PER_HART; + address -= (cntx * ENABLE_PER_HART) as u64 + ENABLE_BASE; + if cntx < self.num_context { + self.plic__context_enable_write(cntx, address, data); + } + }else if CONTEXT_BASE <= address && address < REG_SIZE { + let cntx = ((address - CONTEXT_BASE)as u32) / CONTEXT_PER_HART; + address -= (cntx * CONTEXT_PER_HART)as u64 + CONTEXT_BASE; + if cntx < self.num_context { + self.plic__context_write(cntx, address, data); + } + } + } + + pub fn mmio_read(&mut self, addr: u64) -> u32{ + let mut data: u32 = 0; + let mut address = addr & !0x3; + address -= MEM_LAYOUT[LayoutEntryType::IrqChip as usize].0; + if PRIORITY_BASE <= address && address < ENABLE_BASE { + return self.plic__priority_read(address); + }else if ENABLE_BASE <= address && address < CONTEXT_BASE { + let cntx = ((address - ENABLE_BASE) as u32) / ENABLE_PER_HART; + address -= (cntx * ENABLE_PER_HART) as u64 + ENABLE_BASE; + if cntx < self.num_context { + return self.plic__context_enable_read(cntx, address); + } + }else if CONTEXT_BASE <= address && address < REG_SIZE { + let cntx = ((address - CONTEXT_BASE)as u32) / CONTEXT_PER_HART; + address -= (cntx * CONTEXT_PER_HART)as u64 + CONTEXT_BASE; + if cntx < self.num_context { + return self.plic__context_read(cntx, address); + } + } + 0 + } +} + +pub fn judge_plic_addr(addr: u64) -> Option { + let base: u64 = MEM_LAYOUT[LayoutEntryType::IrqChip as usize].0; + if (base..base + REG_SIZE).contains(&addr) { + Some(addr) + }else { + None + } +} diff --git a/src/arch/riscv64/device/serial.rs b/src/arch/riscv64/device/serial.rs new file mode 100644 index 000000000..01a7be5b7 --- /dev/null +++ b/src/arch/riscv64/device/serial.rs @@ -0,0 +1,28 @@ +use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use super::{PlicState}; +use std::sync::{Arc, Mutex}; +use kvm_ioctls::{VmFd}; +use vmm_sys_util::eventfd::EventFd; +pub const MMIO_SERIAL_IRQ: u32 = 1; +pub const MMIO_SERIAL_ADDR: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].0; +pub const MMIO_SERIAL_ADDR_SIZE: u64 = MEM_LAYOUT[LayoutEntryType::Mmio as usize].1; + +pub struct SerialControl { + plic: Arc>, +} + +impl SerialControl { + pub fn new(plic_state: Arc>) -> Self { + Self { + plic: plic_state.clone() + } + } + pub fn interrupt_trigger(&self) { + let mut plic_guard = self.plic.lock().unwrap(); + plic_guard.plic__irq_trig(MMIO_SERIAL_IRQ, true, true); + drop(plic_guard); + } +} +pub fn serial_register_irqfd(vm_fd: &VmFd, evt_fd: &EventFd) { + +} diff --git a/src/arch/riscv64/memory/mod.rs b/src/arch/riscv64/memory/mod.rs index 6dbcdb011..45786c8f3 100644 --- a/src/arch/riscv64/memory/mod.rs +++ b/src/arch/riscv64/memory/mod.rs @@ -1,5 +1,5 @@ -/// The type of memory layout entry on riscv64 +/// The type of memory layout entry on aarch64 #[repr(usize)] pub enum LayoutEntryType { IrqChip = 0_usize, @@ -15,7 +15,7 @@ pub const MEM_LAYOUT: &[(u64, u64)] = &[ (0x8000_0000, 0x0800_0000), // Mem: max: (1 << 40)-MemStart, default: 128M ]; -/// + pub fn arch_add_ram_ranges(mem_size: u64, ranges: &mut Vec<(u64, u64)>) { if mem_size < ( 1 << 40 ) - MEM_LAYOUT[LayoutEntryType::Mem as usize].0 { ranges.push((MEM_LAYOUT[LayoutEntryType::Mem as usize].0, mem_size)); diff --git a/src/arch/riscv64/mod.rs b/src/arch/riscv64/mod.rs index aef78cd3e..8a5dbcd79 100644 --- a/src/arch/riscv64/mod.rs +++ b/src/arch/riscv64/mod.rs @@ -3,5 +3,4 @@ pub mod cpu; pub mod memory; pub mod device_tree; pub mod device; -pub mod boot_loader; - +pub mod boot_loader; \ No newline at end of file diff --git a/src/arch/x86_64/cpu/mod.rs b/src/arch/x86_64/cpu/mod.rs index 97333fead..52c11af55 100644 --- a/src/arch/x86_64/cpu/mod.rs +++ b/src/arch/x86_64/cpu/mod.rs @@ -15,6 +15,7 @@ use kvm_bindings::{ KVM_MAX_CPUID_ENTRIES, KVM_MP_STATE_RUNNABLE, KVM_MP_STATE_UNINITIALIZED, }; use kvm_ioctls::{Kvm, VcpuFd, VmFd}; +use std::sync::Arc; use crate::arch::x86_64::helper::cpuid::host_cpuid; @@ -107,12 +108,12 @@ impl CPUState { pub fn set_boot_config( &mut self, _vmfd: &std::sync::Arc, - vcpu_fd: &VcpuFd, + vcpu_fd: Arc, boot_config: &X86CPUBootConfig, ) { - self.setup_lapic(vcpu_fd); + self.setup_lapic(vcpu_fd.clone()); self.setup_regs(&boot_config); - self.setup_sregs(vcpu_fd, &boot_config); + self.setup_sregs(vcpu_fd.clone(), &boot_config); self.setup_fpu(); self.setup_msrs(); } @@ -122,8 +123,8 @@ impl CPUState { /// # Arguments /// /// * `vcpu_fd` - Vcpu file descriptor in kvm. - pub fn reset_vcpu(&self, vcpu_fd: &VcpuFd) { - self.setup_cpuid(vcpu_fd); + pub fn reset_vcpu(&self, vcpu_fd: Arc) { + self.setup_cpuid(vcpu_fd.clone()); vcpu_fd .set_lapic(&self.lapic) @@ -146,7 +147,7 @@ impl CPUState { } #[allow(clippy::cast_ptr_alignment)] - fn setup_lapic(&mut self, vcpu_fd: &VcpuFd) { + fn setup_lapic(&mut self, vcpu_fd: Arc) { // Disable nmi and external interrupt before enter protected mode // See: https://elixir.bootlin.com/linux/v4.19.123/source/arch/x86/include/asm/apicdef.h const APIC_LVT0: usize = 0x350; @@ -180,7 +181,7 @@ impl CPUState { }; } - fn setup_sregs(&mut self, vcpu_fd: &VcpuFd, boot_config: &X86CPUBootConfig) { + fn setup_sregs(&mut self, vcpu_fd: Arc, boot_config: &X86CPUBootConfig) { self.sregs = vcpu_fd .get_sregs() .expect("Failed to get spectial register."); @@ -256,7 +257,7 @@ impl CPUState { } } - fn setup_cpuid(&self, vcpu_fd: &VcpuFd) { + fn setup_cpuid(&self, vcpu_fd: Arc) { let sys_fd = match Kvm::new() { Ok(fd) => fd, _ => panic!("setup_cpuid: Open /dev/kvm failed"), diff --git a/src/arch/x86_64/device/mod.rs b/src/arch/x86_64/device/mod.rs index 88f6b5e93..c988058ea 100644 --- a/src/arch/x86_64/device/mod.rs +++ b/src/arch/x86_64/device/mod.rs @@ -1,14 +1,32 @@ pub mod serial; -use std::sync::Arc; - +use crate::arch::CPUState; +use crate::device::{Error, Result}; use kvm_ioctls::VmFd; +use std::sync::Arc; -use crate::{arch::x86_64::boot_loader::X86BootLoader, cpu::CPU, device::Serial, memory::GuestMemory}; +use crate::{ + arch::x86_64::boot_loader::X86BootLoader, cpu::CPU, device::Serial, memory::GuestMemory, +}; +pub fn kvm_setup_fireware( + guest_memory: &Arc, + vcpus: &mut Vec<&mut CPU>, + vm_fd: &Arc, + layout: &X86BootLoader, +) { + let serial = Serial::new(&vm_fd, None); + for i in 0..vcpus.len() { + vcpus[i].set_serial_dev(serial.clone()); + } +} -pub fn kvm_setup_fireware(guest_memory: &Arc, vcpu : &mut CPU, vm_fd: &Arc, layout : &X86BootLoader) { +pub fn judge_other_addr(_addr: u64) -> Option { + None +} - let serial = Serial::new(&vm_fd); - vcpu.set_serial_dev(serial); - -} \ No newline at end of file +pub fn write_other_addr(_state: &CPUState, _addr: u64, _data: u32) -> Result<()> { + Err(Error::MMIoError()) +} +pub fn read_other_addr(_state: &CPUState, _addr: u64) -> Result { + Err(Error::MMIoError()) +} diff --git a/src/arch/x86_64/device/serial.rs b/src/arch/x86_64/device/serial.rs index eb0787d28..3315ec88f 100644 --- a/src/arch/x86_64/device/serial.rs +++ b/src/arch/x86_64/device/serial.rs @@ -1,3 +1,18 @@ +use kvm_ioctls::VmFd; +use vmm_sys_util::eventfd::EventFd; + pub const MMIO_SERIAL_IRQ: u32 = 4; pub const MMIO_SERIAL_ADDR: u64 = 0x3f8; -pub const MMIO_SERIAL_ADDR_SIZE: u64 = 8; \ No newline at end of file +pub const MMIO_SERIAL_ADDR_SIZE: u64 = 8; + +pub fn serial_register_irqfd(vm_fd: &VmFd, evt_fd: &EventFd) { + vm_fd + .register_irqfd(&evt_fd, MMIO_SERIAL_IRQ) + .expect("Failed to register irq fd for serial"); +} + +pub struct SerialControl {} + +impl SerialControl { + pub fn interrupt_trigger(&self) {} +} diff --git a/src/arch/x86_64/kvm/mod.rs b/src/arch/x86_64/kvm/mod.rs index 6d733647a..d5540d848 100644 --- a/src/arch/x86_64/kvm/mod.rs +++ b/src/arch/x86_64/kvm/mod.rs @@ -1,10 +1,10 @@ -use std::path::PathBuf; -use std::sync::Arc; -use kvm_ioctls::{Kvm, VmFd}; -use kvm_bindings::{kvm_pit_config, KVM_PIT_SPEAKER_DUMMY}; -use crate::memory::{GuestMemory }; use crate::arch::{load_kernel, BootLoader, BootLoaderConfig}; use crate::arch::{LayoutEntryType, MEM_LAYOUT}; +use crate::memory::GuestMemory; +use kvm_bindings::{kvm_pit_config, KVM_PIT_SPEAKER_DUMMY}; +use kvm_ioctls::{Kvm, VmFd}; +use std::path::PathBuf; +use std::sync::Arc; pub fn load_boot_source(guest_memory: &Arc, cmdline: &str) -> BootLoader { let initrd_path = PathBuf::from("/tmp/initrd.img"); let initrd_size = match std::fs::metadata("/tmp/initrd.img") { @@ -37,10 +37,8 @@ pub fn arch_init_based_dev(vm_fd: &Arc) { flags: KVM_PIT_SPEAKER_DUMMY, pad: Default::default(), }; - + vm_fd .create_pit2(pit_config) .expect("Failed to create pit2."); } - - diff --git a/src/cpu/mod.rs b/src/cpu/mod.rs index 21097ec93..96f612333 100644 --- a/src/cpu/mod.rs +++ b/src/cpu/mod.rs @@ -11,20 +11,23 @@ // See the Mulan PSL v2 for more details. use crate::arch::CPUBootConfig; +use crate::helper::byte_code::ByteCode; +use std::mem::size_of; use std::sync::{Arc, Mutex}; use std::thread; +use kvm_bindings::KVM_SYSTEM_EVENT_RESET; use kvm_ioctls::{VcpuExit, VcpuFd, VmFd}; +use crate::arch::{judge_other_addr, read_other_addr, write_other_addr, CPUState}; use crate::device::{judge_serial_addr, Serial}; use crate::memory::GuestMemory; -use crate::arch::CPUState; pub struct CPU { /// ID of this virtual CPU, `0` means this cpu is primary `CPU`. pub id: u8, /// The file descriptor of this kvm_based vCPU. - pub fd: VcpuFd, + pub fd: Arc, /// Registers state for kvm_based vCPU. pub state: CPUState, /// System memory space. @@ -47,12 +50,9 @@ impl CPU { Self { id: vcpu_id as u8, - fd: vcpu_fd, + fd: Arc::new(vcpu_fd), sys_mem, - state: CPUState::new( - vcpu_id, - nr_vcpus, - ), + state: CPUState::new(vcpu_id, nr_vcpus), serial: None, } } @@ -64,27 +64,27 @@ impl CPU { /// Realize vcpu status. /// Get register state from kvm. pub fn realize(&mut self, vm_fd: &Arc, bootconfig: CPUBootConfig) { - self.state.set_boot_config(vm_fd, &self.fd, &bootconfig); + self.state + .set_boot_config(vm_fd, self.fd.clone(), &bootconfig); } /// Reset kvm_based vCPU registers state by registers state in `CPU`. pub fn reset(&self) { - self.state.reset_vcpu(&self.fd); + self.state.reset_vcpu(self.fd.clone()); } /// Start run `CPU` in seperate vcpu thread. /// /// # Arguments /// - /// - `arc_cpu`: `CPU` wrapper in `Arc` to send safely during thread. - pub fn start(arc_cpu: Arc) -> thread::JoinHandle<()> { - let cpu_id = arc_cpu.id; + pub fn start(mut vcpu: CPU) -> thread::JoinHandle<()> { + let cpu_id = vcpu.id; thread::Builder::new() .name(format!("CPU {}/KVM", cpu_id)) .spawn(move || { - arc_cpu.reset(); + vcpu.reset(); loop { - if !arc_cpu.kvm_vcpu_exec() { + if !vcpu.kvm_vcpu_exec() { break; } } @@ -97,7 +97,8 @@ impl CPU { /// # Return value /// /// Whether to continue to emulate or not. - fn kvm_vcpu_exec(&self) -> bool { + fn kvm_vcpu_exec(&mut self) -> bool { + // println!("current PC: 0x{:x}", self.fd.get_one_reg(Riscv64CoreRegs::PC.into()).unwrap()); match self.fd.run().expect("Unhandled error in vcpu emulation!") { VcpuExit::IoIn(addr, data) => { if let Some(offset) = judge_serial_addr(addr as u64) { @@ -122,6 +123,12 @@ impl CPU { VcpuExit::MmioRead(addr, mut data) => { if let Some(offset) = judge_serial_addr(addr as u64) { data[0] = self.serial.as_ref().unwrap().lock().unwrap().read(offset); + } else if let Some(addr) = judge_other_addr(addr) { + let res = read_other_addr(&mut self.state, addr).unwrap(); + let res_bytes = res.as_bytes(); + for i in 0..res_bytes.len() { + data[i] = res_bytes[i]; + } } else { let data_len = data.len() as u64; self.sys_mem @@ -142,6 +149,11 @@ impl CPU { { println!("Failed to write data for serial, offset: {}", offset); } + } else if let Some(addr) = judge_other_addr(addr as u64) { + let res: &u32 = u32::from_bytes(&data).unwrap(); + if write_other_addr(&mut self.state, addr, *res).is_err() { + println!("Failed to write other mmio, addr: {:#x}", addr); + } } else { let data_len = data.len() as u64; self.sys_mem @@ -149,6 +161,10 @@ impl CPU { .expect("Invalid mmio write."); } } + VcpuExit::SystemEvent(event_type, _ndata) => match event_type { + KVM_SYSTEM_EVENT_RESET => {} + _ => return false, + }, VcpuExit::Hlt => { println!("KVM_EXIT_HLT"); return false; @@ -156,7 +172,7 @@ impl CPU { VcpuExit::Shutdown => { println!("Guest shutdown"); - return false; + return true; } r => panic!("Unexpected exit reason: {:?}", r), } diff --git a/src/device/mod.rs b/src/device/mod.rs index 928aec337..95bb74d71 100644 --- a/src/device/mod.rs +++ b/src/device/mod.rs @@ -20,6 +20,7 @@ pub use serial::{ pub enum Error { Overflow(usize, usize), IoError(std::io::Error), + MMIoError(), } impl std::fmt::Display for Error { @@ -32,6 +33,9 @@ impl std::fmt::Display for Error { ), Error::IoError(ref e) => { write!(f, "IO errors occurs when read/write memory, error is {}", e) + }, + Error::MMIoError() => { + write!(f, "MMIo Error occurs when read/write mmio memory") } } } diff --git a/src/device/serial.rs b/src/device/serial.rs index d237d4ef0..bec1942ef 100644 --- a/src/device/serial.rs +++ b/src/device/serial.rs @@ -20,10 +20,11 @@ use kvm_ioctls::VmFd; use vmm_sys_util::{epoll::EventSet, eventfd::EventFd, terminal::Terminal}; use super::{Error, Result}; -use crate::arch::{MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ}; +use crate::arch::{ + serial_register_irqfd, SerialControl, MMIO_SERIAL_ADDR, MMIO_SERIAL_ADDR_SIZE, MMIO_SERIAL_IRQ, +}; use crate::helper::epoll::{EpollContext, EventNotifier}; - const UART_IER_RDI: u8 = 0x01; const UART_IER_THRI: u8 = 0x02; const UART_IIR_NO_INT: u8 = 0x01; @@ -80,21 +81,25 @@ pub struct Serial { interrupt_evt: EventFd, /// Operation methods. output: Box, + /// serial interrupt control + serial_ctrl: Option, + /// state control + state: u8, } impl Serial { /// Create a new `Serial` instance with default parameters. - pub fn new(vm_fd: &VmFd) -> Arc> { + pub fn new(vm_fd: &VmFd, serial_ctrl: Option) -> Arc> { std::io::stdin() .lock() .set_raw_mode() .expect("Failed to set raw mode to stdin"); let evt_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap(); - vm_fd - .register_irqfd(&evt_fd, MMIO_SERIAL_IRQ) - .expect("Failed to register irq fd for serial"); - + // vm_fd + // .register_irqfd(&evt_fd, MMIO_SERIAL_IRQ) + // .expect("Failed to register irq fd for serial"); + serial_register_irqfd(&vm_fd, &evt_fd); let serial = Arc::new(Mutex::new(Serial { rbr: VecDeque::new(), ier: 0, @@ -108,9 +113,12 @@ impl Serial { thr_pending: 0, interrupt_evt: evt_fd, output: Box::new(std::io::stdout()), + serial_ctrl, + state: 0, })); let serial_clone = serial.clone(); + let serial_clone1 = serial.clone(); let mut epoll = EpollContext::new(); let handler: Box = Box::new(move |event, _| { if event == EventSet::IN && serial_clone.lock().unwrap().stdin_exce().is_err() { @@ -141,7 +149,7 @@ impl Serial { /// this method would be called when the interrupt identification changes. fn update_iir(&mut self) -> Result<()> { let mut iir = UART_IIR_NO_INT; - + // Data Ready Interrupt enable && Data Ready Signal if self.ier & UART_IER_RDI != 0 && self.lsr & UART_LSR_DR != 0 { iir &= !UART_IIR_NO_INT; iir |= UART_IIR_RDI; @@ -153,7 +161,11 @@ impl Serial { self.iir = iir; if iir != UART_IIR_NO_INT { - self.interrupt_evt.write(1).map_err(Error::IoError)?; + if self.serial_ctrl.is_some() { + self.serial_ctrl.as_ref().unwrap().interrupt_trigger(); + } else { + self.interrupt_evt.write(1).map_err(Error::IoError)?; + } } Ok(()) @@ -166,6 +178,7 @@ impl Serial { } self.rbr.extend(data); + // Data Ready Signal self.lsr |= UART_LSR_DR; self.update_iir()?; @@ -250,7 +263,6 @@ impl Serial { } _ => {} } - ret } diff --git a/src/main.rs b/src/main.rs index dc3046bdd..b7fe454f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,11 +53,12 @@ fn main() { let layout = kvm_load_kernel(&arc_memory,&mut vcpu, &vm_fd); - - kvm_setup_fireware(&arc_memory,&mut vcpu, &vm_fd, &layout); + let mut vcpus = vec![&mut vcpu]; + kvm_setup_fireware(&arc_memory, &mut vcpus, &vm_fd, &layout); + println!("fireware set up !"); // 9. Run vCPU0. - let cpu_task_0 = CPU::start(Arc::new(vcpu)); + let cpu_task_0 = CPU::start(vcpu); println!("Start to run linux kernel!"); cpu_task_0.join().expect("Failed to wait cpu task 0"); } -- Gitee