[ros-diffs] [tkreuzer] 44431: Merge from amd64 branch: - 34939 fix several ULONG / ULONG_PTR / SIZE_T issues (Timo Kreuzer) - 40088 implement __mulh and __umulh (Timo Kreuzer)

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sun Dec 6 04:24:18 CET 2009


Author: tkreuzer
Date: Sun Dec  6 04:24:18 2009
New Revision: 44431

URL: http://svn.reactos.org/svn/reactos?rev=44431&view=rev
Log:
Merge from amd64 branch:
- 34939 fix several ULONG / ULONG_PTR / SIZE_T issues (Timo Kreuzer)
- 40088 implement __mulh and __umulh (Timo Kreuzer)

Modified:
    trunk/reactos/include/crt/mingw32/intrin_x86.h
    trunk/reactos/include/ndk/amd64/   (props changed)
    trunk/reactos/include/ndk/amd64/asmmacro.S   (props changed)
    trunk/reactos/ntoskrnl/mm/pool.c
    trunk/reactos/ntoskrnl/mm/region.c
    trunk/reactos/ntoskrnl/mm/rpoolmgr.h
    trunk/reactos/ntoskrnl/mm/section.c
    trunk/reactos/ntoskrnl/mm/sysldr.c

Modified: trunk/reactos/include/crt/mingw32/intrin_x86.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/include/crt/mingw32/intrin_x86.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/mingw32/intrin_x86.h [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -968,6 +968,23 @@
 	return retval;
 }
 
+#ifdef _M_AMD64
+
+__INTRIN_INLINE __int64 __mulh(__int64 a, __int64 b)
+{
+	__int64 retval;
+	__asm__("imulq %[b]" : "=d" (retval) : [a] "a" (a), [b] "rm" (b));
+	return retval;
+}
+
+__INTRIN_INLINE unsigned __int64 __umulh(unsigned __int64 a, unsigned __int64 b)
+{
+	unsigned __int64 retval;
+	__asm__("mulq %[b]" : "=d" (retval) : [a] "a" (a), [b] "rm" (b));
+	return retval;
+}
+
+#endif
 
 /*** Port I/O ***/
 __INTRIN_INLINE unsigned char __inbyte(const unsigned short Port)

Propchange: trunk/reactos/include/ndk/amd64/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Dec  6 04:24:18 2009
@@ -1,1 +1,1 @@
-/branches/ros-amd64-bringup/reactos/include/ndk/amd64:34925,34967,34970,35323-35324,35347-35348,35361,35436,35509,35588,35739,35823,35952,35966,36360,37323,37434,37472,37475,37536,37820-37821,37869,37990,38013-38014,43426,43454
+/branches/ros-amd64-bringup/reactos/include/ndk/amd64:34925,34967,34970,35323-35324,35347-35348,35361,35436,35509,35588,35739,35823,35952,35966,36360,37323,37434,37472,37475,37536,37820-37821,37869,37990,38013-38014,39338,40088,43426,43454

Propchange: trunk/reactos/include/ndk/amd64/asmmacro.S
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Dec  6 04:24:18 2009
@@ -1,1 +1,1 @@
-/branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S:37475,37536,37820-37821,37869,37990,38013-38014,43426,43454
+/branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S:37475,37536,37820-37821,37869,37990,38013-38014,39338,40088,43426,43454

Modified: trunk/reactos/ntoskrnl/mm/pool.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pool.c?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -92,7 +92,7 @@
  * @implemented
  */
 PVOID NTAPI
-ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
+ExAllocatePool (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
 /*
  * FUNCTION: Allocates pool memory of a specified type and returns a pointer
  * to the allocated block. This routine is used for general purpose allocation
@@ -141,7 +141,7 @@
  * @implemented
  */
 PVOID NTAPI
-ExAllocatePoolWithTag (POOL_TYPE PoolType, ULONG NumberOfBytes, ULONG Tag)
+ExAllocatePoolWithTag (POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag)
 {
    PVOID Block;
 

Modified: trunk/reactos/ntoskrnl/mm/region.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/region.c?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/region.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/region.c [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -238,7 +238,7 @@
 
 VOID
 NTAPI
-MmInitializeRegion(PLIST_ENTRY RegionListHead, ULONG Length, ULONG Type,
+MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type,
                    ULONG Protect)
 {
    PMM_REGION Region;

Modified: trunk/reactos/ntoskrnl/mm/rpoolmgr.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rpoolmgr.h?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/rpoolmgr.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/rpoolmgr.h [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -12,7 +12,7 @@
 
 typedef unsigned long rulong;
 
-#define R_IS_POOL_PTR(pool,ptr) (void*)(ptr) >= pool->UserBase && (ULONG_PTR)(ptr) < ((ULONG_PTR)pool->UserBase + pool->UserSize)
+#define R_IS_POOL_PTR(pool,ptr) (((void*)(ULONG_PTR)(ptr) >= pool->UserBase) && ((ULONG_PTR)(ptr) < ((ULONG_PTR)pool->UserBase + pool->UserSize)))
 #define R_ASSERT_PTR(pool,ptr) ASSERT( R_IS_POOL_PTR(pool,ptr) )
 #define R_ASSERT_SIZE(pool,sz) ASSERT( sz > (sizeof(R_USED)+2*R_RZ) && sz >= sizeof(R_FREE) && sz < pool->UserSize )
 
@@ -712,7 +712,7 @@
 		if ( R_IS_POOL_PTR(pool,NumberOfBytes) )
 		{
 			R_DEBUG("red zone verification requested for block 0x%X\n", NumberOfBytes );
-			RUsedRedZoneCheck(pool,RBodyToHdr((void*)NumberOfBytes), (char*)NumberOfBytes, __FILE__, __LINE__ );
+			RUsedRedZoneCheck(pool,RBodyToHdr((void*)(ULONG_PTR)NumberOfBytes), (char*)(ULONG_PTR)NumberOfBytes, __FILE__, __LINE__ );
 			R_RELEASE_MUTEX(pool);
 			return NULL;
 		}

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -2472,6 +2472,7 @@
    LARGE_INTEGER Offset;
    CHAR Buffer;
    FILE_STANDARD_INFORMATION FileInfo;
+   ULONG Length;
 
    /*
     * Create the section
@@ -2534,7 +2535,8 @@
                                    FileStandardInformation,
                                    sizeof(FILE_STANDARD_INFORMATION),
                                    &FileInfo,
-                                   &Iosb.Information);
+                                   &Length);
+   Iosb.Information = Length;
    if (!NT_SUCCESS(Status))
    {
       ObDereferenceObject(Section);
@@ -4294,8 +4296,8 @@
 NtQuerySection(IN HANDLE SectionHandle,
                IN SECTION_INFORMATION_CLASS SectionInformationClass,
                OUT PVOID SectionInformation,
-               IN ULONG SectionInformationLength,
-               OUT PULONG ResultLength  OPTIONAL)
+               IN SIZE_T SectionInformationLength,
+               OUT PSIZE_T ResultLength  OPTIONAL)
 {
    PROS_SECTION_OBJECT Section;
    KPROCESSOR_MODE PreviousMode;
@@ -4874,7 +4876,7 @@
 NTSTATUS NTAPI
 MmMapViewInSystemSpace (IN PVOID SectionObject,
                         OUT PVOID * MappedBase,
-                        IN OUT PULONG ViewSize)
+                        IN OUT PSIZE_T ViewSize)
 {
    PROS_SECTION_OBJECT Section;
    PMMSUPPORT AddressSpace;

Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=44431&r1=44430&r2=44431&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] Sun Dec  6 04:24:18 2009
@@ -704,7 +704,7 @@
                     ForwardName->Hint = 0;
 
                     /* Set the new address */
-                    *(PULONG)&ForwardThunk.u1.AddressOfData = (ULONG)ForwardName;
+                    ForwardThunk.u1.AddressOfData = (ULONG_PTR)ForwardName;
 
                     /* Snap the forwarder */
                     Status = MiSnapThunk(LdrEntry->DllBase,




More information about the Ros-diffs mailing list