1.1 --- a/Hardware/Ring0.cs Mon Nov 01 20:44:21 2010 +0000
1.2 +++ b/Hardware/Ring0.cs Wed Nov 03 22:07:46 2010 +0000
1.3 @@ -95,6 +95,11 @@
1.4 }
1.5
1.6 public static void Open() {
1.7 + // No implementation for Unix systems
1.8 + int p = (int)Environment.OSVersion.Platform;
1.9 + if ((p == 4) || (p == 128))
1.10 + return;
1.11 +
1.12 if (driver != null)
1.13 return;
1.14
1.15 @@ -170,15 +175,13 @@
1.16 }
1.17
1.18 public static bool RdmsrTx(uint index, out uint eax, out uint edx,
1.19 - UIntPtr threadAffinityMask)
1.20 + ulong threadAffinityMask)
1.21 {
1.22 - IntPtr thread = NativeMethods.GetCurrentThread();
1.23 - UIntPtr mask = NativeMethods.SetThreadAffinityMask(thread,
1.24 - threadAffinityMask);
1.25 + ulong mask = ThreadAffinity.Set(threadAffinityMask);
1.26
1.27 bool result = Rdmsr(index, out eax, out edx);
1.28
1.29 - NativeMethods.SetThreadAffinityMask(thread, mask);
1.30 + ThreadAffinity.Set(mask);
1.31 return result;
1.32 }
1.33
1.34 @@ -276,16 +279,5 @@
1.35
1.36 return driver.DeviceIOControl(IOCTL_OLS_WRITE_PCI_CONFIG, input);
1.37 }
1.38 -
1.39 - private static class NativeMethods {
1.40 - private const string KERNEL = "kernel32.dll";
1.41 -
1.42 - [DllImport(KERNEL, CallingConvention = CallingConvention.Winapi)]
1.43 - public static extern UIntPtr
1.44 - SetThreadAffinityMask(IntPtr handle, UIntPtr mask);
1.45 -
1.46 - [DllImport(KERNEL, CallingConvention = CallingConvention.Winapi)]
1.47 - public static extern IntPtr GetCurrentThread();
1.48 - }
1.49 }
1.50 }