utmapp / utmapp/UTM

Implement (some/all of) the things Rosetta 2 does to achieve high x86_64 performance on Apple Silicon

Open
#5,460 16 comments 9 reactions 0 assignees View on GitHub
enhancement qemu
Dominant language
Swift
Stars
35.5k
Forks
1.8k
Avg merge
5d 5h
Merged PRs (30d)
7

Description

Hi all,
As is well known Rosetta 2 runs x86_64 code on Apple Silicon typically 4-5X faster than QEMU/UTM. These are big gains. This speed-up is due primarily to 3 things that QEMU/UTM does not do on macOS:

1. Use of TSO mode (removes the need for memory fences)
2. Return address prediction (rewriting CALL/RET with BL/RET with some extra housekeeping)
3. Use of Apple Silicon ARM extensions to handle x86_64 flag setting directly (SETF8, SETF16, AXFLAG, XAFLAG)

#1 probably gives the largest gains and can be enabled from userland with the com.apple.private.oahd entitlement. Yes, this couldn't be done with the App Store version of UTM, but shouldn't cause any difficulties for the direct-download version.

#2 and #3 can be achieved without any special entitlements.

QEMU may or may not have interest in implementing these since they are Apple Silicon specific. Has UTM considered these for its QEMU fork? One or more of these changes could lead to large gains.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.