Skip to content

Commit ea4757a

Browse files
authored
Merge pull request #4 from RWTH-OS/aarch64
add support for Apple Silicon
2 parents 27b46b4 + b6f4b3d commit ea4757a

File tree

18 files changed

+2051
-317
lines changed

18 files changed

+2051
-317
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: '0 3 * * 1'
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: macos-11
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Install toolchain from rust-toolchain.toml
21+
run: rustup show
22+
- name: Install missing targets
23+
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
24+
- name: Build for x86_64
25+
run: cargo build --target x86_64-apple-darwin
26+
- name: Build for aarch64
27+
run: cargo build --target aarch64-apple-darwin

.github/workflows/format.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Format
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
format:
14+
name: Format
15+
runs-on: macos-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Install toolchain from rust-toolchain.toml
19+
run: rustup show
20+
- name: Format
21+
run: cargo fmt --all -- --check

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[package]
22
name = "xhypervisor"
3-
version = "0.0.12"
3+
version = "0.2.0"
44
authors = ["Stefan Lankes", "Saurav Sachidanand"]
5+
edition = "2021"
56

67
license = "MIT"
78
repository = "https://www.github.com/RWTH-OS/xhypervisor"
89
documentation = "https://docs.rs/xhypervisor/"
910
readme = "README.md"
1011
description = " Hardware-accelerated virtualization on OS X"
11-
keywords = ["hypervisor", "virtualization", "osx", "x86", "VT-x"]
12+
keywords = ["hypervisor", "virtualization", "osx", "x86", "VT-x", "aarch64"]
1213

1314
build = "build.rs"
1415

1516
[dependencies]
16-
libc = "0.2.66"
17+
libc = "0.2"
1718
thiserror = "1.0"

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
`xhypervisor` is a Rust library that taps into functionality that enables hardware-accelerated execution of virtual machines on OS X.
88
It is a fork of [hypervisor-rs](https://github.com/saurvs/hypervisor-rs) and modified for the development of [uhyve](https://github.com/hermitcore/uhyve) and [ehyve](https://github.com/RWTH-OS/ehyve).
9+
Derived from [ahv](https://github.com/Thog/ahv), we added the support of Apple's Hypervisor Framework on Apple Silicon.
910

1011
It binds to the [Hypervisor](https://developer.apple.com/documentation/hypervisor) framework on OS X, and exposes a safe Rust interface through the `hypervisor` module, and an unsafe foreign function interface through the `xhypervisor::ffi` module.
1112

@@ -17,17 +18,18 @@ To use this library, you need
1718

1819
* OS X Yosemite (10.10), or newer
1920

20-
* an Intel processor with the VT-x feature set that includes Extended Page
21-
Tables (EPT) and the Unrestricted Mode. To verify this, run and expect the
21+
* a Intel processor with the VT-x feature or an Apple Silicon processor with virtualization support. To verify this, run and expect the
2222
following in your Terminal:
2323
```shell
2424
$ sysctl kern.hv_support
2525
kern.hv_support: 1
2626
```
2727

2828
## Status
29+
- **WARNING:** The Apple Silicon support is in an early state
2930
- [x] Accessing x86 registers
30-
- [x] Accessing model-specific registers (MSRs)
31+
- [x] Accessing aarch64 registers
32+
- [x] x86: Accessing model-specific registers (MSRs)
3133
- [x] Mapping guest physical memory segments into guest physical address space
3234
- [x] Virtual CPUs
3335
- [x] Executing and interrupting
@@ -36,4 +38,4 @@ following in your Terminal:
3638
- [x] Accessing floating point (FP) and SIMD state
3739
- [x] Obtaining cumulative execution time
3840
- [x] Synchronizing guest timestamp-counters (TSC)
39-
- [x] Accessing fields of Virtual Machine Control Structures (VMCS)
41+
- [x] x86: Accessing fields of Virtual Machine Control Structures (VMCS)

app.entitlements

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.hypervisor</key>
6+
<true/>
7+
</dict>
8+
</plist>

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fn main() {
22
println!("cargo:rustc-link-lib=framework=Hypervisor");
3+
println!("link-arg=-mmacosx-version-min=11.0");
34
}

0 commit comments

Comments
 (0)