summary refs log tree commit diff
path: root/kvm
diff options
context:
space:
mode:
authorSonny Rao <sonnyrao@chromium.org>2017-12-27 23:20:29 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-02 21:32:18 -0800
commit4aa86930edecf6b7842b9403dbea153ba8101e00 (patch)
tree2dc9a2b775c325b490735ec30b149eca587d3707 /kvm
parent295ccac1f3d6d9291ebc86df076920102cdbb63d (diff)
downloadcrosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar.gz
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar.bz2
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar.lz
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar.xz
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.tar.zst
crosvm-4aa86930edecf6b7842b9403dbea153ba8101e00.zip
kvm_sys: update bindings and add aarch64 bindings
Re-generated the bindings for x86_64 and arm which now use union types
so a little bit of code in the library also changed, and adds bindings
for aarch64 which are required to run an aarch64 guest.

Also, I manually fixed the zero-length array cases where rust bindgen
doesn't properly align the structs.  See rust bindgen bug 684.

BUG=chromium:797868
TEST=run crosvm on x86_64, ensure networking works
TEST=./build_test passes on x86

Change-Id: Iab2193a8f1d4c68bd3346ae683c74bbf16fe45d4
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/845519
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'kvm')
-rw-r--r--kvm/src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/kvm/src/lib.rs b/kvm/src/lib.rs
index 15880eb..30dd499 100644
--- a/kvm/src/lib.rs
+++ b/kvm/src/lib.rs
@@ -290,7 +290,7 @@ impl Vm {
     #[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
     pub fn set_irq_line(&self, irq: u32, active: bool) -> Result<()> {
         let mut irq_level = kvm_irq_level::default();
-        *unsafe { irq_level.__bindgen_anon_1.irq.as_mut() } = irq;
+        irq_level.__bindgen_anon_1.irq = irq;
         irq_level.level = if active { 1 } else { 0 };
 
         // Safe because we know that our file is a VM fd, we know the kernel will only read the
@@ -471,7 +471,7 @@ impl Vcpu {
                     let run_start = run as *mut kvm_run as *mut u8;
                     // Safe because the exit_reason (which comes from the kernel) told us which
                     // union field to use.
-                    let io = unsafe { run.__bindgen_anon_1.io.as_ref() };
+                    let io = unsafe { run.__bindgen_anon_1.io };
                     let port =  io.port;
                     let data_size = io.count as usize * io.size as usize;
                     // The data_offset is defined by the kernel to be some number of bytes into the
@@ -491,7 +491,7 @@ impl Vcpu {
                 KVM_EXIT_MMIO => {
                     // Safe because the exit_reason (which comes from the kernel) told us which
                     // union field to use.
-                    let mmio = unsafe { run.__bindgen_anon_1.mmio.as_mut() };
+                    let mmio = unsafe { &mut run.__bindgen_anon_1.mmio };
                     let addr = mmio.phys_addr;
                     let len = mmio.len as usize;
                     let data_slice = &mut mmio.data[..len];