ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
May 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
15 participants
500 discussions
Start a n
N
ew thread
[tkreuzer] 67524: [NTOSKRNL] - Implement KiCpuId and make use of it - Get rid of ugly CPUID, RDMSR and WRMSR functions - remove unused KTS_ constants
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 23:11:50 2015 New Revision: 67524 URL:
http://svn.reactos.org/svn/reactos?rev=67524&view=rev
Log: [NTOSKRNL] - Implement KiCpuId and make use of it - Get rid of ugly CPUID, RDMSR and WRMSR functions - remove unused KTS_ constants Modified: trunk/reactos/include/ndk/i386/ketypes.h trunk/reactos/ntoskrnl/config/i386/cmhardwr.c trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/include/internal/ke_x.h trunk/reactos/ntoskrnl/kd64/i386/kdx86.c trunk/reactos/ntoskrnl/ke/amd64/cpu.c trunk/reactos/ntoskrnl/ke/i386/cpu.c trunk/reactos/ntoskrnl/ke/i386/kiinit.c Modified: trunk/reactos/include/ndk/i386/ketypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h…
============================================================================== --- trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] Sat May 2 23:11:50 2015 @@ -190,6 +190,21 @@ // Number of pool lookaside lists per pool in the PRCB // #define NUMBER_POOL_LOOKASIDE_LISTS 32 + +// +// Structure for CPUID +// +typedef union _CPU_INFO +{ + UINT32 AsUINT32[4]; + struct + { + ULONG Eax; + ULONG Ebx; + ULONG Ecx; + ULONG Edx; + }; +} CPU_INFO, *PCPU_INFO; // // Trap Frame Definition Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
============================================================================== --- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] Sat May 2 23:11:50 2015 @@ -230,11 +230,13 @@ NTAPI CmpGetIntelBrandString(OUT PCHAR CpuString) { - ULONG BrandId, Ebx, Signature, Dummy; - + CPU_INFO CpuInfo; + ULONG BrandId, Signature; + /* Get the Brand Id */ - CPUID(0x00000001, &Signature, &Ebx, &Dummy, &Dummy); - BrandId = Ebx & 0xFF; + KiCpuId(&CpuInfo, 0x00000001); + Signature = CpuInfo.Eax; + BrandId = CpuInfo.Ebx & 0xFF; switch (BrandId) { @@ -329,7 +331,8 @@ HANDLE KeyHandle, BiosHandle, SystemHandle, FpuHandle, SectionHandle; CONFIGURATION_COMPONENT_DATA ConfigData; CHAR Buffer[128]; - ULONG VendorId, ExtendedId, Dummy; + CPU_INFO CpuInfo; + ULONG VendorId, ExtendedId; PKPRCB Prcb; USHORT IndexTable[MaximumType + 1] = {0}; ANSI_STRING TempString; @@ -521,7 +524,8 @@ else { /* Check if we have extended CPUID that supports name ID */ - CPUID(0x80000000, &ExtendedId, &Dummy, &Dummy, &Dummy); + KiCpuId(&CpuInfo, 0x80000000); + ExtendedId = CpuInfo.Eax; if (ExtendedId >= 0x80000004) { /* Do all the CPUIDs required to get the full name */ @@ -529,11 +533,11 @@ for (ExtendedId = 2; ExtendedId <= 4; ExtendedId++) { /* Do the CPUID and save the name string */ - CPUID(0x80000000 | ExtendedId, - (PULONG)PartialString, - (PULONG)PartialString + 1, - (PULONG)PartialString + 2, - (PULONG)PartialString + 3); + KiCpuId(&CpuInfo, 0x80000000 | ExtendedId); + ((PULONG)PartialString)[0] = CpuInfo.Eax; + ((PULONG)PartialString)[1] = CpuInfo.Ebx; + ((PULONG)PartialString)[2] = CpuInfo.Ecx; + ((PULONG)PartialString)[3] = CpuInfo.Edx; /* Go to the next name string */ PartialString += 16; @@ -544,7 +548,8 @@ } else { - CPUID(0x00000000, &Dummy, &VendorId, &Dummy, &Dummy); + KiCpuId(&CpuInfo, 0x00000000); + VendorId = CpuInfo.Ebx; PartialString = CpuString; switch (VendorId) { Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sat May 2 23:11:50 2015 @@ -153,36 +153,7 @@ /* One of the Reserved Wait Blocks, this one is for the Thread's Timer */ #define TIMER_WAIT_BLOCK 0x3L -#define KTS_SYSCALL_BIT (((KTRAP_STATE_BITS) { { .SystemCall = TRUE } }).Bits) -#define KTS_PM_BIT (((KTRAP_STATE_BITS) { { .PreviousMode = TRUE } }).Bits) -#define KTS_SEG_BIT (((KTRAP_STATE_BITS) { { .Segments = TRUE } }).Bits) -#define KTS_VOL_BIT (((KTRAP_STATE_BITS) { { .Volatiles = TRUE } }).Bits) -#define KTS_FULL_BIT (((KTRAP_STATE_BITS) { { .Full = TRUE } }).Bits) - /* INTERNAL KERNEL FUNCTIONS ************************************************/ - -VOID -NTAPI -CPUID( - IN ULONG InfoType, - OUT PULONG CpuInfoEax, - OUT PULONG CpuInfoEbx, - OUT PULONG CpuInfoEcx, - OUT PULONG CpuInfoEdx -); - -LONGLONG -FASTCALL -RDMSR( - IN ULONG Register -); - -VOID -NTAPI -WRMSR( - IN ULONG Register, - IN LONGLONG Value -); /* Finds a new thread to run */ LONG_PTR Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] Sat May 2 23:11:50 2015 @@ -1660,3 +1660,24 @@ { KeReleaseSpinLock(&KiNmiCallbackListLock, OldIrql); } + +#if defined(_M_IX86) || defined(_M_AMD64) +FORCEINLINE +VOID +KiCpuId( + PCPU_INFO CpuInfo, + ULONG Function) +{ + __cpuid((INT*)CpuInfo->AsUINT32, Function); +} + +FORCEINLINE +VOID +KiCpuIdEx( + PCPU_INFO CpuInfo, + ULONG Function, + ULONG SubFunction) +{ + __cpuidex((INT*)CpuInfo->AsUINT32, Function, SubFunction); +} +#endif /* _M_IX86 || _M_AMD64 */ Modified: trunk/reactos/ntoskrnl/kd64/i386/kdx86.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/i386/kdx86.c…
============================================================================== --- trunk/reactos/ntoskrnl/kd64/i386/kdx86.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kd64/i386/kdx86.c [iso-8859-1] Sat May 2 23:11:50 2015 @@ -95,17 +95,17 @@ OUT PLARGE_INTEGER MsrValue) { /* Wrap this in SEH in case the MSR doesn't exist */ - //_SEH2_TRY + _SEH2_TRY { /* Read from the MSR */ - MsrValue->QuadPart = RDMSR(Msr); - } - //_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + MsrValue->QuadPart = __readmsr(Msr); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Invalid MSR */ - //_SEH2_YIELD(return STATUS_NO_SUCH_DEVICE); - } - //_SEH2_END; + _SEH2_YIELD(return STATUS_NO_SUCH_DEVICE); + } + _SEH2_END; /* Success */ return STATUS_SUCCESS; @@ -117,17 +117,17 @@ IN PLARGE_INTEGER MsrValue) { /* Wrap this in SEH in case the MSR doesn't exist */ - //_SEH2_TRY + _SEH2_TRY { /* Write to the MSR */ - WRMSR(Msr, MsrValue->QuadPart); - } - //_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + __writemsr(Msr, MsrValue->QuadPart); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Invalid MSR */ - //_SEH2_YIELD(return STATUS_NO_SUCH_DEVICE); - } - //_SEH2_END; + _SEH2_YIELD(return STATUS_NO_SUCH_DEVICE); + } + _SEH2_END; /* Success */ return STATUS_SUCCESS; Modified: trunk/reactos/ntoskrnl/ke/amd64/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/cpu.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] Sat May 2 23:11:50 2015 @@ -48,28 +48,6 @@ static const CHAR CmpCentaurID[] = "CentaurHauls"; static const CHAR CmpRiseID[] = "RiseRiseRise"; -/* SUPPORT ROUTINES FOR MSVC COMPATIBILITY ***********************************/ - -VOID -NTAPI -CPUID(IN ULONG InfoType, - OUT PULONG CpuInfoEax, - OUT PULONG CpuInfoEbx, - OUT PULONG CpuInfoEcx, - OUT PULONG CpuInfoEdx) -{ - ULONG CpuInfo[4]; - - /* Perform the CPUID Operation */ - __cpuid((int*)CpuInfo, InfoType); - - /* Return the results */ - *CpuInfoEax = CpuInfo[0]; - *CpuInfoEbx = CpuInfo[1]; - *CpuInfoEcx = CpuInfo[2]; - *CpuInfoEdx = CpuInfo[3]; -} - /* FUNCTIONS *****************************************************************/ VOID @@ -77,7 +55,7 @@ KiSetProcessorType(VOID) { ULONG64 EFlags; - INT Reg[4]; + CPU_INFO CpuInfo; ULONG Stepping, Type; /* Start by assuming no CPUID data */ @@ -87,7 +65,7 @@ EFlags = __readeflags(); /* Do CPUID 1 now */ - __cpuid(Reg, 1); + KiCpuId(&CpuInfo, 1); /* * Get the Stepping and Type. The stepping contains both the @@ -96,11 +74,11 @@ * * For the stepping, we convert this: zzzzzzxy into this: x0y */ - Stepping = Reg[0] & 0xF0; + Stepping = CpuInfo.Eax & 0xF0; Stepping <<= 4; - Stepping += (Reg[0] & 0xFF); + Stepping += (CpuInfo.Eax & 0xFF); Stepping &= 0xF0F; - Type = Reg[0] & 0xF00; + Type = CpuInfo.Eax & 0xF00; Type >>= 8; /* Save them in the PRCB */ @@ -117,16 +95,16 @@ KiGetCpuVendor(VOID) { PKPRCB Prcb = KeGetCurrentPrcb(); - INT Vendor[5]; + CPU_INFO CpuInfo; /* Get the Vendor ID and null-terminate it */ - __cpuid(Vendor, 0); + KiCpuId(&CpuInfo, 0); /* Copy it to the PRCB and null-terminate it */ - *(ULONG*)&Prcb->VendorString[0] = Vendor[1]; // ebx - *(ULONG*)&Prcb->VendorString[4] = Vendor[3]; // edx - *(ULONG*)&Prcb->VendorString[8] = Vendor[2]; // ecx - *(ULONG*)&Prcb->VendorString[12] = 0; + *(ULONG*)&Prcb->VendorString[0] = CpuInfo.Ebx; + *(ULONG*)&Prcb->VendorString[4] = CpuInfo.Edx; + *(ULONG*)&Prcb->VendorString[8] = CpuInfo.Ecx; + Prcb->VendorString[12] = 0; /* Now check the CPU Type */ if (!strcmp((PCHAR)Prcb->VendorString, CmpIntelID)) @@ -137,20 +115,10 @@ { return CPU_AMD; } - else if (!strcmp((PCHAR)Prcb->VendorString, CmpCyrixID)) - { - DPRINT1("Cyrix CPUs not fully supported\n"); - return 0; - } - else if (!strcmp((PCHAR)Prcb->VendorString, CmpTransmetaID)) - { - DPRINT1("Transmeta CPUs not fully supported\n"); - return 0; - } else if (!strcmp((PCHAR)Prcb->VendorString, CmpCentaurID)) { DPRINT1("VIA CPUs not fully supported\n"); - return 0; + return CPU_VIA; } else if (!strcmp((PCHAR)Prcb->VendorString, CmpRiseID)) { @@ -159,7 +127,7 @@ } /* Invalid CPU */ - return 0; + return CPU_UNKNOWN; } ULONG @@ -168,9 +136,8 @@ { PKPRCB Prcb = KeGetCurrentPrcb(); ULONG Vendor; - ULONG FeatureBits = KF_WORKING_PTE; - INT Reg[4]; - ULONG CpuFeatures = 0; + ULONG FeatureBits = KF_WORKING_PTE;; + CPU_INFO CpuInfo; /* Get the Vendor ID */ Vendor = KiGetCpuVendor(); @@ -178,44 +145,41 @@ /* Make sure we got a valid vendor ID at least. */ if (!Vendor) return FeatureBits; - /* Get the CPUID Info. Features are in Reg[3]. */ - __cpuid(Reg, 1); + /* Get the CPUID Info. */ + KiCpuId(&CpuInfo, 1); /* Set the initial APIC ID */ - Prcb->InitialApicId = (UCHAR)(Reg[1] >> 24); - - /* Set the current features */ - CpuFeatures = Reg[3]; + Prcb->InitialApicId = (UCHAR)(CpuInfo.Ebx >> 24); /* Convert all CPUID Feature bits into our format */ - if (CpuFeatures & 0x00000002) FeatureBits |= KF_V86_VIS | KF_CR4; - if (CpuFeatures & 0x00000008) FeatureBits |= KF_LARGE_PAGE | KF_CR4; - if (CpuFeatures & 0x00000010) FeatureBits |= KF_RDTSC; - if (CpuFeatures & 0x00000100) FeatureBits |= KF_CMPXCHG8B; - if (CpuFeatures & 0x00000800) FeatureBits |= KF_FAST_SYSCALL; - if (CpuFeatures & 0x00001000) FeatureBits |= KF_MTRR; - if (CpuFeatures & 0x00002000) FeatureBits |= KF_GLOBAL_PAGE | KF_CR4; - if (CpuFeatures & 0x00008000) FeatureBits |= KF_CMOV; - if (CpuFeatures & 0x00010000) FeatureBits |= KF_PAT; - if (CpuFeatures & 0x00200000) FeatureBits |= KF_DTS; - if (CpuFeatures & 0x00800000) FeatureBits |= KF_MMX; - if (CpuFeatures & 0x01000000) FeatureBits |= KF_FXSR; - if (CpuFeatures & 0x02000000) FeatureBits |= KF_XMMI; - if (CpuFeatures & 0x04000000) FeatureBits |= KF_XMMI64; - - if (Reg[2] & 0x00000001) FeatureBits |= KF_SSE3; - //if (Reg[2] & 0x00000008) FeatureBits |= KF_MONITOR; - //if (Reg[2] & 0x00000200) FeatureBits |= KF_SSE3SUP; - if (Reg[2] & 0x00002000) FeatureBits |= KF_CMPXCHG16B; - //if (Reg[2] & 0x00080000) FeatureBits |= KF_SSE41; - //if (Reg[2] & 0x00800000) FeatureBits |= KF_POPCNT; - if (Reg[2] & 0x04000000) FeatureBits |= KF_XSTATE; + if (CpuInfo.Edx & 0x00000002) FeatureBits |= KF_V86_VIS | KF_CR4; + if (CpuInfo.Edx & 0x00000008) FeatureBits |= KF_LARGE_PAGE | KF_CR4; + if (CpuInfo.Edx & 0x00000010) FeatureBits |= KF_RDTSC; + if (CpuInfo.Edx & 0x00000100) FeatureBits |= KF_CMPXCHG8B; + if (CpuInfo.Edx & 0x00000800) FeatureBits |= KF_FAST_SYSCALL; + if (CpuInfo.Edx & 0x00001000) FeatureBits |= KF_MTRR; + if (CpuInfo.Edx & 0x00002000) FeatureBits |= KF_GLOBAL_PAGE | KF_CR4; + if (CpuInfo.Edx & 0x00008000) FeatureBits |= KF_CMOV; + if (CpuInfo.Edx & 0x00010000) FeatureBits |= KF_PAT; + if (CpuInfo.Edx & 0x00200000) FeatureBits |= KF_DTS; + if (CpuInfo.Edx & 0x00800000) FeatureBits |= KF_MMX; + if (CpuInfo.Edx & 0x01000000) FeatureBits |= KF_FXSR; + if (CpuInfo.Edx & 0x02000000) FeatureBits |= KF_XMMI; + if (CpuInfo.Edx & 0x04000000) FeatureBits |= KF_XMMI64; + + if (CpuInfo.Ecx & 0x00000001) FeatureBits |= KF_SSE3; + //if (CpuInfo.Ecx & 0x00000008) FeatureBits |= KF_MONITOR; + //if (CpuInfo.Ecx & 0x00000200) FeatureBits |= KF_SSE3SUP; + if (CpuInfo.Ecx & 0x00002000) FeatureBits |= KF_CMPXCHG16B; + //if (CpuInfo.Ecx & 0x00080000) FeatureBits |= KF_SSE41; + //if (CpuInfo.Ecx & 0x00800000) FeatureBits |= KF_POPCNT; + if (CpuInfo.Ecx & 0x04000000) FeatureBits |= KF_XSTATE; /* Check if the CPU has hyper-threading */ - if (CpuFeatures & 0x10000000) + if (CpuInfo.Ecx & 0x10000000) { /* Set the number of logical CPUs */ - Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(Reg[1] >> 16); + Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(CpuInfo.Ebx >> 16); if (Prcb->LogicalProcessorsPerPhysicalProcessor > 1) { /* We're on dual-core */ @@ -229,23 +193,23 @@ } /* Check extended cpuid features */ - __cpuid(Reg, 0x80000000); - if ((Reg[0] & 0xffffff00) == 0x80000000) + KiCpuId(&CpuInfo, 0x80000000); + if ((CpuInfo.Eax & 0xffffff00) == 0x80000000) { /* Check if CPUID 0x80000001 is supported */ - if (Reg[0] >= 0x80000001) + if (CpuInfo.Eax >= 0x80000001) { /* Check which extended features are available. */ - __cpuid(Reg, 0x80000001); + KiCpuId(&CpuInfo, 0x80000001); /* Check if NX-bit is supported */ - if (Reg[3] & 0x00100000) FeatureBits |= KF_NX_BIT; + if (CpuInfo.Edx & 0x00100000) FeatureBits |= KF_NX_BIT; /* Now handle each features for each CPU Vendor */ switch (Vendor) { case CPU_AMD: - if (Reg[3] & 0x80000000) FeatureBits |= KF_3DNOW; + if (CpuInfo.Edx & 0x80000000) FeatureBits |= KF_3DNOW; break; } } @@ -261,11 +225,11 @@ { PKIPCR Pcr = (PKIPCR)KeGetPcr(); ULONG Vendor; - INT Data[4]; ULONG CacheRequests = 0, i; ULONG CurrentRegister; UCHAR RegisterByte; BOOLEAN FirstPass = TRUE; + CPU_INFO CpuInfo; /* Set default L2 size */ Pcr->SecondLevelCacheSize = 0; @@ -281,14 +245,14 @@ case CPU_INTEL: /*Check if we support CPUID 2 */ - __cpuid(Data, 0); - if (Data[0] >= 2) + KiCpuId(&CpuInfo, 0); + if (CpuInfo.Eax >= 2) { /* We need to loop for the number of times CPUID will tell us to */ do { /* Do the CPUID call */ - __cpuid(Data, 2); + KiCpuId(&CpuInfo, 2); /* Check if it was the first call */ if (FirstPass) @@ -297,8 +261,8 @@ * The number of times to loop is the first byte. Read * it and then destroy it so we don't get confused. */ - CacheRequests = Data[0] & 0xFF; - Data[0] &= 0xFFFFFF00; + CacheRequests = CpuInfo.Eax & 0xFF; + CpuInfo.Eax &= 0xFFFFFF00; /* Don't go over this again */ FirstPass = FALSE; @@ -308,7 +272,7 @@ for (i = 0; i < 4; i++) { /* Get the current register */ - CurrentRegister = Data[i]; + CurrentRegister = CpuInfo.AsUINT32[i]; /* * If the upper bit is set, then this register should @@ -350,14 +314,14 @@ case CPU_AMD: /* Check if we support CPUID 0x80000006 */ - __cpuid(Data, 0x80000000); - if (Data[0] >= 6) + KiCpuId(&CpuInfo, 0x80000000); + if (CpuInfo.Eax >= 6) { /* Get 2nd level cache and tlb size */ - __cpuid(Data, 0x80000006); + KiCpuId(&CpuInfo, 0x80000006); /* Set the L2 Cache Size */ - Pcr->SecondLevelCacheSize = (Data[2] & 0xFFFF0000) >> 6; + Pcr->SecondLevelCacheSize = (CpuInfo.Ecx & 0xFFFF0000) >> 6; } break; } Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Sat May 2 23:11:50 2015 @@ -62,43 +62,6 @@ /* SUPPORT ROUTINES FOR MSVC COMPATIBILITY ***********************************/ -VOID -NTAPI -CPUID(IN ULONG InfoType, - OUT PULONG CpuInfoEax, - OUT PULONG CpuInfoEbx, - OUT PULONG CpuInfoEcx, - OUT PULONG CpuInfoEdx) -{ - ULONG CpuInfo[4]; - - /* Perform the CPUID Operation */ - __cpuid((int*)CpuInfo, InfoType); - - /* Return the results */ - *CpuInfoEax = CpuInfo[0]; - *CpuInfoEbx = CpuInfo[1]; - *CpuInfoEcx = CpuInfo[2]; - *CpuInfoEdx = CpuInfo[3]; -} - -VOID -NTAPI -WRMSR(IN ULONG Register, - IN LONGLONG Value) -{ - /* Write to the MSR */ - __writemsr(Register, Value); -} - -LONGLONG -FASTCALL -RDMSR(IN ULONG Register) -{ - /* Read from the MSR */ - return __readmsr(Register); -} - /* NSC/Cyrix CPU configuration register index */ #define CX86_CCR1 0xc1 @@ -128,7 +91,7 @@ KiSetProcessorType(VOID) { ULONG EFlags, NewEFlags; - ULONG Reg, Dummy; + CPU_INFO CpuInfo; ULONG Stepping, Type; /* Start by assuming no CPUID data */ @@ -150,11 +113,11 @@ __writeeflags(EFlags); /* Peform CPUID 0 to see if CPUID 1 is supported */ - CPUID(0, &Reg, &Dummy, &Dummy, &Dummy); - if (Reg > 0) + KiCpuId(&CpuInfo, 0); + if (CpuInfo.Eax > 0) { /* Do CPUID 1 now */ - CPUID(1, &Reg, &Dummy, &Dummy, &Dummy); + KiCpuId(&CpuInfo, 1); /* * Get the Stepping and Type. The stepping contains both the @@ -163,11 +126,11 @@ * * For the stepping, we convert this: zzzzzzxy into this: x0y */ - Stepping = Reg & 0xF0; + Stepping = CpuInfo.Eax & 0xF0; Stepping <<= 4; - Stepping += (Reg & 0xFF); + Stepping += (CpuInfo.Eax & 0xFF); Stepping &= 0xF0F; - Type = Reg & 0xF00; + Type = CpuInfo.Eax & 0xF00; Type >>= 8; /* Save them in the PRCB */ @@ -195,27 +158,20 @@ KiGetCpuVendor(VOID) { PKPRCB Prcb = KeGetCurrentPrcb(); - ULONG Vendor[5]; - ULONG Temp; + CPU_INFO CpuInfo; /* Assume no Vendor ID and fail if no CPUID Support. */ Prcb->VendorString[0] = 0; if (!Prcb->CpuID) return 0; - /* Get the Vendor ID and null-terminate it */ - CPUID(0, &Vendor[0], &Vendor[1], &Vendor[2], &Vendor[3]); - Vendor[4] = 0; - - /* Re-arrange vendor string */ - Temp = Vendor[2]; - Vendor[2] = Vendor[3]; - Vendor[3] = Temp; - - /* Copy it to the PRCB and null-terminate it again */ - RtlCopyMemory(Prcb->VendorString, - &Vendor[1], - sizeof(Prcb->VendorString) - sizeof(CHAR)); - Prcb->VendorString[sizeof(Prcb->VendorString) - sizeof(CHAR)] = ANSI_NULL; + /* Get the Vendor ID */ + KiCpuId(&CpuInfo, 0); + + /* Copy it to the PRCB and null-terminate it */ + *(ULONG*)&Prcb->VendorString[0] = CpuInfo.Ebx; + *(ULONG*)&Prcb->VendorString[4] = CpuInfo.Edx; + *(ULONG*)&Prcb->VendorString[8] = CpuInfo.Ecx; + Prcb->VendorString[12] = 0; /* Now check the CPU Type */ if (!strcmp(Prcb->VendorString, CmpIntelID)) @@ -260,7 +216,7 @@ PKPRCB Prcb = KeGetCurrentPrcb(); ULONG Vendor; ULONG FeatureBits = KF_WORKING_PTE; - ULONG Reg[4], Dummy; + CPU_INFO CpuInfo, DummyCpuInfo; UCHAR Ccr1; BOOLEAN ExtendedCPUID = TRUE; ULONG CpuFeatures = 0; @@ -272,10 +228,10 @@ if (!Vendor) return FeatureBits; /* Get the CPUID Info. Features are in Reg[3]. */ - CPUID(1, &Reg[0], &Reg[1], &Dummy, &Reg[3]); + KiCpuId(&CpuInfo, 1); /* Set the initial APIC ID */ - Prcb->InitialApicId = (UCHAR)(Reg[1] >> 24); + Prcb->InitialApicId = (UCHAR)(CpuInfo.Ebx >> 24); switch (Vendor) { @@ -286,9 +242,9 @@ if (Prcb->CpuType == 6) { /* Perform the special sequence to get the MicroCode Signature */ - WRMSR(0x8B, 0); - CPUID(1, &Dummy, &Dummy, &Dummy, &Dummy); - Prcb->UpdateSignature.QuadPart = RDMSR(0x8B); + __writemsr(0x8B, 0); + KiCpuId(&DummyCpuInfo, 1); + Prcb->UpdateSignature.QuadPart = __readmsr(0x8B); } else if (Prcb->CpuType == 5) { @@ -297,8 +253,8 @@ } /* Check for broken P6 with bad SMP PTE implementation */ - if (((Reg[0] & 0x0FF0) == 0x0610 && (Reg[0] & 0x000F) <= 0x9) || - ((Reg[0] & 0x0FF0) == 0x0630 && (Reg[0] & 0x000F) <= 0x4)) + if (((CpuInfo.Eax & 0x0FF0) == 0x0610 && (CpuInfo.Eax & 0x000F) <= 0x9) || + ((CpuInfo.Eax & 0x0FF0) == 0x0630 && (CpuInfo.Eax & 0x000F) <= 0x4)) { /* Remove support for correct PTE support. */ FeatureBits &= ~KF_WORKING_PTE; @@ -309,7 +265,7 @@ ((Prcb->CpuType == 6) && (Prcb->CpuStep < 0x0303))) { /* Disable it */ - Reg[3] &= ~0x800; + CpuInfo.Edx &= ~0x800; } break; @@ -318,29 +274,29 @@ case CPU_AMD: /* Check if this is a K5 or K6. (family 5) */ - if ((Reg[0] & 0x0F00) == 0x0500) + if ((CpuInfo.Eax & 0x0F00) == 0x0500) { /* Get the Model Number */ - switch (Reg[0] & 0x00F0) + switch (CpuInfo.Eax & 0x00F0) { /* Model 1: K5 - 5k86 (initial models) */ case 0x0010: /* Check if this is Step 0 or 1. They don't support PGE */ - if ((Reg[0] & 0x000F) > 0x03) break; + if ((CpuInfo.Eax & 0x000F) > 0x03) break; /* Model 0: K5 - SSA5 */ case 0x0000: /* Model 0 doesn't support PGE at all. */ - Reg[3] &= ~0x2000; + CpuInfo.Edx &= ~0x2000; break; /* Model 8: K6-2 */ case 0x0080: /* K6-2, Step 8 and over have support for MTRR. */ - if ((Reg[0] & 0x000F) >= 0x8) FeatureBits |= KF_AMDK6MTRR; + if ((CpuInfo.Eax & 0x000F) >= 0x8) FeatureBits |= KF_AMDK6MTRR; break; /* Model 9: K6-III @@ -352,10 +308,10 @@ break; } } - else if((Reg[0] & 0x0F00) < 0x0500) + else if((CpuInfo.Eax & 0x0F00) < 0x0500) { /* Families below 5 don't support PGE, PSE or CMOV at all */ - Reg[3] &= ~(0x08 | 0x2000 | 0x8000); + CpuInfo.Edx &= ~(0x08 | 0x2000 | 0x8000); /* They also don't support advanced CPUID functions. */ ExtendedCPUID = FALSE; @@ -386,9 +342,9 @@ case CPU_TRANSMETA: /* Enable CMPXCHG8B if the family (>= 5), model and stepping (>= 4.2) support it */ - if ((Reg[0] & 0x0FFF) >= 0x0542) + if ((CpuInfo.Eax & 0x0FFF) >= 0x0542) { - WRMSR(0x80860004, RDMSR(0x80860004) | 0x0100); + __writemsr(0x80860004, __readmsr(0x80860004) | 0x0100); FeatureBits |= KF_CMPXCHG8B; } @@ -406,7 +362,7 @@ } /* Set the current features */ - CpuFeatures = Reg[3]; + CpuFeatures = CpuInfo.Edx; /* Convert all CPUID Feature bits into our format */ if (CpuFeatures & 0x00000002) FeatureBits |= KF_V86_VIS | KF_CR4; @@ -428,7 +384,7 @@ if (CpuFeatures & 0x10000000) { /* Set the number of logical CPUs */ - Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(Reg[1] >> 16); + Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(CpuInfo.Ebx >> 16); if (Prcb->LogicalProcessorsPerPhysicalProcessor > 1) { /* We're on dual-core */ @@ -445,24 +401,24 @@ if (ExtendedCPUID) { /* Do the call */ - CPUID(0x80000000, &Reg[0], &Dummy, &Dummy, &Dummy); - if ((Reg[0] & 0xffffff00) == 0x80000000) + KiCpuId(&CpuInfo, 0x80000000); + if ((CpuInfo.Eax & 0xffffff00) == 0x80000000) { /* Check if CPUID 0x80000001 is supported */ - if (Reg[0] >= 0x80000001) + if (CpuInfo.Eax >= 0x80000001) { /* Check which extended features are available. */ - CPUID(0x80000001, &Dummy, &Dummy, &Dummy, &Reg[3]); + KiCpuId(&CpuInfo, 0x80000001); /* Check if NX-bit is supported */ - if (Reg[3] & 0x00100000) FeatureBits |= KF_NX_BIT; + if (CpuInfo.Edx & 0x00100000) FeatureBits |= KF_NX_BIT; /* Now handle each features for each CPU Vendor */ switch (Vendor) { case CPU_AMD: case CPU_CENTAUR: - if (Reg[3] & 0x80000000) FeatureBits |= KF_3DNOW; + if (CpuInfo.Edx & 0x80000000) FeatureBits |= KF_3DNOW; break; } } @@ -505,7 +461,7 @@ { PKIPCR Pcr = (PKIPCR)KeGetPcr(); ULONG Vendor; - ULONG Data[4], Dummy; + CPU_INFO CpuInfo; ULONG CacheRequests = 0, i; ULONG CurrentRegister; UCHAR RegisterByte, Associativity = 0; @@ -526,14 +482,14 @@ case CPU_INTEL: /*Check if we support CPUID 2 */ - CPUID(0, &Data[0], &Dummy, &Dummy, &Dummy); - if (Data[0] >= 2) + KiCpuId(&CpuInfo, 0); + if (CpuInfo.Eax >= 2) { /* We need to loop for the number of times CPUID will tell us to */ do { /* Do the CPUID call */ - CPUID(2, &Data[0], &Data[1], &Data[2], &Data[3]); + KiCpuId(&CpuInfo, 2); /* Check if it was the first call */ if (FirstPass) @@ -542,8 +498,8 @@ * The number of times to loop is the first byte. Read * it and then destroy it so we don't get confused. */ - CacheRequests = Data[0] & 0xFF; - Data[0] &= 0xFFFFFF00; + CacheRequests = CpuInfo.Eax & 0xFF; + CpuInfo.Eax &= 0xFFFFFF00; /* Don't go over this again */ FirstPass = FALSE; @@ -553,7 +509,7 @@ for (i = 0; i < 4; i++) { /* Get the current register */ - CurrentRegister = Data[i]; + CurrentRegister = CpuInfo.AsUINT32[i]; /* * If the upper bit is set, then this register should @@ -722,25 +678,25 @@ case CPU_AMD: /* Check if we support CPUID 0x80000005 */ - CPUID(0x80000000, &Data[0], &Data[1], &Data[2], &Data[3]); - if (Data[0] >= 0x80000006) + KiCpuId(&CpuInfo, 0x80000000); + if (CpuInfo.Eax >= 0x80000006) { /* Get L1 size first */ - CPUID(0x80000005, &Data[0], &Data[1], &Data[2], &Data[3]); - KePrefetchNTAGranularity = Data[2] & 0xFF; + KiCpuId(&CpuInfo, 0x80000005); + KePrefetchNTAGranularity = CpuInfo.Ecx & 0xFF; /* Check if we support CPUID 0x80000006 */ - CPUID(0x80000000, &Data[0], &Data[1], &Data[2], &Data[3]); - if (Data[0] >= 0x80000006) + KiCpuId(&CpuInfo, 0x80000000); + if (CpuInfo.Eax >= 0x80000006) { /* Get 2nd level cache and tlb size */ - CPUID(0x80000006, &Data[0], &Data[1], &Data[2], &Data[3]); + KiCpuId(&CpuInfo, 0x80000006); /* Cache line size */ - CacheLine = Data[2] & 0xFF; + CacheLine = CpuInfo.Ecx & 0xFF; /* Hardcode associativity */ - RegisterByte = (Data[2] >> 12) & 0xFF; + RegisterByte = (CpuInfo.Ecx >> 12) & 0xFF; switch (RegisterByte) { case 2: @@ -766,7 +722,7 @@ } /* Compute size */ - Size = (Data[2] >> 16) << 10; + Size = (CpuInfo.Ecx >> 16) << 10; /* Hack for Model 6, Steping 300 */ if ((KeGetCurrentPrcb()->CpuType == 6) && @@ -1047,11 +1003,11 @@ KiLoadFastSyscallMachineSpecificRegisters(IN ULONG_PTR Context) { /* Set CS and ESP */ - WRMSR(0x174, KGDT_R0_CODE); - WRMSR(0x175, (ULONG_PTR)KeGetCurrentPrcb()->DpcStack); + __writemsr(0x174, KGDT_R0_CODE); + __writemsr(0x175, (ULONG_PTR)KeGetCurrentPrcb()->DpcStack); /* Set LSTAR */ - WRMSR(0x176, (ULONG_PTR)KiFastCallEntry); + __writemsr(0x176, (ULONG_PTR)KiFastCallEntry); return 0; } Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Sat May 2 23:11:50 2015 @@ -43,7 +43,7 @@ ULONG i, Affinity, Sample = 0; PFX_SAVE_AREA FxSaveArea; ULONG MXCsrMask = 0xFFBF; - ULONG Dummy; + CPU_INFO CpuInfo; KI_SAMPLE_MAP Samples[4]; PKI_SAMPLE_MAP CurrentSample = Samples; LARGE_IDENTITY_MAP IdentityMap; @@ -190,7 +190,7 @@ for (;;) { /* Do a dummy CPUID to start the sample */ - CPUID(0, &Dummy, &Dummy, &Dummy, &Dummy); + KiCpuId(&CpuInfo, 0); /* Fill out the starting data */ CurrentSample->PerfStart = KeQueryPerformanceCounter(NULL); @@ -203,7 +203,7 @@ &CurrentSample->PerfFreq); /* Do another dummy CPUID */ - CPUID(0, &Dummy, &Dummy, &Dummy, &Dummy); + KiCpuId(&CpuInfo, 0); /* Fill out the ending data */ CurrentSample->PerfEnd =
9 years, 7 months
1
0
0
0
[tkreuzer] 67523: [NTOSKRNL] Handle some more KeFeatureFlags in amd64/cpu.c and set RtlpUse16ByteSLists [NTDLL] Set RtlpUse16ByteSLists [RTL] Make use of RtlpUse16ByteSLists in x64 Interlocked SLis...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 22:20:59 2015 New Revision: 67523 URL:
http://svn.reactos.org/svn/reactos?rev=67523&view=rev
Log: [NTOSKRNL] Handle some more KeFeatureFlags in amd64/cpu.c and set RtlpUse16ByteSLists [NTDLL] Set RtlpUse16ByteSLists [RTL] Make use of RtlpUse16ByteSLists in x64 Interlocked SList functions Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c trunk/reactos/lib/rtl/amd64/slist.S trunk/reactos/ntoskrnl/ke/amd64/cpu.c trunk/reactos/ntoskrnl/ke/amd64/kiinit.c Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Sat May 2 22:20:59 2015 @@ -87,6 +87,7 @@ NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase); void actctx_init(void); +extern BOOLEAN RtlpUse16ByteSLists; #ifdef _WIN64 #define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ll @@ -2183,6 +2184,11 @@ NtCurrentTeb()->RealClientId.UniqueProcess, NtCurrentTeb()->RealClientId.UniqueThread); +#ifdef _WIN64 + /* Set the SList header usage */ + RtlpUse16ByteSLists = SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128]; +#endif /* _WIN64 */ + /* Check if we have a deallocation stack */ if (!Teb->DeallocationStack) { Modified: trunk/reactos/lib/rtl/amd64/slist.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/amd64/slist.S?rev=…
============================================================================== --- trunk/reactos/lib/rtl/amd64/slist.S [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/amd64/slist.S [iso-8859-1] Sat May 2 22:20:59 2015 @@ -8,6 +8,8 @@ #include <asm.inc> #include <ksamd64.inc> + +EXTERN RtlpUse16ByteSLists:BYTE /* typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER @@ -99,11 +101,11 @@ /* Load ListHead->Alignment into rax */ mov rax, [rcx] - /* Check what kind of header this is */ - test rdx, SLIST8B_HEADERTYPE_MASK - jnz RtlInterlockedPopEntrySList16 - - /* We have an 8 byte header */ + /* Check for 16 byte SList support */ + cmp byte ptr [RtlpUse16ByteSLists], 0 + jne RtlInterlockedPopEntrySList16 + + /* Use the 8 byte header */ ExpInterlockedPopEntrySListResume: @@ -229,6 +231,13 @@ /* Not aligned, raise an assertion */ int HEX(2C) ExpInterlockedPushEntrySListChecked: + + /* Make sure RtlpUse16ByteSLists is initialized */ + cmp byte ptr [RtlpUse16ByteSLists], HEX(FF) + jne ExpInterlockedPushEntrySListChecked2 + /* Not initialized, raise an assertion */ + int HEX(2C) +ExpInterlockedPushEntrySListChecked2: #endif /* Load ListHead->Alignment into rax */ @@ -237,11 +246,11 @@ /* Load ListHead->Region into r9 */ mov r9, [rcx + 8] - /* Check what kind of header this is */ - test r9, SLIST8B_HEADERTYPE_MASK - jnz RtlInterlockedPushEntrySList16 - - /* We have an 8 byte header */ + /* Check for 16 byte SList support */ + cmp byte ptr [RtlpUse16ByteSLists], 0 + jne RtlInterlockedPushEntrySList16 + + /* Use the 8 byte header */ RtlInterlockedPushEntrySListLoop: @@ -358,11 +367,11 @@ /* Load ListHead->Alignment into rax */ mov rax, [rcx] - /* Check what kind of header this is */ - test rdx, SLIST8B_HEADERTYPE_MASK - jnz RtlInterlockedFlushSList16 - - /* We have an 8 byte header */ + /* Check for 16 byte SList support */ + cmp byte ptr [RtlpUse16ByteSLists], 0 + jne RtlInterlockedFlushSList16 + + /* Use the 8 byte header */ RtlInterlockedFlushSListLoop: Modified: trunk/reactos/ntoskrnl/ke/amd64/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/cpu.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] Sat May 2 22:20:59 2015 @@ -203,14 +203,13 @@ if (CpuFeatures & 0x02000000) FeatureBits |= KF_XMMI; if (CpuFeatures & 0x04000000) FeatureBits |= KF_XMMI64; -#if 0 - if (Reg[2] & 0x00000001) FeatureBits |= KF_SSE3NEW; - if (Reg[2] & 0x00000008) FeatureBits |= KF_MONITOR; - if (Reg[2] & 0x00000200) FeatureBits |= KF_SSE3SUP; + if (Reg[2] & 0x00000001) FeatureBits |= KF_SSE3; + //if (Reg[2] & 0x00000008) FeatureBits |= KF_MONITOR; + //if (Reg[2] & 0x00000200) FeatureBits |= KF_SSE3SUP; if (Reg[2] & 0x00002000) FeatureBits |= KF_CMPXCHG16B; - if (Reg[2] & 0x00080000) FeatureBits |= KF_SSE41; - if (Reg[2] & 0x00800000) FeatureBits |= KF_POPCNT; -#endif + //if (Reg[2] & 0x00080000) FeatureBits |= KF_SSE41; + //if (Reg[2] & 0x00800000) FeatureBits |= KF_POPCNT; + if (Reg[2] & 0x04000000) FeatureBits |= KF_XSTATE; /* Check if the CPU has hyper-threading */ if (CpuFeatures & 0x10000000) Modified: trunk/reactos/ntoskrnl/ke/amd64/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/kiinit.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] Sat May 2 22:20:59 2015 @@ -15,9 +15,11 @@ #define REQUIRED_FEATURE_BITS (KF_RDTSC|KF_CR4|KF_CMPXCHG8B|KF_XMMI|KF_XMMI64| \ KF_LARGE_PAGE|KF_FAST_SYSCALL|KF_GLOBAL_PAGE| \ - KF_CMOV|KF_PAT|KF_MMX|KF_FXSR|KF_NX_BIT) + KF_CMOV|KF_PAT|KF_MMX|KF_FXSR|KF_NX_BIT|KF_MTRR) /* GLOBALS *******************************************************************/ + +extern BOOLEAN RtlpUse16ByteSLists; /* Function pointer for early debug prints */ ULONG (*FrLdrDbgPrint)(const char *Format, ...); @@ -82,6 +84,8 @@ // KeBugCheckEx(NO_PAGES_AVAILABLE, 2, PAGE_SIZE * 2, 0, 0); // } + /* Initialize 8/16 bit SList support */ + RtlpUse16ByteSLists = (KeFeatureBits & KF_CMPXCHG16B) ? TRUE: FALSE; } VOID @@ -279,19 +283,29 @@ KeI386CpuStep = Prcb->CpuStep; KeProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; KeProcessorLevel = (USHORT)Prcb->CpuType; - if (Prcb->CpuID) KeProcessorRevision = Prcb->CpuStep; + if (Prcb->CpuID) + KeProcessorRevision = Prcb->CpuStep; /* Set basic CPU Features that user mode can read */ + SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; + SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE; + SharedUserData->ProcessorFeatures[PF_PPC_MOVEMEM_64BIT_OK] = TRUE; + SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = TRUE; // ??? + SharedUserData->ProcessorFeatures[PF_NX_ENABLED] = TRUE; + SharedUserData->ProcessorFeatures[PF_FASTFAIL_AVAILABLE] = TRUE; + SharedUserData->ProcessorFeatures[PF_XSAVE_ENABLED] = TRUE; SharedUserData->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = (Prcb->FeatureBits & KF_MMX) ? TRUE: FALSE; - SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI)) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI64)) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (Prcb->FeatureBits & KF_3DNOW) ? TRUE: FALSE; - SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE; + SharedUserData->ProcessorFeatures[PF_SSE3_INSTRUCTIONS_AVAILABLE] = + (Prcb->FeatureBits & KF_SSE3) ? TRUE: FALSE; + SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128] = + (Prcb->FeatureBits & KF_CMPXCHG16B) ? TRUE: FALSE; /* Set the default NX policy (opt-in) */ SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN; @@ -322,7 +336,6 @@ SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSOFF; Prcb->FeatureBits |= KF_NX_DISABLED; } - } static LDR_DATA_TABLE_ENTRY LdrCoreEntries[3];
9 years, 7 months
1
0
0
0
[tkreuzer] 67522: [RTL] - Implement C versions of RtlInterlockedPushEntrySList, RtlInterlockedPushListSList, RtlInterlockedPopEntrySList and RtlInterlockedFlushSList. - RtlInterlockedPushListSList ...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 22:20:38 2015 New Revision: 67522 URL:
http://svn.reactos.org/svn/reactos?rev=67522&view=rev
Log: [RTL] - Implement C versions of RtlInterlockedPushEntrySList, RtlInterlockedPushListSList, RtlInterlockedPopEntrySList and RtlInterlockedFlushSList. - RtlInterlockedPushListSList is fastcall, not stdcall Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/lib/rtl/interlck.c trunk/reactos/lib/rtl/slist.c trunk/reactos/ntoskrnl/ke/amd64/stubs.c Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Sat May 2 22:20:38 2015 @@ -3,7 +3,7 @@ ;@ stdcall RtlConvertVariantToProperty(ptr long ptr ptr ptr long ptr) @ fastcall RtlActivateActivationContextUnsafeFast(ptr ptr) @ fastcall RtlDeactivateActivationContextUnsafeFast(ptr) -@ stdcall RtlInterlockedPushListSList(ptr ptr ptr long) +@ fastcall RtlInterlockedPushListSList(ptr ptr ptr long) @ fastcall -arch=i386 RtlUlongByteSwap(long) @ fastcall -ret64 RtlUlonglongByteSwap(double) @ fastcall -arch=i386 RtlUshortByteSwap(long) Modified: trunk/reactos/lib/rtl/interlck.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/interlck.c?rev=675…
============================================================================== --- trunk/reactos/lib/rtl/interlck.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/interlck.c [iso-8859-1] Sat May 2 22:20:38 2015 @@ -15,17 +15,6 @@ /* FUNCTIONS ***************************************************************/ -PSLIST_ENTRY -NTAPI -RtlInterlockedPushListSList(IN PSLIST_HEADER ListHead, - IN PSLIST_ENTRY List, - IN PSLIST_ENTRY ListEnd, - IN ULONG Count) -{ - UNIMPLEMENTED; - return NULL; -} - LONGLONG NTAPI RtlInterlockedCompareExchange64(LONGLONG volatile *Destination, Modified: trunk/reactos/lib/rtl/slist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/slist.c?rev=67522&…
============================================================================== --- trunk/reactos/lib/rtl/slist.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/slist.c [iso-8859-1] Sat May 2 22:20:38 2015 @@ -4,6 +4,7 @@ * PURPOSE: Slist Routines * FILE: lib/rtl/slist.c * PROGRAMERS: Stefan Ginsberg (stefan__100__(a)hotmail.com) + * Timo Kreuzer (timo.kreuzer(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -13,35 +14,53 @@ #define NDEBUG #include <debug.h> +#ifdef _WIN64 +BOOLEAN RtlpUse16ByteSLists = -1; +#endif + /* FUNCTIONS ***************************************************************/ VOID NTAPI -RtlInitializeSListHead(IN PSLIST_HEADER ListHead) -{ -#ifdef _WIN64 - ListHead->Alignment = 0; - ListHead->Region = 0; - ListHead->Header8.Init = 1; - // ListHead->Header8.HeaderType = 1; // FIXME: depending on cmpxchg16b support? -#else - ListHead->Alignment = 0; -#endif -} - -PSLIST_ENTRY -NTAPI -RtlFirstEntrySList(IN const SLIST_HEADER *ListHead) -{ -#ifdef _WIN64 - if (ListHead->Header8.HeaderType) - { - return (PVOID)(ListHead->Region & ~0xF); +RtlInitializeSListHead( + _Out_ PSLIST_HEADER SListHead) +{ +#if defined(_WIN64) + /* Make sure the header is 16 byte aligned */ + if (((ULONG_PTR)SListHead & 0xf) != 0) + { + DPRINT1("Unaligned SListHead: 0x%p\n", SListHead); + RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); + } + + /* Initialize the Region member */ +#if defined(_IA64_) + /* On Itanium we store the region in the list head */ + SListHead->Region = (ULONG_PTR)SListHead & VRN_MASK; +#else + /* On amd64 we don't need to store anything */ + SListHead->Region = 0; +#endif /* _IA64_ */ +#endif /* _WIN64 */ + + SListHead->Alignment = 0; +} + +PSLIST_ENTRY +NTAPI +RtlFirstEntrySList( + _In_ const SLIST_HEADER *SListHead) +{ +#if defined(_WIN64) + /* Check if the header is initialized as 16 byte header */ + if (SListHead->Header16.HeaderType) + { + return (PVOID)(SListHead->Region & ~0xFLL); } else { union { - PVOID P; + ULONG64 Region; struct { ULONG64 Reserved:4; ULONG64 NextEntry:39; @@ -49,23 +68,230 @@ } Bits; } Pointer; - Pointer.P = (PVOID)ListHead; - Pointer.Bits.NextEntry = ListHead->Header8.NextEntry; - return Pointer.P; - } -#else - return ListHead->Next.Next; +#if defined(_IA64_) + /* On Itanium we stored the region in the list head */ + Pointer.Region = SListHead->Region;; +#else + /* On amd64 we just use the list head itself */ + Pointer.Region = (ULONG64)SListHead; +#endif + Pointer.Bits.NextEntry = SListHead->Header8.NextEntry; + return (PVOID)Pointer.Region; + } +#else + return SListHead->Next.Next; #endif } WORD NTAPI -RtlQueryDepthSList(IN PSLIST_HEADER ListHead) +RtlQueryDepthSList( + _In_ PSLIST_HEADER SListHead) +{ +#if defined(_WIN64) + return (USHORT)(SListHead->Alignment & 0xffff); +#else + return SListHead->Depth; +#endif +} + +PSLIST_ENTRY +FASTCALL +RtlInterlockedPushListSList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY List, + _Inout_ PSLIST_ENTRY ListEnd, + _In_ ULONG Count) { #ifdef _WIN64 - return ListHead->Header8.HeaderType ? - (WORD)ListHead->Header16.Sequence : (WORD)ListHead->Header8.Sequence; -#else - return ListHead->Depth; -#endif -} + UNIMPLEMENTED; + DbgBreakPoint(); + return NULL; +#else + SLIST_HEADER OldHeader, NewHeader; + ULONGLONG Compare; + + /* Read the header */ + OldHeader = *SListHead; + + do + { + /* Link the last list entry */ + ListEnd->Next = OldHeader.Next.Next; + + /* Create a new header */ + NewHeader = OldHeader; + NewHeader.Next.Next = List; + NewHeader.Depth += Count; + NewHeader.Sequence++; + + /* Try to exchange atomically */ + Compare = OldHeader.Alignment; + OldHeader.Alignment = InterlockedCompareExchange64((PLONGLONG)&SListHead->Alignment, + NewHeader.Alignment, + Compare); + } + while (OldHeader.Alignment != Compare); + + /* Return the old first entry */ + return OldHeader.Next.Next; +#endif /* _WIN64 */ +} + + +#if !defined(_M_IX86) && !defined(_M_AMD64) + +_WARN("C based S-List functions can bugcheck, if not handled properly in kernel") + +#ifdef _WIN64 +#error "No generic S-List functions for WIN64!" +#endif + +/* This variable must be used in kernel mode to prevent the system from + bugchecking on non-present kernel memory. If this variable is set to TRUE + an exception needs to be dispatched. */ +BOOLEAN RtlpExpectSListFault; + +PSLIST_ENTRY +NTAPI +RtlInterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry) +{ + SLIST_HEADER OldHeader, NewHeader; + ULONGLONG Compare; + + /* Read the header */ + OldHeader = *SListHead; + + do + { + /* Link the list entry */ + SListEntry->Next = OldHeader.Next.Next; + + /* Create a new header */ + NewHeader = OldHeader; + NewHeader.Next.Next = SListEntry; + NewHeader.Depth++; + NewHeader.Sequence++; + + /* Try to exchange atomically */ + Compare = OldHeader.Alignment; + OldHeader.Alignment = InterlockedCompareExchange64((PLONGLONG)&SListHead->Alignment, + NewHeader.Alignment, + Compare); + } + while (OldHeader.Alignment != Compare); + + /* Return the old first entry */ + return OldHeader.Next.Next; +} + +PSLIST_ENTRY +NTAPI +RtlInterlockedPopEntrySList( + _Inout_ PSLIST_HEADER SListHead) +{ + SLIST_HEADER OldHeader, NewHeader; + ULONGLONG Compare; + +restart: + + /* Read the header */ + OldHeader = *SListHead; + + do + { + /* Check for empty list */ + if (OldHeader.Next.Next == NULL) + { + return NULL; + } + + /* Create a new header */ + NewHeader = OldHeader; + + /* HACK to let the kernel know that we are doing slist-magic */ + RtlpExpectSListFault = TRUE; + + /* Wrapped in SEH, since OldHeader.Next.Next can already be freed */ + _SEH2_TRY + { + NewHeader.Next = *OldHeader.Next.Next; + } + _SEH2_EXCEPT((SListHead->Next.Next != OldHeader.Next.Next) ? + EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + /* We got an exception and the list head changed. + Restart the whole operation. */ + RtlpExpectSListFault = FALSE; + goto restart; + } + _SEH2_END; + + /* We are done */ + RtlpExpectSListFault = FALSE; + + /* Adjust depth */ + NewHeader.Depth--; + + /* Try to exchange atomically */ + Compare = OldHeader.Alignment; + OldHeader.Alignment = InterlockedCompareExchange64((PLONGLONG)SListHead->Alignment, + NewHeader.Alignment, + Compare); + } + while (OldHeader.Alignment != Compare); + + return OldHeader.Next.Next; +} + +PSLIST_ENTRY +NTAPI +RtlInterlockedFlushSList( + _Inout_ PSLIST_HEADER SListHead) +{ + SLIST_HEADER OldHeader, NewHeader; + ULONGLONG Compare; + + /* Read the header */ + OldHeader = *SListHead; + + do + { + /* Check for empty list */ + if (OldHeader.Next.Next == NULL) + { + return NULL; + } + + /* Create a new header (keep the sequence number) */ + NewHeader = OldHeader; + NewHeader.Next.Next = NULL; + NewHeader.Depth = 0; + + /* Try to exchange atomically */ + Compare = OldHeader.Alignment; + OldHeader.Alignment = InterlockedCompareExchange64((PLONGLONG)&SListHead->Alignment, + NewHeader.Alignment, + Compare); + } + while (OldHeader.Alignment != Compare); + + /* Return the old first entry */ + return OldHeader.Next.Next; + +} + +#ifdef _MSC_VER +#pragma comment(linker, "/alternatename:ExpInterlockedPopEntrySList=RtlInterlockedPopEntrySList") +#pragma comment(linker, "/alternatename:ExpInterlockedPushEntrySList=RtlInterlockedPushEntrySList") +#pragma comment(linker, "/alternatename:ExpInterlockedFlushSList=RtlInterlockedFlushSList") +#else +#pragma redefine_extname RtlInterlockedPopEntrySList ExpInterlockedPopEntrySList +#pragma redefine_extname RtlInterlockedPushEntrySList ExpInterlockedPushEntrySList +#pragma redefine_extname RtlInterlockedFlushSList ExpInterlockedFlushSList +#endif + +#endif + Modified: trunk/reactos/ntoskrnl/ke/amd64/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/stubs.c?…
============================================================================== --- trunk/reactos/ntoskrnl/ke/amd64/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/amd64/stubs.c [iso-8859-1] Sat May 2 22:20:38 2015 @@ -453,15 +453,6 @@ return STATUS_UNSUCCESSFUL; } -#undef ExQueryDepthSList -NTKERNELAPI -USHORT -ExQueryDepthSList(IN PSLIST_HEADER ListHead) -{ - return (USHORT)(ListHead->Alignment & 0xffff); -} - - ULONG ProcessCount; BOOLEAN CcPfEnablePrefetcher;
9 years, 7 months
1
0
0
0
[tkreuzer] 67521: [DDK/XDK] - Improve definition of ExInterlockedCompareExchange64 and interlocked SList functions and improve some annotations based on native header - Update processor feature con...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 22:20:18 2015 New Revision: 67521 URL:
http://svn.reactos.org/svn/reactos?rev=67521&view=rev
Log: [DDK/XDK] - Improve definition of ExInterlockedCompareExchange64 and interlocked SList functions and improve some annotations based on native header - Update processor feature constants Modified: trunk/reactos/include/ddk/wdm.h trunk/reactos/include/psdk/winnt.h trunk/reactos/include/xdk/exfuncs.h trunk/reactos/include/xdk/ketypes.h trunk/reactos/include/xdk/rtlfuncs.h trunk/reactos/include/xdk/winnt_old.h Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=6752…
============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -1181,24 +1181,38 @@ } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;; /* Processor features */ -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_SSE_DAZ_MODE_AVAILABLE 11 -#define PF_NX_ENABLED 12 -#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 -#define PF_COMPARE_EXCHANGE128 14 -#define PF_COMPARE64_EXCHANGE128 15 -#define PF_CHANNELS_ENABLED 16 -#define PF_XSAVE_ENABLED 17 +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 +#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 +#define PF_COMPARE_EXCHANGE128 14 +#define PF_COMPARE64_EXCHANGE128 15 +#define PF_CHANNELS_ENABLED 16 +#define PF_XSAVE_ENABLED 17 +#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 +#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 +#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 +#define PF_VIRT_FIRMWARE_ENABLED 21 +#define PF_RDWRFSGSBASE_AVAILABLE 22 +#define PF_FASTFAIL_AVAILABLE 23 +#define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 +#define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 +#define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 +#define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 +#define PF_RDRAND_INSTRUCTION_AVAILABLE 28 +#define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 +#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 +#define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 #define MAXIMUM_WAIT_OBJECTS 64 @@ -11645,77 +11659,77 @@ #if !defined(_WINBASE_) -#if defined(_WIN64) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) +#if defined(_WIN64) && !defined(_NTSYSTEM_) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || !defined(_NTOSP_)) NTKERNELAPI VOID InitializeSListHead( _Out_ PSLIST_HEADER SListHead); -#else +#else /* defined(_WIN64) && ... */ + +/* HACK */ +_IRQL_requires_max_(APC_LEVEL) +NTKERNELAPI +DECLSPEC_NORETURN +VOID +NTAPI +ExRaiseStatus( + _In_ NTSTATUS Status); FORCEINLINE VOID InitializeSListHead( _Out_ PSLIST_HEADER SListHead) { +#if defined(_WIN64) + if (((ULONG_PTR)SListHead & 0xf) != 0) { + ExRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); + } #if defined(_IA64_) - ULONG64 FeatureBits; -#endif - -#if defined(_WIN64) - if (((ULONG_PTR)SListHead & 0xf) != 0) { - RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); - } -#endif - RtlZeroMemory(SListHead, sizeof(SLIST_HEADER)); -#if defined(_IA64_) - FeatureBits = __getReg(CV_IA64_CPUID4); - if ((FeatureBits & KF_16BYTE_INSTR) != 0) { - SListHead->Header16.HeaderType = 1; - SListHead->Header16.Init = 1; - } -#endif + SListHead->Region = (ULONG_PTR)SListHead & VRN_MASK; +#else + SListHead->Region = 0; +#endif /* _IA64_ */ +#endif /* _WIN64 */ + SListHead->Alignment = 0; } -#endif - -#if defined(_WIN64) - -#define InterlockedPopEntrySList(Head) \ - ExpInterlockedPopEntrySList(Head) - -#define InterlockedPushEntrySList(Head, Entry) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#define InterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#else /* !defined(_WIN64) */ +#endif /* defined(_WIN64) && ... */ + +#ifdef _X86_ + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +InterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry); NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -InterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry); - -#define InterlockedFlushSList(ListHead) \ - ExInterlockedFlushSList(ListHead) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#endif /* !defined(_WIN64) */ + _Inout_ PSLIST_HEADER SListHead); + +#define InterlockedFlushSList(SListHead) \ + ExInterlockedFlushSList(SListHead) + +#else /* !_X86_ */ + +#define InterlockedPushEntrySList(SListHead, SListEntry) \ + ExpInterlockedPushEntrySList(SListHead, SListEntry) + +#define InterlockedPopEntrySList(SListHead) \ + ExpInterlockedPopEntrySList(SListHead) + +#define InterlockedFlushSList(SListHead) \ + ExpInterlockedFlushSList(SListHead) + +#endif /* _X86_ */ + +#define QueryDepthSList(SListHead) \ + ExQueryDepthSList(SListHead) #endif /* !defined(_WINBASE_) */ @@ -14787,77 +14801,95 @@ #define ExInterlockedPushEntryList ExfInterlockedPushEntryList #endif /* defined(_X86_) */ -#if defined(_WIN64) - -#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || \ - defined(_NTHAL_) || defined(_NTOSP_) +#ifdef _X86_ + +#ifdef _WIN2K_COMPAT_SLIST_USAGE + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry, + _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedPopEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); + +#else /* !_WIN2K_COMPAT_SLIST_USAGE */ + +#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ + InterlockedPushEntrySList(SListHead, SListEntry) + +#define ExInterlockedPopEntrySList(SListHead, Lock) \ + InterlockedPopEntrySList(SListHead) + +#endif /* _WIN2K_COMPAT_SLIST_USAGE */ + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedFlushSList( + _Inout_ PSLIST_HEADER SListHead); + +#ifdef NONAMELESSUNION +#define ExQueryDepthSList(SListHead) (SListHead)->s.Depth +#else +#define ExQueryDepthSList(SListHead) (SListHead)->Depth +#endif + +#else /* !_X86_ */ + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry); + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPopEntrySList( + _Inout_ PSLIST_HEADER SListHead); + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedFlushSList( + _Inout_ PSLIST_HEADER SListHead); + +#if !defined(_NTSYSTEM_) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) NTKERNELAPI USHORT -ExQueryDepthSList(_In_ PSLIST_HEADER ListHead); +ExQueryDepthSList(_In_ PSLIST_HEADER SListHead); #else FORCEINLINE USHORT -ExQueryDepthSList(_In_ PSLIST_HEADER ListHead) +ExQueryDepthSList(_In_ PSLIST_HEADER SListHead) { - return (USHORT)(ListHead->Alignment & 0xffff); +#ifdef _WIN64 + return (USHORT)(SListHead->Alignment & 0xffff); +#else /* !_WIN64 */ + return (USHORT)SListHead->Depth; +#endif /* _WIN64 */ } #endif -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedFlushSList( - PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry); - -#define ExInterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) -#define ExInterlockedPopEntrySList(Head, Lock) \ - ExpInterlockedPopEntrySList(Head) -#define ExInterlockedPushEntrySList(Head, Entry, Lock) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#else /* !defined(_WIN64) */ - -#ifdef NONAMELESSUNION -#define ExQueryDepthSList(listhead) (listhead)->s.Depth -#else -#define ExQueryDepthSList(listhead) (listhead)->Depth -#endif - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedFlushSList( - _Inout_ PSLIST_HEADER ListHead); - -#endif /* !defined(_WIN64) */ +#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ + ExpInterlockedPushEntrySList(SListHead, SListEntry) + +#define ExInterlockedPopEntrySList(SListHead, Lock) \ + ExpInterlockedPopEntrySList(SListHead) + +#define ExInterlockedFlushSList(SListHead) \ + ExpInterlockedFlushSList(SListHead) + +#endif /* _X86_ */ + #if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY ListEntry, - _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); _IRQL_requires_max_(APC_LEVEL) NTKERNELAPI @@ -14875,13 +14907,6 @@ _In_ PVOID Entry); #else /* !_WIN2K_COMPAT_SLIST_USAGE */ - -#if !defined(_WIN64) -#define ExInterlockedPopEntrySList(_ListHead, _Lock) \ - InterlockedPopEntrySList(_ListHead) -#define ExInterlockedPushEntrySList(_ListHead, _ListEntry, _Lock) \ - InterlockedPushEntrySList(_ListHead, _ListEntry) -#endif _IRQL_requires_max_(APC_LEVEL) static __inline @@ -15282,12 +15307,7 @@ _In_ ULONG Increment, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); -#if defined(_AMD64_) || defined(_IA64_) - -#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ - InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand)) - -#elif defined(_X86_) +#if defined(_M_IX86) NTKERNELAPI LONGLONG @@ -15302,16 +15322,10 @@ #else -NTKERNELAPI -LONGLONG -FASTCALL -ExInterlockedCompareExchange64( - IN OUT LONGLONG volatile *Destination, - IN PLONGLONG Exchange, - IN PLONGLONG Comparand, - IN PKSPIN_LOCK Lock); - -#endif /* defined(_AMD64_) || defined(_IA64_) */ +#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ + InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand)) + +#endif /* defined(_M_IX86) */ NTKERNELAPI PLIST_ENTRY @@ -15689,6 +15703,12 @@ ExFlushLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside); +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:__WARNING_MEMORY_NOT_ACQUIRED) +#endif + +__drv_allocatesMem(Mem) _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) FORCEINLINE @@ -15721,12 +15741,16 @@ return Entry; } +#ifdef _MSC_VER +#pragma warning(pop) +#endif + _IRQL_requires_max_(DISPATCH_LEVEL) FORCEINLINE VOID ExFreeToLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside, - _In_ PVOID Entry) + _In_ __drv_freesMem(Entry) PVOID Entry) { Lookaside->L.TotalFrees += 1; if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { @@ -15755,8 +15779,12 @@ #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ +__drv_allocatesMem(Mem) _IRQL_requires_max_(DISPATCH_LEVEL) -static __inline PVOID +_Ret_maybenull_ +_Post_writable_byte_size_(Lookaside->L.Size) +static __inline +PVOID ExAllocateFromNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside) { @@ -15794,10 +15822,11 @@ } _IRQL_requires_max_(DISPATCH_LEVEL) -static __inline VOID +static __inline +VOID ExFreeToNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside, - _In_ PVOID Entry) + _In_ __drv_freesMem(Mem) PVOID Entry) { Lookaside->L.TotalFrees++; #ifdef NONAMELESSUNION Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=6…
============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -2569,18 +2569,40 @@ #define PROCESSOR_ARCHITECTURE_MSIL 8 #define PROCESSOR_ARCHITECTURE_AMD64 9 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_NX_ENABLED 12 + +/* Processor features */ +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 +#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 +#define PF_COMPARE_EXCHANGE128 14 +#define PF_COMPARE64_EXCHANGE128 15 +#define PF_CHANNELS_ENABLED 16 +#define PF_XSAVE_ENABLED 17 +#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 +#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 +#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 +#define PF_VIRT_FIRMWARE_ENABLED 21 +#define PF_RDWRFSGSBASE_AVAILABLE 22 +#define PF_FASTFAIL_AVAILABLE 23 +#define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 +#define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 +#define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 +#define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 +#define PF_RDRAND_INSTRUCTION_AVAILABLE 28 +#define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 +#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 +#define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 /* also in ddk/ntifs.h */ #define FILE_ACTION_ADDED 0x00000001 Modified: trunk/reactos/include/xdk/exfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/exfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/xdk/exfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/exfuncs.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -84,77 +84,95 @@ #define ExInterlockedPushEntryList ExfInterlockedPushEntryList #endif /* defined(_X86_) */ -#if defined(_WIN64) - -#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || \ - defined(_NTHAL_) || defined(_NTOSP_) +#ifdef _X86_ + +#ifdef _WIN2K_COMPAT_SLIST_USAGE + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry, + _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedPopEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); + +#else /* !_WIN2K_COMPAT_SLIST_USAGE */ + +#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ + InterlockedPushEntrySList(SListHead, SListEntry) + +#define ExInterlockedPopEntrySList(SListHead, Lock) \ + InterlockedPopEntrySList(SListHead) + +#endif /* _WIN2K_COMPAT_SLIST_USAGE */ + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +ExInterlockedFlushSList( + _Inout_ PSLIST_HEADER SListHead); + +#ifdef NONAMELESSUNION +#define ExQueryDepthSList(SListHead) (SListHead)->s.Depth +#else +#define ExQueryDepthSList(SListHead) (SListHead)->Depth +#endif + +#else /* !_X86_ */ + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry); + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPopEntrySList( + _Inout_ PSLIST_HEADER SListHead); + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedFlushSList( + _Inout_ PSLIST_HEADER SListHead); + +#if !defined(_NTSYSTEM_) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) NTKERNELAPI USHORT -ExQueryDepthSList(_In_ PSLIST_HEADER ListHead); +ExQueryDepthSList(_In_ PSLIST_HEADER SListHead); #else FORCEINLINE USHORT -ExQueryDepthSList(_In_ PSLIST_HEADER ListHead) +ExQueryDepthSList(_In_ PSLIST_HEADER SListHead) { - return (USHORT)(ListHead->Alignment & 0xffff); +#ifdef _WIN64 + return (USHORT)(SListHead->Alignment & 0xffff); +#else /* !_WIN64 */ + return (USHORT)SListHead->Depth; +#endif /* _WIN64 */ } #endif -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedFlushSList( - PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry); - -#define ExInterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) -#define ExInterlockedPopEntrySList(Head, Lock) \ - ExpInterlockedPopEntrySList(Head) -#define ExInterlockedPushEntrySList(Head, Entry, Lock) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#else /* !defined(_WIN64) */ - -#ifdef NONAMELESSUNION -#define ExQueryDepthSList(listhead) (listhead)->s.Depth -#else -#define ExQueryDepthSList(listhead) (listhead)->Depth -#endif - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedFlushSList( - _Inout_ PSLIST_HEADER ListHead); - -#endif /* !defined(_WIN64) */ +#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ + ExpInterlockedPushEntrySList(SListHead, SListEntry) + +#define ExInterlockedPopEntrySList(SListHead, Lock) \ + ExpInterlockedPopEntrySList(SListHead) + +#define ExInterlockedFlushSList(SListHead) \ + ExpInterlockedFlushSList(SListHead) + +#endif /* _X86_ */ + #if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); - -NTKERNELAPI -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY ListEntry, - _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); _IRQL_requires_max_(APC_LEVEL) NTKERNELAPI @@ -172,13 +190,6 @@ _In_ PVOID Entry); #else /* !_WIN2K_COMPAT_SLIST_USAGE */ - -#if !defined(_WIN64) -#define ExInterlockedPopEntrySList(_ListHead, _Lock) \ - InterlockedPopEntrySList(_ListHead) -#define ExInterlockedPushEntrySList(_ListHead, _ListEntry, _Lock) \ - InterlockedPushEntrySList(_ListHead, _ListEntry) -#endif _IRQL_requires_max_(APC_LEVEL) static __inline @@ -693,12 +704,7 @@ _In_ ULONG Increment, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock); -#if defined(_AMD64_) || defined(_IA64_) - -#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ - InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand)) - -#elif defined(_X86_) +#if defined(_M_IX86) NTKERNELAPI LONGLONG @@ -713,16 +719,10 @@ #else -NTKERNELAPI -LONGLONG -FASTCALL -ExInterlockedCompareExchange64( - IN OUT LONGLONG volatile *Destination, - IN PLONGLONG Exchange, - IN PLONGLONG Comparand, - IN PKSPIN_LOCK Lock); - -#endif /* defined(_AMD64_) || defined(_IA64_) */ +#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ + InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand)) + +#endif /* defined(_M_IX86) */ NTKERNELAPI PLIST_ENTRY @@ -1189,6 +1189,12 @@ ExFlushLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside); +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:__WARNING_MEMORY_NOT_ACQUIRED) +#endif + +__drv_allocatesMem(Mem) _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) FORCEINLINE @@ -1221,12 +1227,16 @@ return Entry; } +#ifdef _MSC_VER +#pragma warning(pop) +#endif + _IRQL_requires_max_(DISPATCH_LEVEL) FORCEINLINE VOID ExFreeToLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside, - _In_ PVOID Entry) + _In_ __drv_freesMem(Entry) PVOID Entry) { Lookaside->L.TotalFrees += 1; if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { @@ -1255,8 +1265,12 @@ #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ -_IRQL_requires_max_(DISPATCH_LEVEL) -static __inline PVOID +__drv_allocatesMem(Mem) +_IRQL_requires_max_(DISPATCH_LEVEL) +_Ret_maybenull_ +_Post_writable_byte_size_(Lookaside->L.Size) +static __inline +PVOID ExAllocateFromNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside) { @@ -1294,10 +1308,11 @@ } _IRQL_requires_max_(DISPATCH_LEVEL) -static __inline VOID +static __inline +VOID ExFreeToNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside, - _In_ PVOID Entry) + _In_ __drv_freesMem(Mem) PVOID Entry) { Lookaside->L.TotalFrees++; #ifdef NONAMELESSUNION Modified: trunk/reactos/include/xdk/ketypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ketypes.h?rev=…
============================================================================== --- trunk/reactos/include/xdk/ketypes.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/ketypes.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -118,24 +118,38 @@ } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;; /* Processor features */ -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_SSE_DAZ_MODE_AVAILABLE 11 -#define PF_NX_ENABLED 12 -#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 -#define PF_COMPARE_EXCHANGE128 14 -#define PF_COMPARE64_EXCHANGE128 15 -#define PF_CHANNELS_ENABLED 16 -#define PF_XSAVE_ENABLED 17 +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 +#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 +#define PF_COMPARE_EXCHANGE128 14 +#define PF_COMPARE64_EXCHANGE128 15 +#define PF_CHANNELS_ENABLED 16 +#define PF_XSAVE_ENABLED 17 +#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 +#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 +#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 +#define PF_VIRT_FIRMWARE_ENABLED 21 +#define PF_RDWRFSGSBASE_AVAILABLE 22 +#define PF_FASTFAIL_AVAILABLE 23 +#define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 +#define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 +#define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 +#define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 +#define PF_RDRAND_INSTRUCTION_AVAILABLE 28 +#define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 +#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 +#define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 #define MAXIMUM_WAIT_OBJECTS 64 Modified: trunk/reactos/include/xdk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -3301,77 +3301,77 @@ #if !defined(_WINBASE_) -#if defined(_WIN64) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_)) +#if defined(_WIN64) && !defined(_NTSYSTEM_) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || !defined(_NTOSP_)) NTKERNELAPI VOID InitializeSListHead( _Out_ PSLIST_HEADER SListHead); -#else +#else /* defined(_WIN64) && ... */ + +/* HACK */ +_IRQL_requires_max_(APC_LEVEL) +NTKERNELAPI +DECLSPEC_NORETURN +VOID +NTAPI +ExRaiseStatus( + _In_ NTSTATUS Status); FORCEINLINE VOID InitializeSListHead( _Out_ PSLIST_HEADER SListHead) { +#if defined(_WIN64) + if (((ULONG_PTR)SListHead & 0xf) != 0) { + ExRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); + } #if defined(_IA64_) - ULONG64 FeatureBits; -#endif - -#if defined(_WIN64) - if (((ULONG_PTR)SListHead & 0xf) != 0) { - RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); - } -#endif - RtlZeroMemory(SListHead, sizeof(SLIST_HEADER)); -#if defined(_IA64_) - FeatureBits = __getReg(CV_IA64_CPUID4); - if ((FeatureBits & KF_16BYTE_INSTR) != 0) { - SListHead->Header16.HeaderType = 1; - SListHead->Header16.Init = 1; - } -#endif -} - -#endif - -#if defined(_WIN64) - -#define InterlockedPopEntrySList(Head) \ - ExpInterlockedPopEntrySList(Head) - -#define InterlockedPushEntrySList(Head, Entry) \ - ExpInterlockedPushEntrySList(Head, Entry) - -#define InterlockedFlushSList(Head) \ - ExpInterlockedFlushSList(Head) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#else /* !defined(_WIN64) */ + SListHead->Region = (ULONG_PTR)SListHead & VRN_MASK; +#else + SListHead->Region = 0; +#endif /* _IA64_ */ +#endif /* _WIN64 */ + SListHead->Alignment = 0; +} + +#endif /* defined(_WIN64) && ... */ + +#ifdef _X86_ + +NTKERNELAPI +PSLIST_ENTRY +FASTCALL +InterlockedPushEntrySList( + _Inout_ PSLIST_HEADER SListHead, + _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry); NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPopEntrySList( - _Inout_ PSLIST_HEADER ListHead); - -NTKERNELAPI -PSLIST_ENTRY -FASTCALL -InterlockedPushEntrySList( - _Inout_ PSLIST_HEADER ListHead, - _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry); - -#define InterlockedFlushSList(ListHead) \ - ExInterlockedFlushSList(ListHead) - -#define QueryDepthSList(Head) \ - ExQueryDepthSList(Head) - -#endif /* !defined(_WIN64) */ + _Inout_ PSLIST_HEADER SListHead); + +#define InterlockedFlushSList(SListHead) \ + ExInterlockedFlushSList(SListHead) + +#else /* !_X86_ */ + +#define InterlockedPushEntrySList(SListHead, SListEntry) \ + ExpInterlockedPushEntrySList(SListHead, SListEntry) + +#define InterlockedPopEntrySList(SListHead) \ + ExpInterlockedPopEntrySList(SListHead) + +#define InterlockedFlushSList(SListHead) \ + ExpInterlockedFlushSList(SListHead) + +#endif /* _X86_ */ + +#define QueryDepthSList(SListHead) \ + ExQueryDepthSList(SListHead) #endif /* !defined(_WINBASE_) */ Modified: trunk/reactos/include/xdk/winnt_old.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/winnt_old.h?re…
============================================================================== --- trunk/reactos/include/xdk/winnt_old.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/winnt_old.h [iso-8859-1] Sat May 2 22:20:18 2015 @@ -674,18 +674,40 @@ #define PROCESSOR_ARCHITECTURE_MSIL 8 #define PROCESSOR_ARCHITECTURE_AMD64 9 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_NX_ENABLED 12 + +/* Processor features */ +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 +#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 +#define PF_COMPARE_EXCHANGE128 14 +#define PF_COMPARE64_EXCHANGE128 15 +#define PF_CHANNELS_ENABLED 16 +#define PF_XSAVE_ENABLED 17 +#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 +#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 +#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 +#define PF_VIRT_FIRMWARE_ENABLED 21 +#define PF_RDWRFSGSBASE_AVAILABLE 22 +#define PF_FASTFAIL_AVAILABLE 23 +#define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 +#define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 +#define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 +#define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 +#define PF_RDRAND_INSTRUCTION_AVAILABLE 28 +#define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 +#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 +#define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 /* also in ddk/ntifs.h */ #define FILE_ACTION_ADDED 0x00000001
9 years, 7 months
1
0
0
0
[tkreuzer] 67520: [XDK/DDK/NDK] Simplify RtlXxxByteSwap macros (use them unconditionally)
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 22:19:47 2015 New Revision: 67520 URL:
http://svn.reactos.org/svn/reactos?rev=67520&view=rev
Log: [XDK/DDK/NDK] Simplify RtlXxxByteSwap macros (use them unconditionally) Modified: trunk/reactos/include/ddk/wdm.h trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/include/xdk/rtlfuncs.h Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=6752…
============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sat May 2 22:19:47 2015 @@ -11528,15 +11528,9 @@ #endif /* !defined(MIDL_PASS) */ /* Byte Swap Functions */ -#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037 || defined(__GNUC__))) || \ - ((defined(_M_AMD64) || defined(_M_IA64)) \ - && (_MSC_FULL_VER > 13009175 || defined(__GNUC__))) - #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x)) #define RtlUlongByteSwap(_x) _byteswap_ulong((_x)) #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x)) - -#endif #if DBG Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Sat May 2 22:19:47 2015 @@ -1730,46 +1730,18 @@ // #ifdef NTOS_MODE_USER -#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \ - ((defined(_M_AMD64) || \ - defined(_M_IA64)) && (_MSC_FULL_VER > 13009175)) - unsigned short __cdecl _byteswap_ushort(unsigned short); unsigned long __cdecl _byteswap_ulong (unsigned long); unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64); +#ifdef _MSC_VER #pragma intrinsic(_byteswap_ushort) #pragma intrinsic(_byteswap_ulong) #pragma intrinsic(_byteswap_uint64) +#endif // _MSC_VER #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x)) #define RtlUlongByteSwap(_x) _byteswap_ulong((_x)) #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x)) -#elif defined (__GNUC__) - -#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x)) -#define RtlUlongByteSwap(_x) _byteswap_ulong((_x)) -#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x)) - -#else - -#if (NTDDI_VERSION >= NTDDI_WIN2K) -NTSYSAPI -USHORT -FASTCALL -RtlUshortByteSwap(IN USHORT Source); - -NTSYSAPI -ULONG -FASTCALL -RtlUlongByteSwap(IN ULONG Source); - -NTSYSAPI -ULONGLONG -FASTCALL -RtlUlonglongByteSwap(IN ULONGLONG Source); -#endif - -#endif #endif // NTOS_MODE_USER // Modified: trunk/reactos/include/xdk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] Sat May 2 22:19:47 2015 @@ -3184,15 +3184,9 @@ #endif /* !defined(MIDL_PASS) */ /* Byte Swap Functions */ -#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037 || defined(__GNUC__))) || \ - ((defined(_M_AMD64) || defined(_M_IA64)) \ - && (_MSC_FULL_VER > 13009175 || defined(__GNUC__))) - #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x)) #define RtlUlongByteSwap(_x) _byteswap_ulong((_x)) #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x)) - -#endif #if DBG
9 years, 7 months
1
0
0
0
[tkreuzer] 67519: [CRT] Fix MSVC warnings
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 2 22:19:31 2015 New Revision: 67519 URL:
http://svn.reactos.org/svn/reactos?rev=67519&view=rev
Log: [CRT] Fix MSVC warnings Modified: trunk/reactos/lib/sdk/crt/string/scanf.h Modified: trunk/reactos/lib/sdk/crt/string/scanf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/scanf.h…
============================================================================== --- trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] Sat May 2 22:19:31 2015 @@ -297,7 +297,7 @@ if (!seendigit) break; /* not a valid number */ st = 1; if (!suppress) { -#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur +#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -(LONGLONG)cur : cur if (I64_prefix) _SET_NUMBER_(LONGLONG); else if (l_prefix) _SET_NUMBER_(LONG); else if (h_prefix == 1) _SET_NUMBER_(short int); @@ -640,7 +640,7 @@ if ((*(format - 1)) < *(format + 1)) RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1)); else - RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); + RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); format++; } else RtlSetBits(&bitMask, *format, 1);
9 years, 7 months
1
0
0
0
[hbelusca] 67518: [NTVDM] Mouse: - Remove now useless code in mouse support in BIOS. - Implement INT 33h, AH=1Bh "Return mouse sensitivity" (returning hardcoded standard values since we don't suppo...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat May 2 20:48:08 2015 New Revision: 67518 URL:
http://svn.reactos.org/svn/reactos?rev=67518&view=rev
Log: [NTVDM] Mouse: - Remove now useless code in mouse support in BIOS. - Implement INT 33h, AH=1Bh "Return mouse sensitivity" (returning hardcoded standard values since we don't support custom sensitivities) (AH=13h and 1Ah are marked as UNSUPPORTED). - INT 33h, AH=1Fh "Disable mouse driver" returns in ES:BX the old INT 33h vector value: implement that. - Implement INT 33h, AH=21h "Software reset", AH=24h and 4Dh and 6Dh "Software version and mouse info", "pointer to copyright string" and "version 'string'" functionalities. DOS: - Initialize in Win2k3-ntvdm-compatible order the DOS drivers: NUL, then CON, then XMS, and then EMS. - Fix segment/offset inversion usage in INT 21h, AH=5Ch "Lock/Unlock region of file": when using MAKELONG macro to build a far pointer, the first parameter (loword) is the offset, and the second parameter (hiword) is the segment. Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.c trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.h trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.h Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/bios…
============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.c [iso-8859-1] Sat May 2 20:48:08 2015 @@ -17,11 +17,7 @@ #include "bios32p.h" #include "io.h" -#include "hardware/mouse.h" #include "hardware/ps2.h" - -// HACK: For the PS/2 bypass and
MOUSE.COM
driver direct call -#include "dos/mouse32.h" /* PRIVATE VARIABLES **********************************************************/ Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/bios…
============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/moubios32.h [iso-8859-1] Sat May 2 20:48:08 2015 @@ -11,63 +11,6 @@ /* DEFINES ********************************************************************/ -#if 0 // This code is for the
MOUSE.COM
driver - -enum -{ - MOUSE_BUTTON_LEFT, - MOUSE_BUTTON_RIGHT, - MOUSE_BUTTON_MIDDLE, - NUM_MOUSE_BUTTONS -}; - -typedef struct _MOUSE_USER_HANDLER -{ - /* - * CallMask format: see table:
http://www.ctyme.com/intr/rb-5968.htm#Table3171
- * Alternatively, see table:
http://www.ctyme.com/intr/rb-5981.htm#Table3174
- */ - USHORT CallMask; - ULONG Callback; // Far pointer to the callback -} MOUSE_USER_HANDLER, *PMOUSE_USER_HANDLER; - -typedef struct _MOUSE_DRIVER_STATE -{ - SHORT ShowCount; - COORD Position; - WORD Character; - WORD ButtonState; - WORD PressCount[NUM_MOUSE_BUTTONS]; - COORD LastPress[NUM_MOUSE_BUTTONS]; - WORD ReleaseCount[NUM_MOUSE_BUTTONS]; - COORD LastRelease[NUM_MOUSE_BUTTONS]; - SHORT HorizCount; - SHORT VertCount; - WORD MickeysPerCellHoriz; - WORD MickeysPerCellVert; - - /* - * User Subroutine Handlers called on mouse events - */ - MOUSE_USER_HANDLER Handler0; // Handler compatible MS MOUSE v1.0+ - MOUSE_USER_HANDLER Handlers[3]; // Handlers compatible MS MOUSE v6.0+ - - struct - { - WORD ScreenMask; - WORD CursorMask; - } TextCursor; - - struct - { - COORD HotSpot; - WORD ScreenMask[16]; - WORD CursorMask[16]; - } GraphicsCursor; -} MOUSE_DRIVER_STATE, *PMOUSE_DRIVER_STATE; - -#endif - /* FUNCTIONS ******************************************************************/ VOID BiosMousePs2Interface(LPWORD Stack); Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/…
============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Sat May 2 20:48:08 2015 @@ -768,7 +768,6 @@ { setES(HIWORD(INDOS_POINTER)); setBX(LOWORD(INDOS_POINTER)); - break; } @@ -1650,7 +1649,7 @@ if (getAL() == 0x00) { /* Lock region of file */ - if (DosLockFile(getBX(), MAKELONG(getCX(), getDX()), MAKELONG(getSI(), getDI()))) + if (DosLockFile(getBX(), MAKELONG(getDX(), getCX()), MAKELONG(getDI(), getSI()))) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; } @@ -1663,7 +1662,7 @@ else if (getAL() == 0x01) { /* Unlock region of file */ - if (DosUnlockFile(getBX(), MAKELONG(getCX(), getDX()), MAKELONG(getSI(), getDI()))) + if (DosUnlockFile(getBX(), MAKELONG(getDX(), getCX()), MAKELONG(getDI(), getSI()))) { Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; } @@ -2015,6 +2014,12 @@ RegisterDosInt32(0x29, DosFastConOut ); // DOS 2+ Fast Console Output RegisterDosInt32(0x2F, DosInt2Fh ); + /* Load the CON driver */ + ConDrvInitialize(); + + /* Load the XMS driver (HIMEM) */ + XmsInitialize(); + /* Load the EMS driver */ if (!EmsDrvInitialize(EMS_TOTAL_PAGES)) { @@ -2022,12 +2027,6 @@ "Try reducing the number of EMS pages.\n"); } - /* Load the XMS driver (HIMEM) */ - XmsInitialize(); - - /* Load the CON driver */ - ConDrvInitialize(); - return TRUE; } Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/…
============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c [iso-8859-1] Sat May 2 20:48:08 2015 @@ -29,16 +29,25 @@ /* PRIVATE VARIABLES **********************************************************/ -#define MICKEYS_PER_CELL_HORIZ 8 -#define MICKEYS_PER_CELL_VERT 16 +// FIXME: Because I don't know a better place to store the string +// I temporarily put it in BIOS space. This need to be moved to a +// proper place when this driver is interfaced correctly with DOS. +#define COPYRIGHT_POINTER MAKELONG(0xE100, 0xF000) +static const CHAR MouseCopyright[] = "ROS PS/2 16/32-bit Mouse Driver Compatible MS-MOUSE 6.26 Copyright (C) ReactOS Team 1996-2015"; + +// See FIXME from above. +#define VERSION_POINTER MAKELONG(0xE160, 0xF000) +static PWORD Version; + +#define MICKEYS_PER_CELL_HORIZ 8 +#define MICKEYS_PER_CELL_VERT 16 static BOOLEAN DriverEnabled = FALSE; static MOUSE_DRIVER_STATE DriverState; static DWORD OldIrqHandler; +static DWORD OldIntHandler; /* PRIVATE FUNCTIONS **********************************************************/ - -extern VOID WINAPI BiosMouseIrq(LPWORD Stack); static VOID PaintMouseCursor(VOID) { @@ -590,6 +599,13 @@ break; } + /* Define Double-Speed Threshold */ + case 0x13: + { + DPRINT1("INT 33h, AH=13h: Mouse double-speed threshold is UNSUPPORTED\n"); + break; + } + /* Exchange Interrupt Subroutines, compatible MS MOUSE v3.0+ (see function 0x0C) */ case 0x14: { @@ -772,11 +788,31 @@ break; } + /* Set Mouse Sensitivity */ + case 0x1A: + { + DPRINT1("INT 33h, AH=1Ah: Mouse sensitivity is UNSUPPORTED\n"); + break; + } + + /* Return Mouse Sensitivity */ + case 0x1B: + { + DPRINT1("INT 33h, AH=1Bh: Mouse sensitivity is UNSUPPORTED\n"); + + /* Return default values */ + setBX(50); // Horizontal speed + setCX(50); // Vertical speed + setDX(50); // Double speed threshold + break; + } + /* Disable Mouse Driver */ case 0x1F: { - setES(0x0000); - setBX(0x0000); + /* INT 33h vector before the mouse driver was first installed */ + setES(HIWORD(OldIntHandler)); + setBX(LOWORD(OldIntHandler)); DosMouseDisable(); break; @@ -786,6 +822,75 @@ case 0x20: { DosMouseEnable(); + break; + } + + /* Software Reset */ + case 0x21: + { + /* + * See:
http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte3sq8.htm
+ * for detailed information and differences with respect to subfunction 0x00: + *
http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte3j74.htm
+ */ + + SHORT i; + + DriverState.ShowCount = 0; + DriverState.ButtonState = 0; + + /* Initialize the default clipping range */ + DriverState.MinX = 0; + DriverState.MaxX = MOUSE_MAX_HORIZ - 1; + DriverState.MinY = 0; + DriverState.MaxY = MOUSE_MAX_VERT - 1; + + /* Initialize the counters */ + DriverState.HorizCount = DriverState.VertCount = 0; + + for (i = 0; i < NUM_MOUSE_BUTTONS; i++) + { + DriverState.PressCount[i] = DriverState.ReleaseCount[i] = 0; + } + + /* Return mouse information */ + setAX(0xFFFF); // Hardware & driver installed + setBX(NUM_MOUSE_BUTTONS); + + break; + } + + /* Get Software Version, Mouse Type, and IRQ Number, compatible MS MOUSE v6.26+ */ + case 0x24: + { + setBX(MOUSE_VERSION); // Version Number + + // FIXME: To be determined at runtime! + setCH(0x04); // PS/2 Type + setCL(0x00); // PS/2 Interrupt + + break; + } + + /* Return Pointer to Copyright String */ + case 0x4D: + { + setES(HIWORD(COPYRIGHT_POINTER)); + setDI(LOWORD(COPYRIGHT_POINTER)); + break; + } + + /* Get Version String (pointer) */ + case 0x6D: + { + /* + * The format of the version "string" is: + * Offset Size Description + * 00h BYTE major version + * 01h BYTE minor version (BCD) + */ + setES(HIWORD(VERSION_POINTER)); + setDI(LOWORD(VERSION_POINTER)); break; } @@ -883,6 +988,16 @@ /* Clear the state */ RtlZeroMemory(&DriverState, sizeof(DriverState)); + /* Setup the version variable in BCD format, compatible MS-MOUSE */ + Version = (PWORD)FAR_POINTER(VERSION_POINTER); + *Version = MAKEWORD(MOUSE_VERSION/0x0100, MOUSE_VERSION%0x0100); + + /* Mouse Driver Copyright */ + RtlCopyMemory(FAR_POINTER(COPYRIGHT_POINTER), MouseCopyright, sizeof(MouseCopyright)-1); + + /* Get the old mouse service interrupt handler */ + OldIntHandler = ((PDWORD)BaseAddress)[DOS_MOUSE_INTERRUPT]; + /* Initialize the interrupt handler */ RegisterDosInt32(DOS_MOUSE_INTERRUPT, DosMouseService); @@ -892,6 +1007,9 @@ VOID DosMouseCleanup(VOID) { + /* Restore the old mouse service interrupt handler */ + ((PDWORD)BaseAddress)[DOS_MOUSE_INTERRUPT] = OldIntHandler; + if (DriverState.ShowCount > 0) EraseMouseCursor(); DosMouseDisable(); } Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/…
============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.h [iso-8859-1] Sat May 2 20:48:08 2015 @@ -10,6 +10,11 @@ #define _MOUSE32_H_ /* DEFINES ********************************************************************/ + +// +// We are ROS PS/2 Mouse Driver Version 6.26, compatible MS-MOUSE 6.26 +// +#define MOUSE_VERSION MAKEWORD(0x26, 0x06) #define DOS_MOUSE_INTERRUPT 0x33 #define MOUSE_IRQ_INT 0x74
9 years, 7 months
1
0
0
0
[akhaldi] 67517: [BOOTDATA] Add missing font DPI entries in registry. By Ziliang Guo. CORE-8902
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat May 2 19:55:55 2015 New Revision: 67517 URL:
http://svn.reactos.org/svn/reactos?rev=67517&view=rev
Log: [BOOTDATA] Add missing font DPI entries in registry. By Ziliang Guo. CORE-8902 Modified: trunk/reactos/boot/bootdata/hivesft.inf trunk/reactos/boot/bootdata/hivesys.inf Modified: trunk/reactos/boot/bootdata/hivesft.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Sat May 2 19:55:55 2015 @@ -261,6 +261,7 @@ ; Font substitutes HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",,0x00000012 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes",,0x00000012 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI","LogPixels",0x00010003,96 ; win32k GRE initialization HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize",,0x00000012 Modified: trunk/reactos/boot/bootdata/hivesys.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Sat May 2 19:55:55 2015 @@ -401,6 +401,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB",,0x00000012 HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB","CurrentConfig",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\0000","FriendlyName",0x00000000,"New Hardware Profile" +HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\Software\Fonts","LogPixels",0x00010003,96 ; Keyboard Layouts HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000401","Layout File",0x00000000,"kbda1.dll"
9 years, 7 months
1
0
0
0
[akhaldi] 67516: [SYSSETUP] Fix timezone setup in the unattended install of ReactOS. Spotted and fixed by V. CORE-9648
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat May 2 19:48:26 2015 New Revision: 67516 URL:
http://svn.reactos.org/svn/reactos?rev=67516&view=rev
Log: [SYSSETUP] Fix timezone setup in the unattended install of ReactOS. Spotted and fixed by V. CORE-9648 Modified: trunk/reactos/dll/win32/syssetup/wizard.c Modified: trunk/reactos/dll/win32/syssetup/wizard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.…
============================================================================== --- trunk/reactos/dll/win32/syssetup/wizard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/syssetup/wizard.c [iso-8859-1] Sat May 2 19:48:26 2015 @@ -1219,27 +1219,36 @@ BOOL bFound = FALSE; unsigned long iLanguageID; - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", - 0, - KEY_ALL_ACCESS, - &hKey)) - return FALSE; - - dwValueSize = 9 * sizeof(WCHAR); - if (RegQueryValueExW(hKey, - L"Default", - NULL, - NULL, - (LPBYTE)szLanguageIdString, - &dwValueSize)) - { + if (*lpIndex == -1) + { + *lpIndex = 85; /* fallback to GMT time zone */ + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", + 0, + KEY_ALL_ACCESS, + &hKey)) + return FALSE; + + dwValueSize = 9 * sizeof(WCHAR); + if (RegQueryValueExW(hKey, + L"Default", + NULL, + NULL, + (LPBYTE)szLanguageIdString, + &dwValueSize)) + { + RegCloseKey(hKey); + return FALSE; + } + + iLanguageID = wcstoul(szLanguageIdString, NULL, 16); RegCloseKey(hKey); - return FALSE; - } - - iLanguageID = wcstoul(szLanguageIdString, NULL, 16); - RegCloseKey(hKey); + } + else + { + iLanguageID = *lpIndex; + } if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", @@ -1515,7 +1524,7 @@ else { ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST), - SetupData, 85 /* GMT time zone */); + SetupData, -1); SendDlgItemMessage(hwndDlg, IDC_AUTODAYLIGHT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); }
9 years, 7 months
1
0
0
0
[akhaldi] 67515: [WBEMDISP_WINETEST] Import from Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat May 2 19:40:48 2015 New Revision: 67515 URL:
http://svn.reactos.org/svn/reactos?rev=67515&view=rev
Log: [WBEMDISP_WINETEST] Import from Wine Staging 1.7.37. CORE-9246 Added: trunk/rostests/winetests/wbemdisp/ (with props) trunk/rostests/winetests/wbemdisp/CMakeLists.txt (with props) trunk/rostests/winetests/wbemdisp/testlist.c (with props) trunk/rostests/winetests/wbemdisp/wbemdisp.c (with props) Modified: trunk/rostests/winetests/CMakeLists.txt Modified: trunk/rostests/winetests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/CMakeLists.txt?…
============================================================================== --- trunk/rostests/winetests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/CMakeLists.txt [iso-8859-1] Sat May 2 19:40:48 2015 @@ -104,6 +104,7 @@ add_subdirectory(uxtheme) add_subdirectory(vbscript) add_subdirectory(version) +add_subdirectory(wbemdisp) add_subdirectory(wbemprox) add_subdirectory(windowscodecs) add_subdirectory(windowscodecsext) Propchange: trunk/rostests/winetests/wbemdisp/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Sat May 2 19:40:48 2015 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: trunk/rostests/winetests/wbemdisp/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: trunk/rostests/winetests/wbemdisp/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Added: trunk/rostests/winetests/wbemdisp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wbemdisp/CMakeL…
============================================================================== --- trunk/rostests/winetests/wbemdisp/CMakeLists.txt (added) +++ trunk/rostests/winetests/wbemdisp/CMakeLists.txt [iso-8859-1] Sat May 2 19:40:48 2015 @@ -0,0 +1,7 @@ + +add_definitions(-DUSE_WINE_TODOS) +add_executable(wbemdisp_winetest wbemdisp.c testlist.c) +target_link_libraries(wbemdisp_winetest uuid) +set_module_type(wbemdisp_winetest win32cui) +add_importlibs(wbemdisp_winetest oleaut32 ole32 user32 msvcrt kernel32) +add_cd_file(TARGET wbemdisp_winetest DESTINATION reactos/bin FOR all) Propchange: trunk/rostests/winetests/wbemdisp/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/wbemdisp/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wbemdisp/testli…
============================================================================== --- trunk/rostests/winetests/wbemdisp/testlist.c (added) +++ trunk/rostests/winetests/wbemdisp/testlist.c [iso-8859-1] Sat May 2 19:40:48 2015 @@ -0,0 +1,12 @@ +/* Automatically generated by make depend; DO NOT EDIT!! */ + +#define STANDALONE +#include <wine/test.h> + +extern void func_wbemdisp(void); + +const struct test winetest_testlist[] = +{ + { "wbemdisp", func_wbemdisp }, + { 0, 0 } +}; Propchange: trunk/rostests/winetests/wbemdisp/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/wbemdisp/wbemdisp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wbemdisp/wbemdi…
============================================================================== --- trunk/rostests/winetests/wbemdisp/wbemdisp.c (added) +++ trunk/rostests/winetests/wbemdisp/wbemdisp.c [iso-8859-1] Sat May 2 19:40:48 2015 @@ -0,0 +1,251 @@ +/* + * Copyright 2015 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include <stdio.h> +#include "windows.h" +#include "initguid.h" +#include "objidl.h" +#include "wbemdisp.h" +#include "wine/test.h" + +DEFINE_GUID(CLSID_WINMGMTS,0x172bddf8,0xceea,0x11d1,0x8b,0x05,0x00,0x60,0x08,0x06,0xd9,0xb6); +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + +static void test_ParseDisplayName(void) +{ + static const WCHAR biosW[] = {'W','i','n','3','2','_','B','i','o','s',0}; + static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; + static const WCHAR versionW[] = {'v','e','r','s','i','o','n',0}; + static const WCHAR nosuchW[] = {'N','o','S','u','c','h',0}; + static const WCHAR name1[] = + {'w','i','n','m','g','m','t','s',':',0}; + static const WCHAR name2[] = + {'w','i','n','m','g','m','t','s',':','\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0}; + static const WCHAR name3[] = + {'w','i','n','m','g','m','t','s',':','\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':', + 'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k','.', + 'D','e','v','i','c','e','I','D','=','\'','C',':','\'',0}; + static const WCHAR name4[] = + {'w','i','n','m','g','m','t','s',':','\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':', + 'W','i','n','3','2','_','S','e','r','v','i','c','e',0}; + static const struct + { + const WCHAR *name; + HRESULT hr; + REFIID iid; + ULONG eaten; + } tests[] = + { + { name1, S_OK, &IID_ISWbemServices, sizeof(name1)/sizeof(name1[0]) - 1 }, + { name2, S_OK, &IID_ISWbemServices, sizeof(name2)/sizeof(name2[0]) - 1 }, + { name3, S_OK, &IID_ISWbemObject, sizeof(name3)/sizeof(name3[0]) - 1 }, + { name4, S_OK, &IID_ISWbemObject, sizeof(name4)/sizeof(name4[0]) - 1 } + }; + LCID english = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); + IParseDisplayName *displayname; + IBindCtx *ctx; + IMoniker *moniker; + IUnknown *obj; + BSTR str; + ULONG i, eaten, count; + HRESULT hr; + + hr = CoCreateInstance( &CLSID_WINMGMTS, NULL, CLSCTX_INPROC_SERVER, &IID_IParseDisplayName, (void **)&displayname ); + if (hr != S_OK) + { + win_skip( "can't create instance of WINMGMTS\n" ); + return; + } + + hr = CreateBindCtx( 0, &ctx ); + ok( hr == S_OK, "got %x\n", hr ); + + for (i =0; i < sizeof(tests)/sizeof(tests[0]); i++) + { + str = SysAllocString( tests[i].name ); + eaten = 0xdeadbeef; + moniker = NULL; + hr = IParseDisplayName_ParseDisplayName( displayname, NULL, str, &eaten, &moniker ); + SysFreeString( str ); + ok( hr == tests[i].hr, "%u: got %x\n", i, hr ); + ok( eaten == tests[i].eaten, "%u: got %u\n", i, eaten ); + if (moniker) + { + obj = NULL; + hr = IMoniker_BindToObject( moniker, ctx, NULL, tests[i].iid, (void **)&obj ); + ok( hr == S_OK, "%u: got %x\n", i, hr ); + if (obj) IUnknown_Release( obj ); + IMoniker_Release( moniker ); + } + } + + str = SysAllocString( name1 ); + eaten = 0xdeadbeef; + moniker = NULL; + hr = IParseDisplayName_ParseDisplayName( displayname, NULL, str, &eaten, &moniker ); + SysFreeString( str ); + ok( hr == S_OK, "got %x\n", hr ); + ok( eaten == lstrlenW(name1), "got %u\n", eaten ); + if (moniker) + { + ISWbemServices *services = NULL; + + hr = IMoniker_BindToObject( moniker, ctx, NULL, &IID_IUnknown, (void **)&services ); + ok( hr == S_OK, "got %x\n", hr ); + if (services) + { + ISWbemObjectSet *objectset = NULL; + + str = SysAllocString( biosW ); + hr = ISWbemServices_InstancesOf( services, str, 0, NULL, &objectset ); + SysFreeString( str ); + ok( hr == S_OK, "got %x\n", hr ); + if (objectset) + { + hr = ISWbemObjectSet_get__NewEnum( objectset, &obj ); + ok( hr == S_OK, "got %x\n", hr ); + if (obj) + { + IEnumVARIANT *enumvar = NULL; + + hr = IUnknown_QueryInterface( obj, &IID_IEnumVARIANT, (void **)&enumvar ); + ok( hr == S_OK, "got %x\n", hr ); + + if (enumvar) + { + VARIANT var, res; + ULONG fetched; + IDispatch *dispatch = NULL; + DISPID dispid; + DISPPARAMS params; + UINT arg_err; + + fetched = 0xdeadbeef; + hr = IEnumVARIANT_Next( enumvar, 0, &var, &fetched ); + ok( hr == S_OK, "got %x\n", hr ); + ok( !fetched, "got %u\n", fetched ); + + fetched = 0xdeadbeef; + V_VT( &var ) = VT_ERROR; + V_ERROR( &var ) = 0xdeadbeef; + hr = IEnumVARIANT_Next( enumvar, 1, &var, &fetched ); + ok( hr == S_OK, "got %x\n", hr ); + ok( fetched == 1, "got %u\n", fetched ); + ok( V_VT( &var ) == VT_DISPATCH, "got %u\n", V_VT( &var ) ); + ok( V_DISPATCH( &var ) != (IDispatch *)0xdeadbeef, "got %u\n", V_VT( &var ) ); + + dispatch = V_DISPATCH( &var ); + count = 0; + hr = IDispatch_GetTypeInfoCount( dispatch, &count ); + ok( hr == S_OK, "got %x\n", hr ); + ok( count == 1, "got %u\n", count ); + + str = SysAllocString( manufacturerW ); + dispid = 0xdeadbeef; + hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &str, 1, english, &dispid ); + SysFreeString( str ); + ok( hr == S_OK, "got %x\n", hr ); + ok( dispid == 0x1800001 || dispid == 0x10b /* win2k */, "got %x\n", dispid ); + + str = SysAllocString( versionW ); + dispid = 0xdeadbeef; + hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &str, 1, english, &dispid ); + SysFreeString( str ); + ok( hr == S_OK, "got %x\n", hr ); + ok( dispid == 0x1800002 || dispid == 0x119 /* win2k */, "got %x\n", dispid ); + + str = SysAllocString( nosuchW ); + dispid = 0xdeadbeef; + hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &str, 1, english, &dispid ); + SysFreeString( str ); + ok( hr == DISP_E_UNKNOWNNAME, "got %x\n", hr ); + ok( dispid == DISPID_UNKNOWN, "got %x\n", dispid ); + + str = SysAllocString( manufacturerW ); + dispid = 0xdeadbeef; + hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &str, 1, english, &dispid ); + SysFreeString( str ); + ok( hr == S_OK, "got %x\n", hr ); + ok( dispid == 0x1800001 || dispid == 0x10b /* win2k */, "got %x\n", dispid ); + + if (dispid == 0x1800001) /* crashes on win2k */ + { + V_VT( &res ) = VT_ERROR; + V_BSTR( &res ) = (BSTR)0xdeadbeef; + params.rgvarg = (VARIANTARG *)0xdeadbeef; + params.rgdispidNamedArgs = (DISPID *)0xdeadbeef; + params.cArgs = params.cNamedArgs = 0xdeadbeef; + arg_err = 0xdeadbeef; + hr = IDispatch_Invoke( dispatch, DISPID_UNKNOWN, &IID_NULL, english, + DISPATCH_METHOD|DISPATCH_PROPERTYGET, + ¶ms, &res, NULL, &arg_err ); + ok( hr == DISP_E_MEMBERNOTFOUND || hr == S_OK /* winxp */, "got %x\n", hr ); + ok( params.rgvarg == (VARIANTARG *)0xdeadbeef, "got %p\n", params.rgvarg ); + ok( params.rgdispidNamedArgs == (DISPID *)0xdeadbeef, "got %p\n", params.rgdispidNamedArgs ); + ok( params.cArgs == 0xdeadbeef, "got %u\n", params.cArgs ); + ok( params.cNamedArgs == 0xdeadbeef, "got %u\n", params.cNamedArgs ); + ok( V_VT( &res ) == VT_ERROR, "got %u\n", V_VT( &res ) ); + ok( V_ERROR( &res ) == 0xdeadbeef, "got %u\n", V_VT( &res ) ); + ok( arg_err == 0xdeadbeef, "got %u\n", arg_err ); + if (hr == S_OK) VariantClear( &res ); + } + + V_VT( &res ) = VT_ERROR; + V_BSTR( &res ) = (BSTR)0xdeadbeef; + memset( ¶ms, 0, sizeof(params) ); + hr = IDispatch_Invoke( dispatch, dispid, &IID_NULL, english, + DISPATCH_METHOD|DISPATCH_PROPERTYGET, + ¶ms, &res, NULL, NULL ); + ok( hr == S_OK, "got %x\n", hr ); + ok( params.rgvarg == NULL, "got %p\n", params.rgvarg ); + ok( params.rgdispidNamedArgs == NULL, "got %p\n", params.rgdispidNamedArgs ); + ok( !params.cArgs, "got %u\n", params.cArgs ); + ok( !params.cNamedArgs, "got %u\n", params.cNamedArgs ); + ok( V_VT( &res ) == VT_BSTR, "got %u\n", V_VT( &res ) ); + ok( V_BSTR( &res ) != (BSTR)0xdeadbeef, "got %u\n", V_VT( &res ) ); + VariantClear( &res ); + VariantClear( &var ); + + fetched = 0xdeadbeef; + hr = IEnumVARIANT_Next( enumvar, 1, &var, &fetched ); + ok( hr == S_FALSE, "got %x\n", hr ); + ok( !fetched, "got %u\n", fetched ); + + IEnumVARIANT_Release( enumvar ); + } + IUnknown_Release( obj ); + } + ISWbemObjectSet_Release( objectset ); + } + IUnknown_Release( services ); + } + IMoniker_Release( moniker ); + } + + IBindCtx_Release( ctx ); + IParseDisplayName_Release( displayname ); +} + +START_TEST(wbemdisp) +{ + CoInitialize( NULL ); + test_ParseDisplayName(); + CoUninitialize(); +} Propchange: trunk/rostests/winetests/wbemdisp/wbemdisp.c ------------------------------------------------------------------------------ svn:eol-style = native
9 years, 7 months
1
0
0
0
← Newer
1
...
44
45
46
47
48
49
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200