Commit 909a9407 authored by Avi Drissman's avatar Avi Drissman Committed by Chromium LUCI CQ

Fix OS Architecture under Rosetta

base::SysInfo::OperatingSystemArchitecture() should return the
architecture of the underlying OS, not the architecture of the
Chromium binary. However, arch(3) under Rosetta will lie.

Therefore, on the Mac, rely on the documented API to determine
if Chromium is running under Rosetta and return correct values.

Fixed: 1155315
Change-Id: I94e851b8e64eeacf776d1fed0579e5e543539402
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613154
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841164}
parent a6cd3092
......@@ -63,6 +63,17 @@ void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
*bugfix_version = version.patchVersion;
}
// static
std::string SysInfo::OperatingSystemArchitecture() {
switch (mac::GetCPUType()) {
case mac::CPUType::kIntel:
return "x86_64";
case mac::CPUType::kTranslatedIntel:
case mac::CPUType::kArm:
return "arm64";
}
}
// static
int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
struct host_basic_info hostinfo;
......
......@@ -211,6 +211,7 @@ void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
}
#endif
#if !defined(OS_MAC)
// static
std::string SysInfo::OperatingSystemArchitecture() {
struct utsname info;
......@@ -228,6 +229,7 @@ std::string SysInfo::OperatingSystemArchitecture() {
}
return arch;
}
#endif // !defined(OS_MAC)
// static
size_t SysInfo::VMAllocationGranularity() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment