diff options
author | Zach Reizner <zachr@google.com> | 2018-10-03 10:22:32 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-09 21:14:05 -0700 |
commit | 55a9e504beef368bd97e51ffd5a7fa6c034eb8ad (patch) | |
tree | 894d8685e2fdfa105ea35d1cb6cfceee06502c7a /x86_64 | |
parent | 046df60760f3b0691f23c27a7f24a96c9afe8c05 (diff) | |
download | crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar.gz crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar.bz2 crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar.lz crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar.xz crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.tar.zst crosvm-55a9e504beef368bd97e51ffd5a7fa6c034eb8ad.zip |
cargo fmt all source code
Now that cargo fmt has landed, run it over everything at once to bring rust source to the standard formatting. TEST=cargo test BUG=None Change-Id: Ic95a48725e5a40dcbd33ba6d5aef2bd01e91865b Reviewed-on: https://chromium-review.googlesource.com/1259287 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'x86_64')
-rw-r--r-- | x86_64/build.rs | 4 | ||||
-rw-r--r-- | x86_64/src/bootparam.rs | 4744 | ||||
-rw-r--r-- | x86_64/src/cpuid.rs | 73 | ||||
-rw-r--r-- | x86_64/src/gdt.rs | 15 | ||||
-rw-r--r-- | x86_64/src/interrupts.rs | 20 | ||||
-rw-r--r-- | x86_64/src/lib.rs | 321 | ||||
-rw-r--r-- | x86_64/src/mpspec.rs | 1008 | ||||
-rw-r--r-- | x86_64/src/mptable.rs | 80 | ||||
-rw-r--r-- | x86_64/src/regs.rs | 130 |
9 files changed, 3904 insertions, 2491 deletions
diff --git a/x86_64/build.rs b/x86_64/build.rs index 95b7a8c..77f3ae4 100644 --- a/x86_64/build.rs +++ b/x86_64/build.rs @@ -5,7 +5,5 @@ extern crate cc; fn main() { - cc::Build::new() - .file("host_cpuid.c") - .compile("host_cpuid"); + cc::Build::new().file("host_cpuid.c").compile("host_cpuid"); } diff --git a/x86_64/src/bootparam.rs b/x86_64/src/bootparam.rs index 2b90d35..51d6102 100644 --- a/x86_64/src/bootparam.rs +++ b/x86_64/src/bootparam.rs @@ -257,18 +257,26 @@ pub struct __kernel_fd_set { } #[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 { &(*(0 as *const __kernel_fd_set)).fds_bits as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(__kernel_fd_set), - "::", - stringify!(fds_bits))); + 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 { &(*(0 as *const __kernel_fd_set)).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); } impl Clone for __kernel_fd_set { fn clone(&self) -> Self { @@ -304,18 +312,26 @@ pub struct __kernel_fsid_t { } #[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 { &(*(0 as *const __kernel_fsid_t)).val as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(__kernel_fsid_t), - "::", - stringify!(val))); + 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 { &(*(0 as *const __kernel_fsid_t)).val as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); } impl Clone for __kernel_fsid_t { fn clone(&self) -> Self { @@ -380,222 +396,366 @@ pub struct screen_info { } #[test] fn bindgen_test_layout_screen_info() { - assert_eq!(::std::mem::size_of::<screen_info>(), - 64usize, - concat!("Size of: ", stringify!(screen_info))); - assert_eq!(::std::mem::align_of::<screen_info>(), - 1usize, - concat!("Alignment of ", stringify!(screen_info))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_x as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_x))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_y as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_y))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).ext_mem_k as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(ext_mem_k))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_page as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_page))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_mode as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_mode))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_cols as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_cols))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).flags as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(flags))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).unused2 as *const _ as usize }, - 9usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(unused2))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_ega_bx as *const _ as usize }, - 10usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_ega_bx))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).unused3 as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(unused3))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_lines as *const _ as usize }, - 14usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_lines))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_isVGA as *const _ as usize }, - 15usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_isVGA))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).orig_video_points as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(orig_video_points))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_width as *const _ as usize }, - 18usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_width))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_height as *const _ as usize }, - 20usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_height))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_depth as *const _ as usize }, - 22usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_depth))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_base as *const _ as usize }, - 24usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_base))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_size as *const _ as usize }, - 28usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_size))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).cl_magic as *const _ as usize }, - 32usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(cl_magic))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).cl_offset as *const _ as usize }, - 34usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(cl_offset))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).lfb_linelength as *const _ as usize }, - 36usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(lfb_linelength))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).red_size as *const _ as usize }, - 38usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(red_size))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).red_pos as *const _ as usize }, - 39usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(red_pos))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).green_size as *const _ as usize }, - 40usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(green_size))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).green_pos as *const _ as usize }, - 41usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(green_pos))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).blue_size as *const _ as usize }, - 42usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(blue_size))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).blue_pos as *const _ as usize }, - 43usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(blue_pos))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).rsvd_size as *const _ as usize }, - 44usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(rsvd_size))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).rsvd_pos as *const _ as usize }, - 45usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(rsvd_pos))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).vesapm_seg as *const _ as usize }, - 46usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(vesapm_seg))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).vesapm_off as *const _ as usize }, - 48usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(vesapm_off))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).pages as *const _ as usize }, - 50usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(pages))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).vesa_attributes as *const _ as usize }, - 52usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(vesa_attributes))); - assert_eq!(unsafe { &(*(0 as *const screen_info)).capabilities as *const _ as usize }, - 54usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(capabilities))); - assert_eq!(unsafe { &(*(0 as *const screen_info))._reserved as *const _ as usize }, - 58usize, - concat!("Alignment of field: ", - stringify!(screen_info), - "::", - stringify!(_reserved))); + assert_eq!( + ::std::mem::size_of::<screen_info>(), + 64usize, + concat!("Size of: ", stringify!(screen_info)) + ); + assert_eq!( + ::std::mem::align_of::<screen_info>(), + 1usize, + concat!("Alignment of ", stringify!(screen_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_x as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_x) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_y as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_y) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).ext_mem_k as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(ext_mem_k) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_page as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_page) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_mode as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_mode) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_cols as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_cols) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).flags as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).unused2 as *const _ as usize }, + 9usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(unused2) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_ega_bx as *const _ as usize }, + 10usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_ega_bx) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).unused3 as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(unused3) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_lines as *const _ as usize }, + 14usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_lines) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_isVGA as *const _ as usize }, + 15usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_isVGA) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).orig_video_points as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(orig_video_points) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_width as *const _ as usize }, + 18usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_width) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_height as *const _ as usize }, + 20usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_height) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_depth as *const _ as usize }, + 22usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_depth) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_base as *const _ as usize }, + 24usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_base) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_size as *const _ as usize }, + 28usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).cl_magic as *const _ as usize }, + 32usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(cl_magic) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).cl_offset as *const _ as usize }, + 34usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(cl_offset) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).lfb_linelength as *const _ as usize }, + 36usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(lfb_linelength) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).red_size as *const _ as usize }, + 38usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(red_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).red_pos as *const _ as usize }, + 39usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(red_pos) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).green_size as *const _ as usize }, + 40usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(green_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).green_pos as *const _ as usize }, + 41usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(green_pos) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).blue_size as *const _ as usize }, + 42usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(blue_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).blue_pos as *const _ as usize }, + 43usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(blue_pos) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).rsvd_size as *const _ as usize }, + 44usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(rsvd_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).rsvd_pos as *const _ as usize }, + 45usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(rsvd_pos) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).vesapm_seg as *const _ as usize }, + 46usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(vesapm_seg) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).vesapm_off as *const _ as usize }, + 48usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(vesapm_off) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).pages as *const _ as usize }, + 50usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(pages) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).vesa_attributes as *const _ as usize }, + 52usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(vesa_attributes) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info)).capabilities as *const _ as usize }, + 54usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(capabilities) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const screen_info))._reserved as *const _ as usize }, + 58usize, + concat!( + "Alignment of field: ", + stringify!(screen_info), + "::", + stringify!(_reserved) + ) + ); } impl Clone for screen_info { fn clone(&self) -> Self { @@ -619,66 +779,106 @@ pub struct apm_bios_info { } #[test] fn bindgen_test_layout_apm_bios_info() { - assert_eq!(::std::mem::size_of::<apm_bios_info>(), - 20usize, - concat!("Size of: ", stringify!(apm_bios_info))); - assert_eq!(::std::mem::align_of::<apm_bios_info>(), - 4usize, - concat!("Alignment of ", stringify!(apm_bios_info))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).version as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(version))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).cseg as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(cseg))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).offset as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(offset))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).cseg_16 as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(cseg_16))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).dseg as *const _ as usize }, - 10usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(dseg))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).flags as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(flags))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).cseg_len as *const _ as usize }, - 14usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(cseg_len))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).cseg_16_len as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(cseg_16_len))); - assert_eq!(unsafe { &(*(0 as *const apm_bios_info)).dseg_len as *const _ as usize }, - 18usize, - concat!("Alignment of field: ", - stringify!(apm_bios_info), - "::", - stringify!(dseg_len))); + assert_eq!( + ::std::mem::size_of::<apm_bios_info>(), + 20usize, + concat!("Size of: ", stringify!(apm_bios_info)) + ); + assert_eq!( + ::std::mem::align_of::<apm_bios_info>(), + 4usize, + concat!("Alignment of ", stringify!(apm_bios_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).version as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).cseg as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(cseg) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).offset as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(offset) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).cseg_16 as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(cseg_16) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).dseg as *const _ as usize }, + 10usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(dseg) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).flags as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).cseg_len as *const _ as usize }, + 14usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(cseg_len) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).cseg_16_len as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(cseg_16_len) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const apm_bios_info)).dseg_len as *const _ as usize }, + 18usize, + concat!( + "Alignment of field: ", + stringify!(apm_bios_info), + "::", + stringify!(dseg_len) + ) + ); } impl Clone for apm_bios_info { fn clone(&self) -> Self { @@ -727,41 +927,61 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_1 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_1>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_1>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).base_address as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(base_address))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).reserved1 as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).reserved2 as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(reserved2))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_1>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_1>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).base_address as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(base_address) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).reserved1 as *const _ + as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_1)).reserved2 as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(reserved2) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { @@ -779,59 +999,86 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_2 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_2() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_2>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_2>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).bus as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(bus))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).slot as - *const _ as usize - }, - 1usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(slot))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).function as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(function))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).channel as - *const _ as usize - }, - 3usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(channel))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).reserved as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_2>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_2>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).bus as *const _ as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(bus) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).slot as *const _ + as usize + }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(slot) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).function as *const _ + as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(function) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).channel as *const _ + as usize + }, + 3usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(channel) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_2)).reserved as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_2 { fn clone(&self) -> Self { @@ -845,23 +1092,35 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_3 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_3() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_3>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_3>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_3)).reserved as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_3>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_3>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_3)).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_3 { fn clone(&self) -> Self { @@ -875,23 +1134,35 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_4 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_4() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_4>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_4>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_4)).reserved as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_4>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_4>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_4)).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_4), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_4 { fn clone(&self) -> Self { @@ -905,23 +1176,35 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_5 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_5() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_5>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_5>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_5)).reserved as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_5>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_5>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_5)).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_5), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_5 { fn clone(&self) -> Self { @@ -935,23 +1218,35 @@ pub struct edd_device_params__bindgen_ty_1__bindgen_ty_6 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1__bindgen_ty_6() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_6>(), - 8usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_6>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_6)).reserved as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1__bindgen_ty_6>(), + 8usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1__bindgen_ty_6>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_1__bindgen_ty_6)).reserved as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1__bindgen_ty_6), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_6 { fn clone(&self) -> Self { @@ -960,60 +1255,76 @@ impl Clone for edd_device_params__bindgen_ty_1__bindgen_ty_6 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_1>(), - 8usize, - concat!("Size of: ", stringify!(edd_device_params__bindgen_ty_1))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_1>(), - 1usize, - concat!("Alignment of ", stringify!(edd_device_params__bindgen_ty_1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).isa as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(isa))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).pci as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(pci))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).ibnd as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(ibnd))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).xprs as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(xprs))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).htpt as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(htpt))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_1)).unknown as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_1), - "::", - stringify!(unknown))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_1>(), + 8usize, + concat!("Size of: ", stringify!(edd_device_params__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_1>(), + 1usize, + concat!("Alignment of ", stringify!(edd_device_params__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).isa as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(isa) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).pci as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(pci) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).ibnd as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(ibnd) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).xprs as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(xprs) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).htpt as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(htpt) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_1)).unknown as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_1), + "::", + stringify!(unknown) + ) + ); } impl Clone for edd_device_params__bindgen_ty_1 { fn clone(&self) -> Self { @@ -1046,59 +1357,87 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_1 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_1>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_1>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).device as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(device))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved1 as - *const _ as usize - }, - 1usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved2 as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(reserved2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved3 as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(reserved3))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved4 as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(reserved4))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_1>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_1>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).device as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(device) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved1 as *const _ + as usize + }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved2 as *const _ + as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved3 as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_1)).reserved4 as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(reserved4) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_1 { fn clone(&self) -> Self { @@ -1117,68 +1456,99 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_2 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_2() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_2>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_2>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).device as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(device))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).lun as - *const _ as usize - }, - 1usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(lun))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved1 as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved2 as - *const _ as usize - }, - 3usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(reserved2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved3 as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(reserved3))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved4 as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), - "::", - stringify!(reserved4))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_2>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_2>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).device as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(device) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).lun as *const _ as usize + }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(lun) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved1 as *const _ + as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved2 as *const _ + as usize + }, + 3usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved3 as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_2)).reserved4 as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_2), + "::", + stringify!(reserved4) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_2 { fn clone(&self) -> Self { @@ -1195,50 +1565,72 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_3 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_3() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_3>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_3>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).id as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), - "::", - stringify!(id))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).lun as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), - "::", - stringify!(lun))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).reserved1 as - *const _ as usize - }, - 10usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).reserved2 as - *const _ as usize - }, - 12usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), - "::", - stringify!(reserved2))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_3>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_3>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).id as *const _ as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).lun as *const _ as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), + "::", + stringify!(lun) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).reserved1 as *const _ + as usize + }, + 10usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_3)).reserved2 as *const _ + as usize + }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_3), + "::", + stringify!(reserved2) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_3 { fn clone(&self) -> Self { @@ -1253,32 +1645,48 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_4 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_4() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_4>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_4>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_4)).serial_number as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4), - "::", - stringify!(serial_number))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_4)).reserved as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_4>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_4>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_4)).serial_number + as *const _ as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4), + "::", + stringify!(serial_number) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_4)).reserved as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_4), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_4 { fn clone(&self) -> Self { @@ -1293,32 +1701,47 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_5 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_5() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_5>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_5>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_5)).eui as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5), - "::", - stringify!(eui))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_5)).reserved as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_5>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_5>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_5)).eui as *const _ as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5), + "::", + stringify!(eui) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_5)).reserved as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_5), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_5 { fn clone(&self) -> Self { @@ -1333,32 +1756,47 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_6 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_6() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_6>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_6>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_6)).wwid as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6), - "::", - stringify!(wwid))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_6)).lun as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6), - "::", - stringify!(lun))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_6>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_6>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_6)).wwid as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6), + "::", + stringify!(wwid) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_6)).lun as *const _ as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_6), + "::", + stringify!(lun) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_6 { fn clone(&self) -> Self { @@ -1373,32 +1811,48 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_7 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_7() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_7>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_7>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_7)).identity_tag as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7), - "::", - stringify!(identity_tag))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_7)).reserved as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_7>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_7>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_7)).identity_tag as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7), + "::", + stringify!(identity_tag) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_7)).reserved as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_7), + "::", + stringify!(reserved) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_7 { fn clone(&self) -> Self { @@ -1414,41 +1868,61 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_8 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_8() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_8>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_8>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).array_number as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), - "::", - stringify!(array_number))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).reserved1 as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).reserved2 as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), - "::", - stringify!(reserved2))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_8>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_8>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).array_number as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), + "::", + stringify!(array_number) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).reserved1 as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_8)).reserved2 as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_8), + "::", + stringify!(reserved2) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_8 { fn clone(&self) -> Self { @@ -1466,59 +1940,87 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_9 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_9() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_9>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_9>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).device as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), - "::", - stringify!(device))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved1 as - *const _ as usize - }, - 1usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved2 as - *const _ as usize - }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), - "::", - stringify!(reserved2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved3 as - *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), - "::", - stringify!(reserved3))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved4 as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), - "::", - stringify!(reserved4))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_9>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_9>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).device as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), + "::", + stringify!(device) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved1 as *const _ + as usize + }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved2 as *const _ + as usize + }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved3 as *const _ + as usize + }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_9)).reserved4 as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_9), + "::", + stringify!(reserved4) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_9 { fn clone(&self) -> Self { @@ -1533,32 +2035,48 @@ pub struct edd_device_params__bindgen_ty_2__bindgen_ty_10 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2__bindgen_ty_10() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_10>(), - 16usize, - concat!("Size of: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_10>(), - 1usize, - concat!("Alignment of ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_10)).reserved1 as - *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10), - "::", - stringify!(reserved1))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_10)).reserved2 as - *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10), - "::", - stringify!(reserved2))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2__bindgen_ty_10>(), + 16usize, + concat!( + "Size of: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10) + ) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2__bindgen_ty_10>(), + 1usize, + concat!( + "Alignment of ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_10)).reserved1 as *const _ + as usize + }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(0 as *const edd_device_params__bindgen_ty_2__bindgen_ty_10)).reserved2 as *const _ + as usize + }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2__bindgen_ty_10), + "::", + stringify!(reserved2) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_10 { fn clone(&self) -> Self { @@ -1567,92 +2085,116 @@ impl Clone for edd_device_params__bindgen_ty_2__bindgen_ty_10 { } #[test] fn bindgen_test_layout_edd_device_params__bindgen_ty_2() { - assert_eq!(::std::mem::size_of::<edd_device_params__bindgen_ty_2>(), - 16usize, - concat!("Size of: ", stringify!(edd_device_params__bindgen_ty_2))); - assert_eq!(::std::mem::align_of::<edd_device_params__bindgen_ty_2>(), - 1usize, - concat!("Alignment of ", stringify!(edd_device_params__bindgen_ty_2))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).ata as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(ata))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).atapi as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(atapi))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).scsi as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(scsi))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).usb as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(usb))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).i1394 as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(i1394))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).fibre as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(fibre))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).i2o as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(i2o))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).raid as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(raid))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).sata as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(sata))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params__bindgen_ty_2)).unknown as *const _ as usize - }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params__bindgen_ty_2), - "::", - stringify!(unknown))); + assert_eq!( + ::std::mem::size_of::<edd_device_params__bindgen_ty_2>(), + 16usize, + concat!("Size of: ", stringify!(edd_device_params__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params__bindgen_ty_2>(), + 1usize, + concat!("Alignment of ", stringify!(edd_device_params__bindgen_ty_2)) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).ata as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(ata) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).atapi as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(atapi) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).scsi as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(scsi) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).usb as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(usb) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).i1394 as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(i1394) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).fibre as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(fibre) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).i2o as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(i2o) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).raid as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(raid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).sata as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(sata) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params__bindgen_ty_2)).unknown as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params__bindgen_ty_2), + "::", + stringify!(unknown) + ) + ); } impl Clone for edd_device_params__bindgen_ty_2 { fn clone(&self) -> Self { @@ -1661,132 +2203,196 @@ impl Clone for edd_device_params__bindgen_ty_2 { } #[test] fn bindgen_test_layout_edd_device_params() { - assert_eq!(::std::mem::size_of::<edd_device_params>(), - 74usize, - concat!("Size of: ", stringify!(edd_device_params))); - assert_eq!(::std::mem::align_of::<edd_device_params>(), - 1usize, - concat!("Alignment of ", stringify!(edd_device_params))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).length as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(length))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).info_flags as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(info_flags))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).num_default_cylinders as *const _ as usize - }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(num_default_cylinders))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).num_default_heads as *const _ as usize - }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(num_default_heads))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).sectors_per_track as *const _ as usize - }, - 12usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(sectors_per_track))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).number_of_sectors as *const _ as usize - }, - 16usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(number_of_sectors))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).bytes_per_sector as *const _ as usize - }, - 24usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(bytes_per_sector))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).dpte_ptr as *const _ as usize }, - 26usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(dpte_ptr))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).key as *const _ as usize }, - 30usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(key))); - assert_eq!(unsafe { - &(*(0 as *const edd_device_params)).device_path_info_length as *const _ as usize - }, - 32usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(device_path_info_length))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).reserved2 as *const _ as usize }, - 33usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(reserved2))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).reserved3 as *const _ as usize }, - 34usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(reserved3))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).host_bus_type as *const _ as usize }, - 36usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(host_bus_type))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).interface_type as *const _ as usize }, - 40usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(interface_type))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).interface_path as *const _ as usize }, - 48usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(interface_path))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).device_path as *const _ as usize }, - 56usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(device_path))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).reserved4 as *const _ as usize }, - 72usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(reserved4))); - assert_eq!(unsafe { &(*(0 as *const edd_device_params)).checksum as *const _ as usize }, - 73usize, - concat!("Alignment of field: ", - stringify!(edd_device_params), - "::", - stringify!(checksum))); + assert_eq!( + ::std::mem::size_of::<edd_device_params>(), + 74usize, + concat!("Size of: ", stringify!(edd_device_params)) + ); + assert_eq!( + ::std::mem::align_of::<edd_device_params>(), + 1usize, + concat!("Alignment of ", stringify!(edd_device_params)) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).length as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).info_flags as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(info_flags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).num_default_cylinders as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(num_default_cylinders) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).num_default_heads as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(num_default_heads) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).sectors_per_track as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(sectors_per_track) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).number_of_sectors as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(number_of_sectors) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).bytes_per_sector as *const _ as usize }, + 24usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(bytes_per_sector) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).dpte_ptr as *const _ as usize }, + 26usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(dpte_ptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).key as *const _ as usize }, + 30usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(key) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).device_path_info_length as *const _ as usize }, + 32usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(device_path_info_length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).reserved2 as *const _ as usize }, + 33usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).reserved3 as *const _ as usize }, + 34usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).host_bus_type as *const _ as usize }, + 36usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(host_bus_type) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).interface_type as *const _ as usize }, + 40usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(interface_type) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).interface_path as *const _ as usize }, + 48usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(interface_path) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).device_path as *const _ as usize }, + 56usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(device_path) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).reserved4 as *const _ as usize }, + 72usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(reserved4) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_device_params)).checksum as *const _ as usize }, + 73usize, + concat!( + "Alignment of field: ", + stringify!(edd_device_params), + "::", + stringify!(checksum) + ) + ); } impl Clone for edd_device_params { fn clone(&self) -> Self { @@ -1806,54 +2412,86 @@ pub struct edd_info { } #[test] fn bindgen_test_layout_edd_info() { - assert_eq!(::std::mem::size_of::<edd_info>(), - 82usize, - concat!("Size of: ", stringify!(edd_info))); - assert_eq!(::std::mem::align_of::<edd_info>(), - 1usize, - concat!("Alignment of ", stringify!(edd_info))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).device as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(device))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).version as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(version))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).interface_support as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(interface_support))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).legacy_max_cylinder as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(legacy_max_cylinder))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).legacy_max_head as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(legacy_max_head))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).legacy_sectors_per_track as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(legacy_sectors_per_track))); - assert_eq!(unsafe { &(*(0 as *const edd_info)).params as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(edd_info), - "::", - stringify!(params))); + assert_eq!( + ::std::mem::size_of::<edd_info>(), + 82usize, + concat!("Size of: ", stringify!(edd_info)) + ); + assert_eq!( + ::std::mem::align_of::<edd_info>(), + 1usize, + concat!("Alignment of ", stringify!(edd_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).device as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(device) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).version as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).interface_support as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(interface_support) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).legacy_max_cylinder as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(legacy_max_cylinder) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).legacy_max_head as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(legacy_max_head) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).legacy_sectors_per_track as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(legacy_sectors_per_track) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd_info)).params as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(edd_info), + "::", + stringify!(params) + ) + ); } impl Clone for edd_info { fn clone(&self) -> Self { @@ -1870,36 +2508,56 @@ pub struct edd { } #[test] fn bindgen_test_layout_edd() { - assert_eq!(::std::mem::size_of::<edd>(), - 560usize, - concat!("Size of: ", stringify!(edd))); - assert_eq!(::std::mem::align_of::<edd>(), - 4usize, - concat!("Alignment of ", stringify!(edd))); - assert_eq!(unsafe { &(*(0 as *const edd)).mbr_signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(edd), - "::", - stringify!(mbr_signature))); - assert_eq!(unsafe { &(*(0 as *const edd)).edd_info as *const _ as usize }, - 64usize, - concat!("Alignment of field: ", - stringify!(edd), - "::", - stringify!(edd_info))); - assert_eq!(unsafe { &(*(0 as *const edd)).mbr_signature_nr as *const _ as usize }, - 556usize, - concat!("Alignment of field: ", - stringify!(edd), - "::", - stringify!(mbr_signature_nr))); - assert_eq!(unsafe { &(*(0 as *const edd)).edd_info_nr as *const _ as usize }, - 557usize, - concat!("Alignment of field: ", - stringify!(edd), - "::", - stringify!(edd_info_nr))); + assert_eq!( + ::std::mem::size_of::<edd>(), + 560usize, + concat!("Size of: ", stringify!(edd)) + ); + assert_eq!( + ::std::mem::align_of::<edd>(), + 4usize, + concat!("Alignment of ", stringify!(edd)) + ); + assert_eq!( + unsafe { &(*(0 as *const edd)).mbr_signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edd), + "::", + stringify!(mbr_signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd)).edd_info as *const _ as usize }, + 64usize, + concat!( + "Alignment of field: ", + stringify!(edd), + "::", + stringify!(edd_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd)).mbr_signature_nr as *const _ as usize }, + 556usize, + concat!( + "Alignment of field: ", + stringify!(edd), + "::", + stringify!(mbr_signature_nr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const edd)).edd_info_nr as *const _ as usize }, + 557usize, + concat!( + "Alignment of field: ", + stringify!(edd), + "::", + stringify!(edd_info_nr) + ) + ); } impl Clone for edd { fn clone(&self) -> Self { @@ -1915,30 +2573,46 @@ pub struct e820entry { } #[test] fn bindgen_test_layout_e820entry() { - assert_eq!(::std::mem::size_of::<e820entry>(), - 20usize, - concat!("Size of: ", stringify!(e820entry))); - assert_eq!(::std::mem::align_of::<e820entry>(), - 1usize, - concat!("Alignment of ", stringify!(e820entry))); - assert_eq!(unsafe { &(*(0 as *const e820entry)).addr as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(e820entry), - "::", - stringify!(addr))); - assert_eq!(unsafe { &(*(0 as *const e820entry)).size as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(e820entry), - "::", - stringify!(size))); - assert_eq!(unsafe { &(*(0 as *const e820entry)).type_ as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(e820entry), - "::", - stringify!(type_))); + assert_eq!( + ::std::mem::size_of::<e820entry>(), + 20usize, + concat!("Size of: ", stringify!(e820entry)) + ); + assert_eq!( + ::std::mem::align_of::<e820entry>(), + 1usize, + concat!("Alignment of ", stringify!(e820entry)) + ); + assert_eq!( + unsafe { &(*(0 as *const e820entry)).addr as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(e820entry), + "::", + stringify!(addr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const e820entry)).size as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(e820entry), + "::", + stringify!(size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const e820entry)).type_ as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(e820entry), + "::", + stringify!(type_) + ) + ); } impl Clone for e820entry { fn clone(&self) -> Self { @@ -1952,24 +2626,36 @@ pub struct e820map { } #[test] fn bindgen_test_layout_e820map() { - assert_eq!(::std::mem::size_of::<e820map>(), - 2564usize, - concat!("Size of: ", stringify!(e820map))); - assert_eq!(::std::mem::align_of::<e820map>(), - 4usize, - concat!("Alignment of ", stringify!(e820map))); - assert_eq!(unsafe { &(*(0 as *const e820map)).nr_map as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(e820map), - "::", - stringify!(nr_map))); - assert_eq!(unsafe { &(*(0 as *const e820map)).map as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(e820map), - "::", - stringify!(map))); + assert_eq!( + ::std::mem::size_of::<e820map>(), + 2564usize, + concat!("Size of: ", stringify!(e820map)) + ); + assert_eq!( + ::std::mem::align_of::<e820map>(), + 4usize, + concat!("Alignment of ", stringify!(e820map)) + ); + assert_eq!( + unsafe { &(*(0 as *const e820map)).nr_map as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(e820map), + "::", + stringify!(nr_map) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const e820map)).map as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(e820map), + "::", + stringify!(map) + ) + ); } impl Default for e820map { fn default() -> Self { @@ -1986,36 +2672,56 @@ pub struct ist_info { } #[test] fn bindgen_test_layout_ist_info() { - assert_eq!(::std::mem::size_of::<ist_info>(), - 16usize, - concat!("Size of: ", stringify!(ist_info))); - assert_eq!(::std::mem::align_of::<ist_info>(), - 4usize, - concat!("Alignment of ", stringify!(ist_info))); - assert_eq!(unsafe { &(*(0 as *const ist_info)).signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(ist_info), - "::", - stringify!(signature))); - assert_eq!(unsafe { &(*(0 as *const ist_info)).command as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(ist_info), - "::", - stringify!(command))); - assert_eq!(unsafe { &(*(0 as *const ist_info)).event as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(ist_info), - "::", - stringify!(event))); - assert_eq!(unsafe { &(*(0 as *const ist_info)).perf_level as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(ist_info), - "::", - stringify!(perf_level))); + assert_eq!( + ::std::mem::size_of::<ist_info>(), + 16usize, + concat!("Size of: ", stringify!(ist_info)) + ); + assert_eq!( + ::std::mem::align_of::<ist_info>(), + 4usize, + concat!("Alignment of ", stringify!(ist_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const ist_info)).signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(ist_info), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const ist_info)).command as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(ist_info), + "::", + stringify!(command) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const ist_info)).event as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(ist_info), + "::", + stringify!(event) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const ist_info)).perf_level as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(ist_info), + "::", + stringify!(perf_level) + ) + ); } impl Clone for ist_info { fn clone(&self) -> Self { @@ -2028,18 +2734,26 @@ pub struct edid_info { } #[test] fn bindgen_test_layout_edid_info() { - assert_eq!(::std::mem::size_of::<edid_info>(), - 128usize, - concat!("Size of: ", stringify!(edid_info))); - assert_eq!(::std::mem::align_of::<edid_info>(), - 1usize, - concat!("Alignment of ", stringify!(edid_info))); - assert_eq!(unsafe { &(*(0 as *const edid_info)).dummy as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(edid_info), - "::", - stringify!(dummy))); + assert_eq!( + ::std::mem::size_of::<edid_info>(), + 128usize, + concat!("Size of: ", stringify!(edid_info)) + ); + assert_eq!( + ::std::mem::align_of::<edid_info>(), + 1usize, + concat!("Alignment of ", stringify!(edid_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const edid_info)).dummy as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(edid_info), + "::", + stringify!(dummy) + ) + ); } impl Default for edid_info { fn default() -> Self { @@ -2056,36 +2770,56 @@ pub struct setup_data { } #[test] fn bindgen_test_layout_setup_data() { - assert_eq!(::std::mem::size_of::<setup_data>(), - 16usize, - concat!("Size of: ", stringify!(setup_data))); - assert_eq!(::std::mem::align_of::<setup_data>(), - 8usize, - concat!("Alignment of ", stringify!(setup_data))); - assert_eq!(unsafe { &(*(0 as *const setup_data)).next as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(setup_data), - "::", - stringify!(next))); - assert_eq!(unsafe { &(*(0 as *const setup_data)).type_ as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(setup_data), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const setup_data)).len as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(setup_data), - "::", - stringify!(len))); - assert_eq!(unsafe { &(*(0 as *const setup_data)).data as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(setup_data), - "::", - stringify!(data))); + assert_eq!( + ::std::mem::size_of::<setup_data>(), + 16usize, + concat!("Size of: ", stringify!(setup_data)) + ); + assert_eq!( + ::std::mem::align_of::<setup_data>(), + 8usize, + concat!("Alignment of ", stringify!(setup_data)) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_data)).next as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(setup_data), + "::", + stringify!(next) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_data)).type_ as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(setup_data), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_data)).len as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(setup_data), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_data)).data as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(setup_data), + "::", + stringify!(data) + ) + ); } impl Clone for setup_data { fn clone(&self) -> Self { @@ -2136,242 +2870,396 @@ pub struct setup_header { } #[test] fn bindgen_test_layout_setup_header() { - assert_eq!(::std::mem::size_of::<setup_header>(), - 119usize, - concat!("Size of: ", stringify!(setup_header))); - assert_eq!(::std::mem::align_of::<setup_header>(), - 1usize, - concat!("Alignment of ", stringify!(setup_header))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).setup_sects as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(setup_sects))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).root_flags as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(root_flags))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).syssize as *const _ as usize }, - 3usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(syssize))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).ram_size as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(ram_size))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).vid_mode as *const _ as usize }, - 9usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(vid_mode))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).root_dev as *const _ as usize }, - 11usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(root_dev))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).boot_flag as *const _ as usize }, - 13usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(boot_flag))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).jump as *const _ as usize }, - 15usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(jump))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).header as *const _ as usize }, - 17usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(header))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).version as *const _ as usize }, - 21usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(version))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).realmode_swtch as *const _ as usize }, - 23usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(realmode_swtch))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).start_sys as *const _ as usize }, - 27usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(start_sys))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).kernel_version as *const _ as usize }, - 29usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(kernel_version))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).type_of_loader as *const _ as usize }, - 31usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(type_of_loader))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).loadflags as *const _ as usize }, - 32usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(loadflags))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).setup_move_size as *const _ as usize }, - 33usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(setup_move_size))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).code32_start as *const _ as usize }, - 35usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(code32_start))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).ramdisk_image as *const _ as usize }, - 39usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(ramdisk_image))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).ramdisk_size as *const _ as usize }, - 43usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(ramdisk_size))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).bootsect_kludge as *const _ as usize }, - 47usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(bootsect_kludge))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).heap_end_ptr as *const _ as usize }, - 51usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(heap_end_ptr))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).ext_loader_ver as *const _ as usize }, - 53usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(ext_loader_ver))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).ext_loader_type as *const _ as usize }, - 54usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(ext_loader_type))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).cmd_line_ptr as *const _ as usize }, - 55usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(cmd_line_ptr))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).initrd_addr_max as *const _ as usize }, - 59usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(initrd_addr_max))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).kernel_alignment as *const _ as usize }, - 63usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(kernel_alignment))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).relocatable_kernel as *const _ as usize }, - 67usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(relocatable_kernel))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).min_alignment as *const _ as usize }, - 68usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(min_alignment))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).xloadflags as *const _ as usize }, - 69usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(xloadflags))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).cmdline_size as *const _ as usize }, - 71usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(cmdline_size))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).hardware_subarch as *const _ as usize }, - 75usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(hardware_subarch))); - assert_eq!(unsafe { - &(*(0 as *const setup_header)).hardware_subarch_data as *const _ as usize - }, - 79usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(hardware_subarch_data))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).payload_offset as *const _ as usize }, - 87usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(payload_offset))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).payload_length as *const _ as usize }, - 91usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(payload_length))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).setup_data as *const _ as usize }, - 95usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(setup_data))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).pref_address as *const _ as usize }, - 103usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(pref_address))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).init_size as *const _ as usize }, - 111usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(init_size))); - assert_eq!(unsafe { &(*(0 as *const setup_header)).handover_offset as *const _ as usize }, - 115usize, - concat!("Alignment of field: ", - stringify!(setup_header), - "::", - stringify!(handover_offset))); + assert_eq!( + ::std::mem::size_of::<setup_header>(), + 119usize, + concat!("Size of: ", stringify!(setup_header)) + ); + assert_eq!( + ::std::mem::align_of::<setup_header>(), + 1usize, + concat!("Alignment of ", stringify!(setup_header)) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).setup_sects as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(setup_sects) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).root_flags as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(root_flags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).syssize as *const _ as usize }, + 3usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(syssize) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).ram_size as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(ram_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).vid_mode as *const _ as usize }, + 9usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(vid_mode) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).root_dev as *const _ as usize }, + 11usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(root_dev) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).boot_flag as *const _ as usize }, + 13usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(boot_flag) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).jump as *const _ as usize }, + 15usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(jump) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).header as *const _ as usize }, + 17usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(header) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).version as *const _ as usize }, + 21usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).realmode_swtch as *const _ as usize }, + 23usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(realmode_swtch) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).start_sys as *const _ as usize }, + 27usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(start_sys) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).kernel_version as *const _ as usize }, + 29usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(kernel_version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).type_of_loader as *const _ as usize }, + 31usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(type_of_loader) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).loadflags as *const _ as usize }, + 32usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(loadflags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).setup_move_size as *const _ as usize }, + 33usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(setup_move_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).code32_start as *const _ as usize }, + 35usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(code32_start) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).ramdisk_image as *const _ as usize }, + 39usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(ramdisk_image) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).ramdisk_size as *const _ as usize }, + 43usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(ramdisk_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).bootsect_kludge as *const _ as usize }, + 47usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(bootsect_kludge) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).heap_end_ptr as *const _ as usize }, + 51usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(heap_end_ptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).ext_loader_ver as *const _ as usize }, + 53usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(ext_loader_ver) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).ext_loader_type as *const _ as usize }, + 54usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(ext_loader_type) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).cmd_line_ptr as *const _ as usize }, + 55usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(cmd_line_ptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).initrd_addr_max as *const _ as usize }, + 59usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(initrd_addr_max) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).kernel_alignment as *const _ as usize }, + 63usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(kernel_alignment) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).relocatable_kernel as *const _ as usize }, + 67usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(relocatable_kernel) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).min_alignment as *const _ as usize }, + 68usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(min_alignment) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).xloadflags as *const _ as usize }, + 69usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(xloadflags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).cmdline_size as *const _ as usize }, + 71usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(cmdline_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).hardware_subarch as *const _ as usize }, + 75usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(hardware_subarch) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).hardware_subarch_data as *const _ as usize }, + 79usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(hardware_subarch_data) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).payload_offset as *const _ as usize }, + 87usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(payload_offset) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).payload_length as *const _ as usize }, + 91usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(payload_length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).setup_data as *const _ as usize }, + 95usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(setup_data) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).pref_address as *const _ as usize }, + 103usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(pref_address) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).init_size as *const _ as usize }, + 111usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(init_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const setup_header)).handover_offset as *const _ as usize }, + 115usize, + concat!( + "Alignment of field: ", + stringify!(setup_header), + "::", + stringify!(handover_offset) + ) + ); } impl Clone for setup_header { fn clone(&self) -> Self { @@ -2386,24 +3274,36 @@ pub struct sys_desc_table { } #[test] fn bindgen_test_layout_sys_desc_table() { - assert_eq!(::std::mem::size_of::<sys_desc_table>(), - 16usize, - concat!("Size of: ", stringify!(sys_desc_table))); - assert_eq!(::std::mem::align_of::<sys_desc_table>(), - 2usize, - concat!("Alignment of ", stringify!(sys_desc_table))); - assert_eq!(unsafe { &(*(0 as *const sys_desc_table)).length as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(sys_desc_table), - "::", - stringify!(length))); - assert_eq!(unsafe { &(*(0 as *const sys_desc_table)).table as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(sys_desc_table), - "::", - stringify!(table))); + assert_eq!( + ::std::mem::size_of::<sys_desc_table>(), + 16usize, + concat!("Size of: ", stringify!(sys_desc_table)) + ); + assert_eq!( + ::std::mem::align_of::<sys_desc_table>(), + 2usize, + concat!("Alignment of ", stringify!(sys_desc_table)) + ); + assert_eq!( + unsafe { &(*(0 as *const sys_desc_table)).length as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(sys_desc_table), + "::", + stringify!(length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const sys_desc_table)).table as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(sys_desc_table), + "::", + stringify!(table) + ) + ); } impl Clone for sys_desc_table { fn clone(&self) -> Self { @@ -2420,36 +3320,56 @@ pub struct olpc_ofw_header { } #[test] fn bindgen_test_layout_olpc_ofw_header() { - assert_eq!(::std::mem::size_of::<olpc_ofw_header>(), - 16usize, - concat!("Size of: ", stringify!(olpc_ofw_header))); - assert_eq!(::std::mem::align_of::<olpc_ofw_header>(), - 1usize, - concat!("Alignment of ", stringify!(olpc_ofw_header))); - assert_eq!(unsafe { &(*(0 as *const olpc_ofw_header)).ofw_magic as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(olpc_ofw_header), - "::", - stringify!(ofw_magic))); - assert_eq!(unsafe { &(*(0 as *const olpc_ofw_header)).ofw_version as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(olpc_ofw_header), - "::", - stringify!(ofw_version))); - assert_eq!(unsafe { &(*(0 as *const olpc_ofw_header)).cif_handler as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(olpc_ofw_header), - "::", - stringify!(cif_handler))); - assert_eq!(unsafe { &(*(0 as *const olpc_ofw_header)).irq_desc_table as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(olpc_ofw_header), - "::", - stringify!(irq_desc_table))); + assert_eq!( + ::std::mem::size_of::<olpc_ofw_header>(), + 16usize, + concat!("Size of: ", stringify!(olpc_ofw_header)) + ); + assert_eq!( + ::std::mem::align_of::<olpc_ofw_header>(), + 1usize, + concat!("Alignment of ", stringify!(olpc_ofw_header)) + ); + assert_eq!( + unsafe { &(*(0 as *const olpc_ofw_header)).ofw_magic as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(olpc_ofw_header), + "::", + stringify!(ofw_magic) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const olpc_ofw_header)).ofw_version as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(olpc_ofw_header), + "::", + stringify!(ofw_version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const olpc_ofw_header)).cif_handler as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(olpc_ofw_header), + "::", + stringify!(cif_handler) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const olpc_ofw_header)).irq_desc_table as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(olpc_ofw_header), + "::", + stringify!(irq_desc_table) + ) + ); } impl Clone for olpc_ofw_header { fn clone(&self) -> Self { @@ -2470,60 +3390,96 @@ pub struct efi_info { } #[test] fn bindgen_test_layout_efi_info() { - assert_eq!(::std::mem::size_of::<efi_info>(), - 32usize, - concat!("Size of: ", stringify!(efi_info))); - assert_eq!(::std::mem::align_of::<efi_info>(), - 4usize, - concat!("Alignment of ", stringify!(efi_info))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_loader_signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_loader_signature))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_systab as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_systab))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_memdesc_size as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_memdesc_size))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_memdesc_version as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_memdesc_version))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_memmap as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_memmap))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_memmap_size as *const _ as usize }, - 20usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_memmap_size))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_systab_hi as *const _ as usize }, - 24usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_systab_hi))); - assert_eq!(unsafe { &(*(0 as *const efi_info)).efi_memmap_hi as *const _ as usize }, - 28usize, - concat!("Alignment of field: ", - stringify!(efi_info), - "::", - stringify!(efi_memmap_hi))); + assert_eq!( + ::std::mem::size_of::<efi_info>(), + 32usize, + concat!("Size of: ", stringify!(efi_info)) + ); + assert_eq!( + ::std::mem::align_of::<efi_info>(), + 4usize, + concat!("Alignment of ", stringify!(efi_info)) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_loader_signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_loader_signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_systab as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_systab) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_memdesc_size as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_memdesc_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_memdesc_version as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_memdesc_version) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_memmap as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_memmap) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_memmap_size as *const _ as usize }, + 20usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_memmap_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_systab_hi as *const _ as usize }, + 24usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_systab_hi) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const efi_info)).efi_memmap_hi as *const _ as usize }, + 28usize, + concat!( + "Alignment of field: ", + stringify!(efi_info), + "::", + stringify!(efi_memmap_hi) + ) + ); } impl Clone for efi_info { fn clone(&self) -> Self { @@ -2567,206 +3523,336 @@ pub struct boot_params { } #[test] fn bindgen_test_layout_boot_params() { - assert_eq!(::std::mem::size_of::<boot_params>(), - 4096usize, - concat!("Size of: ", stringify!(boot_params))); - assert_eq!(::std::mem::align_of::<boot_params>(), - 1usize, - concat!("Alignment of ", stringify!(boot_params))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).screen_info as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(screen_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).apm_bios_info as *const _ as usize }, - 64usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(apm_bios_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad2 as *const _ as usize }, - 84usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad2))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).tboot_addr as *const _ as usize }, - 88usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(tboot_addr))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).ist_info as *const _ as usize }, - 96usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(ist_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad3 as *const _ as usize }, - 112usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad3))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).hd0_info as *const _ as usize }, - 128usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(hd0_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).hd1_info as *const _ as usize }, - 144usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(hd1_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).sys_desc_table as *const _ as usize }, - 160usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(sys_desc_table))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).olpc_ofw_header as *const _ as usize }, - 176usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(olpc_ofw_header))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).ext_ramdisk_image as *const _ as usize }, - 192usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(ext_ramdisk_image))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).ext_ramdisk_size as *const _ as usize }, - 196usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(ext_ramdisk_size))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).ext_cmd_line_ptr as *const _ as usize }, - 200usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(ext_cmd_line_ptr))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad4 as *const _ as usize }, - 204usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad4))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).edid_info as *const _ as usize }, - 320usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(edid_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).efi_info as *const _ as usize }, - 448usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(efi_info))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).alt_mem_k as *const _ as usize }, - 480usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(alt_mem_k))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).scratch as *const _ as usize }, - 484usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(scratch))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).e820_entries as *const _ as usize }, - 488usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(e820_entries))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).eddbuf_entries as *const _ as usize }, - 489usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(eddbuf_entries))); - assert_eq!(unsafe { - &(*(0 as *const boot_params)).edd_mbr_sig_buf_entries as *const _ as usize - }, - 490usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(edd_mbr_sig_buf_entries))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).kbd_status as *const _ as usize }, - 491usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(kbd_status))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad5 as *const _ as usize }, - 492usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad5))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).sentinel as *const _ as usize }, - 495usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(sentinel))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad6 as *const _ as usize }, - 496usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad6))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).hdr as *const _ as usize }, - 497usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(hdr))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad7 as *const _ as usize }, - 616usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad7))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).edd_mbr_sig_buffer as *const _ as usize }, - 656usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(edd_mbr_sig_buffer))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).e820_map as *const _ as usize }, - 720usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(e820_map))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad8 as *const _ as usize }, - 3280usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad8))); - assert_eq!(unsafe { &(*(0 as *const boot_params)).eddbuf as *const _ as usize }, - 3328usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(eddbuf))); - assert_eq!(unsafe { &(*(0 as *const boot_params))._pad9 as *const _ as usize }, - 3820usize, - concat!("Alignment of field: ", - stringify!(boot_params), - "::", - stringify!(_pad9))); + assert_eq!( + ::std::mem::size_of::<boot_params>(), + 4096usize, + concat!("Size of: ", stringify!(boot_params)) + ); + assert_eq!( + ::std::mem::align_of::<boot_params>(), + 1usize, + concat!("Alignment of ", stringify!(boot_params)) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).screen_info as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(screen_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).apm_bios_info as *const _ as usize }, + 64usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(apm_bios_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad2 as *const _ as usize }, + 84usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad2) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).tboot_addr as *const _ as usize }, + 88usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(tboot_addr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).ist_info as *const _ as usize }, + 96usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(ist_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad3 as *const _ as usize }, + 112usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad3) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).hd0_info as *const _ as usize }, + 128usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(hd0_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).hd1_info as *const _ as usize }, + 144usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(hd1_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).sys_desc_table as *const _ as usize }, + 160usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(sys_desc_table) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).olpc_ofw_header as *const _ as usize }, + 176usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(olpc_ofw_header) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).ext_ramdisk_image as *const _ as usize }, + 192usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(ext_ramdisk_image) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).ext_ramdisk_size as *const _ as usize }, + 196usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(ext_ramdisk_size) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).ext_cmd_line_ptr as *const _ as usize }, + 200usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(ext_cmd_line_ptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad4 as *const _ as usize }, + 204usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad4) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).edid_info as *const _ as usize }, + 320usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(edid_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).efi_info as *const _ as usize }, + 448usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(efi_info) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).alt_mem_k as *const _ as usize }, + 480usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(alt_mem_k) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).scratch as *const _ as usize }, + 484usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(scratch) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).e820_entries as *const _ as usize }, + 488usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(e820_entries) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).eddbuf_entries as *const _ as usize }, + 489usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(eddbuf_entries) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).edd_mbr_sig_buf_entries as *const _ as usize }, + 490usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(edd_mbr_sig_buf_entries) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).kbd_status as *const _ as usize }, + 491usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(kbd_status) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad5 as *const _ as usize }, + 492usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad5) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).sentinel as *const _ as usize }, + 495usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(sentinel) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad6 as *const _ as usize }, + 496usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad6) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).hdr as *const _ as usize }, + 497usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(hdr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad7 as *const _ as usize }, + 616usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad7) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).edd_mbr_sig_buffer as *const _ as usize }, + 656usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(edd_mbr_sig_buffer) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).e820_map as *const _ as usize }, + 720usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(e820_map) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad8 as *const _ as usize }, + 3280usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad8) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params)).eddbuf as *const _ as usize }, + 3328usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(eddbuf) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const boot_params))._pad9 as *const _ as usize }, + 3820usize, + concat!( + "Alignment of field: ", + stringify!(boot_params), + "::", + stringify!(_pad9) + ) + ); } impl Default for boot_params { fn default() -> Self { diff --git a/x86_64/src/cpuid.rs b/x86_64/src/cpuid.rs index 36a2b28..0cfa32e 100644 --- a/x86_64/src/cpuid.rs +++ b/x86_64/src/cpuid.rs @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use std::result; -use std::fmt::{self, Display}; use std::error::{self, Error as CpuidError}; +use std::fmt::{self, Display}; +use std::result; use kvm; use sys_util; @@ -19,10 +19,8 @@ pub type Result<T> = result::Result<T, Error>; impl error::Error for Error { fn description(&self) -> &str { match self { - &Error::GetSupportedCpusFailed(_) => - "GetSupportedCpus ioctl failed", - &Error::SetSupportedCpusFailed(_) => - "SetSupportedCpus ioctl failed", + &Error::GetSupportedCpusFailed(_) => "GetSupportedCpus ioctl failed", + &Error::SetSupportedCpusFailed(_) => "SetSupportedCpus ioctl failed", } } } @@ -36,16 +34,16 @@ impl Display for Error { // This function is implemented in C because stable rustc does not // support inline assembly. extern "C" { - fn host_cpuid(func: u32, - func2: u32, - rEax: *mut u32, - rEbx: *mut u32, - rEcx: *mut u32, - rEdx: *mut u32) - -> (); + fn host_cpuid( + func: u32, + func2: u32, + rEax: *mut u32, + rEbx: *mut u32, + rEcx: *mut u32, + rEdx: *mut u32, + ) -> (); } - // CPUID bits in ebx, ecx, and edx. const EBX_CLFLUSH_CACHELINE: u32 = 8; // Flush a cache line size. const EBX_CLFLUSH_SIZE_SHIFT: u32 = 8; // Bytes flushed when executing CLFLUSH. @@ -65,31 +63,33 @@ fn filter_cpuid(cpu_id: u64, cpu_count: u64, kvm_cpuid: &mut kvm::CpuId) -> Resu if entry.index == 0 { entry.ecx |= 1 << ECX_HYPERVISOR_SHIFT; } - entry.ebx = (cpu_id << EBX_CPUID_SHIFT) as u32 | - (EBX_CLFLUSH_CACHELINE << EBX_CLFLUSH_SIZE_SHIFT); + entry.ebx = (cpu_id << EBX_CPUID_SHIFT) as u32 + | (EBX_CLFLUSH_CACHELINE << EBX_CLFLUSH_SIZE_SHIFT); if cpu_count > 1 { entry.ebx |= (cpu_count as u32) << EBX_CPU_COUNT_SHIFT; entry.edx |= 1 << EDX_HTT_SHIFT; } } - 2 | 0x80000005 | 0x80000006 => { - unsafe { - host_cpuid(entry.function, - 0, - &mut entry.eax as *mut u32, - &mut entry.ebx as *mut u32, - &mut entry.ecx as *mut u32, - &mut entry.edx as *mut u32); - } - } + 2 | 0x80000005 | 0x80000006 => unsafe { + host_cpuid( + entry.function, + 0, + &mut entry.eax as *mut u32, + &mut entry.ebx as *mut u32, + &mut entry.ecx as *mut u32, + &mut entry.edx as *mut u32, + ); + }, 4 => { unsafe { - host_cpuid(entry.function, - entry.index, - &mut entry.eax as *mut u32, - &mut entry.ebx as *mut u32, - &mut entry.ecx as *mut u32, - &mut entry.edx as *mut u32); + host_cpuid( + entry.function, + entry.index, + &mut entry.eax as *mut u32, + &mut entry.ebx as *mut u32, + &mut entry.ecx as *mut u32, + &mut entry.edx as *mut u32, + ); } entry.eax &= !0xFC000000; } @@ -114,7 +114,8 @@ fn filter_cpuid(cpu_id: u64, cpu_count: u64, kvm_cpuid: &mut kvm::CpuId) -> Resu /// * `cpu_id` - The index of the CPU `vcpu` is for. /// * `nrcpus` - The number of vcpus being used by this VM. pub fn setup_cpuid(kvm: &kvm::Kvm, vcpu: &kvm::Vcpu, cpu_id: u64, nrcpus: u64) -> Result<()> { - let mut kvm_cpuid = kvm.get_supported_cpuid() + let mut kvm_cpuid = kvm + .get_supported_cpuid() .map_err(Error::GetSupportedCpusFailed)?; filter_cpuid(cpu_id, nrcpus, &mut kvm_cpuid)?; @@ -144,8 +145,10 @@ mod tests { assert_eq!(entries[0].function, 0); assert_eq!(1, (entries[1].ebx >> EBX_CPUID_SHIFT) & 0x000000ff); assert_eq!(2, (entries[1].ebx >> EBX_CPU_COUNT_SHIFT) & 0x000000ff); - assert_eq!(EBX_CLFLUSH_CACHELINE, - (entries[1].ebx >> EBX_CLFLUSH_SIZE_SHIFT) & 0x000000ff); + assert_eq!( + EBX_CLFLUSH_CACHELINE, + (entries[1].ebx >> EBX_CLFLUSH_SIZE_SHIFT) & 0x000000ff + ); assert_ne!(0, entries[1].ecx & (1 << ECX_HYPERVISOR_SHIFT)); assert_ne!(0, entries[1].edx & (1 << EDX_HTT_SHIFT)); } diff --git a/x86_64/src/gdt.rs b/x86_64/src/gdt.rs index 06af094..7eb1ff7 100644 --- a/x86_64/src/gdt.rs +++ b/x86_64/src/gdt.rs @@ -8,18 +8,21 @@ use kvm_sys::kvm_segment; /// Constructor for a conventional segment GDT (or LDT) entry. Derived from the kernel's segment.h. pub fn gdt_entry(flags: u16, base: u32, limit: u32) -> u64 { - ((((base as u64) & 0xff000000u64) << (56 - 24)) | (((flags as u64) & 0x0000f0ffu64) << 40) | - (((limit as u64) & 0x000f0000u64) << (48 - 16)) | - (((base as u64) & 0x00ffffffu64) << 16) | (((limit as u64) & 0x0000ffffu64))) + ((((base as u64) & 0xff000000u64) << (56 - 24)) + | (((flags as u64) & 0x0000f0ffu64) << 40) + | (((limit as u64) & 0x000f0000u64) << (48 - 16)) + | (((base as u64) & 0x00ffffffu64) << 16) + | ((limit as u64) & 0x0000ffffu64)) } fn get_base(entry: u64) -> u64 { - ((((entry) & 0xFF00000000000000) >> 32) | (((entry) & 0x000000FF00000000) >> 16) | - (((entry) & 0x00000000FFFF0000) >> 16)) + ((((entry) & 0xFF00000000000000) >> 32) + | (((entry) & 0x000000FF00000000) >> 16) + | (((entry) & 0x00000000FFFF0000) >> 16)) } fn get_limit(entry: u64) -> u32 { - ((((entry) & 0x000F000000000000) >> 32) | (((entry) & 0x000000000000FFFF))) as u32 + ((((entry) & 0x000F000000000000) >> 32) | ((entry) & 0x000000000000FFFF)) as u32 } fn get_g(entry: u64) -> u8 { diff --git a/x86_64/src/interrupts.rs b/x86_64/src/interrupts.rs index 65bc621..5c469c8 100644 --- a/x86_64/src/interrupts.rs +++ b/x86_64/src/interrupts.rs @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use std::error::{self, Error as InterruptsError}; +use std::fmt::{self, Display}; use std::io::Cursor; use std::mem; use std::result; -use std::error::{self, Error as InterruptsError}; -use std::fmt::{self, Display}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; @@ -76,13 +76,17 @@ pub fn set_lint(vcpu: &kvm::Vcpu) -> Result<()> { let mut klapic = vcpu.get_lapic().map_err(Error::GetLapic)?; let lvt_lint0 = get_klapic_reg(&klapic, APIC_LVT0); - set_klapic_reg(&mut klapic, - APIC_LVT0, - set_apic_delivery_mode(lvt_lint0, APIC_MODE_EXTINT)); + set_klapic_reg( + &mut klapic, + APIC_LVT0, + set_apic_delivery_mode(lvt_lint0, APIC_MODE_EXTINT), + ); let lvt_lint1 = get_klapic_reg(&klapic, APIC_LVT1); - set_klapic_reg(&mut klapic, - APIC_LVT1, - set_apic_delivery_mode(lvt_lint1, APIC_MODE_NMI)); + set_klapic_reg( + &mut klapic, + APIC_LVT1, + set_apic_delivery_mode(lvt_lint1, APIC_MODE_NMI), + ); vcpu.set_lapic(&klapic).map_err(Error::SetLapic) } diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs index a372a95..244aa45 100644 --- a/x86_64/src/lib.rs +++ b/x86_64/src/lib.rs @@ -6,13 +6,13 @@ extern crate arch; extern crate byteorder; extern crate data_model; extern crate devices; +extern crate kernel_cmdline; +extern crate kernel_loader; extern crate kvm; extern crate kvm_sys; extern crate libc; -extern crate sys_util; extern crate resources; -extern crate kernel_cmdline; -extern crate kernel_loader; +extern crate sys_util; #[allow(dead_code)] #[allow(non_upper_case_globals)] @@ -58,22 +58,22 @@ mod interrupts; mod mptable; mod regs; -use std::mem; -use std::result; use std::error::{self, Error as X86Error}; +use std::ffi::{CStr, CString}; use std::fmt::{self, Display}; use std::fs::File; -use std::ffi::{CStr, CString}; use std::io::{self, stdout}; +use std::mem; +use std::result; use std::sync::{Arc, Mutex}; use arch::{RunnableLinuxVm, VirtioDeviceStub, VmComponents}; use bootparam::boot_params; use bootparam::E820_RAM; use devices::{PciConfigIo, PciInterruptPin}; -use sys_util::{EventFd, GuestAddress, GuestMemory}; -use resources::{AddressRanges, SystemAllocator}; use kvm::*; +use resources::{AddressRanges, SystemAllocator}; +use sys_util::{EventFd, GuestAddress, GuestMemory}; #[derive(Debug)] pub enum Error { @@ -120,16 +120,13 @@ impl error::Error for Error { &Error::CreatePciRoot(_) => "failed to create a PCI root hub", &Error::CreateSocket(_) => "failed to create socket", &Error::CreateVcpu(_) => "failed to create VCPU", - &Error::KernelOffsetPastEnd => - "The kernel extends past the end of RAM", + &Error::KernelOffsetPastEnd => "The kernel extends past the end of RAM", &Error::RegisterIrqfd(_) => "Error registering an IrqFd", &Error::RegisterVsock(_) => "error registering virtual socket device", &Error::LoadCmdline(_) => "Error Loading command line", &Error::LoadKernel(_) => "Error Loading Kernel", - &Error::ZeroPageSetup => - "Error writing the zero page of guest memory", - &Error::ZeroPagePastRamEnd => - "The zero page extends past the end of guest_mem", + &Error::ZeroPageSetup => "Error writing the zero page of guest memory", + &Error::ZeroPagePastRamEnd => "The zero page extends past the end of guest_mem", &Error::E820Configuration => "Invalid e820 setup params", } } @@ -155,13 +152,14 @@ const CMDLINE_OFFSET: u64 = 0x20000; const CMDLINE_MAX_SIZE: u64 = KERNEL_START_OFFSET - CMDLINE_OFFSET; const X86_64_IRQ_BASE: u32 = 5; -fn configure_system(guest_mem: &GuestMemory, - kernel_addr: GuestAddress, - cmdline_addr: GuestAddress, - cmdline_size: usize, - num_cpus: u8, - pci_irqs: Vec<(u32, PciInterruptPin)>) - -> Result<()> { +fn configure_system( + guest_mem: &GuestMemory, + kernel_addr: GuestAddress, + cmdline_addr: GuestAddress, + cmdline_size: usize, + num_cpus: u8, + pci_irqs: Vec<(u32, PciInterruptPin)>, +) -> Result<()> { const EBDA_START: u64 = 0x0009fc00; const KERNEL_BOOT_FLAG_MAGIC: u16 = 0xaa55; const KERNEL_HDR_MAGIC: u32 = 0x53726448; @@ -186,27 +184,35 @@ fn configure_system(guest_mem: &GuestMemory, let mem_end = guest_mem.end_addr(); if mem_end < end_32bit_gap_start { - add_e820_entry(&mut params, - kernel_addr.offset() as u64, - mem_end.offset_from(kernel_addr) as u64, - E820_RAM)?; + add_e820_entry( + &mut params, + kernel_addr.offset() as u64, + mem_end.offset_from(kernel_addr) as u64, + E820_RAM, + )?; } else { - add_e820_entry(&mut params, - kernel_addr.offset() as u64, - end_32bit_gap_start.offset_from(kernel_addr) as u64, - E820_RAM)?; + add_e820_entry( + &mut params, + kernel_addr.offset() as u64, + end_32bit_gap_start.offset_from(kernel_addr) as u64, + E820_RAM, + )?; if mem_end > first_addr_past_32bits { - add_e820_entry(&mut params, - first_addr_past_32bits.offset() as u64, - mem_end.offset_from(first_addr_past_32bits) as u64, - E820_RAM)?; + add_e820_entry( + &mut params, + first_addr_past_32bits.offset() as u64, + mem_end.offset_from(first_addr_past_32bits) as u64, + E820_RAM, + )?; } } let zero_page_addr = GuestAddress(ZERO_PAGE_OFFSET); - guest_mem.checked_offset(zero_page_addr, mem::size_of::<boot_params>() as u64) + guest_mem + .checked_offset(zero_page_addr, mem::size_of::<boot_params>() as u64) .ok_or(Error::ZeroPagePastRamEnd)?; - guest_mem.write_obj_at_addr(params, zero_page_addr) + guest_mem + .write_obj_at_addr(params, zero_page_addr) .map_err(|_| Error::ZeroPageSetup)?; Ok(()) @@ -242,7 +248,10 @@ fn arch_memory_regions(size: u64) -> Vec<(GuestAddress, u64)> { } else { regions.push((GuestAddress(0), end_32bit_gap_start.offset())); if mem_end > first_addr_past_32bits { - regions.push((first_addr_past_32bits, mem_end.offset_from(first_addr_past_32bits))); + regions.push(( + first_addr_past_32bits, + mem_end.offset_from(first_addr_past_32bits), + )); } } @@ -251,11 +260,11 @@ fn arch_memory_regions(size: u64) -> Vec<(GuestAddress, u64)> { impl arch::LinuxArch for X8664arch { fn build_vm<F>(mut components: VmComponents, virtio_devs: F) -> Result<RunnableLinuxVm> - where - F: FnOnce(&GuestMemory, &EventFd) -> Result<Vec<VirtioDeviceStub>> + where + F: FnOnce(&GuestMemory, &EventFd) -> Result<Vec<VirtioDeviceStub>>, { - let mut resources = Self::get_resource_allocator(components.memory_mb, - components.wayland_dmabuf); + let mut resources = + Self::get_resource_allocator(components.memory_mb, components.wayland_dmabuf); let mem = Self::setup_memory(components.memory_mb)?; let kvm = Kvm::new().map_err(Error::CreateKvm)?; let mut vm = Self::create_vm(&kvm, mem.clone())?; @@ -263,10 +272,15 @@ impl arch::LinuxArch for X8664arch { let vcpu_count = components.vcpu_count; let mut vcpus = Vec::with_capacity(vcpu_count as usize); for cpu_id in 0..vcpu_count { - let vcpu = Vcpu::new(cpu_id as libc::c_ulong, &kvm, &vm) - .map_err(Error::CreateVcpu)?; - Self::configure_vcpu(vm.get_memory(), &kvm, &vm, &vcpu, - cpu_id as u64, vcpu_count as u64)?; + let vcpu = Vcpu::new(cpu_id as libc::c_ulong, &kvm, &vm).map_err(Error::CreateVcpu)?; + Self::configure_vcpu( + vm.get_memory(), + &kvm, + &vm, + &vcpu, + cpu_id as u64, + vcpu_count as u64, + )?; vcpus.push(vcpu); } @@ -275,27 +289,33 @@ impl arch::LinuxArch for X8664arch { let mut mmio_bus = devices::Bus::new(); - let (pci, pci_irqs) = arch::generate_pci_root(components.pci_devices, - &mut mmio_bus, - &mut resources, - &mut vm) - .map_err(Error::CreatePciRoot)?; + let (pci, pci_irqs) = arch::generate_pci_root( + components.pci_devices, + &mut mmio_bus, + &mut resources, + &mut vm, + ).map_err(Error::CreatePciRoot)?; let pci_bus = Arc::new(Mutex::new(PciConfigIo::new(pci))); let exit_evt = EventFd::new().map_err(Error::CreateEventFd)?; let (io_bus, stdio_serial) = Self::setup_io_bus( &mut vm, exit_evt.try_clone().map_err(Error::CloneEventFd)?, - Some(pci_bus.clone()))?; - + Some(pci_bus.clone()), + )?; // Create a list of mmio devices to be added. let mmio_devs = virtio_devs(&mem, &exit_evt)?; for stub in mmio_devs { - arch::register_mmio(&mut mmio_bus, &mut vm, stub.dev, stub.jail, - &mut resources, &mut cmdline) - .map_err(Error::RegisterVsock)?; + arch::register_mmio( + &mut mmio_bus, + &mut vm, + stub.dev, + stub.jail, + &mut resources, + &mut cmdline, + ).map_err(Error::RegisterVsock)?; } for param in components.extra_kernel_params { @@ -305,8 +325,13 @@ impl arch::LinuxArch for X8664arch { // separate out load_kernel from other setup to get a specific error for // kernel loading Self::load_kernel(&mem, &mut components.kernel_image)?; - Self::setup_system_memory(&mem, components.memory_mb, vcpu_count, - &CString::new(cmdline).unwrap(), pci_irqs)?; + Self::setup_system_memory( + &mem, + components.memory_mb, + vcpu_count, + &CString::new(cmdline).unwrap(), + pci_irqs, + )?; Ok(RunnableLinuxVm { vm, @@ -330,8 +355,7 @@ impl X8664arch { /// * `mem` - The memory to be used by the guest. /// * `kernel_image` - the File object for the specified kernel. fn load_kernel(mem: &GuestMemory, mut kernel_image: &mut File) -> Result<()> { - kernel_loader::load_kernel(mem, GuestAddress(KERNEL_START_OFFSET), - &mut kernel_image)?; + kernel_loader::load_kernel(mem, GuestAddress(KERNEL_START_OFFSET), &mut kernel_image)?; Ok(()) } @@ -343,13 +367,22 @@ impl X8664arch { /// * `mem` - The memory to be used by the guest. /// * `vcpu_count` - Number of virtual CPUs the guest will have. /// * `cmdline` - the kernel commandline - fn setup_system_memory(mem: &GuestMemory, _mem_size: u64, - vcpu_count: u32, cmdline: &CStr, - pci_irqs: Vec<(u32, PciInterruptPin)>) -> Result<()> { + fn setup_system_memory( + mem: &GuestMemory, + _mem_size: u64, + vcpu_count: u32, + cmdline: &CStr, + pci_irqs: Vec<(u32, PciInterruptPin)>, + ) -> Result<()> { kernel_loader::load_cmdline(mem, GuestAddress(CMDLINE_OFFSET), cmdline)?; - configure_system(mem, GuestAddress(KERNEL_START_OFFSET), - GuestAddress(CMDLINE_OFFSET), - cmdline.to_bytes().len() + 1, vcpu_count as u8, pci_irqs)?; + configure_system( + mem, + GuestAddress(KERNEL_START_OFFSET), + GuestAddress(CMDLINE_OFFSET), + cmdline.to_bytes().len() + 1, + vcpu_count as u8, + pci_irqs, + )?; Ok(()) } @@ -400,15 +433,16 @@ impl X8664arch { // Put device memory at a 2MB boundary after physical memory or 4gb, whichever is greater. const MB: u64 = 1024 * 1024; const GB: u64 = 1024 * MB; - let mem_size_round_2mb = (mem_size + 2*MB - 1) / (2*MB) * (2*MB); + let mem_size_round_2mb = (mem_size + 2 * MB - 1) / (2 * MB) * (2 * MB); std::cmp::max(mem_size_round_2mb, 4 * GB) / sys_util::pagesize() as u64 } /// This returns a minimal kernel command for this architecture fn get_base_linux_cmdline() -> kernel_cmdline::Cmdline { let mut cmdline = kernel_cmdline::Cmdline::new(CMDLINE_MAX_SIZE as usize); - cmdline.insert_str("console=ttyS0 noacpi reboot=k panic=1"). - unwrap(); + cmdline + .insert_str("console=ttyS0 noacpi reboot=k panic=1") + .unwrap(); cmdline } @@ -417,10 +451,11 @@ impl X8664arch { const MMIO_BASE: u64 = 0xe0000000; let device_addr_start = Self::get_base_dev_pfn(mem_size) * sys_util::pagesize() as u64; AddressRanges::new() - .add_io_addresses(0xc000, 0x10000) - .add_mmio_addresses(MMIO_BASE, 0x100000) - .add_device_addresses(device_addr_start, u64::max_value() - device_addr_start) - .create_allocator(X86_64_IRQ_BASE, gpu_allocation).unwrap() + .add_io_addresses(0xc000, 0x10000) + .add_mmio_addresses(MMIO_BASE, 0x100000) + .add_device_addresses(device_addr_start, u64::max_value() - device_addr_start) + .create_allocator(X86_64_IRQ_BASE, gpu_allocation) + .unwrap() } /// Sets up the IO bus for this platform @@ -429,8 +464,11 @@ impl X8664arch { /// /// * - `vm` the vm object /// * - `exit_evt` - the event fd object which should receive exit events - fn setup_io_bus(vm: &mut Vm, exit_evt: EventFd, pci: Option<Arc<Mutex<devices::PciConfigIo>>>) - -> Result<(devices::Bus, Arc<Mutex<devices::Serial>>)> { + fn setup_io_bus( + vm: &mut Vm, + exit_evt: EventFd, + pci: Option<Arc<Mutex<devices::PciConfigIo>>>, + ) -> Result<(devices::Bus, Arc<Mutex<devices::Serial>>)> { struct NoDevice; impl devices::BusDevice for NoDevice {} @@ -438,56 +476,84 @@ impl X8664arch { let com_evt_1_3 = EventFd::new().map_err(|e| Error::CreateEventFd(e))?; let com_evt_2_4 = EventFd::new().map_err(|e| Error::CreateEventFd(e))?; - let stdio_serial = - Arc::new(Mutex::new( - devices::Serial::new_out(com_evt_1_3.try_clone(). - map_err(|e| Error::CloneEventFd(e))?, - Box::new(stdout())))); + let stdio_serial = Arc::new(Mutex::new(devices::Serial::new_out( + com_evt_1_3 + .try_clone() + .map_err(|e| Error::CloneEventFd(e))?, + Box::new(stdout()), + ))); let nul_device = Arc::new(Mutex::new(NoDevice)); - io_bus.insert(stdio_serial.clone(), 0x3f8, 0x8, false).unwrap(); - io_bus.insert(Arc::new(Mutex::new( - devices::Serial::new_sink(com_evt_2_4.try_clone(). - map_err(|e| Error::CloneEventFd(e))?))), - 0x2f8, - 0x8, - false) - .unwrap(); - io_bus.insert(Arc::new(Mutex::new( - devices::Serial::new_sink(com_evt_1_3.try_clone(). - map_err(|e| Error::CloneEventFd(e))?))), - 0x3e8, - 0x8, - false) + io_bus + .insert(stdio_serial.clone(), 0x3f8, 0x8, false) .unwrap(); - io_bus.insert(Arc::new(Mutex::new( - devices::Serial::new_sink(com_evt_2_4.try_clone(). - map_err(|e| Error::CloneEventFd(e))?))), - 0x2e8, - 0x8, - false) + io_bus + .insert( + Arc::new(Mutex::new(devices::Serial::new_sink( + com_evt_2_4 + .try_clone() + .map_err(|e| Error::CloneEventFd(e))?, + ))), + 0x2f8, + 0x8, + false, + ).unwrap(); + io_bus + .insert( + Arc::new(Mutex::new(devices::Serial::new_sink( + com_evt_1_3 + .try_clone() + .map_err(|e| Error::CloneEventFd(e))?, + ))), + 0x3e8, + 0x8, + false, + ).unwrap(); + io_bus + .insert( + Arc::new(Mutex::new(devices::Serial::new_sink( + com_evt_2_4 + .try_clone() + .map_err(|e| Error::CloneEventFd(e))?, + ))), + 0x2e8, + 0x8, + false, + ).unwrap(); + io_bus + .insert(Arc::new(Mutex::new(devices::Cmos::new())), 0x70, 0x2, false) .unwrap(); - io_bus.insert(Arc::new(Mutex::new(devices::Cmos::new())), 0x70, 0x2, false) - .unwrap(); - io_bus.insert(Arc::new(Mutex::new( - devices::I8042Device::new(exit_evt.try_clone(). - map_err(|e| Error::CloneEventFd(e))?))), - 0x061, - 0x4, - false) - .unwrap(); - io_bus.insert(nul_device.clone(), 0x040, 0x8, false).unwrap(); // ignore pit - io_bus.insert(nul_device.clone(), 0x0ed, 0x1, false).unwrap(); // most likely this one does nothing - io_bus.insert(nul_device.clone(), 0x0f0, 0x2, false).unwrap(); // ignore fpu + io_bus + .insert( + Arc::new(Mutex::new(devices::I8042Device::new( + exit_evt.try_clone().map_err(|e| Error::CloneEventFd(e))?, + ))), + 0x061, + 0x4, + false, + ).unwrap(); + io_bus + .insert(nul_device.clone(), 0x040, 0x8, false) + .unwrap(); // ignore pit + io_bus + .insert(nul_device.clone(), 0x0ed, 0x1, false) + .unwrap(); // most likely this one does nothing + io_bus + .insert(nul_device.clone(), 0x0f0, 0x2, false) + .unwrap(); // ignore fpu if let Some(pci_root) = pci { io_bus.insert(pci_root, 0xcf8, 0x8, false).unwrap(); } else { // ignore pci. - io_bus.insert(nul_device.clone(), 0xcf8, 0x8, false).unwrap(); + io_bus + .insert(nul_device.clone(), 0xcf8, 0x8, false) + .unwrap(); } - vm.register_irqfd(&com_evt_1_3, 4).map_err(Error::RegisterIrqfd)?; - vm.register_irqfd(&com_evt_2_4, 3).map_err(Error::RegisterIrqfd)?; + vm.register_irqfd(&com_evt_1_3, 4) + .map_err(Error::RegisterIrqfd)?; + vm.register_irqfd(&com_evt_2_4, 3) + .map_err(Error::RegisterIrqfd)?; Ok((io_bus, stdio_serial)) } @@ -504,28 +570,31 @@ impl X8664arch { /// * `vcpu` - The VCPU object to configure. /// * `cpu_id` - The id of the given `vcpu`. /// * `num_cpus` - Number of virtual CPUs the guest will have. - fn configure_vcpu(guest_mem: &GuestMemory, - kvm: &Kvm, - _vm: &Vm, - vcpu: &Vcpu, - cpu_id: u64, - num_cpus: u64) - -> Result<()> { + fn configure_vcpu( + guest_mem: &GuestMemory, + kvm: &Kvm, + _vm: &Vm, + vcpu: &Vcpu, + cpu_id: u64, + num_cpus: u64, + ) -> Result<()> { let kernel_load_addr = GuestAddress(KERNEL_START_OFFSET); cpuid::setup_cpuid(kvm, vcpu, cpu_id, num_cpus)?; regs::setup_msrs(vcpu)?; - let kernel_end = guest_mem.checked_offset(kernel_load_addr, KERNEL_64BIT_ENTRY_OFFSET) + let kernel_end = guest_mem + .checked_offset(kernel_load_addr, KERNEL_64BIT_ENTRY_OFFSET) .ok_or(Error::KernelOffsetPastEnd)?; - regs::setup_regs(vcpu, - (kernel_end).offset() as u64, - BOOT_STACK_POINTER as u64, - ZERO_PAGE_OFFSET as u64)?; + regs::setup_regs( + vcpu, + (kernel_end).offset() as u64, + BOOT_STACK_POINTER as u64, + ZERO_PAGE_OFFSET as u64, + )?; regs::setup_fpu(vcpu)?; regs::setup_sregs(guest_mem, vcpu)?; interrupts::set_lint(vcpu)?; Ok(()) } - } #[cfg(test)] mod tests { diff --git a/x86_64/src/mpspec.rs b/x86_64/src/mpspec.rs index a418207..8106ef0 100644 --- a/x86_64/src/mpspec.rs +++ b/x86_64/src/mpspec.rs @@ -52,72 +52,116 @@ pub struct mpf_intel { } #[test] fn bindgen_test_layout_mpf_intel() { - assert_eq!(::std::mem::size_of::<mpf_intel>(), - 16usize, - concat!("Size of: ", stringify!(mpf_intel))); - assert_eq!(::std::mem::align_of::<mpf_intel>(), - 4usize, - concat!("Alignment of ", stringify!(mpf_intel))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(signature))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).physptr as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(physptr))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).length as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(length))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).specification as *const _ as usize }, - 9usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(specification))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).checksum as *const _ as usize }, - 10usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(checksum))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).feature1 as *const _ as usize }, - 11usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature1))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).feature2 as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature2))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).feature3 as *const _ as usize }, - 13usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature3))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).feature4 as *const _ as usize }, - 14usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature4))); - assert_eq!(unsafe { &(*(0 as *const mpf_intel)).feature5 as *const _ as usize }, - 15usize, - concat!("Alignment of field: ", - stringify!(mpf_intel), - "::", - stringify!(feature5))); + assert_eq!( + ::std::mem::size_of::<mpf_intel>(), + 16usize, + concat!("Size of: ", stringify!(mpf_intel)) + ); + assert_eq!( + ::std::mem::align_of::<mpf_intel>(), + 4usize, + concat!("Alignment of ", stringify!(mpf_intel)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).physptr as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(physptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).length as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).specification as *const _ as usize }, + 9usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(specification) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).checksum as *const _ as usize }, + 10usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(checksum) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).feature1 as *const _ as usize }, + 11usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(feature1) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).feature2 as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(feature2) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).feature3 as *const _ as usize }, + 13usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(feature3) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).feature4 as *const _ as usize }, + 14usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(feature4) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpf_intel)).feature5 as *const _ as usize }, + 15usize, + concat!( + "Alignment of field: ", + stringify!(mpf_intel), + "::", + stringify!(feature5) + ) + ); } impl Clone for mpf_intel { fn clone(&self) -> Self { @@ -141,78 +185,126 @@ pub struct mpc_table { } #[test] fn bindgen_test_layout_mpc_table() { - assert_eq!(::std::mem::size_of::<mpc_table>(), - 44usize, - concat!("Size of: ", stringify!(mpc_table))); - assert_eq!(::std::mem::align_of::<mpc_table>(), - 4usize, - concat!("Alignment of ", stringify!(mpc_table))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(signature))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).length as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(length))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).spec as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(spec))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).checksum as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(checksum))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).oem as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oem))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).productid as *const _ as usize }, - 16usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(productid))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).oemptr as *const _ as usize }, - 28usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemptr))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).oemsize as *const _ as usize }, - 32usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemsize))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).oemcount as *const _ as usize }, - 34usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(oemcount))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).lapic as *const _ as usize }, - 36usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(lapic))); - assert_eq!(unsafe { &(*(0 as *const mpc_table)).reserved as *const _ as usize }, - 40usize, - concat!("Alignment of field: ", - stringify!(mpc_table), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<mpc_table>(), + 44usize, + concat!("Size of: ", stringify!(mpc_table)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_table>(), + 4usize, + concat!("Alignment of ", stringify!(mpc_table)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).length as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).spec as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(spec) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).checksum as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(checksum) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).oem as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(oem) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).productid as *const _ as usize }, + 16usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(productid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).oemptr as *const _ as usize }, + 28usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(oemptr) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).oemsize as *const _ as usize }, + 32usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(oemsize) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).oemcount as *const _ as usize }, + 34usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(oemcount) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).lapic as *const _ as usize }, + 36usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(lapic) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_table)).reserved as *const _ as usize }, + 40usize, + concat!( + "Alignment of field: ", + stringify!(mpc_table), + "::", + stringify!(reserved) + ) + ); } impl Clone for mpc_table { fn clone(&self) -> Self { @@ -232,54 +324,86 @@ pub struct mpc_cpu { } #[test] fn bindgen_test_layout_mpc_cpu() { - assert_eq!(::std::mem::size_of::<mpc_cpu>(), - 20usize, - concat!("Size of: ", stringify!(mpc_cpu))); - assert_eq!(::std::mem::align_of::<mpc_cpu>(), - 4usize, - concat!("Alignment of ", stringify!(mpc_cpu))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).type_ as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).apicid as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(apicid))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).apicver as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(apicver))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).cpuflag as *const _ as usize }, - 3usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(cpuflag))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).cpufeature as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(cpufeature))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).featureflag as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(featureflag))); - assert_eq!(unsafe { &(*(0 as *const mpc_cpu)).reserved as *const _ as usize }, - 12usize, - concat!("Alignment of field: ", - stringify!(mpc_cpu), - "::", - stringify!(reserved))); + assert_eq!( + ::std::mem::size_of::<mpc_cpu>(), + 20usize, + concat!("Size of: ", stringify!(mpc_cpu)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_cpu>(), + 4usize, + concat!("Alignment of ", stringify!(mpc_cpu)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).type_ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).apicid as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(apicid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).apicver as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(apicver) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).cpuflag as *const _ as usize }, + 3usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(cpuflag) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).cpufeature as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(cpufeature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).featureflag as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(featureflag) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_cpu)).reserved as *const _ as usize }, + 12usize, + concat!( + "Alignment of field: ", + stringify!(mpc_cpu), + "::", + stringify!(reserved) + ) + ); } impl Clone for mpc_cpu { fn clone(&self) -> Self { @@ -295,30 +419,46 @@ pub struct mpc_bus { } #[test] fn bindgen_test_layout_mpc_bus() { - assert_eq!(::std::mem::size_of::<mpc_bus>(), - 8usize, - concat!("Size of: ", stringify!(mpc_bus))); - assert_eq!(::std::mem::align_of::<mpc_bus>(), - 1usize, - concat!("Alignment of ", stringify!(mpc_bus))); - assert_eq!(unsafe { &(*(0 as *const mpc_bus)).type_ as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const mpc_bus)).busid as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(busid))); - assert_eq!(unsafe { &(*(0 as *const mpc_bus)).bustype as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(mpc_bus), - "::", - stringify!(bustype))); + assert_eq!( + ::std::mem::size_of::<mpc_bus>(), + 8usize, + concat!("Size of: ", stringify!(mpc_bus)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_bus>(), + 1usize, + concat!("Alignment of ", stringify!(mpc_bus)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_bus)).type_ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_bus), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_bus)).busid as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(mpc_bus), + "::", + stringify!(busid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_bus)).bustype as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(mpc_bus), + "::", + stringify!(bustype) + ) + ); } impl Clone for mpc_bus { fn clone(&self) -> Self { @@ -336,42 +476,66 @@ pub struct mpc_ioapic { } #[test] fn bindgen_test_layout_mpc_ioapic() { - assert_eq!(::std::mem::size_of::<mpc_ioapic>(), - 8usize, - concat!("Size of: ", stringify!(mpc_ioapic))); - assert_eq!(::std::mem::align_of::<mpc_ioapic>(), - 4usize, - concat!("Alignment of ", stringify!(mpc_ioapic))); - assert_eq!(unsafe { &(*(0 as *const mpc_ioapic)).type_ as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const mpc_ioapic)).apicid as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicid))); - assert_eq!(unsafe { &(*(0 as *const mpc_ioapic)).apicver as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicver))); - assert_eq!(unsafe { &(*(0 as *const mpc_ioapic)).flags as *const _ as usize }, - 3usize, - concat!("Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(flags))); - assert_eq!(unsafe { &(*(0 as *const mpc_ioapic)).apicaddr as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_ioapic), - "::", - stringify!(apicaddr))); + assert_eq!( + ::std::mem::size_of::<mpc_ioapic>(), + 8usize, + concat!("Size of: ", stringify!(mpc_ioapic)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_ioapic>(), + 4usize, + concat!("Alignment of ", stringify!(mpc_ioapic)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_ioapic)).type_ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_ioapic), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_ioapic)).apicid as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(mpc_ioapic), + "::", + stringify!(apicid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_ioapic)).apicver as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(mpc_ioapic), + "::", + stringify!(apicver) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_ioapic)).flags as *const _ as usize }, + 3usize, + concat!( + "Alignment of field: ", + stringify!(mpc_ioapic), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_ioapic)).apicaddr as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_ioapic), + "::", + stringify!(apicaddr) + ) + ); } impl Clone for mpc_ioapic { fn clone(&self) -> Self { @@ -391,54 +555,86 @@ pub struct mpc_intsrc { } #[test] fn bindgen_test_layout_mpc_intsrc() { - assert_eq!(::std::mem::size_of::<mpc_intsrc>(), - 8usize, - concat!("Size of: ", stringify!(mpc_intsrc))); - assert_eq!(::std::mem::align_of::<mpc_intsrc>(), - 2usize, - concat!("Alignment of ", stringify!(mpc_intsrc))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).type_ as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).irqtype as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(irqtype))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).irqflag as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(irqflag))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).srcbus as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(srcbus))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).srcbusirq as *const _ as usize }, - 5usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(srcbusirq))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).dstapic as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(dstapic))); - assert_eq!(unsafe { &(*(0 as *const mpc_intsrc)).dstirq as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(mpc_intsrc), - "::", - stringify!(dstirq))); + assert_eq!( + ::std::mem::size_of::<mpc_intsrc>(), + 8usize, + concat!("Size of: ", stringify!(mpc_intsrc)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_intsrc>(), + 2usize, + concat!("Alignment of ", stringify!(mpc_intsrc)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).type_ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).irqtype as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(irqtype) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).irqflag as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(irqflag) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).srcbus as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(srcbus) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).srcbusirq as *const _ as usize }, + 5usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(srcbusirq) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).dstapic as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(dstapic) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_intsrc)).dstirq as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(mpc_intsrc), + "::", + stringify!(dstirq) + ) + ); } impl Clone for mpc_intsrc { fn clone(&self) -> Self { @@ -463,54 +659,86 @@ pub struct mpc_lintsrc { } #[test] fn bindgen_test_layout_mpc_lintsrc() { - assert_eq!(::std::mem::size_of::<mpc_lintsrc>(), - 8usize, - concat!("Size of: ", stringify!(mpc_lintsrc))); - assert_eq!(::std::mem::align_of::<mpc_lintsrc>(), - 2usize, - concat!("Alignment of ", stringify!(mpc_lintsrc))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).type_ as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(type_))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).irqtype as *const _ as usize }, - 1usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(irqtype))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).irqflag as *const _ as usize }, - 2usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(irqflag))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).srcbusid as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(srcbusid))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).srcbusirq as *const _ as usize }, - 5usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(srcbusirq))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).destapic as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(destapic))); - assert_eq!(unsafe { &(*(0 as *const mpc_lintsrc)).destapiclint as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(mpc_lintsrc), - "::", - stringify!(destapiclint))); + assert_eq!( + ::std::mem::size_of::<mpc_lintsrc>(), + 8usize, + concat!("Size of: ", stringify!(mpc_lintsrc)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_lintsrc>(), + 2usize, + concat!("Alignment of ", stringify!(mpc_lintsrc)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).type_ as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).irqtype as *const _ as usize }, + 1usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(irqtype) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).irqflag as *const _ as usize }, + 2usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(irqflag) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).srcbusid as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(srcbusid) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).srcbusirq as *const _ as usize }, + 5usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(srcbusirq) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).destapic as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(destapic) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_lintsrc)).destapiclint as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(mpc_lintsrc), + "::", + stringify!(destapiclint) + ) + ); } impl Clone for mpc_lintsrc { fn clone(&self) -> Self { @@ -528,42 +756,66 @@ pub struct mpc_oemtable { } #[test] fn bindgen_test_layout_mpc_oemtable() { - assert_eq!(::std::mem::size_of::<mpc_oemtable>(), - 16usize, - concat!("Size of: ", stringify!(mpc_oemtable))); - assert_eq!(::std::mem::align_of::<mpc_oemtable>(), - 2usize, - concat!("Alignment of ", stringify!(mpc_oemtable))); - assert_eq!(unsafe { &(*(0 as *const mpc_oemtable)).signature as *const _ as usize }, - 0usize, - concat!("Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(signature))); - assert_eq!(unsafe { &(*(0 as *const mpc_oemtable)).length as *const _ as usize }, - 4usize, - concat!("Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(length))); - assert_eq!(unsafe { &(*(0 as *const mpc_oemtable)).rev as *const _ as usize }, - 6usize, - concat!("Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(rev))); - assert_eq!(unsafe { &(*(0 as *const mpc_oemtable)).checksum as *const _ as usize }, - 7usize, - concat!("Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(checksum))); - assert_eq!(unsafe { &(*(0 as *const mpc_oemtable)).mpc as *const _ as usize }, - 8usize, - concat!("Alignment of field: ", - stringify!(mpc_oemtable), - "::", - stringify!(mpc))); + assert_eq!( + ::std::mem::size_of::<mpc_oemtable>(), + 16usize, + concat!("Size of: ", stringify!(mpc_oemtable)) + ); + assert_eq!( + ::std::mem::align_of::<mpc_oemtable>(), + 2usize, + concat!("Alignment of ", stringify!(mpc_oemtable)) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_oemtable)).signature as *const _ as usize }, + 0usize, + concat!( + "Alignment of field: ", + stringify!(mpc_oemtable), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_oemtable)).length as *const _ as usize }, + 4usize, + concat!( + "Alignment of field: ", + stringify!(mpc_oemtable), + "::", + stringify!(length) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_oemtable)).rev as *const _ as usize }, + 6usize, + concat!( + "Alignment of field: ", + stringify!(mpc_oemtable), + "::", + stringify!(rev) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_oemtable)).checksum as *const _ as usize }, + 7usize, + concat!( + "Alignment of field: ", + stringify!(mpc_oemtable), + "::", + stringify!(checksum) + ) + ); + assert_eq!( + unsafe { &(*(0 as *const mpc_oemtable)).mpc as *const _ as usize }, + 8usize, + concat!( + "Alignment of field: ", + stringify!(mpc_oemtable), + "::", + stringify!(mpc) + ) + ); } impl Clone for mpc_oemtable { fn clone(&self) -> Self { diff --git a/x86_64/src/mptable.rs b/x86_64/src/mptable.rs index 6ccb1d6..b7842b0 100644 --- a/x86_64/src/mptable.rs +++ b/x86_64/src/mptable.rs @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use std::error::{self, Error as MptableError}; +use std::fmt::{self, Display}; use std::io; use std::mem; use std::result; use std::slice; -use std::error::{self, Error as MptableError}; -use std::fmt::{self, Display}; use libc::c_char; @@ -43,18 +43,15 @@ pub enum Error { impl error::Error for Error { fn description(&self) -> &str { match self { - &Error::NotEnoughMemory => - "There was too little guest memory to store the MP table", - &Error::AddressOverflow => - "The MP table has too little address space to be stored", + &Error::NotEnoughMemory => "There was too little guest memory to store the MP table", + &Error::AddressOverflow => "The MP table has too little address space to be stored", &Error::Clear => "Failure while zeroing out the memory for the MP table", &Error::WriteMpfIntel => "Failure to write the MP floating pointer", &Error::WriteMpcCpu => "Failure to write MP CPU entry", &Error::WriteMpcIoapic => "Failure to write MP ioapic entry", &Error::WriteMpcBus => "Failure to write MP bus entry", &Error::WriteMpcIntsrc => "Failure to write MP interrupt source entry", - &Error::WriteMpcLintsrc => - "Failure to write MP local interrupt source entry", + &Error::WriteMpcLintsrc => "Failure to write MP local interrupt source entry", &Error::WriteMpcTable => "Failure to write MP table header", } } @@ -105,17 +102,22 @@ fn mpf_intel_compute_checksum(v: &mpf_intel) -> u8 { } fn compute_mp_size(num_cpus: u8) -> usize { - mem::size_of::<mpf_intel>() + mem::size_of::<mpc_table>() + - mem::size_of::<mpc_cpu>() * (num_cpus as usize) + mem::size_of::<mpc_ioapic>() + - mem::size_of::<mpc_bus>() * 2 + mem::size_of::<mpc_intsrc>() + - mem::size_of::<mpc_intsrc>() * 16 + - mem::size_of::<mpc_lintsrc>() * 2 + mem::size_of::<mpf_intel>() + + mem::size_of::<mpc_table>() + + mem::size_of::<mpc_cpu>() * (num_cpus as usize) + + mem::size_of::<mpc_ioapic>() + + mem::size_of::<mpc_bus>() * 2 + + mem::size_of::<mpc_intsrc>() + + mem::size_of::<mpc_intsrc>() * 16 + + mem::size_of::<mpc_lintsrc>() * 2 } /// Performs setup of the MP table for the given `num_cpus`. -pub fn setup_mptable(mem: &GuestMemory, num_cpus: u8, - pci_irqs: Vec<(u32, PciInterruptPin)>) - -> Result<()> { +pub fn setup_mptable( + mem: &GuestMemory, + num_cpus: u8, + pci_irqs: Vec<(u32, PciInterruptPin)>, +) -> Result<()> { const PCI_BUS_ID: u8 = 0; const ISA_BUS_ID: u8 = 1; @@ -164,12 +166,11 @@ pub fn setup_mptable(mem: &GuestMemory, num_cpus: u8, mpc_cpu.type_ = MP_PROCESSOR as u8; mpc_cpu.apicid = cpu_id; mpc_cpu.apicver = APIC_VERSION; - mpc_cpu.cpuflag = CPU_ENABLED as u8 | - if cpu_id == 0 { - CPU_BOOTPROCESSOR as u8 - } else { - 0 - }; + mpc_cpu.cpuflag = CPU_ENABLED as u8 | if cpu_id == 0 { + CPU_BOOTPROCESSOR as u8 + } else { + 0 + }; mpc_cpu.cpufeature = CPU_STEPPING; mpc_cpu.featureflag = CPU_FEATURE_APIC | CPU_FEATURE_FPU; mem.write_obj_at_addr(mpc_cpu, base_mp) @@ -326,7 +327,6 @@ pub fn setup_mptable(mem: &GuestMemory, num_cpus: u8, Ok(()) } - #[cfg(test)] mod tests { use super::*; @@ -345,8 +345,10 @@ mod tests { #[test] fn bounds_check() { let num_cpus = 4; - let mem = GuestMemory::new(&[(GuestAddress(MPTABLE_START), - compute_mp_size(num_cpus) as u64)]).unwrap(); + let mem = GuestMemory::new(&[( + GuestAddress(MPTABLE_START), + compute_mp_size(num_cpus) as u64, + )]).unwrap(); setup_mptable(&mem, num_cpus, Vec::new()).unwrap(); } @@ -354,8 +356,10 @@ mod tests { #[test] fn bounds_check_fails() { let num_cpus = 4; - let mem = GuestMemory::new(&[(GuestAddress(MPTABLE_START), - (compute_mp_size(num_cpus) - 1) as u64)]).unwrap(); + let mem = GuestMemory::new(&[( + GuestAddress(MPTABLE_START), + (compute_mp_size(num_cpus) - 1) as u64, + )]).unwrap(); assert!(setup_mptable(&mem, num_cpus, Vec::new()).is_err()); } @@ -363,8 +367,10 @@ mod tests { #[test] fn mpf_intel_checksum() { let num_cpus = 1; - let mem = GuestMemory::new(&[(GuestAddress(MPTABLE_START), - compute_mp_size(num_cpus) as u64)]).unwrap(); + let mem = GuestMemory::new(&[( + GuestAddress(MPTABLE_START), + compute_mp_size(num_cpus) as u64, + )]).unwrap(); setup_mptable(&mem, num_cpus, Vec::new()).unwrap(); @@ -376,8 +382,10 @@ mod tests { #[test] fn mpc_table_checksum() { let num_cpus = 4; - let mem = GuestMemory::new(&[(GuestAddress(MPTABLE_START), - compute_mp_size(num_cpus) as u64)]).unwrap(); + let mem = GuestMemory::new(&[( + GuestAddress(MPTABLE_START), + compute_mp_size(num_cpus) as u64, + )]).unwrap(); setup_mptable(&mem, num_cpus, Vec::new()).unwrap(); @@ -407,8 +415,10 @@ mod tests { #[test] fn cpu_entry_count() { const MAX_CPUS: u8 = 0xff; - let mem = GuestMemory::new(&[(GuestAddress(MPTABLE_START), - compute_mp_size(MAX_CPUS) as u64)]).unwrap(); + let mem = GuestMemory::new(&[( + GuestAddress(MPTABLE_START), + compute_mp_size(MAX_CPUS) as u64, + )]).unwrap(); for i in 0..MAX_CPUS { setup_mptable(&mem, i, Vec::new()).unwrap(); @@ -416,9 +426,7 @@ mod tests { let mpf_intel: mpf_intel = mem.read_obj_from_addr(GuestAddress(MPTABLE_START)).unwrap(); let mpc_offset = GuestAddress(mpf_intel.physptr as u64); let mpc_table: mpc_table = mem.read_obj_from_addr(mpc_offset).unwrap(); - let mpc_end = mpc_offset - .checked_add(mpc_table.length as u64) - .unwrap(); + let mpc_end = mpc_offset.checked_add(mpc_table.length as u64).unwrap(); let mut entry_offset = mpc_offset .checked_add(mem::size_of::<mpc_table>() as u64) diff --git a/x86_64/src/regs.rs b/x86_64/src/regs.rs index 85d822a..977e19f 100644 --- a/x86_64/src/regs.rs +++ b/x86_64/src/regs.rs @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use std::{mem, result}; use std::error::{self, Error as RegsError}; use std::fmt::{self, Display}; +use std::{mem, result}; +use gdt; use kvm; use kvm_sys::kvm_fpu; use kvm_sys::kvm_msr_entry; use kvm_sys::kvm_msrs; use kvm_sys::kvm_regs; use kvm_sys::kvm_sregs; -use gdt; use sys_util; use sys_util::{GuestAddress, GuestMemory}; @@ -44,27 +44,16 @@ pub type Result<T> = result::Result<T, Error>; impl error::Error for Error { fn description(&self) -> &str { match self { - &Error::MsrIoctlFailed(_) => - "Setting up msrs failed", - &Error::FpuIoctlFailed(_) => - "Failed to configure the FPU", - &Error::GetSRegsIoctlFailed(_) => - "Failed to get sregs for this cpu", - &Error::SettingRegistersIoctl(_) => - "Failed to set base registers for this cpu", - &Error::SetSRegsIoctlFailed(_) => - "Failed to set sregs for this cpu", - &Error::WriteGDTFailure => - "Writing the GDT to RAM failed", - &Error::WriteIDTFailure => - "Writing the IDT to RAM failed", - &Error::WritePML4Address => - "Writing PML4 to RAM failed", - &Error::WritePDPTEAddress => - "Writing PDPTE to RAM failed", - &Error::WritePDEAddress => - "Writing PDE to RAM failed", - + &Error::MsrIoctlFailed(_) => "Setting up msrs failed", + &Error::FpuIoctlFailed(_) => "Failed to configure the FPU", + &Error::GetSRegsIoctlFailed(_) => "Failed to get sregs for this cpu", + &Error::SettingRegistersIoctl(_) => "Failed to set base registers for this cpu", + &Error::SetSRegsIoctlFailed(_) => "Failed to set sregs for this cpu", + &Error::WriteGDTFailure => "Writing the GDT to RAM failed", + &Error::WriteIDTFailure => "Writing the IDT to RAM failed", + &Error::WritePML4Address => "Writing PML4 to RAM failed", + &Error::WritePDPTEAddress => "Writing PDPTE to RAM failed", + &Error::WritePDEAddress => "Writing PDE to RAM failed", } } } @@ -79,57 +68,57 @@ fn create_msr_entries() -> Vec<kvm_msr_entry> { let mut entries = Vec::<kvm_msr_entry>::new(); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_IA32_SYSENTER_CS, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_IA32_SYSENTER_CS, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_IA32_SYSENTER_ESP, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_IA32_SYSENTER_ESP, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_IA32_SYSENTER_EIP, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_IA32_SYSENTER_EIP, + data: 0x0, + ..Default::default() + }); // x86_64 specific msrs, we only run on x86_64 not x86 entries.push(kvm_msr_entry { - index: ::msr_index::MSR_STAR, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_STAR, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_CSTAR, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_CSTAR, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_KERNEL_GS_BASE, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_KERNEL_GS_BASE, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_SYSCALL_MASK, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_SYSCALL_MASK, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_LSTAR, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_LSTAR, + data: 0x0, + ..Default::default() + }); // end of x86_64 specific code entries.push(kvm_msr_entry { - index: ::msr_index::MSR_IA32_TSC, - data: 0x0, - ..Default::default() - }); + index: ::msr_index::MSR_IA32_TSC, + data: 0x0, + ..Default::default() + }); entries.push(kvm_msr_entry { - index: ::msr_index::MSR_IA32_MISC_ENABLE, - data: ::msr_index::MSR_IA32_MISC_ENABLE_FAST_STRING as u64, - ..Default::default() - }); + index: ::msr_index::MSR_IA32_MISC_ENABLE, + data: ::msr_index::MSR_IA32_MISC_ENABLE_FAST_STRING as u64, + ..Default::default() + }); entries } @@ -141,8 +130,8 @@ fn create_msr_entries() -> Vec<kvm_msr_entry> { /// * `vcpu` - Structure for the vcpu that holds the vcpu fd. pub fn setup_msrs(vcpu: &kvm::Vcpu) -> Result<()> { let entry_vec = create_msr_entries(); - let vec_size_bytes = mem::size_of::<kvm_msrs>() + - (entry_vec.len() * mem::size_of::<kvm_msr_entry>()); + let vec_size_bytes = + mem::size_of::<kvm_msrs>() + (entry_vec.len() * mem::size_of::<kvm_msr_entry>()); let vec: Vec<u8> = Vec::with_capacity(vec_size_bytes); let msrs: &mut kvm_msrs = unsafe { // Converting the vector's memory to a struct is unsafe. Carefully using the read-only @@ -198,8 +187,7 @@ pub fn setup_regs(vcpu: &kvm::Vcpu, boot_ip: u64, boot_sp: u64, boot_si: u64) -> ..Default::default() }; - vcpu.set_regs(®s) - .map_err(Error::SettingRegistersIoctl)?; + vcpu.set_regs(®s).map_err(Error::SettingRegistersIoctl)?; Ok(()) } @@ -219,9 +207,11 @@ const BOOT_GDT_MAX: usize = 4; fn write_gdt_table(table: &[u64], guest_mem: &GuestMemory) -> Result<()> { let boot_gdt_addr = GuestAddress(BOOT_GDT_OFFSET); for (index, entry) in table.iter().enumerate() { - let addr = guest_mem.checked_offset(boot_gdt_addr, (index * mem::size_of::<u64>()) as u64) + let addr = guest_mem + .checked_offset(boot_gdt_addr, (index * mem::size_of::<u64>()) as u64) .ok_or(Error::WriteGDTFailure)?; - guest_mem.write_obj_at_addr(*entry, addr) + guest_mem + .write_obj_at_addr(*entry, addr) .map_err(|_| Error::WriteGDTFailure)?; } Ok(()) @@ -236,7 +226,7 @@ fn write_idt_value(val: u64, guest_mem: &GuestMemory) -> Result<()> { fn configure_segments_and_sregs(mem: &GuestMemory, sregs: &mut kvm_sregs) -> Result<()> { let gdt_table: [u64; BOOT_GDT_MAX as usize] = [ - gdt::gdt_entry(0, 0, 0), // NULL + gdt::gdt_entry(0, 0, 0), // NULL gdt::gdt_entry(0xa09b, 0, 0xfffff), // CODE gdt::gdt_entry(0xc093, 0, 0xfffff), // DATA gdt::gdt_entry(0x808b, 0, 0xfffff), // TSS |