Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fatal SEHException on Arm calling RDTSC #1055

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
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
10 changes: 9 additions & 1 deletion src/NetMQ/Core/Utils/OpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ internal static class Opcode

public static bool Open()
{
#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 &&
RuntimeInformation.ProcessArchitecture != Architecture.X64)
{
return false; // RDTSC instruction not supported
}
#endif

var p = (int)Environment.OSVersion.Platform;

byte[] rdtscCode = IntPtr.Size == 4 ? RDTSC_32 : RDTSC_64;

s_size = (ulong)(rdtscCode.Length);

if ((p == 4) || (p == 128))
if ((p == 4) || (p == 128)) // Unix || Mono on Unix
{
// Unix
if (IsARMArchitecture()) return false;
Expand Down