by tensor · 1y ago · 0 comments
1. Creating and configuring a virtual machine:
hv_vm_create(HV_VM_DEFAULT);
2. Allocating guest memory: void* memory = mmap(...);
hv_vm_map(memory, guest_physical_address, size, HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC);
3. Creating virtual CPUs: hv_vcpu_create(&vcpu, HV_VCPU_DEFAULT);
4. Setting registers: hv_vcpu_write_register(vcpu, HV_X86_RIP, 0x1000); // Set instruction pointer
hv_vcpu_write_register(vcpu, HV_X86_RSP, 0x8000); // Stack pointer
5. Running guest code: hv_vcpu_run(vcpu);
6. Handling VM exits: hv_vcpu_exit_reason_t reason;
hv_vcpu_read_register(vcpu, HV_X86_EXIT_REASON, &reason);Apple’s stack gives you low-level access to ARM virtualization, and from there Apple has high-level convenience frameworks on top. OrbStack implements all of the high-level code themselves.
Native Linux (and Docker) support would be something like WSL1, where Windows kernel implemented Linux syscalls.
It's possible that Apple has implemented a similar hypervisor here.
XNU is modular, with its BSD servers on top of Mach. I don’t see this as being a strong advantage of NT.
That's their phrasing, which suggests to me that it's just a virtualization system. Linux container images generally contain the kernel.
No, containers differ from VMs precisely in requiring dependency on the host kernel.