All Projects → Thog → ahv

Thog / ahv

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Allows Apple Silicon Hypervisor Framework interactions in a safe manner

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to ahv

Project-Mendacius
A GUI based virtualisation tool for running Linux on macOS Big Sur (x86 or arm64)
Stars: ✭ 107 (+114%)
Mutual labels:  virtualization, apple-silicon
esdc-ce
Danube Cloud :: Community Edition
Stars: ✭ 101 (+102%)
Mutual labels:  virtualization
Kubevirt
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
Stars: ✭ 2,916 (+5732%)
Mutual labels:  virtualization
nuber
Virtualization management software
Stars: ✭ 33 (-34%)
Mutual labels:  virtualization
Tosdatabridge
A collection of resources for pulling real-time streaming data off of TDAmeritrade's ThinkOrSwim(TOS) platform; providing C, C++, Java and Python interfaces.
Stars: ✭ 229 (+358%)
Mutual labels:  virtualization
ryzen-hackintosh
My hackintosh files & hardware info 
Stars: ✭ 19 (-62%)
Mutual labels:  virtualization
Ansible Role Proxmox
Deploys and configures Proxmox VE 5.x/6.x clusters.
Stars: ✭ 196 (+292%)
Mutual labels:  virtualization
vagrant-ovirt4
oVirt v4 provider for Vagrant
Stars: ✭ 33 (-34%)
Mutual labels:  virtualization
Coyote
Framework providing operating system abstractions and a range of shared networking (RDMA, TCP/IP) and memory services to common modern heterogeneous platforms.
Stars: ✭ 80 (+60%)
Mutual labels:  virtualization
community
Community content
Stars: ✭ 29 (-42%)
Mutual labels:  virtualization
open-5g.github.io
Reference website for information on open, programmable, and virtualized 5G networks.
Stars: ✭ 41 (-18%)
Mutual labels:  virtualization
Dojo
Containerize your development and operations environment
Stars: ✭ 240 (+380%)
Mutual labels:  virtualization
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-64%)
Mutual labels:  virtualization
Xo
Merged with monorepo https://github.com/vatesfr/xen-orchestra
Stars: ✭ 219 (+338%)
Mutual labels:  virtualization
blog
retrohunblog
Stars: ✭ 46 (-8%)
Mutual labels:  virtualization
Masonic
🧱 High-performance masonry layouts for React
Stars: ✭ 209 (+318%)
Mutual labels:  virtualization
Tools
Combination of different utilities, have fun!
Stars: ✭ 166 (+232%)
Mutual labels:  virtualization
react-bolivianite-grid
React grid component for virtualized rendering large tabular data.
Stars: ✭ 95 (+90%)
Mutual labels:  virtualization
ADLES
Automated Deployment of Lab Environments System (ADLES)
Stars: ✭ 28 (-44%)
Mutual labels:  virtualization
asitop
Perf monitoring CLI tool for Apple Silicon
Stars: ✭ 1,197 (+2294%)
Mutual labels:  apple-silicon

ahv

Allows interaction with the Hypervisor Framework on Apple Silicon in a safe and unsafe way.

Usage

To use ahv, add this to your Cargo.toml:

[dependencies]
ahv = "0.2.0"

Example

The following example execute a move of the immediate value 2 to register x0 at EL1 and then call HVC 0.

use ahv::*;

fn main() -> Result<()> {
    let el1_user_payload = [
        0x40, 0x00, 0x80, 0xD2, // mov x0, #2
        0x02, 0x00, 0x00, 0xD4, // hvc #0
    ];

    const EL1_USER_PAYLOAD_ADDRESS: hv_ipa_t = 0x20000;
    let mut virtual_machine: VirtualMachine = VirtualMachine::new(None)?;
    let el1_user_payload_allocation_handle = virtual_machine.allocate_from(&el1_user_payload)?;
    virtual_machine.map(el1_user_payload_allocation_handle,
                        EL1_USER_PAYLOAD_ADDRESS,
                        MemoryPermission::READ_WRITE_EXECUTE)?;

    {
        // vCPU scope
        let mut vcpu = virtual_machine.create_vcpu(None)?;

        vcpu.set_register(Register::CPSR, 0x3c4)?;
        vcpu.set_register(Register::PC, EL1_USER_PAYLOAD_ADDRESS)?;
        vcpu.set_trap_debug_exceptions(true)?;
    
        loop {
            let result = vcpu.run()?;
    
            match result {
                VirtualCpuExitReason::Exception { exception } => {
                    let ec = (exception.syndrome >> 26) & 0x3f;
    
                    if ec == 0x16 {
                        println!("HVC executed! x0 is {}", vcpu.get_register(Register::X0)?);
                        break;
                    } else {
                        println!("Unknown exception class 0x{:x}", ec);
                        break;
                    }
                }
                reason => {
                    println!("Unexpected exit! Reason: {:?}", reason);
                    break;
                }
            }
        }
    }

    // VirtualMachine will unmap and deallocate on drop.

    Ok(())
}

To run this example make sure to give the built binary the com.apple.security.hypervisor entitlement.

License

ahv is distributed under the terms of either the MIT license or the Apache License (Version 2.0), at the user's choice.

See LICENSE-APACHE and LICENSE-MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].