Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use SystemPageSize
  • Loading branch information
timcassell committed Aug 24, 2023
commit 383ab60f2261e063e75f9516e9cc845b6858c6b7
16 changes: 2 additions & 14 deletions src/BenchmarkDotNet/Disassemblers/ClrMdV2Disassembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,15 @@ private static ulong GetMinValidAddress()
// https://github.com/dotnet/BenchmarkDotNet/pull/2413#issuecomment-1688100117
if (RuntimeInformation.IsWindows())
return 65536;
if (RuntimeInformation.IsLinux())
return (ulong) Environment.SystemPageSize;
if (RuntimeInformation.IsMacOS())
return RuntimeInformation.GetCurrentPlatform() switch
{
Environments.Platform.X86 or Environments.Platform.X64 => 4096,
Environments.Platform.Arm64 => 0x100000000,
_ => throw new NotSupportedException($"{RuntimeInformation.GetCurrentPlatform()} is not supported")
};
if (RuntimeInformation.IsLinux())
{
try
{
if (File.Exists("/proc/sys/vm/mmap_min_addr"))
{
string? minAddrResult = File.ReadAllText("/proc/sys/vm/mmap_min_addr");
ulong.TryParse(minAddrResult, out ulong minAddress);
return minAddress;
}
}
catch { }
return 0;
}
throw new NotSupportedException($"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported");
}

Expand Down