Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Virtual machine's guest memory crate

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
BSD-3-Clause
LICENSE-BSD-3-Clause
NotificationsYou must be signed in to change notification settings

likebreath/vm-memory

 
 

Design

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.

Platform Support

  • Arch: x86, AMD64, ARM64
  • OS: Linux/Unix/Windows

Usage

Addvm-memory as a dependency inCargo.toml

[dependencies]vm-memory ="*"

Then addextern crate vm-memory; to your crate root.

Examples

  • Creating a VM physical memory object in hypervisor specific ways using theGuestMemoryMmap implementation of theGuestMemory trait:
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);}

License

This project is licensed under either of

About

Virtual machine's guest memory crate

Resources

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
BSD-3-Clause
LICENSE-BSD-3-Clause

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust100.0%

[8]ページ先頭

©2009-2025 Movatter.jp