{"id":13612142,"url":"https://github.com/marysaka/ahv","last_synced_at":"2025-09-20T13:32:13.588Z","repository":{"id":54736575,"uuid":"324586500","full_name":"marysaka/ahv","owner":"marysaka","description":"Bindings for Apple Silicon Hypervisor","archived":false,"fork":false,"pushed_at":"2025-02-16T09:15:54.000Z","size":60,"stargazers_count":64,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-13T07:31:14.542Z","etag":null,"topics":["apple-silicon","macos","nostd","virtualization"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marysaka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-26T15:49:13.000Z","updated_at":"2025-07-24T03:31:43.000Z","dependencies_parsed_at":"2024-11-07T20:32:58.817Z","dependency_job_id":"bd451b0a-b2d0-4fd2-951c-f2246a765db8","html_url":"https://github.com/marysaka/ahv","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":"0.19999999999999996","last_synced_commit":"52de9a3a63699d60afcb27bda1e18fc9730138c1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/marysaka/ahv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marysaka%2Fahv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marysaka%2Fahv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marysaka%2Fahv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marysaka%2Fahv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marysaka","download_url":"https://codeload.github.com/marysaka/ahv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marysaka%2Fahv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276105131,"owners_count":25586179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple-silicon","macos","nostd","virtualization"],"created_at":"2024-08-01T20:00:23.316Z","updated_at":"2025-09-20T13:32:13.310Z","avatar_url":"https://github.com/marysaka.png","language":"Rust","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# ahv\n\nBindings for Apple Silicon Hypervisor.\n\n## Usage\n\nTo use `ahv`, add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nahv = \"0.3.0\"\n```\n\n## Example\n\nThe following example execute a move of the immediate value 2 to register x0 at EL1 and then call HVC 0.\n\n```rust\nuse ahv::*;\n\nfn main() -\u003e Result\u003c()\u003e {\n    let el1_user_payload = [\n        0x40, 0x00, 0x80, 0xD2, // mov x0, #2\n        0x02, 0x00, 0x00, 0xD4, // hvc #0\n    ];\n\n    const EL1_USER_PAYLOAD_ADDRESS: hv_ipa_t = 0x20000;\n    let mut virtual_machine: VirtualMachine = VirtualMachine::new(None)?;\n    let el1_user_payload_allocation_handle = virtual_machine.allocate_from(\u0026el1_user_payload)?;\n    virtual_machine.map(el1_user_payload_allocation_handle,\n                        EL1_USER_PAYLOAD_ADDRESS,\n                        MemoryPermission::READ_WRITE_EXECUTE)?;\n\n    {\n        // vCPU scope\n        let mut vcpu = virtual_machine.create_vcpu(None)?;\n\n        vcpu.set_register(Register::CPSR, 0x3c4)?;\n        vcpu.set_register(Register::PC, EL1_USER_PAYLOAD_ADDRESS)?;\n        vcpu.set_trap_debug_exceptions(true)?;\n    \n        loop {\n            let result = vcpu.run()?;\n    \n            match result {\n                VirtualCpuExitReason::Exception { exception } =\u003e {\n                    let ec = (exception.syndrome \u003e\u003e 26) \u0026 0x3f;\n    \n                    if ec == 0x16 {\n                        println!(\"HVC executed! x0 is {}\", vcpu.get_register(Register::X0)?);\n                        break;\n                    } else {\n                        println!(\"Unknown exception class 0x{:x}\", ec);\n                        break;\n                    }\n                }\n                reason =\u003e {\n                    println!(\"Unexpected exit! Reason: {:?}\", reason);\n                    break;\n                }\n            }\n        }\n    }\n\n    // VirtualMachine will unmap and deallocate on drop.\n\n    Ok(())\n}\n```\n\n**To run this example make sure to give the built binary the ``com.apple.security.hypervisor`` entitlement.**\n\n## MSRV\n\nCurrent MSRV is 1.65.0.\n\n## License\n\nahv is distributed under the terms of either the MIT license or the Apache\nLicense (Version 2.0), at the user's choice.\n\nSee [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarysaka%2Fahv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarysaka%2Fahv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarysaka%2Fahv/lists"}