diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-12-22 11:46:17 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-12-23 17:43:21 +0300 |
commit | d1823e83d7335aa99b1cff887543a56c2b17aa78 (patch) | |
tree | 7f2df0ca5774734eb7270497845e0ef5d4d3d0ef /src/System.Private.CoreLib | |
parent | ca7ce91a101d1e5f796394046b8326af6dc9012e (diff) |
Refactor MEMORY_BASIC_INFORMATION, SYSTEM_INFO
Diffstat (limited to 'src/System.Private.CoreLib')
4 files changed, 13 insertions, 38 deletions
diff --git a/src/System.Private.CoreLib/src/Interop/Interop.manual.cs b/src/System.Private.CoreLib/src/Interop/Interop.manual.cs index b08beefa6..4ccf5bcd4 100644 --- a/src/System.Private.CoreLib/src/Interop/Interop.manual.cs +++ b/src/System.Private.CoreLib/src/Interop/Interop.manual.cs @@ -177,38 +177,12 @@ internal partial class Interop internal int DaylightBias; } - [StructLayout(LayoutKind.Sequential)] - internal struct _SYSTEM_INFO - { - internal int dwOemId; - internal int dwPageSize; - internal IntPtr lpMinimumApplicationAddress; - internal IntPtr lpMaximumApplicationAddress; - internal IntPtr dwActiveProcessorMask; - internal int dwNumberOfProcessors; - internal int dwProcessorType; - internal int dwAllocationGranularity; - internal short wProcessorLevel; - internal short wProcessorRevision; - } - internal struct _FILETIME { internal uint dwLowDateTime; internal uint dwHighDateTime; } - internal struct _MEMORY_BASIC_INFORMATION - { - internal IntPtr BaseAddress; - internal IntPtr AllocationBase; - internal uint AllocationProtect; - internal UIntPtr RegionSize; - internal uint State; - internal uint Protect; - internal uint Type; - } - internal unsafe struct InlineArray_ULONG_PTR_15 { internal UIntPtr this[uint index] @@ -464,9 +438,6 @@ internal partial class Interop [DllImport("api-ms-win-core-localization-l1-2-0.dll", CharSet = CharSet.Unicode)] internal static extern int GetLocaleInfoEx(string lpLocaleName, uint LCType, IntPtr lpLCData, int cchData); - [DllImport("api-ms-win-core-sysinfo-l1-2-0.dll")] - internal extern static void GetNativeSystemInfo(out _SYSTEM_INFO lpSystemInfo); - [DllImport("api-ms-win-core-heap-l1-1-0.dll")] internal extern static IntPtr GetProcessHeap(); @@ -556,9 +527,6 @@ internal partial class Interop [DllImport("api-ms-win-core-localization-l1-2-0.dll", CharSet = CharSet.Unicode)] internal extern static int LCMapStringEx(string lpLocaleName, uint dwMapFlags, string lpSrcStr, int cchSrc, IntPtr lpDestStr, int cchDest, IntPtr lpVersionInformation, IntPtr lpReserved, IntPtr sortHandle); - [DllImport("api-ms-win-core-memory-l1-1-0.dll")] - internal extern static UIntPtr VirtualQuery(IntPtr lpAddress, out _MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength); - [DllImport("api-ms-win-core-localization-l2-1-0.dll", CharSet = CharSet.Unicode)] internal extern static int EnumCalendarInfoExEx(IntPtr pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string lpReserved, uint CalType, IntPtr lParam); diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj index afabb1ec7..3d9588a49 100644 --- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -56,7 +56,7 @@ </PropertyGroup> <PropertyGroup Condition="'$(IsProjectNLibrary)' != 'true'"> - <!-- TODO: For now, drop DEBUG define comming from central location - asserts compiled + <!-- CORERT-TODO: For now, drop DEBUG define comming from central location - asserts compiled into DEBUG builds use interfaces that we are not able to handle yet --> <!-- <DefineConstants>CORERT;$(DefineConstants)</DefineConstants> --> <DefineConstants>CORERT</DefineConstants> @@ -486,12 +486,19 @@ <Compile Include="System\Runtime\CommandLine.Win32.cs" /> - <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.Errors.cs" /> - <Compile Condition="'$(IsProjectNLibrary)' == 'true'" Include="System\Environment.EnvironmentVariables.UWP.cs" /> <Compile Condition="'$(IsProjectNLibrary)' != 'true'" Include="System\Environment.EnvironmentVariables.Win32.cs" /> <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.Environment.cs" /> </ItemGroup> + <ItemGroup> + <!-- CORERT-TODO: Port to Unix --> + <Compile Include="..\..\Common\src\Interop\Windows\Interop.Libraries.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.Errors.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.MEMORY_BASIC_INFORMATION.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.VirtualQuery.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.SYSTEM_INFO.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.GetNativeSystemInfo.cs" /> + </ItemGroup> <ItemGroup Condition="'$(TargetsUnix)'=='true'"> <Compile Include="System\Globalization\CultureInfo.Dummy.cs" /> diff --git a/src/System.Private.CoreLib/src/System/Environment.cs b/src/System.Private.CoreLib/src/System/Environment.cs index fcaca5aa7..f94084ba7 100644 --- a/src/System.Private.CoreLib/src/System/Environment.cs +++ b/src/System.Private.CoreLib/src/System/Environment.cs @@ -70,7 +70,7 @@ namespace System get { // @TODO: can we finally fix this to return the actual number of processors when there are >64? - Interop._SYSTEM_INFO info = new Interop._SYSTEM_INFO(); + Interop.mincore.SYSTEM_INFO info; Interop.mincore.GetNativeSystemInfo(out info); return (int)info.dwNumberOfProcessors; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 89dccd8f1..6124eb267 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -151,10 +151,10 @@ namespace System.Runtime.CompilerServices // We need to first ensure that the current stack page has been written to, so that it has the same attributes all higher stack pages. // This way info.RegionSize will include the whole stack written so far. // - Interop._MEMORY_BASIC_INFORMATION info = new Interop._MEMORY_BASIC_INFORMATION(); + Interop.mincore.MEMORY_BASIC_INFORMATION info = new Interop.mincore.MEMORY_BASIC_INFORMATION(); Volatile.Write(ref info.BaseAddress, IntPtr.Zero); // Extra paranoid write, to avoid optimizations. - Interop.mincore.VirtualQuery((IntPtr)(&info), out info, (UIntPtr)(uint)sizeof(Interop._MEMORY_BASIC_INFORMATION)); + Interop.mincore.VirtualQuery((IntPtr)(&info), out info, (UIntPtr)(uint)sizeof(Interop.mincore.MEMORY_BASIC_INFORMATION)); byte* lower = (byte*)info.AllocationBase; byte* upper = (byte*)info.BaseAddress + info.RegionSize.ToUInt64(); |