diff --git a/Cargo.lock b/Cargo.lock index f2a5fb901..7d0c8d870 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,6 +37,21 @@ name = "cloud-hypervisor" version = "0.1.0" dependencies = [ "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "vmm 0.1.0", +] + +[[package]] +name = "kvm-bindings" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kvm-ioctls" +version = "0.1.0" +source = "git+https://github.com/rust-vmm/kvm-ioctls#e0d6aefd28097446ee8fcd66160c583f165b5116" +dependencies = [ + "kvm-bindings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -90,6 +105,23 @@ name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "vm-memory" +version = "0.1.0" +source = "git+https://github.com/rust-vmm/vm-memory#08b24bf6245459f14226f52f19f91ad9648ad8e6" +dependencies = [ + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vmm" +version = "0.1.0" +dependencies = [ + "kvm-bindings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kvm-ioctls 0.1.0 (git+https://github.com/rust-vmm/kvm-ioctls)", + "vm-memory 0.1.0 (git+https://github.com/rust-vmm/vm-memory)", +] + [[package]] name = "winapi" version = "0.3.6" @@ -114,6 +146,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180" +"checksum kvm-bindings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c223e8703d2eb76d990c5f58e29c85b0f6f50e24b823babde927948e7c71fc03" +"checksum kvm-ioctls 0.1.0 (git+https://github.com/rust-vmm/kvm-ioctls)" = "" "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" @@ -122,6 +156,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum vm-memory 0.1.0 (git+https://github.com/rust-vmm/vm-memory)" = "" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 5070c5b9e..2fd966169 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,4 +5,6 @@ authors = ["The Cloud Hypervisor Authors"] edition = "2018" [dependencies] -clap = "=2.27.1" \ No newline at end of file +clap = "=2.27.1" + +vmm = { path = "vmm" } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 9d2fdf23b..95d280cf2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 // +extern crate vmm; + #[macro_use(crate_version, crate_authors)] extern crate clap; @@ -29,4 +31,6 @@ fn main() { .expect("Missing argument: kernel"); println!("Booting {:?}...", kernel_path.as_path()); + + vmm::test_vm() } diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 76aa532fd..7f0a1271c 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -16,16 +16,16 @@ pub fn test_vm() { let code = [ 0xba, 0xf8, 0x03, /* mov $0x3f8, %dx */ 0x00, 0xd8, /* add %bl, %al */ - 0x04, '0' as u8, /* add $'0', %al */ - 0xee, /* out %al, (%dx) */ - 0xb0, '\n' as u8, /* mov $'\n', %al */ - 0xee, /* out %al, (%dx) */ - 0xf4, /* hlt */ + 0x04, b'0', /* add $'0', %al */ + 0xee, /* out %al, (%dx) */ + 0xb0, b'\n', /* mov $'\n', %al */ + 0xee, /* out %al, (%dx) */ + 0xf4, /* hlt */ ]; let mem_size = 0x1000; let load_addr = GuestAddress(0x1000); - let mem = GuestMemoryMmap::new(&vec![(load_addr, mem_size)]).unwrap(); + let mem = GuestMemoryMmap::new(&[(load_addr, mem_size)]).unwrap(); let kvm = Kvm::new().expect("new KVM instance creation failed"); let vm_fd = kvm.create_vm().expect("new VM fd creation failed");