diff --git a/Cargo.lock b/Cargo.lock index fb3e9546a..6f6c0a4ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,7 +62,6 @@ version = "0.1.0" dependencies = [ "acpi_tables", "anyhow", - "arch_gen", "byteorder", "hypervisor", "libc", @@ -76,10 +75,6 @@ dependencies = [ "vm-migration", ] -[[package]] -name = "arch_gen" -version = "0.1.0" - [[package]] name = "atty" version = "0.2.14" diff --git a/Cargo.toml b/Cargo.toml index ae48e9108..9f385bdc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,6 @@ members = [ "acpi_tables", "api_client", "arch", - "arch_gen", "block_util", "devices", "event_monitor", diff --git a/arch/Cargo.toml b/arch/Cargo.toml index ec5449c3f..526e15d19 100644 --- a/arch/Cargo.toml +++ b/arch/Cargo.toml @@ -11,7 +11,6 @@ tdx = [] [dependencies] acpi_tables = { path = "../acpi_tables", optional = true } anyhow = "1.0" -arch_gen = { path = "../arch_gen" } byteorder = "1.4.3" hypervisor = { path = "../hypervisor" } libc = "0.2.94" diff --git a/arch/src/lib.rs b/arch/src/lib.rs index 2f4089125..332d140a6 100644 --- a/arch/src/lib.rs +++ b/arch/src/lib.rs @@ -16,7 +16,6 @@ extern crate libc; extern crate log; #[cfg(feature = "acpi")] extern crate acpi_tables; -extern crate arch_gen; extern crate linux_loader; extern crate serde; extern crate vm_memory; diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index cbbf27442..fac51bed9 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -9,6 +9,7 @@ use std::sync::Arc; pub mod interrupts; pub mod layout; +mod mpspec; mod mptable; pub mod regs; use crate::InitramfsConfig; diff --git a/arch/src/x86_64/mpspec.rs b/arch/src/x86_64/mpspec.rs new file mode 100644 index 000000000..8006a3f97 --- /dev/null +++ b/arch/src/x86_64/mpspec.rs @@ -0,0 +1,112 @@ +// 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 LICENSE-BSD-3-Clause file. + +pub const MP_PROCESSOR: ::std::os::raw::c_uint = 0; +pub const MP_BUS: ::std::os::raw::c_uint = 1; +pub const MP_IOAPIC: ::std::os::raw::c_uint = 2; +pub const MP_INTSRC: ::std::os::raw::c_uint = 3; +pub const MP_LINTSRC: ::std::os::raw::c_uint = 4; +pub const CPU_ENABLED: ::std::os::raw::c_uint = 1; +pub const CPU_BOOTPROCESSOR: ::std::os::raw::c_uint = 2; +pub const MPC_APIC_USABLE: ::std::os::raw::c_uint = 1; +pub const MP_IRQDIR_DEFAULT: ::std::os::raw::c_uint = 0; + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpf_intel { + pub signature: [::std::os::raw::c_char; 4usize], + pub physptr: ::std::os::raw::c_uint, + pub length: ::std::os::raw::c_uchar, + pub specification: ::std::os::raw::c_uchar, + pub checksum: ::std::os::raw::c_uchar, + pub feature1: ::std::os::raw::c_uchar, + pub feature2: ::std::os::raw::c_uchar, + pub feature3: ::std::os::raw::c_uchar, + pub feature4: ::std::os::raw::c_uchar, + pub feature5: ::std::os::raw::c_uchar, +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_table { + pub signature: [::std::os::raw::c_char; 4usize], + pub length: ::std::os::raw::c_ushort, + pub spec: ::std::os::raw::c_char, + pub checksum: ::std::os::raw::c_char, + pub oem: [::std::os::raw::c_char; 8usize], + pub productid: [::std::os::raw::c_char; 12usize], + pub oemptr: ::std::os::raw::c_uint, + pub oemsize: ::std::os::raw::c_ushort, + pub oemcount: ::std::os::raw::c_ushort, + pub lapic: ::std::os::raw::c_uint, + pub reserved: ::std::os::raw::c_uint, +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_cpu { + pub type_: ::std::os::raw::c_uchar, + pub apicid: ::std::os::raw::c_uchar, + pub apicver: ::std::os::raw::c_uchar, + pub cpuflag: ::std::os::raw::c_uchar, + pub cpufeature: ::std::os::raw::c_uint, + pub featureflag: ::std::os::raw::c_uint, + pub reserved: [::std::os::raw::c_uint; 2usize], +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_bus { + pub type_: ::std::os::raw::c_uchar, + pub busid: ::std::os::raw::c_uchar, + pub bustype: [::std::os::raw::c_uchar; 6usize], +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_ioapic { + pub type_: ::std::os::raw::c_uchar, + pub apicid: ::std::os::raw::c_uchar, + pub apicver: ::std::os::raw::c_uchar, + pub flags: ::std::os::raw::c_uchar, + pub apicaddr: ::std::os::raw::c_uint, +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_intsrc { + pub type_: ::std::os::raw::c_uchar, + pub irqtype: ::std::os::raw::c_uchar, + pub irqflag: ::std::os::raw::c_ushort, + pub srcbus: ::std::os::raw::c_uchar, + pub srcbusirq: ::std::os::raw::c_uchar, + pub dstapic: ::std::os::raw::c_uchar, + pub dstirq: ::std::os::raw::c_uchar, +} + +pub const MP_IRQ_SOURCE_TYPES_MP_INT: ::std::os::raw::c_uint = 0; +pub const MP_IRQ_SOURCE_TYPES_MP_NMI: ::std::os::raw::c_uint = 1; +pub const MP_IRQ_SOURCE_TYPES_MP_EXT_INT: ::std::os::raw::c_uint = 3; + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_lintsrc { + pub type_: ::std::os::raw::c_uchar, + pub irqtype: ::std::os::raw::c_uchar, + pub irqflag: ::std::os::raw::c_ushort, + pub srcbusid: ::std::os::raw::c_uchar, + pub srcbusirq: ::std::os::raw::c_uchar, + pub destapic: ::std::os::raw::c_uchar, + pub destapiclint: ::std::os::raw::c_uchar, +} + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct mpc_oemtable { + pub signature: [::std::os::raw::c_char; 4usize], + pub length: ::std::os::raw::c_ushort, + pub rev: ::std::os::raw::c_char, + pub checksum: ::std::os::raw::c_char, + pub mpc: [::std::os::raw::c_char; 8usize], +} diff --git a/arch/src/x86_64/mptable.rs b/arch/src/x86_64/mptable.rs index 289a0c121..244c4d53b 100644 --- a/arch/src/x86_64/mptable.rs +++ b/arch/src/x86_64/mptable.rs @@ -5,15 +5,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-BSD-3-Clause file. +use crate::x86_64::mpspec; +use layout::{APIC_START, HIGH_RAM_START, IOAPIC_START}; +use libc::c_char; use std::io; use std::mem; use std::result; use std::slice; - -use libc::c_char; - -use arch_gen::x86::mpspec; -use layout::{APIC_START, HIGH_RAM_START, IOAPIC_START}; use vm_memory::{ Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError, GuestMemoryMmap, }; @@ -222,7 +220,7 @@ pub fn setup_mptable(offset: GuestAddress, mem: &GuestMemoryMmap, num_cpus: u8) let size = mem::size_of::(); let mut mpc_intsrc = MpcIntsrcWrapper(mpspec::mpc_intsrc::default()); mpc_intsrc.0.type_ = mpspec::MP_INTSRC as u8; - mpc_intsrc.0.irqtype = mpspec::mp_irq_source_types_mp_INT as u8; + mpc_intsrc.0.irqtype = mpspec::MP_IRQ_SOURCE_TYPES_MP_INT as u8; mpc_intsrc.0.irqflag = mpspec::MP_IRQDIR_DEFAULT as u16; mpc_intsrc.0.srcbus = 0; mpc_intsrc.0.srcbusirq = i; @@ -237,7 +235,7 @@ pub fn setup_mptable(offset: GuestAddress, mem: &GuestMemoryMmap, num_cpus: u8) let size = mem::size_of::(); let mut mpc_lintsrc = MpcLintsrcWrapper(mpspec::mpc_lintsrc::default()); mpc_lintsrc.0.type_ = mpspec::MP_LINTSRC as u8; - mpc_lintsrc.0.irqtype = mpspec::mp_irq_source_types_mp_ExtINT as u8; + mpc_lintsrc.0.irqtype = mpspec::MP_IRQ_SOURCE_TYPES_MP_EXT_INT as u8; mpc_lintsrc.0.irqflag = mpspec::MP_IRQDIR_DEFAULT as u16; mpc_lintsrc.0.srcbusid = 0; mpc_lintsrc.0.srcbusirq = 0; @@ -252,7 +250,7 @@ pub fn setup_mptable(offset: GuestAddress, mem: &GuestMemoryMmap, num_cpus: u8) let size = mem::size_of::(); let mut mpc_lintsrc = MpcLintsrcWrapper(mpspec::mpc_lintsrc::default()); mpc_lintsrc.0.type_ = mpspec::MP_LINTSRC as u8; - mpc_lintsrc.0.irqtype = mpspec::mp_irq_source_types_mp_NMI as u8; + mpc_lintsrc.0.irqtype = mpspec::MP_IRQ_SOURCE_TYPES_MP_NMI as u8; mpc_lintsrc.0.irqflag = mpspec::MP_IRQDIR_DEFAULT as u16; mpc_lintsrc.0.srcbusid = 0; mpc_lintsrc.0.srcbusirq = 0; diff --git a/arch_gen/Cargo.lock b/arch_gen/Cargo.lock deleted file mode 100644 index 5835454d0..000000000 --- a/arch_gen/Cargo.lock +++ /dev/null @@ -1,6 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "arch_gen" -version = "0.1.0" - diff --git a/arch_gen/Cargo.toml b/arch_gen/Cargo.toml deleted file mode 100644 index 022653f80..000000000 --- a/arch_gen/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "arch_gen" -version = "0.1.0" -authors = ["Amazon firecracker team "] - -[dependencies] - diff --git a/arch_gen/src/lib.rs b/arch_gen/src/lib.rs deleted file mode 100644 index 636064503..000000000 --- a/arch_gen/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub mod x86; diff --git a/arch_gen/src/x86/mod.rs b/arch_gen/src/x86/mod.rs deleted file mode 100644 index fda4a2b7a..000000000 --- a/arch_gen/src/x86/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// -// 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 LICENSE-BSD-3-Clause file. - -#[allow(non_upper_case_globals)] -#[allow(non_camel_case_types)] -#[allow(non_snake_case)] -#[allow(non_camel_case_types)] -#[allow(non_upper_case_globals)] -#[allow(clippy::unreadable_literal, clippy::redundant_static_lifetimes)] -pub mod mpspec; diff --git a/arch_gen/src/x86/mpspec.rs b/arch_gen/src/x86/mpspec.rs deleted file mode 100644 index 23246cb7d..000000000 --- a/arch_gen/src/x86/mpspec.rs +++ /dev/null @@ -1,832 +0,0 @@ -// 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 LICENSE-BSD-3-Clause file. - -/* automatically generated by rust-bindgen */ - -pub const MPC_SIGNATURE: &'static [u8; 5usize] = b"PCMP\x00"; -pub const MP_PROCESSOR: ::std::os::raw::c_uint = 0; -pub const MP_BUS: ::std::os::raw::c_uint = 1; -pub const MP_IOAPIC: ::std::os::raw::c_uint = 2; -pub const MP_INTSRC: ::std::os::raw::c_uint = 3; -pub const MP_LINTSRC: ::std::os::raw::c_uint = 4; -pub const MP_TRANSLATION: ::std::os::raw::c_uint = 192; -pub const CPU_ENABLED: ::std::os::raw::c_uint = 1; -pub const CPU_BOOTPROCESSOR: ::std::os::raw::c_uint = 2; -pub const CPU_STEPPING_MASK: ::std::os::raw::c_uint = 15; -pub const CPU_MODEL_MASK: ::std::os::raw::c_uint = 240; -pub const CPU_FAMILY_MASK: ::std::os::raw::c_uint = 3840; -pub const BUSTYPE_EISA: &'static [u8; 5usize] = b"EISA\x00"; -pub const BUSTYPE_ISA: &'static [u8; 4usize] = b"ISA\x00"; -pub const BUSTYPE_INTERN: &'static [u8; 7usize] = b"INTERN\x00"; -pub const BUSTYPE_MCA: &'static [u8; 4usize] = b"MCA\x00"; -pub const BUSTYPE_VL: &'static [u8; 3usize] = b"VL\x00"; -pub const BUSTYPE_PCI: &'static [u8; 4usize] = b"PCI\x00"; -pub const BUSTYPE_PCMCIA: &'static [u8; 7usize] = b"PCMCIA\x00"; -pub const BUSTYPE_CBUS: &'static [u8; 5usize] = b"CBUS\x00"; -pub const BUSTYPE_CBUSII: &'static [u8; 7usize] = b"CBUSII\x00"; -pub const BUSTYPE_FUTURE: &'static [u8; 7usize] = b"FUTURE\x00"; -pub const BUSTYPE_MBI: &'static [u8; 4usize] = b"MBI\x00"; -pub const BUSTYPE_MBII: &'static [u8; 5usize] = b"MBII\x00"; -pub const BUSTYPE_MPI: &'static [u8; 4usize] = b"MPI\x00"; -pub const BUSTYPE_MPSA: &'static [u8; 5usize] = b"MPSA\x00"; -pub const BUSTYPE_NUBUS: &'static [u8; 6usize] = b"NUBUS\x00"; -pub const BUSTYPE_TC: &'static [u8; 3usize] = b"TC\x00"; -pub const BUSTYPE_VME: &'static [u8; 4usize] = b"VME\x00"; -pub const BUSTYPE_XPRESS: &'static [u8; 7usize] = b"XPRESS\x00"; -pub const MPC_APIC_USABLE: ::std::os::raw::c_uint = 1; -pub const MP_IRQDIR_DEFAULT: ::std::os::raw::c_uint = 0; -pub const MP_IRQDIR_HIGH: ::std::os::raw::c_uint = 1; -pub const MP_IRQDIR_LOW: ::std::os::raw::c_uint = 3; -pub const MP_APIC_ALL: ::std::os::raw::c_uint = 255; -pub const MPC_OEM_SIGNATURE: &'static [u8; 5usize] = b"_OEM\x00"; -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpf_intel { - pub signature: [::std::os::raw::c_char; 4usize], - pub physptr: ::std::os::raw::c_uint, - pub length: ::std::os::raw::c_uchar, - pub specification: ::std::os::raw::c_uchar, - pub checksum: ::std::os::raw::c_uchar, - pub feature1: ::std::os::raw::c_uchar, - pub feature2: ::std::os::raw::c_uchar, - pub feature3: ::std::os::raw::c_uchar, - pub feature4: ::std::os::raw::c_uchar, - pub feature5: ::std::os::raw::c_uchar, -} -#[test] -fn bindgen_test_layout_mpf_intel() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(mpf_intel)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(mpf_intel)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).signature as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(signature) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).physptr as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(physptr) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).length as *const _ as usize }, - 8usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(length) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).specification as *const _ as usize }, - 9usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(specification) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).checksum as *const _ as usize }, - 10usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(checksum) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).feature1 as *const _ as usize }, - 11usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature1) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).feature2 as *const _ as usize }, - 12usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature2) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).feature3 as *const _ as usize }, - 13usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature3) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).feature4 as *const _ as usize }, - 14usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature4) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).feature5 as *const _ as usize }, - 15usize, - concat!( - "Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature5) - ) - ); -} -impl Clone for mpf_intel { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_table { - pub signature: [::std::os::raw::c_char; 4usize], - pub length: ::std::os::raw::c_ushort, - pub spec: ::std::os::raw::c_char, - pub checksum: ::std::os::raw::c_char, - pub oem: [::std::os::raw::c_char; 8usize], - pub productid: [::std::os::raw::c_char; 12usize], - pub oemptr: ::std::os::raw::c_uint, - pub oemsize: ::std::os::raw::c_ushort, - pub oemcount: ::std::os::raw::c_ushort, - pub lapic: ::std::os::raw::c_uint, - pub reserved: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout_mpc_table() { - assert_eq!( - ::std::mem::size_of::(), - 44usize, - concat!("Size of: ", stringify!(mpc_table)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(mpc_table)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).signature as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(signature) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).length as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(length) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).spec as *const _ as usize }, - 6usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(spec) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).checksum as *const _ as usize }, - 7usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(checksum) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).oem as *const _ as usize }, - 8usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oem) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).productid as *const _ as usize }, - 16usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(productid) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).oemptr as *const _ as usize }, - 28usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemptr) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).oemsize as *const _ as usize }, - 32usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemsize) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).oemcount as *const _ as usize }, - 34usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemcount) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).lapic as *const _ as usize }, - 36usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(lapic) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).reserved as *const _ as usize }, - 40usize, - concat!( - "Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(reserved) - ) - ); -} -impl Clone for mpc_table { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_cpu { - pub type_: ::std::os::raw::c_uchar, - pub apicid: ::std::os::raw::c_uchar, - pub apicver: ::std::os::raw::c_uchar, - pub cpuflag: ::std::os::raw::c_uchar, - pub cpufeature: ::std::os::raw::c_uint, - pub featureflag: ::std::os::raw::c_uint, - pub reserved: [::std::os::raw::c_uint; 2usize], -} -#[test] -fn bindgen_test_layout_mpc_cpu() { - assert_eq!( - ::std::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(mpc_cpu)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(mpc_cpu)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).type_ as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).apicid as *const _ as usize }, - 1usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(apicid) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).apicver as *const _ as usize }, - 2usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(apicver) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).cpuflag as *const _ as usize }, - 3usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(cpuflag) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).cpufeature as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(cpufeature) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).featureflag as *const _ as usize }, - 8usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(featureflag) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).reserved as *const _ as usize }, - 12usize, - concat!( - "Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(reserved) - ) - ); -} -impl Clone for mpc_cpu { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_bus { - pub type_: ::std::os::raw::c_uchar, - pub busid: ::std::os::raw::c_uchar, - pub bustype: [::std::os::raw::c_uchar; 6usize], -} -#[test] -fn bindgen_test_layout_mpc_bus() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(mpc_bus)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(mpc_bus)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).type_ as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).busid as *const _ as usize }, - 1usize, - concat!( - "Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(busid) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).bustype as *const _ as usize }, - 2usize, - concat!( - "Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(bustype) - ) - ); -} -impl Clone for mpc_bus { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_ioapic { - pub type_: ::std::os::raw::c_uchar, - pub apicid: ::std::os::raw::c_uchar, - pub apicver: ::std::os::raw::c_uchar, - pub flags: ::std::os::raw::c_uchar, - pub apicaddr: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout_mpc_ioapic() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(mpc_ioapic)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(mpc_ioapic)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).type_ as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).apicid as *const _ as usize }, - 1usize, - concat!( - "Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicid) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).apicver as *const _ as usize }, - 2usize, - concat!( - "Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicver) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).flags as *const _ as usize }, - 3usize, - concat!( - "Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).apicaddr as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicaddr) - ) - ); -} -impl Clone for mpc_ioapic { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_intsrc { - pub type_: ::std::os::raw::c_uchar, - pub irqtype: ::std::os::raw::c_uchar, - pub irqflag: ::std::os::raw::c_ushort, - pub srcbus: ::std::os::raw::c_uchar, - pub srcbusirq: ::std::os::raw::c_uchar, - pub dstapic: ::std::os::raw::c_uchar, - pub dstirq: ::std::os::raw::c_uchar, -} -#[test] -fn bindgen_test_layout_mpc_intsrc() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(mpc_intsrc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(mpc_intsrc)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).type_ as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).irqtype as *const _ as usize }, - 1usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(irqtype) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).irqflag as *const _ as usize }, - 2usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(irqflag) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).srcbus as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(srcbus) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).srcbusirq as *const _ as usize }, - 5usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(srcbusirq) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).dstapic as *const _ as usize }, - 6usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(dstapic) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).dstirq as *const _ as usize }, - 7usize, - concat!( - "Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(dstirq) - ) - ); -} -impl Clone for mpc_intsrc { - fn clone(&self) -> Self { - *self - } -} -pub const mp_irq_source_types_mp_INT: mp_irq_source_types = 0; -pub const mp_irq_source_types_mp_NMI: mp_irq_source_types = 1; -pub const mp_irq_source_types_mp_SMI: mp_irq_source_types = 2; -pub const mp_irq_source_types_mp_ExtINT: mp_irq_source_types = 3; -pub type mp_irq_source_types = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_lintsrc { - pub type_: ::std::os::raw::c_uchar, - pub irqtype: ::std::os::raw::c_uchar, - pub irqflag: ::std::os::raw::c_ushort, - pub srcbusid: ::std::os::raw::c_uchar, - pub srcbusirq: ::std::os::raw::c_uchar, - pub destapic: ::std::os::raw::c_uchar, - pub destapiclint: ::std::os::raw::c_uchar, -} -#[test] -fn bindgen_test_layout_mpc_lintsrc() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(mpc_lintsrc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(mpc_lintsrc)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).type_ as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).irqtype as *const _ as usize }, - 1usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(irqtype) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).irqflag as *const _ as usize }, - 2usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(irqflag) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).srcbusid as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(srcbusid) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).srcbusirq as *const _ as usize }, - 5usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(srcbusirq) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).destapic as *const _ as usize }, - 6usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(destapic) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).destapiclint as *const _ as usize }, - 7usize, - concat!( - "Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(destapiclint) - ) - ); -} -impl Clone for mpc_lintsrc { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[derive(Debug, Default, Copy)] -pub struct mpc_oemtable { - pub signature: [::std::os::raw::c_char; 4usize], - pub length: ::std::os::raw::c_ushort, - pub rev: ::std::os::raw::c_char, - pub checksum: ::std::os::raw::c_char, - pub mpc: [::std::os::raw::c_char; 8usize], -} -#[test] -fn bindgen_test_layout_mpc_oemtable() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(mpc_oemtable)) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(mpc_oemtable)) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).signature as *const _ as usize }, - 0usize, - concat!( - "Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(signature) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).length as *const _ as usize }, - 4usize, - concat!( - "Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(length) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).rev as *const _ as usize }, - 6usize, - concat!( - "Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(rev) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).checksum as *const _ as usize }, - 7usize, - concat!( - "Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(checksum) - ) - ); - assert_eq!( - unsafe { &(*std::ptr::null::()).mpc as *const _ as usize }, - 8usize, - concat!( - "Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(mpc) - ) - ); -} -impl Clone for mpc_oemtable { - fn clone(&self) -> Self { - *self - } -} -pub const mp_bustype_MP_BUS_ISA: mp_bustype = 1; -pub const mp_bustype_MP_BUS_EISA: mp_bustype = 2; -pub const mp_bustype_MP_BUS_PCI: mp_bustype = 3; -pub type mp_bustype = ::std::os::raw::c_uint;