diff -r 9bf70d316cea -r bddc6e01840a Hardware/Ring0.cs --- a/Hardware/Ring0.cs Mon Nov 01 20:44:21 2010 +0000 +++ b/Hardware/Ring0.cs Wed Nov 03 22:07:46 2010 +0000 @@ -95,6 +95,11 @@ } public static void Open() { + // No implementation for Unix systems + int p = (int)Environment.OSVersion.Platform; + if ((p == 4) || (p == 128)) + return; + if (driver != null) return; @@ -170,15 +175,13 @@ } public static bool RdmsrTx(uint index, out uint eax, out uint edx, - UIntPtr threadAffinityMask) + ulong threadAffinityMask) { - IntPtr thread = NativeMethods.GetCurrentThread(); - UIntPtr mask = NativeMethods.SetThreadAffinityMask(thread, - threadAffinityMask); + ulong mask = ThreadAffinity.Set(threadAffinityMask); bool result = Rdmsr(index, out eax, out edx); - NativeMethods.SetThreadAffinityMask(thread, mask); + ThreadAffinity.Set(mask); return result; } @@ -276,16 +279,5 @@ return driver.DeviceIOControl(IOCTL_OLS_WRITE_PCI_CONFIG, input); } - - private static class NativeMethods { - private const string KERNEL = "kernel32.dll"; - - [DllImport(KERNEL, CallingConvention = CallingConvention.Winapi)] - public static extern UIntPtr - SetThreadAffinityMask(IntPtr handle, UIntPtr mask); - - [DllImport(KERNEL, CallingConvention = CallingConvention.Winapi)] - public static extern IntPtr GetCurrentThread(); - } } }