- Notifications
You must be signed in to change notification settings - Fork0
Virtual machine's guest memory crate
License
Apache-2.0, BSD-3-Clause licenses found
Licenses found
sshyran/vm-memory-rust
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
In a typical Virtual Machine Monitor (VMM) there are several components, suchas boot loader, virtual device drivers, virtio backend drivers and vhostdrivers, that need to access the VM physical memory. Thevm-memory crateprovides a set of traits to decouple VM memory consumers from VM memoryproviders. Based on these traits, VM memory consumers can access the physicalmemory of the VM without knowing the implementation details of the VM memoryprovider. Thus VMM components based on these traits can be shared and reused bymultiple virtualization solutions.
The detailed design of thevm-memory crate can be foundhere.
- Arch: x86, AMD64, ARM64
- OS: Linux/Unix/Windows
Addvm-memory as a dependency inCargo.toml
[dependencies]vm-memory ="*"
Then addextern crate vm-memory; to your crate root.
- Creating a VM physical memory object in hypervisor specific ways using the
GuestMemoryMmapimplementation of theGuestMemorytrait:
fnprovide_mem_to_virt_dev(){let gm =GuestMemoryMmap::from_ranges(&[(GuestAddress(0),0x1000),(GuestAddress(0x1000),0x1000)]).unwrap();virt_device_io(&gm);}
- Consumers accessing the VM's physical memory:
fnvirt_device_io<T:GuestMemory>(mem:&T){let sample_buf =&[1,2,3,4,5];assert_eq!(mem.write(sample_buf,GuestAddress(0xffc)).unwrap(),5);let buf =&mut[0u8;5];assert_eq!(mem.read(buf,GuestAddress(0xffc)).unwrap(),5);assert_eq!(buf, sample_buf);}
This project is licensed under either of
- Apache License, Version 2.0
- BSD-3-Clause License
About
Virtual machine's guest memory crate
Resources
License
Apache-2.0, BSD-3-Clause licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Languages
- Rust100.0%