Skip to content

Commit

Permalink
Fix Remove M1 limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghao committed Aug 30, 2023
1 parent 076b913 commit 7a9e9ca
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions darwin/PlatformHelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,12 @@ double Platform_calculateNanosecondsPerMachTick(void) {
* the "Apple M1" chip specifically when running under Rosetta 2.
*/

char cpuBrandString[1024] = "";
Platform_getCPUBrandString(cpuBrandString, sizeof(cpuBrandString));

bool isRunningUnderRosetta2 = Platform_isRunningTranslated();

// Kernel version 20.0.0 is macOS 11.0 (Big Sur)
bool isBuggedVersion = Platform_KernelVersionIsBetween((KernelVersion) {20, 0, 0}, (KernelVersion) {999, 999, 999});

if (isRunningUnderRosetta2 && String_eq(cpuBrandString, "Apple M1") && isBuggedVersion) {
if (isRunningUnderRosetta2 && isBuggedVersion) {
// In this case `mach_timebase_info` provides the wrong value, so we hard-code the correct factor,
// as determined from `mach_timebase_info` when the process running natively.
info = (mach_timebase_info_data_t) { .numer = 125, .denom = 3 };
Expand Down

0 comments on commit 7a9e9ca

Please sign in to comment.