Comments (10)
I'm working on a stack of Hypervisor.framework patches here: https://android-review.googlesource.com/c/platform/external/qemu/+/1510277
from xhyve.
You can pretty much follow those and incorporate into the xhyve implementation. It was quite straightforward compared to x86 support and as long as you have virtual firmware for setting up memory maps and routing interrupts, it should be doable. The key parts are:
-
Setting up an arm64 set of source files in xhyve/src for storing register state along with timer and GIC state. You can use the qemu version as a reference. You'll probably need a different set of virtual firmware sources. You can use the virt board (https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/hw/arm/virt.c) as a reference. You'll need to implement something that stores information for memory maps, irqs, etc. and implements the state for GIC and vtimer.
-
I notice there's a lot of x86-isms still present in the source, such as vmm_ioport.c, vmm_util.c, vmm_lapic.c, etc. vmm.c will need different handlers for ARM64 style exits such as DABT and WFx in addition to Hypevisor.framework's VTIMER. (see the code for reference).
-
First, try getting something basic running that uses hv_vcpu_run, hv_vm_create, hv_vm_map that follows how it's being used in xhyve, while aborting on all exits, similar to https://android.googlesource.com/platform/external/qemu/+/c17eb6a3ffd50047e9646aff6640b710cb8ff48a
You'll need to ensure that
- Hypervisor.framework's PC register is pointed to the same beginning address specified by virtual firmware in xhyve
- Memory maps are all set up
- Register sync up when guest exits and pre-guest-enters is working. We found https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/target/arm/hvf.c#699 to be a sufficient set of registers.
- Implement VM exit handling
There will be these types of Hypervisor.framework exits that you need to handle for ARM64:
- EL2 Exception (https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/target/arm/hvf.c#1439), which includes the following subclasses:
- WFx (Wait for Interrupt)
- Guest Abort (Data or Instruction Abort) for MMIO
- SMC
- system register access
- VTimer access (https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/target/arm/hvf.c#1595)
- This happens when the guest sets a timer but doesn't really have much to do after that and wants to be woken up later on
- Implement kicking the vcpus out of running the guest (https://android.googlesource.com/platform/external/qemu/+/cfaec60e391f549fed43736aa09fa670416b6bdf)
- here: https://github.com/machyve/xhyve/blob/master/src/vmm/vmm.c#L1689
- you'll need to use hv_vcpus_exit() API
from xhyve.
Right. I was trying to get something quick and dirty up and running, so I used the Virt framework. A full solution built using the Hypervisor framework would be nice to have since that would provide an ability to add/remove hardware and change the machine model, among many other things.
from xhyve.
This is upsetting. https://forums.macrumors.com/threads/if-you-disable-sip-all-you-ios-apps-will-stop-working-on-your-m1.2269661/
Turning off SIP just to run dtruss hoses apps permanently. You would have to link with a tracing glibc to get system calls.
from xhyve.
ls /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk//System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/arm64
machine_cpuid.h machine_machdep.h
These seem to be the arm64 headers to fix src/vmm/x86.c ?
from xhyve.
https://developer.apple.com/documentation/hypervisor/apple_silicon
from xhyve.
@jonmasters got Fedora to boot on M1 https://twitter.com/jonmasters/status/1331137023386800128
from xhyve.
That's with Virtualization.framework, which is the easier-to-use library versus Hypervisor.framework (and may be more appropriate even?)
The tweet references https://github.com/KhaosT/SimpleVM
from xhyve.
To answer @chadbrewbaker original question. The build generates an x86_64 binary and Rosetta won’t work for virtualization which was made clear by Apple. This won’t work for arm64 until it is ported and if you are interested you should look at the architecture specific code in FreeBSD-UPB/freebsd:bhyvearm64-rebase for inspiration. While following this paper: https://papers.freebsd.org/2019/bsdcan/elisei-bhyvearm64_cpu_and_memory_virtualization_on_armv8.0_a/
from xhyve.
I'm working on a stack of Hypervisor.framework patches here: https://android-review.googlesource.com/c/platform/external/qemu/+/1510277
@741g looks like that got merged. what are the next steps? :)
https://gist.github.com/osy86/10d0ac0210f0eb99474ae31cf8d6dd9e#file-windows-10-arm-utm-zip for anybody else that lands on this
from xhyve.
Related Issues (20)
- building on Linux? HOT 3
- Port to AMD SVM HOT 2
- Incorrect SMBIOS type 17 table generation
- Use ASL compiler to build ACPI Tables
- Unable to create VM (22) vmx_set_ctlreg: cap_field: 2 bit: 20 unspecified don't care HOT 2
- Windows 10 fails to boot with rdmsr to register 0x3a on vcpu 0 error HOT 6
- Still doesn't work on Big Sur for me HOT 8
- com.apple.vm.hypervisor is deprecated HOT 1
- Best way to shutdown VM? HOT 2
- Alpine Linux boot hangs at "Mounting boot media: [ 0.750233] SCSI subsystem initialized"
- Success with NetBSD, DragonFly BSD or OpenSolaris?
- Challenges in porting Bhyve to Xhyve (MAC)? HOT 1
- AppleSilicon support
- virtio_9p? HOT 4
- Monterey: make returns atomic.h error
- signing xhyve
- New release? HOT 1
- Cluster provider for xhyve
- Is it possible to run macOS guests in xHyve? Hackintosh-like?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhyve.