Merge from amd64 branch:

- 34939 fix several ULONG / ULONG_PTR / SIZE_T issues (Timo Kreuzer)
- 40088 implement __mulh and __umulh (Timo Kreuzer)

svn path=/trunk/; revision=44431
This commit is contained in:
Timo Kreuzer 2009-12-06 03:24:18 +00:00
parent 3ab9af72ac
commit 79690d04fa
6 changed files with 29 additions and 10 deletions

View file

@ -968,6 +968,23 @@ __INTRIN_INLINE unsigned long long __emulu(const unsigned int a, const unsigned
return retval; 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 ***/ /*** Port I/O ***/
__INTRIN_INLINE unsigned char __inbyte(const unsigned short Port) __INTRIN_INLINE unsigned char __inbyte(const unsigned short Port)

View file

@ -92,7 +92,7 @@ EiAllocatePool(POOL_TYPE PoolType,
* @implemented * @implemented
*/ */
PVOID NTAPI 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 * FUNCTION: Allocates pool memory of a specified type and returns a pointer
* to the allocated block. This routine is used for general purpose allocation * to the allocated block. This routine is used for general purpose allocation
@ -141,7 +141,7 @@ ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
* @implemented * @implemented
*/ */
PVOID NTAPI PVOID NTAPI
ExAllocatePoolWithTag (POOL_TYPE PoolType, ULONG NumberOfBytes, ULONG Tag) ExAllocatePoolWithTag (POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag)
{ {
PVOID Block; PVOID Block;

View file

@ -238,7 +238,7 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress,
VOID VOID
NTAPI NTAPI
MmInitializeRegion(PLIST_ENTRY RegionListHead, ULONG Length, ULONG Type, MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type,
ULONG Protect) ULONG Protect)
{ {
PMM_REGION Region; PMM_REGION Region;

View file

@ -12,7 +12,7 @@
typedef unsigned long rulong; 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_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 ) #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 @@ RPoolAlloc ( PR_POOL pool, rulong NumberOfBytes, rulong Tag, rulong align )
if ( R_IS_POOL_PTR(pool,NumberOfBytes) ) if ( R_IS_POOL_PTR(pool,NumberOfBytes) )
{ {
R_DEBUG("red zone verification requested for block 0x%X\n", 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); R_RELEASE_MUTEX(pool);
return NULL; return NULL;
} }

View file

@ -2472,6 +2472,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
LARGE_INTEGER Offset; LARGE_INTEGER Offset;
CHAR Buffer; CHAR Buffer;
FILE_STANDARD_INFORMATION FileInfo; FILE_STANDARD_INFORMATION FileInfo;
ULONG Length;
/* /*
* Create the section * Create the section
@ -2534,7 +2535,8 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
FileStandardInformation, FileStandardInformation,
sizeof(FILE_STANDARD_INFORMATION), sizeof(FILE_STANDARD_INFORMATION),
&FileInfo, &FileInfo,
&Iosb.Information); &Length);
Iosb.Information = Length;
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ObDereferenceObject(Section); ObDereferenceObject(Section);
@ -4294,8 +4296,8 @@ NTSTATUS NTAPI
NtQuerySection(IN HANDLE SectionHandle, NtQuerySection(IN HANDLE SectionHandle,
IN SECTION_INFORMATION_CLASS SectionInformationClass, IN SECTION_INFORMATION_CLASS SectionInformationClass,
OUT PVOID SectionInformation, OUT PVOID SectionInformation,
IN ULONG SectionInformationLength, IN SIZE_T SectionInformationLength,
OUT PULONG ResultLength OPTIONAL) OUT PSIZE_T ResultLength OPTIONAL)
{ {
PROS_SECTION_OBJECT Section; PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode; KPROCESSOR_MODE PreviousMode;
@ -4874,7 +4876,7 @@ MmForceSectionClosed (
NTSTATUS NTAPI NTSTATUS NTAPI
MmMapViewInSystemSpace (IN PVOID SectionObject, MmMapViewInSystemSpace (IN PVOID SectionObject,
OUT PVOID * MappedBase, OUT PVOID * MappedBase,
IN OUT PULONG ViewSize) IN OUT PSIZE_T ViewSize)
{ {
PROS_SECTION_OBJECT Section; PROS_SECTION_OBJECT Section;
PMMSUPPORT AddressSpace; PMMSUPPORT AddressSpace;

View file

@ -704,7 +704,7 @@ MiSnapThunk(IN PVOID DllBase,
ForwardName->Hint = 0; ForwardName->Hint = 0;
/* Set the new address */ /* Set the new address */
*(PULONG)&ForwardThunk.u1.AddressOfData = (ULONG)ForwardName; ForwardThunk.u1.AddressOfData = (ULONG_PTR)ForwardName;
/* Snap the forwarder */ /* Snap the forwarder */
Status = MiSnapThunk(LdrEntry->DllBase, Status = MiSnapThunk(LdrEntry->DllBase,