Skip to content

Commit ebe5ad3

Browse files
authored
Merge pull request #1055 from jonorossi/rdtsc-arm
Fix fatal SEHException on Arm calling RDTSC
2 parents 40504cd + 380d827 commit ebe5ad3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/NetMQ/Core/Utils/OpCode.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ internal static class Opcode
1212

1313
public static bool Open()
1414
{
15+
#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
16+
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 &&
17+
RuntimeInformation.ProcessArchitecture != Architecture.X64)
18+
{
19+
return false; // RDTSC instruction not supported
20+
}
21+
#endif
22+
1523
var p = (int)Environment.OSVersion.Platform;
1624

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

1927
s_size = (ulong)(rdtscCode.Length);
2028

21-
if ((p == 4) || (p == 128))
29+
if ((p == 4) || (p == 128)) // Unix || Mono on Unix
2230
{
2331
// Unix
2432
if (IsARMArchitecture()) return false;

0 commit comments

Comments
 (0)