diff --git a/tools/hermit_proxy/src/dedicate/mod.rs b/tools/hermit_proxy/src/dedicate/mod.rs deleted file mode 100644 index 683c2c7a2..000000000 --- a/tools/hermit_proxy/src/dedicate/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod qemu; -pub mod multi; -pub mod proto; -pub mod socket; diff --git a/tools/hermit_proxy/src/hermit.rs b/tools/hermit_proxy/src/hermit.rs index d6aed5856..fc369b5ea 100644 --- a/tools/hermit_proxy/src/hermit.rs +++ b/tools/hermit_proxy/src/hermit.rs @@ -6,8 +6,8 @@ use inotify::INotify; use inotify::ffi::{IN_MODIFY, IN_CREATE}; use hermit_env; -use dedicate::qemu::QEmu; -use dedicate::multi::Multi; +use qemu::QEmu; +use multi::Multi; use uhyve::Uhyve; use uhyve::vm::VirtualMachine; use error::*; diff --git a/tools/hermit_proxy/src/main.rs b/tools/hermit_proxy/src/main.rs index 141a19488..64d996971 100644 --- a/tools/hermit_proxy/src/main.rs +++ b/tools/hermit_proxy/src/main.rs @@ -21,8 +21,11 @@ mod error; mod utils; mod hermit; mod uhyve; -mod dedicate; mod hermit_env; +mod qemu; +mod multi; +mod proto; +mod socket; use nix::sys::signal; use std::{env, process}; diff --git a/tools/hermit_proxy/src/dedicate/multi.rs b/tools/hermit_proxy/src/multi.rs similarity index 98% rename from tools/hermit_proxy/src/dedicate/multi.rs rename to tools/hermit_proxy/src/multi.rs index 3701c0d85..1150370bb 100644 --- a/tools/hermit_proxy/src/dedicate/multi.rs +++ b/tools/hermit_proxy/src/multi.rs @@ -5,7 +5,7 @@ use std::io::{Write, Read}; use error::*; use hermit_env; -use dedicate::socket::Socket; +use socket::Socket; pub struct Multi { num: u8, diff --git a/tools/hermit_proxy/src/dedicate/proto.rs b/tools/hermit_proxy/src/proto.rs similarity index 100% rename from tools/hermit_proxy/src/dedicate/proto.rs rename to tools/hermit_proxy/src/proto.rs diff --git a/tools/hermit_proxy/src/dedicate/qemu.rs b/tools/hermit_proxy/src/qemu.rs similarity index 99% rename from tools/hermit_proxy/src/dedicate/qemu.rs rename to tools/hermit_proxy/src/qemu.rs index fa91f181d..bc3dec0ed 100644 --- a/tools/hermit_proxy/src/dedicate/qemu.rs +++ b/tools/hermit_proxy/src/qemu.rs @@ -7,7 +7,7 @@ use std::fs::File; use std::io::Read; use hermit_env; -use dedicate::socket::Socket; +use socket::Socket; const PIDNAME: &'static str = "/tmp/hpid-XXXXXX"; const TMPNAME: &'static str = "/tmp/hermit-XXXXXX"; diff --git a/tools/hermit_proxy/src/dedicate/socket.rs b/tools/hermit_proxy/src/socket.rs similarity index 99% rename from tools/hermit_proxy/src/dedicate/socket.rs rename to tools/hermit_proxy/src/socket.rs index 5e11b368e..0e789698b 100644 --- a/tools/hermit_proxy/src/dedicate/socket.rs +++ b/tools/hermit_proxy/src/socket.rs @@ -6,8 +6,8 @@ use std::ffi::CString; use std::process; use byteorder::{ReadBytesExt, WriteBytesExt, LittleEndian}; -use dedicate::proto; -use dedicate::proto::Packet; +use proto; +use proto::Packet; use libc; diff --git a/tools/hermit_proxy/src/uhyve/proto.rs b/tools/hermit_proxy/src/uhyve/proto.rs index 1b37798cd..9f04e675a 100644 --- a/tools/hermit_proxy/src/uhyve/proto.rs +++ b/tools/hermit_proxy/src/uhyve/proto.rs @@ -54,9 +54,9 @@ impl Syscall { unsafe { let ref run = *(mem.as_ptr() as *const kvm_run); - debug!("Exit reason {}", run.exit_reason); + debug!("{:?}", &mem[0..100]); - + debug!("Exit reason {}", run.exit_reason); if run.exit_reason != KVM_EXIT_IO { return Syscall::Other(mem.as_ptr() as *const kvm_run); diff --git a/tools/hermit_proxy/src/uhyve/vcpu.rs b/tools/hermit_proxy/src/uhyve/vcpu.rs index 6909caf4a..651bc09ad 100644 --- a/tools/hermit_proxy/src/uhyve/vcpu.rs +++ b/tools/hermit_proxy/src/uhyve/vcpu.rs @@ -131,7 +131,6 @@ impl VirtualCPU { pub fn get_supported_cpuid(&self) -> Result { let mut cpuid = kvm_cpuid2::empty(); - debug!("Size {}", mem::size_of::()); unsafe { uhyve::ioctl::get_supported_cpuid(self.kvm_fd, (&mut cpuid.header) as *mut kvm_cpuid2_header) @@ -206,7 +205,7 @@ impl VirtualCPU { debug!("Set the system to 64bit"); self.setup_system_64bit(&mut sregs)?; - debug!("SREGS {:?}", sregs); + debug!("SREGS {:#?}", sregs); self.set_sregs(sregs)?; @@ -243,8 +242,6 @@ impl VirtualCPU { sregs.gs = data_seg; sregs.ss = data_seg; - debug!("Code: {:#?},\n Data: {:#?}", code_seg,data_seg); - Ok(()) } pub fn setup_system_page_table(&self, sregs: &mut kvm_sregs, mem: &mut [u8]) -> Result<()> { @@ -264,8 +261,6 @@ impl VirtualCPU { *pml4 = (BOOT_PDPTE as u64) | (X86_PDPT_P | X86_PDPT_RW); *pdpte = (BOOT_PDE as u64) | (X86_PDPT_P | X86_PDPT_RW); - println!("\n{}\n", *pdpte); - for i in 0..(GUEST_SIZE/GUEST_PAGE_SIZE) { *(pde.offset(i as isize)) = (i*GUEST_PAGE_SIZE) as u64 | (X86_PDPT_P | X86_PDPT_RW | X86_PDPT_PS); } @@ -288,13 +283,11 @@ impl VirtualCPU { pub fn setup_cpuid(&self) -> Result<()> { let mut kvm_cpuid = self.get_supported_cpuid()?; - debug!("Supported CPUs {:?}", kvm_cpuid.data.iter()); - for entry in kvm_cpuid.data.iter_mut() { match entry.function { 1 => { entry.ecx |= 1u32 << 31; // propagate that we are running on a hypervisor - entry.ecx = entry.ecx & !(1 << 21); + //entry.ecx = entry.ecx & !(1 << 21); entry.edx |= 1u32 << 5; // enable msr support }, 0x0A => { diff --git a/tools/hermit_proxy/src/uhyve/vm.rs b/tools/hermit_proxy/src/uhyve/vm.rs index a40c2cd54..76519d011 100644 --- a/tools/hermit_proxy/src/uhyve/vm.rs +++ b/tools/hermit_proxy/src/uhyve/vm.rs @@ -110,6 +110,7 @@ impl VirtualMachine { slot: 0, guest_phys_addr: 0, flags: 0, memory_size: self.mem.len() as u64, userspace_addr: start_ptr }; + debug!("Bla {}", self.mem.len()); self.set_user_memory_region(kvm_region)?; self.create_irqchip()?; let vcpu = self.create_vcpu(0)?; diff --git a/tools/hermit_proxy/src/utils.rs b/tools/hermit_proxy/src/utils.rs index e4c16adb6..a0e356084 100644 --- a/tools/hermit_proxy/src/utils.rs +++ b/tools/hermit_proxy/src/utils.rs @@ -7,7 +7,7 @@ use error::*; use libc; -/// Returns the cpu frequency +/// Returns the CPU frequency pub fn cpufreq() -> Result { let mut content = String::new(); @@ -44,7 +44,7 @@ pub fn create_tmp_file(name: &str) -> Result { let new_name = CString::from_raw(raw).into_string().unwrap(); - debug!("UTILS - Created tmp file with name {}", new_name); + debug!("Created tmp file with name {}", new_name); Ok(new_name) } @@ -56,6 +56,8 @@ pub fn delete_tmp_file(name: &str) -> Result<()> { let c_str = CString::new(name).unwrap(); let res = libc::unlink(c_str.into_raw()); + debug!("Deleted tmp file {}", name); + if res < 0 { return Err(Error::InvalidFile(name.into())); } else {