1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

Move all files in dedicate to the root folder

This commit is contained in:
l_schmid 2017-05-12 07:11:58 +02:00
parent 0037839174
commit bf26275636
11 changed files with 19 additions and 24 deletions

View file

@ -1,4 +0,0 @@
pub mod qemu;
pub mod multi;
pub mod proto;
pub mod socket;

View file

@ -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::*;

View file

@ -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};

View file

@ -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,

View file

@ -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";

View file

@ -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;

View file

@ -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);

View file

@ -131,7 +131,6 @@ impl VirtualCPU {
pub fn get_supported_cpuid(&self) -> Result<kvm_cpuid2> {
let mut cpuid = kvm_cpuid2::empty();
debug!("Size {}", mem::size_of::<kvm_cpuid2>());
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 => {

View file

@ -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)?;

View file

@ -7,7 +7,7 @@ use error::*;
use libc;
/// Returns the cpu frequency
/// Returns the CPU frequency
pub fn cpufreq() -> Result<u32> {
let mut content = String::new();
@ -44,7 +44,7 @@ pub fn create_tmp_file(name: &str) -> Result<String> {
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 {