mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 10:12:00 +00:00
Continue of MSVC-compiling changes....
I double checked, but in case someone's recent commit is somehow overwritten -- please, don't be very frustrated :) -- I will fix it, just drop me a note. svn path=/trunk/; revision=7338
This commit is contained in:
parent
4150f6827f
commit
49f967d0ed
101 changed files with 2287 additions and 957 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: copy.c,v 1.19 2003/07/21 21:53:51 royce Exp $
|
||||
/* $Id: copy.c,v 1.20 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -26,7 +26,11 @@
|
|||
|
||||
#define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
static PHYSICAL_ADDRESS CcZeroPage = (PHYSICAL_ADDRESS)0LL;
|
||||
#else
|
||||
static PHYSICAL_ADDRESS CcZeroPage = { 0 };
|
||||
#endif
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -78,7 +82,15 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
|
|||
{
|
||||
TempLength = min(Bcb->CacheSegmentSize, Length);
|
||||
memcpy(Buffer, current->BaseAddress, TempLength);
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
Length = Length - TempLength;
|
||||
previous = current;
|
||||
current = current->NextInChain;
|
||||
|
@ -120,7 +132,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
|
|||
{
|
||||
PVOID address;
|
||||
PHYSICAL_ADDRESS page;
|
||||
address = current2->BaseAddress + (i * PAGE_SIZE);
|
||||
address = (char*)current2->BaseAddress + (i * PAGE_SIZE);
|
||||
page = MmGetPhysicalAddressForProcess(NULL, address);
|
||||
((PULONG)(Mdl + 1))[offset] = page.u.LowPart;
|
||||
offset++;
|
||||
|
@ -159,7 +171,15 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
|
|||
current = current->NextInChain;
|
||||
TempLength = min(Bcb->CacheSegmentSize, Length);
|
||||
memcpy(Buffer, previous->BaseAddress, TempLength);
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
Length = Length - TempLength;
|
||||
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
|
||||
}
|
||||
|
@ -179,7 +199,7 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
|
|||
KEVENT Event;
|
||||
|
||||
SegOffset.QuadPart = CacheSeg->FileOffset;
|
||||
Size = CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset;
|
||||
Size = (ULONG)(CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset);
|
||||
if (Size > CacheSeg->Bcb->CacheSegmentSize)
|
||||
{
|
||||
Size = CacheSeg->Bcb->CacheSegmentSize;
|
||||
|
@ -201,7 +221,7 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
|
|||
}
|
||||
if (CacheSeg->Bcb->CacheSegmentSize > Size)
|
||||
{
|
||||
memset (CacheSeg->BaseAddress + Size, 0,
|
||||
memset ((char*)CacheSeg->BaseAddress + Size, 0,
|
||||
CacheSeg->Bcb->CacheSegmentSize - Size);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -219,7 +239,7 @@ WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
|
|||
|
||||
CacheSeg->Dirty = FALSE;
|
||||
SegOffset.QuadPart = CacheSeg->FileOffset;
|
||||
Size = CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset;
|
||||
Size = (ULONG)(CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset);
|
||||
if (Size > CacheSeg->Bcb->CacheSegmentSize)
|
||||
{
|
||||
Size = CacheSeg->Bcb->CacheSegmentSize;
|
||||
|
@ -271,7 +291,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
|
|||
Buffer, IoStatus);
|
||||
|
||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||
ReadOffset = FileOffset->QuadPart;
|
||||
ReadOffset = (ULONG)FileOffset->QuadPart;
|
||||
|
||||
DPRINT("AllocationSize %d, FileSize %d\n",
|
||||
(ULONG)Bcb->AllocationSize.QuadPart,
|
||||
|
@ -328,13 +348,21 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
memcpy (Buffer, BaseAddress + ReadOffset % Bcb->CacheSegmentSize,
|
||||
memcpy (Buffer, (char*)BaseAddress + ReadOffset % Bcb->CacheSegmentSize,
|
||||
TempLength);
|
||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
|
||||
ReadLength += TempLength;
|
||||
Length -= TempLength;
|
||||
ReadOffset += TempLength;
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while (Length > 0)
|
||||
{
|
||||
|
@ -343,7 +371,15 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
|
|||
ReadLength += TempLength;
|
||||
Length -= TempLength;
|
||||
ReadOffset += TempLength;
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
IoStatus->Status = STATUS_SUCCESS;
|
||||
IoStatus->Information = ReadLength;
|
||||
|
@ -424,13 +460,21 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
|
|||
return(FALSE);
|
||||
}
|
||||
}
|
||||
memcpy (BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
|
||||
memcpy ((char*)BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
|
||||
Buffer, TempLength);
|
||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
|
||||
|
||||
Length -= TempLength;
|
||||
WriteOffset += TempLength;
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
while (Length > 0)
|
||||
|
@ -454,7 +498,15 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
|
|||
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
|
||||
Length -= TempLength;
|
||||
WriteOffset += TempLength;
|
||||
#if defined(__GNUC__)
|
||||
Buffer += TempLength;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Buffer;
|
||||
pTemp += TempLength;
|
||||
Buffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -628,7 +680,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
|
|||
}
|
||||
TempLength = min (Length, Bcb->CacheSegmentSize -
|
||||
Start % Bcb->CacheSegmentSize);
|
||||
memset (current->BaseAddress + Start % Bcb->CacheSegmentSize,
|
||||
memset ((char*)current->BaseAddress + Start % Bcb->CacheSegmentSize,
|
||||
0, TempLength);
|
||||
}
|
||||
else
|
||||
|
@ -644,7 +696,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
|
|||
count < size; i++)
|
||||
{
|
||||
PVOID Address;
|
||||
Address = current->BaseAddress + (i * PAGE_SIZE);
|
||||
Address = (char*)current->BaseAddress + (i * PAGE_SIZE);
|
||||
page =
|
||||
MmGetPhysicalAddressForProcess(NULL, Address);
|
||||
((PULONG)(Mdl + 1))[count++] = page.u.LowPart;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pin.c,v 1.13 2003/07/10 06:27:13 royce Exp $
|
||||
/* $Id: pin.c,v 1.14 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -53,7 +53,7 @@ CcMapData (IN PFILE_OBJECT FileObject,
|
|||
" pBcb %x, pBuffer %x)\n", FileObject, (ULONG)FileOffset->QuadPart,
|
||||
Length, Wait, pBcb, pBuffer);
|
||||
|
||||
ReadOffset = FileOffset->QuadPart;
|
||||
ReadOffset = (ULONG)FileOffset->QuadPart;
|
||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||
assert(Bcb);
|
||||
|
||||
|
@ -88,7 +88,15 @@ CcMapData (IN PFILE_OBJECT FileObject,
|
|||
return(FALSE);
|
||||
}
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
*pBuffer += ReadOffset % Bcb->CacheSegmentSize;
|
||||
#else
|
||||
{
|
||||
char* pTemp = *pBuffer;
|
||||
pTemp += ReadOffset % Bcb->CacheSegmentSize;
|
||||
*pBuffer = pTemp;
|
||||
}
|
||||
#endif
|
||||
iBcb = ExAllocateFromNPagedLookasideList(&iBcbLookasideList);
|
||||
if (iBcb == NULL)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: view.c,v 1.69 2003/10/12 17:05:44 hbirr Exp $
|
||||
/* $Id: view.c,v 1.70 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/cc/view.c
|
||||
|
@ -105,7 +105,14 @@ static HANDLE LazyCloseThreadHandle;
|
|||
static CLIENT_ID LazyCloseThreadId;
|
||||
static volatile BOOLEAN LazyCloseThreadShouldTerminate;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
void * alloca(size_t size);
|
||||
#elif defined(_MSC_VER)
|
||||
void* _alloca(size_t size);
|
||||
#else
|
||||
#error Unknown compiler for alloca intrinsic stack allocation "function"
|
||||
#endif
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg);
|
||||
|
@ -275,7 +282,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
|
|||
for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++)
|
||||
{
|
||||
PHYSICAL_ADDRESS Page;
|
||||
Page = MmGetPhysicalAddress(current->BaseAddress + i * PAGE_SIZE);
|
||||
Page = MmGetPhysicalAddress((char*)current->BaseAddress + i * PAGE_SIZE);
|
||||
Status = MmPageOutPhysicalAddress(Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -609,7 +616,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
}
|
||||
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
current->BaseAddress + (i * PAGE_SIZE),
|
||||
(char*)current->BaseAddress + (i * PAGE_SIZE),
|
||||
PAGE_READWRITE,
|
||||
Page,
|
||||
TRUE);
|
||||
|
@ -638,8 +645,15 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
|
|||
|
||||
Length = ROUND_UP(Length, Bcb->CacheSegmentSize);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
CacheSegList = alloca(sizeof(PCACHE_SEGMENT) *
|
||||
(Length / Bcb->CacheSegmentSize));
|
||||
#elif defined(_MSC_VER)
|
||||
CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) *
|
||||
(Length / Bcb->CacheSegmentSize));
|
||||
#else
|
||||
#error Unknown compiler for alloca intrinsic stack allocation "function"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Look for a cache segment already mapping the same data.
|
||||
|
@ -866,7 +880,11 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
Offset.QuadPart = 0LL;
|
||||
#else
|
||||
Offset.QuadPart = 0;
|
||||
#endif
|
||||
Length = Bcb->FileSize.u.LowPart;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1222,11 @@ CmLazyCloseThreadMain(PVOID Ignored)
|
|||
|
||||
while (1)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
Timeout.QuadPart += 100000000LL; // 10sec
|
||||
#else
|
||||
Timeout.QuadPart += 100000000; // 10sec
|
||||
#endif
|
||||
Status = KeWaitForSingleObject(&LazyCloseThreadEvent,
|
||||
0,
|
||||
KernelMode,
|
||||
|
|
|
@ -1446,7 +1446,11 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
BitmapSize);
|
||||
|
||||
/* Write hive block and block bitmap */
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = 0ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = NtWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1505,7 +1509,11 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
}
|
||||
|
||||
BlockIndex++;
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart += 4096ULL;
|
||||
#else
|
||||
FileOffset.QuadPart += 4096;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Truncate log file */
|
||||
|
@ -1624,7 +1632,11 @@ CmiFinishLogUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
BitmapSize);
|
||||
|
||||
/* Write hive block and block bitmap */
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = 0ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = NtWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1787,7 +1799,11 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
RegistryHive->HiveHeader->Checksum = CmiCalcChecksum((PULONG)RegistryHive->HiveHeader);
|
||||
|
||||
/* Write hive block */
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = 0ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = NtWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1823,7 +1839,11 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
BlockPtr = RegistryHive->BlockList[BlockIndex];
|
||||
DPRINT("BlockPtr %p\n", BlockPtr);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = (ULONGLONG)(BlockIndex + 1) * 4096ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = (ULONGLONG)(BlockIndex + 1) * 4096;
|
||||
#endif
|
||||
DPRINT("File offset %I64x\n", FileOffset.QuadPart);
|
||||
|
||||
/* Write hive block */
|
||||
|
@ -1899,7 +1919,11 @@ CmiFinishHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
|||
RegistryHive->HiveHeader->Checksum = CmiCalcChecksum((PULONG)RegistryHive->HiveHeader);
|
||||
|
||||
/* Write hive block */
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = 0ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = NtWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -2599,7 +2623,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
/* Remove the key from the parent key's hash block */
|
||||
if (ParentKey->KeyCell->HashTableOffset != (BLOCK_OFFSET) -1)
|
||||
{
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset)
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset);
|
||||
HashBlock = CmiGetCell (ParentKey->RegistryHive,
|
||||
ParentKey->KeyCell->HashTableOffset,
|
||||
NULL);
|
||||
|
@ -2608,7 +2632,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
DPRINT("CmiGetCell() failed\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
DPRINT("ParentKey HashBlock %p\n", HashBlock)
|
||||
DPRINT("ParentKey HashBlock %p\n", HashBlock);
|
||||
if (HashBlock != NULL)
|
||||
{
|
||||
CmiRemoveKeyFromHashTable(ParentKey->RegistryHive,
|
||||
|
@ -2622,7 +2646,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
/* Remove the key's hash block */
|
||||
if (SubKey->KeyCell->HashTableOffset != (BLOCK_OFFSET) -1)
|
||||
{
|
||||
DPRINT("SubKey HashTableOffset %lx\n", SubKey->KeyCell->HashTableOffset)
|
||||
DPRINT("SubKey HashTableOffset %lx\n", SubKey->KeyCell->HashTableOffset);
|
||||
HashBlock = CmiGetCell (RegistryHive,
|
||||
SubKey->KeyCell->HashTableOffset,
|
||||
NULL);
|
||||
|
@ -2631,7 +2655,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
DPRINT("CmiGetCell() failed\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
DPRINT("SubKey HashBlock %p\n", HashBlock)
|
||||
DPRINT("SubKey HashBlock %p\n", HashBlock);
|
||||
if (HashBlock != NULL)
|
||||
{
|
||||
CmiDestroyCell (RegistryHive,
|
||||
|
@ -2644,13 +2668,13 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
/* Decrement the number of the parent key's sub keys */
|
||||
if (ParentKey != NULL)
|
||||
{
|
||||
DPRINT("ParentKey %p\n", ParentKey)
|
||||
DPRINT("ParentKey %p\n", ParentKey);
|
||||
ParentKey->KeyCell->NumberOfSubKeys--;
|
||||
|
||||
/* Remove the parent key's hash table */
|
||||
if (ParentKey->KeyCell->NumberOfSubKeys == 0)
|
||||
{
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset)
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset);
|
||||
HashBlock = CmiGetCell (ParentKey->RegistryHive,
|
||||
ParentKey->KeyCell->HashTableOffset,
|
||||
NULL);
|
||||
|
@ -2659,7 +2683,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
|||
DPRINT("CmiGetCell() failed\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
DPRINT("ParentKey HashBlock %p\n", HashBlock)
|
||||
DPRINT("ParentKey HashBlock %p\n", HashBlock);
|
||||
if (HashBlock != NULL)
|
||||
{
|
||||
CmiDestroyCell (ParentKey->RegistryHive,
|
||||
|
@ -3381,7 +3405,7 @@ CmiDestroyCell (PREGISTRY_HIVE RegistryHive,
|
|||
pFree->CellSize = -pFree->CellSize;
|
||||
|
||||
/* Clear block (except the block size) */
|
||||
RtlZeroMemory(((PVOID)pFree) + sizeof(ULONG),
|
||||
RtlZeroMemory(((char*)pFree) + sizeof(ULONG),
|
||||
pFree->CellSize - sizeof(ULONG));
|
||||
|
||||
/* Add block to the list of free blocks */
|
||||
|
@ -4163,7 +4187,11 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
|||
Hive->HiveHeader->Checksum = CmiCalcChecksum ((PULONG)Hive->HiveHeader);
|
||||
|
||||
/* Write hive block */
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = 0ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = NtWriteFile (FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -4185,7 +4213,11 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
|||
BlockPtr = Hive->BlockList[BlockIndex];
|
||||
DPRINT ("BlockPtr %p\n", BlockPtr);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
FileOffset.QuadPart = (ULONGLONG)(BlockIndex + 1) * 4096ULL;
|
||||
#else
|
||||
FileOffset.QuadPart = (ULONGLONG)(BlockIndex + 1) * 4096;
|
||||
#endif
|
||||
DPRINT ("File offset %I64x\n", FileOffset.QuadPart);
|
||||
|
||||
/* Write hive block */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.115 2003/11/27 00:48:11 gdalsnes Exp $
|
||||
/* $Id: registry.c,v 1.116 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1106,7 +1106,11 @@ CmiSyncHives(VOID)
|
|||
CmiHiveSyncPending = TRUE;
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
Timeout.QuadPart = -50000000LL;
|
||||
#else
|
||||
Timeout.QuadPart = -50000000;
|
||||
#endif
|
||||
KeSetTimer(&CmiHiveSyncTimer,
|
||||
Timeout,
|
||||
&CmiHiveSyncDpc);
|
||||
|
|
|
@ -590,7 +590,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
|
|||
{
|
||||
DPRINT("Expand REG_MULTI_SZ type\n");
|
||||
|
||||
StringPtr = (PWSTR)((PVOID)FullValueInfo + FullValueInfo->DataOffset);
|
||||
StringPtr = (PWSTR)((char*)FullValueInfo + FullValueInfo->DataOffset);
|
||||
while (*StringPtr != 0)
|
||||
{
|
||||
StringLen = (wcslen(StringPtr) + 1) * sizeof(WCHAR);
|
||||
|
@ -609,7 +609,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
|
|||
{
|
||||
Status = QueryEntry->QueryRoutine(ValueName,
|
||||
FullValueInfo->Type,
|
||||
(PVOID)FullValueInfo + FullValueInfo->DataOffset,
|
||||
(char*)FullValueInfo + FullValueInfo->DataOffset,
|
||||
FullValueInfo->DataLength,
|
||||
Context,
|
||||
QueryEntry->EntryContext);
|
||||
|
|
|
@ -140,7 +140,7 @@ KdbPrintUserAddress(PVOID address)
|
|||
CONTAINING_RECORD(current_entry, LDR_MODULE, InLoadOrderModuleList);
|
||||
|
||||
if (address >= (PVOID)current->BaseAddress &&
|
||||
address < (PVOID)(current->BaseAddress + current->SizeOfImage))
|
||||
address < (PVOID)((char*)current->BaseAddress + current->SizeOfImage))
|
||||
{
|
||||
RelativeAddress = (ULONG_PTR) address - (ULONG_PTR)current->BaseAddress;
|
||||
Status = LdrGetAddressInformation(¤t->SymbolInfo,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: interlck.c,v 1.5 2002/12/16 22:56:30 hbirr Exp $
|
||||
/* $Id: interlck.c,v 1.6 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* reactos/ntoskrnl/ex/i386/interlck.c
|
||||
*
|
||||
|
@ -6,6 +6,8 @@
|
|||
#include <ddk/ntddk.h>
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
INTERLOCKED_RESULT FASTCALL
|
||||
Exfi386InterlockedIncrementLong(IN PLONG Addend);
|
||||
|
||||
|
@ -16,6 +18,24 @@ __asm__("\n\t.global @Exfi386InterlockedIncrementLong@4\n\t"
|
|||
"andl $0xC000, %eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
INTERLOCKED_RESULT FASTCALL
|
||||
Exfi386InterlockedIncrementLong(IN PLONG Addend)
|
||||
{
|
||||
__asm add ecx, 1
|
||||
__asm lahf
|
||||
__asm and eax, 0xC000
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
INTERLOCKED_RESULT FASTCALL
|
||||
Exfi386InterlockedDecrementLong(IN PLONG Addend);
|
||||
|
@ -27,6 +47,24 @@ __asm__("\n\t.global @Exfi386InterlockedDecrementLong@4\n\t"
|
|||
"andl $0xC000, %eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
INTERLOCKED_RESULT FASTCALL
|
||||
Exfi386InterlockedDecrementLong(IN PLONG Addend)
|
||||
{
|
||||
__asm sub ecx, 1
|
||||
__asm lahf
|
||||
__asm and eax, 0xC000
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
ULONG FASTCALL
|
||||
Exfi386InterlockedExchangeUlong(IN PULONG Target,
|
||||
|
@ -38,7 +76,24 @@ __asm__("\n\t.global @Exfi386InterlockedExchangeUlong@8\n\t"
|
|||
"movl %edx,%eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
ULONG FASTCALL
|
||||
Exfi386InterlockedExchangeUlong(IN PULONG Target,
|
||||
IN ULONG Value)
|
||||
{
|
||||
__asm xchg [ecx], edx
|
||||
__asm mov eax, edx
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
INTERLOCKED_RESULT STDCALL
|
||||
Exi386InterlockedIncrementLong(IN PLONG Addend);
|
||||
|
@ -51,6 +106,25 @@ __asm__("\n\t.global _Exi386InterlockedIncrementLong@4\n\t"
|
|||
"andl $0xC000, %eax\n\t"
|
||||
"ret $4\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
INTERLOCKED_RESULT STDCALL
|
||||
Exi386InterlockedIncrementLong(IN PLONG Addend)
|
||||
{
|
||||
__asm mov eax, Addend
|
||||
__asm add [eax], 1
|
||||
__asm lahf
|
||||
__asm and eax, 0xC000
|
||||
__asm ret 4
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
INTERLOCKED_RESULT STDCALL
|
||||
Exi386InterlockedDecrementLong(IN PLONG Addend);
|
||||
|
@ -63,6 +137,25 @@ __asm__("\n\t.global _Exi386InterlockedDecrementLong@4\n\t"
|
|||
"andl $0xC000, %eax\n\t"
|
||||
"ret $4\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
INTERLOCKED_RESULT STDCALL
|
||||
Exi386InterlockedDecrementLong(IN PLONG Addend)
|
||||
{
|
||||
__asm mov eax, Addend
|
||||
__asm sub [eax], 1
|
||||
__asm lahf
|
||||
__asm and eax, 0xC000
|
||||
__asm ret 4
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
ULONG STDCALL
|
||||
Exi386InterlockedExchangeUlong(IN PULONG Target,
|
||||
|
@ -75,11 +168,30 @@ __asm__("\n\t.global _Exi386InterlockedExchangeUlong@8\n\t"
|
|||
"xchgl %eax,(%edx)\n\t"
|
||||
"ret $8\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
ULONG STDCALL
|
||||
Exi386InterlockedExchangeUlong(IN PULONG Target,
|
||||
IN ULONG Value)
|
||||
{
|
||||
__asm mov edx, Value
|
||||
__asm mov eax, Target
|
||||
__asm xchg [edx], eax
|
||||
__asm ret 8
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedIncrement@4
|
||||
* STDCALL : _InterlockedIncrement@4
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
LONG FASTCALL
|
||||
InterlockedIncrement(PLONG Addend);
|
||||
/*
|
||||
|
@ -97,11 +209,28 @@ __asm__("\n\t.global @InterlockedIncrement@4\n\t"
|
|||
"incl %eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
LONG FASTCALL
|
||||
InterlockedIncrement(PLONG Addend)
|
||||
{
|
||||
__asm mov eax, 1
|
||||
__asm xadd [ecx], eax
|
||||
__asm inc eax
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedDecrement@4
|
||||
* STDCALL : _InterlockedDecrement@4
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
LONG FASTCALL
|
||||
InterlockedDecrement(PLONG Addend);
|
||||
|
||||
|
@ -112,12 +241,29 @@ __asm__("\n\t.global @InterlockedDecrement@4\n\t"
|
|||
"decl %eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
LONG FASTCALL
|
||||
InterlockedDecrement(PLONG Addend)
|
||||
{
|
||||
__asm mov eax, -1
|
||||
__asm xadd [ecx], eax
|
||||
__asm dec eax
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedExchange@8
|
||||
* STDCALL : _InterlockedExchange@8
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
LONG FASTCALL
|
||||
InterlockedExchange(PLONG Target,
|
||||
LONG Value);
|
||||
|
@ -128,11 +274,28 @@ __asm__("\n\t.global @InterlockedExchange@8\n\t"
|
|||
"movl %edx,%eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
LONG FASTCALL
|
||||
InterlockedExchange(PLONG Target,
|
||||
LONG Value)
|
||||
{
|
||||
__asm xchg [ecx], edx
|
||||
__asm mov eax, edx
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedExchangeAdd@8
|
||||
* STDCALL: _InterlockedExchangeAdd@8
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
|
||||
LONG FASTCALL
|
||||
InterlockedExchangeAdd(PLONG Addend,
|
||||
LONG Value);
|
||||
|
@ -143,11 +306,29 @@ __asm__("\n\t.global @InterlockedExchangeAdd@8\n\t"
|
|||
"movl %edx,%eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
LONG FASTCALL
|
||||
InterlockedExchangeAdd(PLONG Addend,
|
||||
LONG Value)
|
||||
{
|
||||
__asm xadd [ecx], edx
|
||||
__asm mov eax, edx
|
||||
__asm ret
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedCompareExchange@12
|
||||
* STDCALL: _InterlockedCompareExchange@12
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
|
||||
LONG FASTCALL
|
||||
InterlockedCompareExchange(PLONG Destination,
|
||||
LONG Exchange,
|
||||
|
@ -159,4 +340,21 @@ __asm__("\n\t.global @InterlockedCompareExchange@12\n\t"
|
|||
"cmpxchg %edx,(%ecx)\n\t"
|
||||
"ret $4\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
LONG FASTCALL
|
||||
InterlockedCompareExchange(PLONG Destination,
|
||||
LONG Exchange,
|
||||
LONG Comperand)
|
||||
{
|
||||
__asm mov eax, Comperand
|
||||
__asm cmpxchg [ecx], edx
|
||||
__asm ret 4
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: lookas.c,v 1.12 2003/10/12 17:05:44 hbirr Exp $
|
||||
/* $Id: lookas.c,v 1.13 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -126,7 +126,7 @@ ExpDefaultFree(PVOID Buffer)
|
|||
* Buffer = Pointer to memory to free
|
||||
*/
|
||||
{
|
||||
return ExFreePool(Buffer);
|
||||
ExFreePool(Buffer);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: resource.c,v 1.26 2003/08/14 18:30:28 silverblade Exp $
|
||||
/* $Id: resource.c,v 1.27 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -712,11 +712,11 @@ ExIsResourceAcquiredSharedLite(
|
|||
ULONG i;
|
||||
if (Resource->OwnerThreads[0].OwnerThread == ExGetCurrentResourceThread())
|
||||
{
|
||||
return(Resource->OwnerThreads[0].OwnerCount);
|
||||
return (USHORT)(Resource->OwnerThreads[0].OwnerCount);
|
||||
}
|
||||
if (Resource->OwnerThreads[1].OwnerThread == ExGetCurrentResourceThread())
|
||||
{
|
||||
return(Resource->OwnerThreads[1].OwnerCount);
|
||||
return (USHORT)(Resource->OwnerThreads[1].OwnerCount);
|
||||
}
|
||||
if (!Resource->OwnerThreads[1].TableSize)
|
||||
{
|
||||
|
@ -726,7 +726,7 @@ ExIsResourceAcquiredSharedLite(
|
|||
{
|
||||
if (Resource->OwnerTable[i].OwnerThread==ExGetCurrentResourceThread())
|
||||
{
|
||||
return Resource->OwnerTable[i].OwnerCount;
|
||||
return (USHORT)Resource->OwnerTable[i].OwnerCount;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
|
@ -768,8 +768,8 @@ ExReleaseResourceLite (
|
|||
PERESOURCE Resource
|
||||
)
|
||||
{
|
||||
return(ExReleaseResourceForThreadLite(Resource,
|
||||
ExGetCurrentResourceThread()));
|
||||
ExReleaseResourceForThreadLite(Resource,
|
||||
ExGetCurrentResourceThread());
|
||||
}
|
||||
|
||||
|
||||
|
@ -789,7 +789,7 @@ ExReleaseResourceForThread (
|
|||
ERESOURCE_THREAD ResourceThreadId
|
||||
)
|
||||
{
|
||||
return(ExReleaseResourceForThreadLite(Resource,ResourceThreadId));
|
||||
ExReleaseResourceForThreadLite(Resource,ResourceThreadId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: zone.c,v 1.6 2003/07/17 16:57:38 silverblade Exp $
|
||||
/* $Id: zone.c,v 1.7 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -42,12 +42,12 @@ ExExtendZone (
|
|||
|
||||
PushEntryList(&Zone->SegmentList,&seg->SegmentList);
|
||||
|
||||
entry = (PZONE_SEGMENT_HEADER)( ((PVOID)seg) + sizeof(ZONE_SEGMENT_HEADER) );
|
||||
entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) );
|
||||
|
||||
for (i=0;i<(SegmentSize / Zone->BlockSize);i++)
|
||||
{
|
||||
PushEntryList(&Zone->FreeList,&entry->SegmentList);
|
||||
entry = (PZONE_SEGMENT_HEADER)(((PVOID)entry) + sizeof(PZONE_SEGMENT_HEADER) +
|
||||
entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) +
|
||||
Zone->BlockSize);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -111,12 +111,12 @@ ExInitializeZone (
|
|||
|
||||
PushEntryList(&Zone->SegmentList,&seg->SegmentList);
|
||||
|
||||
entry = (PZONE_SEGMENT_HEADER)( ((PVOID)seg) + sizeof(ZONE_SEGMENT_HEADER) );
|
||||
entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) );
|
||||
|
||||
for (i=0;i<(InitialSegmentSize / BlockSize);i++)
|
||||
{
|
||||
PushEntryList(&Zone->FreeList,&entry->SegmentList);
|
||||
entry = (PZONE_SEGMENT_HEADER)(((PVOID)entry) + sizeof(PZONE_SEGMENT_HEADER) + BlockSize);
|
||||
entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) + BlockSize);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mcb.c,v 1.10 2003/07/10 06:27:13 royce Exp $
|
||||
/* $Id: mcb.c,v 1.11 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* reactos/ntoskrnl/fs/mcb.c
|
||||
*
|
||||
|
@ -27,7 +27,7 @@ FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb,
|
|||
IN LONGLONG Lbn,
|
||||
IN LONGLONG SectorCount)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb,
|
|||
OUT PLONGLONG Lbn,
|
||||
OUT PLONGLONG SectorCount)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ VOID STDCALL
|
|||
FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb,
|
||||
IN POOL_TYPE PoolType)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
Mcb->PoolType = PoolType;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb,
|
|||
OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL,
|
||||
OUT PULONG Index OPTIONAL)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ FsRtlLookupLastLargeMcbEntry(IN PLARGE_MCB Mcb,
|
|||
OUT PLONGLONG Vbn,
|
||||
OUT PLONGLONG Lbn)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ FsRtlLookupLastMcbEntry (IN PMCB Mcb,
|
|||
OUT PVBN Vbn,
|
||||
OUT PLBN Lbn)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ FsRtlLookupMcbEntry (IN PMCB Mcb,
|
|||
OUT PULONG SectorCount OPTIONAL,
|
||||
OUT PULONG Index)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ FsRtlRemoveLargeMcbEntry(IN PLARGE_MCB Mcb,
|
|||
IN LONGLONG Vbn,
|
||||
IN LONGLONG SectorCount)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,7 +216,7 @@ FsRtlRemoveMcbEntry (IN PMCB Mcb,
|
|||
IN VBN Vbn,
|
||||
IN ULONG SectorCount)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,7 +228,7 @@ FsRtlSplitLargeMcb(IN PLARGE_MCB Mcb,
|
|||
IN LONGLONG Vbn,
|
||||
IN LONGLONG Amount)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ VOID STDCALL
|
|||
FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb,
|
||||
IN LONGLONG Vbn)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: notify.c,v 1.8 2003/10/11 20:40:21 navaraf Exp $
|
||||
/* $Id: notify.c,v 1.9 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* reactos/ntoskrnl/fs/notify.c
|
||||
*
|
||||
|
@ -96,7 +96,11 @@ FsRtlNotifyFullChangeDirectory (
|
|||
IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
|
||||
)
|
||||
{
|
||||
#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||
DbgPrint("%s()\n", __FUNCTION__);
|
||||
#else
|
||||
DbgPrint("FsRtlNotifyFullChangeDirectory()\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: inbv.c,v 1.4 2003/11/17 02:12:50 hyperion Exp $
|
||||
/* $Id: inbv.c,v 1.5 2003/12/30 18:52:03 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -85,7 +85,7 @@ InbvDisplayString(IN PCHAR String)
|
|||
}
|
||||
|
||||
BOOLEAN
|
||||
STDCALL_FUNC
|
||||
STDCALL
|
||||
InbvResetDisplayParameters(ULONG SizeX, ULONG SizeY)
|
||||
{
|
||||
return(InbvResetDisplay());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* The following flags are used to tell iswctype and _isctype what character
|
||||
* types you are looking for.
|
||||
*/
|
||||
|
||||
#define _UPPER 0x0001
|
||||
#define _LOWER 0x0002
|
||||
#define _DIGIT 0x0004
|
||||
|
@ -24,6 +25,10 @@
|
|||
typedef wchar_t wctype_t;
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define inline __inline
|
||||
typedef wchar_t wint_t;
|
||||
#endif
|
||||
|
||||
extern inline int isspace(int c);
|
||||
extern inline int toupper(int c);
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
#include <internal/dbg.h>
|
||||
#include <roscfg.h>
|
||||
|
||||
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
/* TODO: Verify which version the MS compiler learned the __FUNCTION__ macro */
|
||||
#define __FUNCTION__ "<unknown>"
|
||||
#endif
|
||||
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0)
|
||||
|
||||
|
||||
#ifdef DBG
|
||||
|
@ -52,7 +56,11 @@
|
|||
#endif
|
||||
|
||||
/* Print if using a "checked" version */
|
||||
#define CPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
#ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */
|
||||
#define CPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0)
|
||||
#else
|
||||
#define CPRINT DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint
|
||||
#endif
|
||||
|
||||
#else /* DBG */
|
||||
|
||||
|
@ -65,8 +73,13 @@
|
|||
|
||||
#endif /* DBG */
|
||||
|
||||
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||
#ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */
|
||||
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0)
|
||||
#else
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint
|
||||
#endif
|
||||
|
||||
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0)
|
||||
|
||||
#if defined(KDBG) && defined(NDEBUG) && defined(__NTOSKRNL__)
|
||||
|
||||
|
@ -75,17 +88,25 @@
|
|||
DbgPrint("(%s:%d) ",__FILE__,__LINE__); \
|
||||
DbgPrint(args); \
|
||||
} \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#define CHECKPOINT
|
||||
|
||||
#else /* KDBG && NDEBUG && __NTOSKRNL__ */
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
|
||||
#ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */
|
||||
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0)
|
||||
#else
|
||||
#define DPRINT DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint
|
||||
#endif
|
||||
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0)
|
||||
#else /* NDEBUG */
|
||||
#ifdef __GNUC__ /* using GNU C/C99 macro ellipsis */
|
||||
#define DPRINT(args...)
|
||||
#else
|
||||
#define DPRINT
|
||||
#endif
|
||||
#define CHECKPOINT
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ PULONG MmGetPageEntry(PVOID Address);
|
|||
|
||||
#define KERNEL_BASE (0xc0000000)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#define FLUSH_TLB { \
|
||||
unsigned int tmp; \
|
||||
__asm__ __volatile__( \
|
||||
|
@ -39,6 +41,15 @@ PULONG MmGetPageEntry(PVOID Address);
|
|||
:: "memory"); \
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
/* TODO: Verify that this really WORKS. Perhaps it, as the GCC thing */
|
||||
/* above, needs to actually touch some memory too ? */
|
||||
#define FLUSH_TLB __asm mov eax, cr3 __asm mov cr3, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
|
||||
PULONG MmGetPageDirectory(VOID);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -130,10 +130,17 @@ static inline PKPCR KeGetCurrentKPCR(VOID)
|
|||
{
|
||||
ULONG value;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__ __volatile__ ("movl %%fs:0x18, %0\n\t"
|
||||
: "=r" (value)
|
||||
: /* no inputs */
|
||||
);
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, fs:0x18;
|
||||
__asm mov value, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
return((PKPCR)value);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: buildirp.c,v 1.37 2003/11/19 21:11:47 gdalsnes Exp $
|
||||
/* $Id: buildirp.c,v 1.38 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -114,7 +114,7 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
|
|||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->MajorFunction = MajorFunction;
|
||||
StackPtr->MajorFunction = (UCHAR)MajorFunction;
|
||||
StackPtr->MinorFunction = 0;
|
||||
StackPtr->Flags = 0;
|
||||
StackPtr->Control = 0;
|
||||
|
@ -447,7 +447,7 @@ IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
|
|||
}
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->MajorFunction = MajorFunction;
|
||||
StackPtr->MajorFunction = (UCHAR)MajorFunction;
|
||||
StackPtr->MinorFunction = 0;
|
||||
StackPtr->Flags = 0;
|
||||
StackPtr->Control = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.71 2003/12/14 17:44:02 hbirr Exp $
|
||||
/* $Id: create.c,v 1.72 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -457,15 +457,15 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
break;
|
||||
}
|
||||
StackLoc->MinorFunction = 0;
|
||||
StackLoc->Flags = Options;
|
||||
StackLoc->Flags = (UCHAR)Options;
|
||||
StackLoc->Control = 0;
|
||||
StackLoc->DeviceObject = FileObject->DeviceObject;
|
||||
StackLoc->FileObject = FileObject;
|
||||
StackLoc->Parameters.Create.SecurityContext = &SecurityContext;
|
||||
StackLoc->Parameters.Create.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS);
|
||||
StackLoc->Parameters.Create.Options |= (CreateDisposition << 24);
|
||||
StackLoc->Parameters.Create.FileAttributes = FileAttributes;
|
||||
StackLoc->Parameters.Create.ShareAccess = ShareAccess;
|
||||
StackLoc->Parameters.Create.FileAttributes = (USHORT)FileAttributes;
|
||||
StackLoc->Parameters.Create.ShareAccess = (USHORT)ShareAccess;
|
||||
StackLoc->Parameters.Create.EaLength = EaLength;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: driver.c,v 1.32 2003/12/15 17:50:23 ekohl Exp $
|
||||
/* $Id: driver.c,v 1.33 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -420,7 +420,7 @@ MiFreeBootDriverMemory(PVOID StartAddress, ULONG Length)
|
|||
|
||||
for (i = 0; i < PAGE_ROUND_UP(Length)/PAGE_SIZE; i++)
|
||||
{
|
||||
MmDeleteVirtualMapping(NULL, StartAddress + i * PAGE_SIZE, TRUE, NULL, NULL);
|
||||
MmDeleteVirtualMapping(NULL, (char*)StartAddress + i * PAGE_SIZE, TRUE, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: errlog.c,v 1.15 2003/11/21 22:28:50 ekohl Exp $
|
||||
/* $Id: errlog.c,v 1.16 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -121,7 +121,11 @@ IopRestartLogWorker (VOID)
|
|||
KeInitializeTimer (&WorkerDpc->Timer);
|
||||
|
||||
/* Restart after 30 seconds */
|
||||
#if defined(__GNUC__)
|
||||
Timeout.QuadPart = -300000000LL;
|
||||
#else
|
||||
Timeout.QuadPart = -300000000;
|
||||
#endif
|
||||
KeSetTimer (&WorkerDpc->Timer,
|
||||
Timeout,
|
||||
&WorkerDpc->Dpc);
|
||||
|
@ -274,7 +278,7 @@ IopLogWorker (PVOID Parameter)
|
|||
Message->Size =
|
||||
sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) +
|
||||
LogEntry->PacketSize + DriverNameLength;
|
||||
Message->DriverNameLength = DriverNameLength;
|
||||
Message->DriverNameLength = (USHORT)DriverNameLength;
|
||||
Message->TimeStamp.QuadPart = LogEntry->TimeStamp.QuadPart;
|
||||
Message->DriverNameOffset = (DriverName != NULL) ? LogEntry->PacketSize : 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: iowork.c,v 1.5 2003/07/11 01:23:14 royce Exp $
|
||||
/* $Id: iowork.c,v 1.6 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -34,7 +34,7 @@ typedef struct _IO_WORKITEM
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
VOID STDCALL STATIC
|
||||
VOID STATIC STDCALL
|
||||
IoWorkItemCallback(PVOID Parameter)
|
||||
{
|
||||
PIO_WORKITEM IoWorkItem = (PIO_WORKITEM)Parameter;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: irp.c,v 1.55 2003/11/30 20:01:05 gdalsnes Exp $
|
||||
/* $Id: irp.c,v 1.56 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -386,7 +386,7 @@ IoIsOperationSynchronous(IN PIRP Irp)
|
|||
VOID STDCALL
|
||||
IoEnqueueIrp(IN PIRP Irp)
|
||||
{
|
||||
return IoQueueThreadIrp(Irp);
|
||||
IoQueueThreadIrp(Irp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mdl.c,v 1.12 2003/07/10 15:47:00 royce Exp $
|
||||
/* $Id: mdl.c,v 1.13 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -49,7 +49,7 @@ IoAllocateMdl(PVOID VirtualAddress,
|
|||
MmSizeOfMdl(VirtualAddress,Length),
|
||||
TAG_MDL);
|
||||
}
|
||||
MmInitializeMdl(Mdl,VirtualAddress,Length);
|
||||
MmInitializeMdl(Mdl, (char*)VirtualAddress, Length);
|
||||
if (Irp!=NULL && !SecondaryBuffer)
|
||||
{
|
||||
Irp->MdlAddress = Mdl;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pnproot.c,v 1.18 2003/11/17 02:12:51 hyperion Exp $
|
||||
/* $Id: pnproot.c,v 1.19 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -49,6 +49,8 @@ typedef enum {
|
|||
} PNPROOT_DEVICE_STATE;
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
|
||||
{
|
||||
// Pointer to device object, this device extension is associated with
|
||||
|
@ -61,6 +63,29 @@ typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
|
|||
DEVICE_POWER_STATE DevicePowerState;
|
||||
} __attribute((packed)) PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
|
||||
{
|
||||
// Pointer to device object, this device extension is associated with
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
// Wether this device extension is for an FDO or PDO
|
||||
BOOLEAN IsFDO;
|
||||
// Wether the device is removed
|
||||
BOOLEAN Removed;
|
||||
// Current device power state for the device
|
||||
DEVICE_POWER_STATE DevicePowerState;
|
||||
} PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
|
||||
#include <poppack.h>
|
||||
|
||||
#else
|
||||
#error Unknown compiler for structure packing
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
/* Physical Device Object device extension for a child device */
|
||||
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
|
||||
{
|
||||
|
@ -72,6 +97,27 @@ typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
|
|||
UNICODE_STRING InstanceID;
|
||||
} __attribute((packed)) PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
|
||||
{
|
||||
// Common device data
|
||||
PNPROOT_COMMON_DEVICE_EXTENSION Common;
|
||||
// Device ID
|
||||
UNICODE_STRING DeviceID;
|
||||
// Instance ID
|
||||
UNICODE_STRING InstanceID;
|
||||
} PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
|
||||
#include <poppack.h>
|
||||
|
||||
#else
|
||||
#error Unknown compiler for structure packing
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
/* Functional Device Object device extension for the PCI driver device object */
|
||||
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
|
||||
{
|
||||
|
@ -92,6 +138,34 @@ typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
|
|||
KSPIN_LOCK DeviceListLock;
|
||||
} __attribute((packed)) PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
|
||||
{
|
||||
// Common device data
|
||||
PNPROOT_COMMON_DEVICE_EXTENSION Common;
|
||||
// Physical Device Object
|
||||
PDEVICE_OBJECT Pdo;
|
||||
// Lower device object
|
||||
PDEVICE_OBJECT Ldo;
|
||||
// Current state of the driver
|
||||
PNPROOT_DEVICE_STATE State;
|
||||
// Namespace device list
|
||||
LIST_ENTRY DeviceListHead;
|
||||
// Number of (not removed) devices in device list
|
||||
ULONG DeviceListCount;
|
||||
// Lock for namespace device list
|
||||
// FIXME: Use fast mutex instead?
|
||||
KSPIN_LOCK DeviceListLock;
|
||||
} PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
|
||||
#include <poppack.h>
|
||||
|
||||
#else
|
||||
#error Unknown compiler for structure packing
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
PDEVICE_OBJECT PnpRootDeviceObject;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: process.c,v 1.15 2003/07/10 15:47:00 royce Exp $
|
||||
/* $Id: process.c,v 1.16 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -93,10 +93,10 @@ IoGetRequestorProcess(IN PIRP Irp)
|
|||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN STDCALL EXPORTED
|
||||
BOOLEAN STDCALL
|
||||
IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
|
||||
{
|
||||
BOOLEAN PreviousHEM = NtCurrentTeb()->HardErrorDisabled;
|
||||
BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled);
|
||||
|
||||
NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ? FALSE : TRUE);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rawfs.c,v 1.8 2003/12/14 17:56:22 hbirr Exp $
|
||||
/* $Id: rawfs.c,v 1.9 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -412,7 +412,7 @@ static NTSTATUS
|
|||
RawFsClose(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsClose(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ RawFsCreate(IN PRAWFS_IRP_CONTEXT IrpContext)
|
|||
|
||||
IrpContext->Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(IrpContext->Irp,
|
||||
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
(CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
|
||||
RawFsFreeIrpContext(IrpContext);
|
||||
|
||||
return Status;
|
||||
|
@ -511,7 +511,7 @@ static NTSTATUS
|
|||
RawFsRead(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsRead(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ static NTSTATUS
|
|||
RawFsWrite(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsWrite(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ static NTSTATUS
|
|||
RawFsQueryInformation(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsQueryInformation(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ static NTSTATUS
|
|||
RawFsSetInformation(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsSetInformation(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -730,7 +730,7 @@ static NTSTATUS
|
|||
RawFsDirectoryControl(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsDirectoryControl(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ static NTSTATUS
|
|||
RawFsQueryVolumeInformation(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsQueryVolumeInformation(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@ static NTSTATUS
|
|||
RawFsSetVolumeInformation(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsSetVolumeInformation(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,7 @@ static NTSTATUS
|
|||
RawFsLockControl(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsLockControl(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ static NTSTATUS
|
|||
RawFsCleanup(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsCleanup(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ static NTSTATUS
|
|||
RawFsFlush(IN PRAWFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("RawFsFlush(IrpContext %x)\n", IrpContext);
|
||||
UNIMPLEMENTED
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: timer.c,v 1.10 2003/11/05 22:49:06 gvg Exp $
|
||||
/* $Id: timer.c,v 1.11 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -78,7 +78,7 @@ IoStartTimer(PDEVICE_OBJECT DeviceObject)
|
|||
* DeviceObject = Device whose timer is to be started
|
||||
*/
|
||||
{
|
||||
long long int lli;
|
||||
LONGLONG lli;
|
||||
LARGE_INTEGER li;
|
||||
|
||||
lli = -1000000;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xhaldrv.c,v 1.41 2003/12/14 17:56:22 hbirr Exp $
|
||||
/* $Id: xhaldrv.c,v 1.42 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -298,7 +298,11 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
SectorOffset.QuadPart = 0LL;
|
||||
#else
|
||||
SectorOffset.QuadPart = 0;
|
||||
#endif
|
||||
Status = xHalpReadSector (DeviceObject,
|
||||
SectorSize,
|
||||
&SectorOffset,
|
||||
|
@ -686,7 +690,11 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
LARGE_INTEGER RealPartitionOffset;
|
||||
ULONGLONG PartitionOffset;
|
||||
#if defined(__GNUC__)
|
||||
ULONGLONG nextPartitionOffset = 0LL;
|
||||
#else
|
||||
ULONGLONG nextPartitionOffset = 0;
|
||||
#endif
|
||||
ULONGLONG containerOffset;
|
||||
NTSTATUS Status;
|
||||
PPARTITION_SECTOR PartitionSector;
|
||||
|
@ -754,8 +762,13 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
RtlZeroMemory(LayoutBuffer,
|
||||
0x1000);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
PartitionOffset = 0ULL;
|
||||
containerOffset = 0ULL;
|
||||
#else
|
||||
PartitionOffset = 0;
|
||||
containerOffset = 0;
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -767,7 +780,11 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
/* Shift offset by 63 sectors */
|
||||
RealPartitionOffset.QuadPart = PartitionOffset + (ULONGLONG)(63 * SectorSize);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0ULL)
|
||||
#else
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0)
|
||||
#endif
|
||||
{
|
||||
/* Use sector 1 instead of sector 0 */
|
||||
RealPartitionOffset.QuadPart = (ULONGLONG)SectorSize;
|
||||
|
@ -823,7 +840,11 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
if (PartitionOffset == 0ULL)
|
||||
#else
|
||||
if (PartitionOffset == 0)
|
||||
#endif
|
||||
{
|
||||
LayoutBuffer->Signature = PartitionSector->Signature;
|
||||
DPRINT("Disk signature: %lx\n", LayoutBuffer->Signature);
|
||||
|
@ -926,7 +947,11 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
PPARTITION_SECTOR PartitionSector;
|
||||
LARGE_INTEGER RealPartitionOffset;
|
||||
ULONGLONG PartitionOffset;
|
||||
#if defined(__GNUC__)
|
||||
ULONGLONG nextPartitionOffset = 0LL;
|
||||
#else
|
||||
ULONGLONG nextPartitionOffset = 0;
|
||||
#endif
|
||||
ULONGLONG containerOffset;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
@ -978,8 +1003,13 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
PartitionOffset = 0ULL;
|
||||
containerOffset = 0ULL;
|
||||
#else
|
||||
PartitionOffset = 0;
|
||||
containerOffset = 0;
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -991,7 +1021,11 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
/* Shift offset by 63 sectors */
|
||||
RealPartitionOffset.QuadPart = PartitionOffset + (ULONGLONG)(63 * SectorSize);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0ULL)
|
||||
#else
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0)
|
||||
#endif
|
||||
{
|
||||
/* Use sector 1 instead of sector 0 */
|
||||
RealPartitionOffset.QuadPart = (ULONGLONG)SectorSize;
|
||||
|
@ -1051,7 +1085,11 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (IsContainerPartition (PartitionSector->Partition[i].PartitionType))
|
||||
{
|
||||
ExtendedFound = TRUE;
|
||||
#if defined(__GNUC__)
|
||||
if (containerOffset == 0ULL)
|
||||
#else
|
||||
if (containerOffset == 0)
|
||||
#endif
|
||||
{
|
||||
containerOffset = PartitionOffset;
|
||||
}
|
||||
|
@ -1105,7 +1143,11 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
PPARTITION_SECTOR PartitionSector;
|
||||
LARGE_INTEGER RealPartitionOffset;
|
||||
ULONGLONG PartitionOffset;
|
||||
#if defined(__GNUC__)
|
||||
ULONGLONG NextPartitionOffset = 0LL;
|
||||
#else
|
||||
ULONGLONG NextPartitionOffset = 0;
|
||||
#endif
|
||||
ULONGLONG ContainerOffset;
|
||||
BOOLEAN ContainerEntry;
|
||||
DISK_MANAGER DiskManager;
|
||||
|
@ -1174,8 +1216,13 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
#if defined(__GNUC__)
|
||||
PartitionOffset = 0ULL;
|
||||
ContainerOffset = 0ULL;
|
||||
#else
|
||||
PartitionOffset = 0;
|
||||
ContainerOffset = 0;
|
||||
#endif
|
||||
for (i = 0; i < PartitionBuffer->PartitionCount; i += 4)
|
||||
{
|
||||
DPRINT ("PartitionOffset: %I64u\n", PartitionOffset);
|
||||
|
@ -1187,7 +1234,11 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
/* Shift offset by 63 sectors */
|
||||
RealPartitionOffset.QuadPart = PartitionOffset + (ULONGLONG)(63 * SectorSize);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0ULL)
|
||||
#else
|
||||
else if (DiskManager == EZ_Drive && PartitionOffset == 0)
|
||||
#endif
|
||||
{
|
||||
/* Use sector 1 instead of sector 0 */
|
||||
RealPartitionOffset.QuadPart = (ULONGLONG)SectorSize;
|
||||
|
@ -1243,8 +1294,13 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
PartitionBuffer->PartitionEntry[i + j].PartitionType;
|
||||
|
||||
/* Set partition data */
|
||||
#if defined(__GNUC__)
|
||||
if (PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart == 0ULL &&
|
||||
PartitionBuffer->PartitionEntry[i + j].PartitionLength.QuadPart == 0ULL)
|
||||
#else
|
||||
if (PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart == 0 &&
|
||||
PartitionBuffer->PartitionEntry[i + j].PartitionLength.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
PartitionSector->Partition[j].StartingBlock = 0;
|
||||
PartitionSector->Partition[j].SectorCount = 0;
|
||||
|
@ -1266,7 +1322,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
*/
|
||||
|
||||
/* Compute starting CHS values */
|
||||
lba = (PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart) / SectorSize;
|
||||
lba = (ULONG)((PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart) / SectorSize);
|
||||
x = lba / SectorsPerTrack;
|
||||
StartCylinder = (x / NumberOfHeads) %1024;
|
||||
StartHead = x % NumberOfHeads;
|
||||
|
@ -1275,8 +1331,8 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
lba, StartCylinder, StartHead, StartSector);
|
||||
|
||||
/* Compute ending CHS values */
|
||||
lba = (PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart +
|
||||
(PartitionBuffer->PartitionEntry[i + j].PartitionLength.QuadPart - 1)) / SectorSize;
|
||||
lba = (ULONG)((PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart +
|
||||
(PartitionBuffer->PartitionEntry[i + j].PartitionLength.QuadPart - 1)) / SectorSize);
|
||||
x = lba / SectorsPerTrack;
|
||||
EndCylinder = (x / NumberOfHeads) % 1024;
|
||||
EndHead = x % NumberOfHeads;
|
||||
|
@ -1332,7 +1388,11 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
NextPartitionOffset =
|
||||
PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
if (ContainerOffset == 0ULL)
|
||||
#else
|
||||
if (ContainerOffset == 0)
|
||||
#endif
|
||||
{
|
||||
ContainerOffset = NextPartitionOffset;
|
||||
}
|
||||
|
|
|
@ -269,9 +269,9 @@ GspGetPacket()
|
|||
if (ch == '#')
|
||||
{
|
||||
ch = KdGetChar ();
|
||||
XmitChecksum = HexValue (ch) << 4;
|
||||
XmitChecksum = (CHAR)(HexValue (ch) << 4);
|
||||
ch = KdGetChar ();
|
||||
XmitChecksum += HexValue (ch);
|
||||
XmitChecksum += (CHAR)(HexValue (ch));
|
||||
|
||||
if (Checksum != XmitChecksum)
|
||||
{
|
||||
|
@ -430,8 +430,8 @@ GspHex2Mem (PCHAR Buffer,
|
|||
|
||||
for (i = 0; i < countinpage && ! GspMemoryError; i++)
|
||||
{
|
||||
ch = HexValue (*Buffer++) << 4;
|
||||
ch = ch + HexValue (*Buffer++);
|
||||
ch = (CHAR)(HexValue (*Buffer++) << 4);
|
||||
ch = (CHAR)(ch + HexValue (*Buffer++));
|
||||
|
||||
GspAccessLocation = Address;
|
||||
*current = ch;
|
||||
|
@ -874,6 +874,7 @@ typedef struct _GsHwBreakPoint
|
|||
ULONG Address;
|
||||
} GsHwBreakPoint;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
GsHwBreakPoint GspBreakpoints[4] =
|
||||
{
|
||||
{ Enabled : FALSE },
|
||||
|
@ -881,6 +882,15 @@ GsHwBreakPoint GspBreakpoints[4] =
|
|||
{ Enabled : FALSE },
|
||||
{ Enabled : FALSE }
|
||||
};
|
||||
#else
|
||||
GsHwBreakPoint GspBreakpoints[4] =
|
||||
{
|
||||
{ FALSE },
|
||||
{ FALSE },
|
||||
{ FALSE },
|
||||
{ FALSE }
|
||||
};
|
||||
#endif
|
||||
|
||||
VOID
|
||||
GspCorrectHwBreakpoint()
|
||||
|
@ -888,10 +898,11 @@ GspCorrectHwBreakpoint()
|
|||
ULONG BreakpointNumber;
|
||||
BOOLEAN CorrectIt;
|
||||
BOOLEAN Bit;
|
||||
ULONG dr7;
|
||||
ULONG dr7_;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
asm volatile (
|
||||
"movl %%db7, %0\n" : "=r" (dr7) : );
|
||||
"movl %%db7, %0\n" : "=r" (dr7_) : );
|
||||
do
|
||||
{
|
||||
ULONG addr0, addr1, addr2, addr3;
|
||||
|
@ -904,17 +915,30 @@ GspCorrectHwBreakpoint()
|
|||
: "=r" (addr0), "=r" (addr1),
|
||||
"=r" (addr2), "=r" (addr3) : );
|
||||
} while (FALSE);
|
||||
#elif defined(_MSC_VER)
|
||||
__asm
|
||||
{
|
||||
mov eax, dr7; mov dr7_, eax;
|
||||
mov eax, dr0; mov addr0, eax;
|
||||
mov eax, dr1; mov addr1, eax;
|
||||
mov eax, dr2; mov addr2, eax;
|
||||
mov eax, dr3; mov addr3, eax;
|
||||
}
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
CorrectIt = FALSE;
|
||||
for (BreakpointNumber = 0; BreakpointNumber < 3; BreakpointNumber++)
|
||||
{
|
||||
Bit = 2 << (BreakpointNumber << 1);
|
||||
if (!(dr7 & Bit) && GspBreakpoints[BreakpointNumber].Enabled) {
|
||||
if (!(dr7_ & Bit) && GspBreakpoints[BreakpointNumber].Enabled) {
|
||||
CorrectIt = TRUE;
|
||||
dr7 |= Bit;
|
||||
dr7 &= ~(0xf0000 << (BreakpointNumber << 2));
|
||||
dr7 |= (((GspBreakpoints[BreakpointNumber].Length << 2) |
|
||||
dr7_ |= Bit;
|
||||
dr7_ &= ~(0xf0000 << (BreakpointNumber << 2));
|
||||
dr7_ |= (((GspBreakpoints[BreakpointNumber].Length << 2) |
|
||||
GspBreakpoints[BreakpointNumber].Type) << 16) << (BreakpointNumber << 2);
|
||||
switch (BreakpointNumber) {
|
||||
#if defined(__GNUC__)
|
||||
case 0:
|
||||
asm volatile ("movl %0, %%dr0\n"
|
||||
: : "r" (GspBreakpoints[BreakpointNumber].Address) );
|
||||
|
@ -934,18 +958,57 @@ GspCorrectHwBreakpoint()
|
|||
asm volatile ("movl %0, %%dr3\n"
|
||||
: : "r" (GspBreakpoints[BreakpointNumber].Address) );
|
||||
break;
|
||||
#elif defined(_MSC_VER)
|
||||
case 0:
|
||||
{
|
||||
ULONG addr = GspBreakpoints[BreakpointNumber].Address;
|
||||
__asm mov eax, addr;
|
||||
__asm mov dr0, eax;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
ULONG addr = GspBreakpoints[BreakpointNumber].Address;
|
||||
__asm mov eax, addr;
|
||||
__asm mov dr1, eax;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
ULONG addr = GspBreakpoints[BreakpointNumber].Address;
|
||||
__asm mov eax, addr;
|
||||
__asm mov dr2, eax;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
ULONG addr = GspBreakpoints[BreakpointNumber].Address;
|
||||
__asm mov eax, addr;
|
||||
__asm mov dr3, eax;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if ((dr7 & Bit) && !GspBreakpoints[BreakpointNumber].Enabled)
|
||||
else if ((dr7_ & Bit) && !GspBreakpoints[BreakpointNumber].Enabled)
|
||||
{
|
||||
CorrectIt = TRUE;
|
||||
dr7 &= ~Bit;
|
||||
dr7 &= ~(0xf0000 << (BreakpointNumber << 2));
|
||||
dr7_ &= ~Bit;
|
||||
dr7_ &= ~(0xf0000 << (BreakpointNumber << 2));
|
||||
}
|
||||
}
|
||||
if (CorrectIt)
|
||||
{
|
||||
asm volatile ( "movl %0, %%db7\n" : : "r" (dr7));
|
||||
#if defined(__GNUC__)
|
||||
asm volatile ( "movl %0, %%db7\n" : : "r" (dr7_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, dr7_;
|
||||
__asm mov dr7, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -997,7 +1060,13 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
|
|||
|
||||
/* FIXME: Stop on other CPUs too */
|
||||
/* Disable hardware debugging while we are inside the stub */
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %0,%%db7" : /* no output */ : "r" (0));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, 0 __asm mov dr7, eax
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
if (STATUS_ACCESS_VIOLATION == (NTSTATUS) ExceptionRecord->ExceptionCode &&
|
||||
NULL != GspAccessLocation &&
|
||||
|
@ -1149,7 +1218,7 @@ GspSetSingleRegisterInTrapFrame (ptr, Register, Context, TrapFrame);
|
|||
case 'c':
|
||||
{
|
||||
ULONG BreakpointNumber;
|
||||
ULONG dr6;
|
||||
ULONG dr6_;
|
||||
|
||||
/* try to read optional parameter, pc unchanged if no parm */
|
||||
if (GspHex2Long (&ptr, &Address))
|
||||
|
@ -1164,12 +1233,18 @@ GspSetSingleRegisterInTrapFrame (ptr, Register, Context, TrapFrame);
|
|||
if (Stepping)
|
||||
Context->EFlags |= 0x100;
|
||||
|
||||
asm volatile ("movl %%db6, %0\n" : "=r" (dr6) : );
|
||||
if (!(dr6 & 0x4000))
|
||||
#if defined(__GNUC__)
|
||||
asm volatile ("movl %%db6, %0\n" : "=r" (dr6_) : );
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, dr6 __asm mov dr6_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
if (!(dr6_ & 0x4000))
|
||||
{
|
||||
for (BreakpointNumber = 0; BreakpointNumber < 4; ++BreakpointNumber)
|
||||
{
|
||||
if (dr6 & (1 << BreakpointNumber))
|
||||
if (dr6_ & (1 << BreakpointNumber))
|
||||
{
|
||||
if (GspBreakpoints[BreakpointNumber].Type == 0)
|
||||
{
|
||||
|
@ -1181,7 +1256,13 @@ GspSetSingleRegisterInTrapFrame (ptr, Register, Context, TrapFrame);
|
|||
}
|
||||
}
|
||||
GspCorrectHwBreakpoint();
|
||||
#if defined(__GNUC__)
|
||||
asm volatile ("movl %0, %%db6\n" : : "r" (0));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, 0 __asm mov dr6, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
return kdHandleException;
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: service.c,v 1.5 2002/09/08 10:23:27 chorns Exp $
|
||||
/* $Id: service.c,v 1.6 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -47,6 +47,8 @@ KdpServiceDispatcher (
|
|||
#define _STR(x) #x
|
||||
#define STR(x) _STR(x)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
void interrupt_handler2d(void);
|
||||
__asm__("\n\t.global _interrupt_handler2d\n\t"
|
||||
"_interrupt_handler2d:\n\t"
|
||||
|
@ -113,4 +115,82 @@ void interrupt_handler2d(void);
|
|||
|
||||
"iret\n\t");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
__declspec(naked)
|
||||
void interrupt_handler2d()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* Save the user context */
|
||||
push ebp
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
push ds
|
||||
push es
|
||||
push fs
|
||||
push gs
|
||||
|
||||
sub esp, 112 /* FloatSave */
|
||||
|
||||
mov eax, dr7; push eax;
|
||||
mov eax, dr6; push eax;
|
||||
mov eax, dr3; push eax;
|
||||
mov eax, dr2; push eax;
|
||||
mov eax, dr1; push eax;
|
||||
mov eax, dr0; push eax;
|
||||
|
||||
push 0 /* ContextFlags */
|
||||
|
||||
/* Set ES to kernel segment */
|
||||
mov bx, KERNEL_DS
|
||||
mov es, bx
|
||||
|
||||
/* FIXME: check to see if SS is valid/inrange */
|
||||
|
||||
mov ds, bx /* DS is now also kernel segment */
|
||||
|
||||
/* Call debug service dispatcher */
|
||||
push edx
|
||||
push ecx
|
||||
push eax
|
||||
call KdpServiceDispatcher
|
||||
add esp, 12 /* restore stack pointer */
|
||||
|
||||
/* Restore the user context */
|
||||
add esp, 4 /* UserContext */
|
||||
pop eax; mov dr0, eax;
|
||||
pop eax; mov dr1, eax;
|
||||
pop eax; mov dr2, eax;
|
||||
pop eax; mov dr3, eax;
|
||||
pop eax; mov dr6, eax;
|
||||
pop eax; mov dr7, eax;
|
||||
add esp, 112 /* FloatingSave */
|
||||
pop gs
|
||||
pop fs
|
||||
pop es
|
||||
pop ds
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop edx
|
||||
pop ecx
|
||||
add esp, 4 /* Eax Not restored */
|
||||
|
||||
pop ebp
|
||||
|
||||
iret
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -297,7 +297,7 @@ BOOLEAN STDCALL
|
|||
KeInsertQueueApc (PKAPC Apc,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2,
|
||||
KPRIORITY PriorityBoost)
|
||||
KPRIORITY PriorityBoost)
|
||||
/*
|
||||
* FUNCTION: Queues an APC for execution
|
||||
* ARGUMENTS:
|
||||
|
@ -313,18 +313,23 @@ KeInsertQueueApc (PKAPC Apc,
|
|||
DPRINT("KeInsertQueueApc(Apc %x, SystemArgument1 %x, "
|
||||
"SystemArgument2 %x)\n",Apc,SystemArgument1,
|
||||
SystemArgument2);
|
||||
|
||||
KeAcquireSpinLock(&PiApcLock, &oldlvl);
|
||||
|
||||
|
||||
Apc->SystemArgument1 = SystemArgument1;
|
||||
Apc->SystemArgument2 = SystemArgument2;
|
||||
|
||||
|
||||
if (Apc->Inserted)
|
||||
{
|
||||
#if 0
|
||||
/* TMN: This code is in error */
|
||||
DbgPrint("KeInsertQueueApc(): multiple APC insertations\n");
|
||||
KEBUGCHECK(0);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
KeAcquireSpinLock(&PiApcLock, &oldlvl);
|
||||
|
||||
TargetThread = Apc->Thread;
|
||||
|
||||
if (TargetThread->State == THREAD_STATE_TERMINATED_1 ||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bug.c,v 1.40 2003/10/12 17:05:45 hbirr Exp $
|
||||
/* $Id: bug.c,v 1.41 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/bug.c
|
||||
|
@ -103,7 +103,14 @@ KeBugCheckWithTf(ULONG BugCheckCode,
|
|||
KdDebugState |= KD_DEBUG_SCREEN;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__("cli\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm cli
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
if (KeGetCurrentIrql() < DISPATCH_LEVEL)
|
||||
{
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
|
@ -137,7 +144,13 @@ KeBugCheckWithTf(ULONG BugCheckCode,
|
|||
DbgPrint("Recursive bug check halting now\n");
|
||||
for (;;)
|
||||
{
|
||||
__asm__ ("hlt\n\t");
|
||||
#if defined(__GNUC__)
|
||||
__asm__("hlt\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm hlt
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
InBugCheck = 1;
|
||||
|
@ -148,14 +161,28 @@ KeBugCheckWithTf(ULONG BugCheckCode,
|
|||
|
||||
if (KdDebuggerEnabled)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("sti\n\t");
|
||||
DbgBreakPoint();
|
||||
__asm__("cli\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm sti
|
||||
DbgBreakPoint();
|
||||
__asm cli
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("hlt\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm hlt
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +215,13 @@ KeBugCheckEx(ULONG BugCheckCode,
|
|||
KdDebugState |= KD_DEBUG_SCREEN;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__("cli\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm cli
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
if (KeGetCurrentIrql() < DISPATCH_LEVEL)
|
||||
{
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
|
@ -222,7 +255,13 @@ KeBugCheckEx(ULONG BugCheckCode,
|
|||
DbgPrint("Recursive bug check halting now\n");
|
||||
for (;;)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("hlt\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm hlt
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
InBugCheck = 1;
|
||||
|
@ -237,21 +276,43 @@ KeBugCheckEx(ULONG BugCheckCode,
|
|||
PsGetCurrentThread(),
|
||||
PsGetCurrentThread()->Cid.UniqueThread);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm push ebp
|
||||
__asm call KeDumpStackFrames
|
||||
__asm add esp, 4
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
MmDumpToPagingFile(BugCheckCode, BugCheckParameter1,
|
||||
BugCheckParameter2, BugCheckParameter3,
|
||||
BugCheckParameter4, NULL);
|
||||
|
||||
if (KdDebuggerEnabled)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("sti\n\t");
|
||||
DbgBreakPoint();
|
||||
__asm__("cli\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm sti
|
||||
DbgBreakPoint();
|
||||
__asm cli
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("hlt\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm hlt
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: catch.c,v 1.38 2003/12/14 19:43:09 navaraf Exp $
|
||||
/* $Id: catch.c,v 1.39 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/catch.c
|
||||
|
@ -220,7 +220,7 @@ NtRaiseException (IN PEXCEPTION_RECORD ExceptionRecord,
|
|||
KiDispatchException(ExceptionRecord,
|
||||
Context,
|
||||
PsGetCurrentThread()->Tcb.TrapFrame,
|
||||
ExGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)ExGetPreviousMode(),
|
||||
SearchFrames);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000, 1999, 1998 David Welch <welch@cwcom.net>,
|
||||
* Copyright (C) 2000, 1999, 1998 David Welch <welch@cwcom.net>,
|
||||
* Philip Susi <phreak@iag.net>,
|
||||
* Eric Kohl <ekohl@abo.rhein-zeitung.de>
|
||||
*
|
||||
|
@ -18,7 +18,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dpc.c,v 1.28 2003/10/12 17:05:45 hbirr Exp $
|
||||
/* $Id: dpc.c,v 1.29 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -48,19 +48,19 @@
|
|||
|
||||
static LIST_ENTRY DpcQueueHead; /* Head of the list of pending DPCs */
|
||||
static KSPIN_LOCK DpcQueueLock; /* Lock for the above list */
|
||||
/*
|
||||
/*
|
||||
* Number of pending DPCs. This is inspected by
|
||||
* the idle thread to determine if the queue needs to
|
||||
* be run down
|
||||
*/
|
||||
ULONG DpcQueueSize = 0;
|
||||
ULONG DpcQueueSize = 0;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
VOID STDCALL
|
||||
KeInitializeDpc (PKDPC Dpc,
|
||||
PKDEFERRED_ROUTINE DeferredRoutine,
|
||||
PVOID DeferredContext)
|
||||
|
@ -82,7 +82,7 @@ KeInitializeDpc (PKDPC Dpc,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
VOID STDCALL
|
||||
KiDispatchInterrupt(VOID)
|
||||
/*
|
||||
* FUNCTION: Called to execute queued dpcs
|
||||
|
@ -91,14 +91,14 @@ KiDispatchInterrupt(VOID)
|
|||
PLIST_ENTRY current_entry;
|
||||
PKDPC current;
|
||||
KIRQL oldlvl;
|
||||
|
||||
|
||||
assert_irql(DISPATCH_LEVEL);
|
||||
|
||||
|
||||
if (DpcQueueSize == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldlvl);
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
|
||||
|
@ -106,9 +106,13 @@ KiDispatchInterrupt(VOID)
|
|||
{
|
||||
current_entry = RemoveHeadList(&DpcQueueHead);
|
||||
DpcQueueSize--;
|
||||
|
||||
assert(DpcQueueSize || IsListEmpty(&DpcQueueHead));
|
||||
|
||||
current = CONTAINING_RECORD(current_entry,KDPC,DpcListEntry);
|
||||
current->Lock=FALSE;
|
||||
KeReleaseSpinLock(&DpcQueueLock, oldlvl);
|
||||
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
|
||||
KeLowerIrql(oldlvl);
|
||||
current->DeferredRoutine(current,current->DeferredContext,
|
||||
current->SystemArgument1,
|
||||
current->SystemArgument2);
|
||||
|
@ -116,13 +120,14 @@ KiDispatchInterrupt(VOID)
|
|||
KeRaiseIrql(HIGH_LEVEL, &oldlvl);
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
}
|
||||
KeReleaseSpinLock(&DpcQueueLock, oldlvl);
|
||||
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
|
||||
KeLowerIrql(oldlvl);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN STDCALL
|
||||
BOOLEAN STDCALL
|
||||
KeRemoveQueueDpc (PKDPC Dpc)
|
||||
/*
|
||||
* FUNCTION: Removes DPC object from the system dpc queue
|
||||
|
@ -133,25 +138,30 @@ KeRemoveQueueDpc (PKDPC Dpc)
|
|||
*/
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
|
||||
BOOLEAN WasInQueue;
|
||||
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
if (!Dpc->Lock)
|
||||
WasInQueue = Dpc->Lock ? TRUE : FALSE;
|
||||
if (WasInQueue)
|
||||
{
|
||||
KeReleaseSpinLock(&DpcQueueLock, oldIrql);
|
||||
return(FALSE);
|
||||
RemoveEntryList(&Dpc->DpcListEntry);
|
||||
DpcQueueSize--;
|
||||
Dpc->Lock=0;
|
||||
}
|
||||
RemoveEntryList(&Dpc->DpcListEntry);
|
||||
DpcQueueSize--;
|
||||
Dpc->Lock=0;
|
||||
KeReleaseSpinLock(&DpcQueueLock, oldIrql);
|
||||
return(TRUE);
|
||||
|
||||
assert(DpcQueueSize || IsListEmpty(&DpcQueueHead));
|
||||
|
||||
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
|
||||
KeLowerIrql(oldIrql);
|
||||
|
||||
return WasInQueue;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN STDCALL
|
||||
BOOLEAN STDCALL
|
||||
KeInsertQueueDpc (PKDPC Dpc,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2)
|
||||
|
@ -181,11 +191,13 @@ KeInsertQueueDpc (PKDPC Dpc,
|
|||
}
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldlvl);
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
assert(DpcQueueSize || IsListEmpty(&DpcQueueHead));
|
||||
InsertHeadList(&DpcQueueHead,&Dpc->DpcListEntry);
|
||||
DPRINT("Dpc->DpcListEntry.Flink %x\n", Dpc->DpcListEntry.Flink);
|
||||
DpcQueueSize++;
|
||||
Dpc->Lock=(PULONG)1;
|
||||
KeReleaseSpinLock( &DpcQueueLock, oldlvl );
|
||||
KeReleaseSpinLockFromDpcLevel(&DpcQueueLock);
|
||||
KeLowerIrql(oldlvl);
|
||||
DPRINT("DpcQueueHead.Flink %x\n",DpcQueueHead.Flink);
|
||||
DPRINT("Leaving KeInsertQueueDpc()\n",0);
|
||||
return(TRUE);
|
||||
|
|
|
@ -37,7 +37,13 @@
|
|||
VOID STDCALL
|
||||
DbgBreakPoint(VOID)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("int $3\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm int 3;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -46,7 +52,14 @@ DbgBreakPoint(VOID)
|
|||
VOID STDCALL
|
||||
DbgBreakPointWithStatus(ULONG Status)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__("mov %0, %%eax\n\t"
|
||||
"int $3\n\t"
|
||||
::"m"(Status));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, Status
|
||||
__asm int 3;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ KiKernelTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2)
|
|||
ULONG
|
||||
KiDoubleFaultHandler(VOID)
|
||||
{
|
||||
unsigned int cr2;
|
||||
unsigned int cr2_;
|
||||
ULONG StackLimit;
|
||||
ULONG StackBase;
|
||||
ULONG Esp0;
|
||||
|
@ -215,12 +215,19 @@ KiDoubleFaultHandler(VOID)
|
|||
Esp0 = OldTss->Esp;
|
||||
|
||||
/* Get CR2 */
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr2;
|
||||
__asm mov cr2_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
if (PsGetCurrentThread() != NULL &&
|
||||
PsGetCurrentThread()->ThreadsProcess != NULL)
|
||||
{
|
||||
OldCr3 =
|
||||
OldCr3 = (ULONG)
|
||||
PsGetCurrentThread()->ThreadsProcess->Pcb.DirectoryTableBase.QuadPart;
|
||||
}
|
||||
else
|
||||
|
@ -254,7 +261,7 @@ KiDoubleFaultHandler(VOID)
|
|||
DbgPrint("CS:EIP %x:%x ", OldTss->Cs, OldTss->Eip);
|
||||
print_address((PVOID)OldTss->Eip);
|
||||
DbgPrint("\n");
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2, OldCr3);
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2_, OldCr3);
|
||||
DbgPrint("Proc: %x ",PsGetCurrentProcess());
|
||||
if (PsGetCurrentProcess() != NULL)
|
||||
{
|
||||
|
@ -401,7 +408,7 @@ KiDoubleFaultHandler(VOID)
|
|||
VOID
|
||||
KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG Parameter1, ULONG Parameter2)
|
||||
{
|
||||
ULONG cr3;
|
||||
ULONG cr3_;
|
||||
ULONG i;
|
||||
ULONG StackLimit;
|
||||
PULONG Frame;
|
||||
|
@ -427,8 +434,15 @@ KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG Parameter1, ULONG Parameter2)
|
|||
Tf->Cs&0xffff, Tf->Eip);
|
||||
print_address((PVOID)Tf->Eip);
|
||||
DbgPrint("\n");
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3));
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2, cr3);
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr3;
|
||||
__asm mov cr3_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2, cr3_);
|
||||
DbgPrint("Proc: %x ",PsGetCurrentProcess());
|
||||
if (PsGetCurrentProcess() != NULL)
|
||||
{
|
||||
|
@ -493,7 +507,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
* Complete CPU context
|
||||
*/
|
||||
{
|
||||
unsigned int cr2;
|
||||
unsigned int cr2_;
|
||||
NTSTATUS Status;
|
||||
ULONG Esp0;
|
||||
|
||||
|
@ -504,15 +518,22 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
Esp0 = (ULONG)&Tf->Eip;
|
||||
|
||||
/* Get CR2 */
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||
Tf->DebugPointer = (PVOID)cr2;
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr2;
|
||||
__asm mov cr2_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
Tf->DebugPointer = (PVOID)cr2_;
|
||||
|
||||
/*
|
||||
* If this was a V86 mode exception then handle it specially
|
||||
*/
|
||||
if (Tf->Eflags & (1 << 17))
|
||||
{
|
||||
return(KeV86Exception(ExceptionNr, Tf, cr2));
|
||||
return(KeV86Exception(ExceptionNr, Tf, cr2_));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -538,7 +559,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
Status = MmPageFault(Tf->Cs&0xffff,
|
||||
&Tf->Eip,
|
||||
&Tf->Eax,
|
||||
cr2,
|
||||
cr2_,
|
||||
Tf->ErrorCode);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -551,11 +572,11 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
*/
|
||||
if ((Tf->Cs & 0xFFFF) == USER_CS)
|
||||
{
|
||||
return(KiUserTrapHandler(Tf, ExceptionNr, (PVOID)cr2));
|
||||
return(KiUserTrapHandler(Tf, ExceptionNr, (PVOID)cr2_));
|
||||
}
|
||||
else
|
||||
{
|
||||
return(KiKernelTrapHandler(Tf, ExceptionNr, (PVOID)cr2));
|
||||
return(KiKernelTrapHandler(Tf, ExceptionNr, (PVOID)cr2_));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fpu.c,v 1.11 2003/11/06 20:40:25 gvg Exp $
|
||||
/* $Id: fpu.c,v 1.12 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||
|
@ -46,31 +46,60 @@ VOID INIT_FUNCTION
|
|||
KiCheckFPU(VOID)
|
||||
{
|
||||
unsigned short int status;
|
||||
int cr0;
|
||||
int cr0_;
|
||||
|
||||
HardwareMathSupport = 0;
|
||||
|
||||
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0));
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0_));
|
||||
/* Set NE and MP. */
|
||||
cr0 = cr0 | 0x22;
|
||||
cr0_ = cr0_ | 0x22;
|
||||
/* Clear EM */
|
||||
cr0 = cr0 & (~0x4);
|
||||
__asm__("movl %0, %%cr0\n\t" : : "a" (cr0));
|
||||
cr0_ = cr0_ & (~0x4);
|
||||
__asm__("movl %0, %%cr0\n\t" : : "a" (cr0_));
|
||||
|
||||
__asm__("clts\n\t");
|
||||
__asm__("fninit\n\t");
|
||||
__asm__("fstsw %0\n\t" : "=a" (status));
|
||||
if (status != 0)
|
||||
{
|
||||
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0));
|
||||
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0_));
|
||||
/* Set the EM flag in CR0 so any FPU instructions cause a trap. */
|
||||
cr0 = cr0 | 0x4;
|
||||
cr0_ = cr0_ | 0x4;
|
||||
__asm__("movl %0, %%cr0\n\t" :
|
||||
: "a" (cr0));
|
||||
: "a" (cr0_));
|
||||
return;
|
||||
}
|
||||
/* fsetpm for i287, ignored by i387 */
|
||||
__asm__(".byte 0xDB, 0xE4\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr0;
|
||||
__asm mov cr0_, eax;
|
||||
cr0_ |= 0x22; /* Set NE and MP. */
|
||||
cr0_ &= ~0x4; /* Clear EM */
|
||||
__asm
|
||||
{
|
||||
mov eax, cr0_;
|
||||
mov cr0, eax;
|
||||
clts;
|
||||
fninit;
|
||||
fstsw status
|
||||
}
|
||||
if (status != 0)
|
||||
{
|
||||
__asm mov eax, cr0_;
|
||||
__asm or eax, 4; /* Set the EM flag in CR0 so any FPU instructions cause a trap. */
|
||||
__asm mov cr0, eax;
|
||||
return;
|
||||
}
|
||||
/* fsetpm for i287, ignored by i387 */
|
||||
__asm _emit 0xDB __asm _emit 0xe4
|
||||
// __asm fsetpm;
|
||||
// __asm__(".byte 0xDB, 0xE4\n\t");
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
HardwareMathSupport = 1;
|
||||
}
|
||||
|
||||
|
@ -91,7 +120,14 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
|
|||
}
|
||||
*((PVOID *) Save) = FpState;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__("fsave %0\n\t" : "=m" (*FpState));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, FpState;
|
||||
__asm fsave [eax];
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -101,7 +137,15 @@ KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
|
|||
{
|
||||
char *FpState = *((PVOID *) Save);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__("frstor %0\n\t" : "=m" (*FpState));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, FpState;
|
||||
__asm frstor [eax];
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
ExFreePool(FpState);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -112,19 +112,20 @@ KiInitializeGdt(PKPCR Pcr)
|
|||
*/
|
||||
Base = (ULONG)Pcr;
|
||||
Entry = PCR_SELECTOR / 2;
|
||||
Gdt[Entry + 1] = ((ULONG)Base) & 0xffff;
|
||||
Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
|
||||
|
||||
Gdt[Entry + 2] = Gdt[Entry + 2] & ~(0xff);
|
||||
Gdt[Entry + 2] = Gdt[Entry + 2] | ((((ULONG)Base) & 0xff0000) >> 16);
|
||||
Gdt[Entry + 2] = (USHORT)(Gdt[Entry + 2] | ((((ULONG)Base) & 0xff0000) >> 16));
|
||||
|
||||
Gdt[Entry + 3] = Gdt[Entry + 3] & ~(0xff00);
|
||||
Gdt[Entry + 3] = Gdt[Entry + 3] | ((((ULONG)Base) & 0xff000000) >> 16);
|
||||
Gdt[Entry + 3] = (USHORT)(Gdt[Entry + 3] | ((((ULONG)Base) & 0xff000000) >> 16));
|
||||
|
||||
/*
|
||||
* Load the GDT
|
||||
*/
|
||||
Descriptor.Length = 8 * 11;
|
||||
Descriptor.Base = (ULONG)Gdt;
|
||||
#if defined(__GNUC__)
|
||||
__asm__ ("lgdt %0\n\t" : /* no output */ : "m" (Descriptor));
|
||||
|
||||
/*
|
||||
|
@ -142,6 +143,24 @@ KiInitializeGdt(PKPCR Pcr)
|
|||
".l4:\n\t"
|
||||
: /* no output */
|
||||
: "a" (KERNEL_CS));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm
|
||||
{
|
||||
lgdt Descriptor;
|
||||
mov ax, KERNEL_DS;
|
||||
mov bx, PCR_SELECTOR;
|
||||
mov ds, ax;
|
||||
mov es, ax;
|
||||
mov fs, bx;
|
||||
mov gs, ax;
|
||||
push KERNEL_CS;
|
||||
push offset l4 ; // what the heck...
|
||||
ret
|
||||
l4:
|
||||
}
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -158,15 +177,15 @@ KeSetBaseGdtSelector(ULONG Entry,
|
|||
|
||||
Entry = (Entry & (~0x3)) / 2;
|
||||
|
||||
Gdt[Entry + 1] = ((ULONG)Base) & 0xffff;
|
||||
Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
|
||||
|
||||
Gdt[Entry + 2] = Gdt[Entry + 2] & ~(0xff);
|
||||
Gdt[Entry + 2] = Gdt[Entry + 2] |
|
||||
((((ULONG)Base) & 0xff0000) >> 16);
|
||||
Gdt[Entry + 2] = (USHORT)(Gdt[Entry + 2] |
|
||||
((((ULONG)Base) & 0xff0000) >> 16));
|
||||
|
||||
Gdt[Entry + 3] = Gdt[Entry + 3] & ~(0xff00);
|
||||
Gdt[Entry + 3] = Gdt[Entry + 3] |
|
||||
((((ULONG)Base) & 0xff000000) >> 16);
|
||||
Gdt[Entry + 3] = (USHORT)(Gdt[Entry + 3] |
|
||||
((((ULONG)Base) & 0xff000000) >> 16));
|
||||
|
||||
DPRINT("%x %x %x %x\n",
|
||||
Gdt[Entry + 0],
|
||||
|
|
|
@ -19,11 +19,22 @@
|
|||
|
||||
IDT_DESCRIPTOR KiIdt[256];
|
||||
|
||||
#if defined(__GNUC__)
|
||||
struct
|
||||
{
|
||||
USHORT Length;
|
||||
ULONG Base;
|
||||
} __attribute__((packed)) KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
|
||||
#else
|
||||
#include <pshpack1.h>
|
||||
struct dummyname_for_this_one
|
||||
{
|
||||
USHORT Length;
|
||||
ULONG Base;
|
||||
};
|
||||
#include <poppack.h>
|
||||
struct dummyname_for_this_one KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
|
||||
#endif
|
||||
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: irq.c,v 1.36 2003/10/12 17:05:45 hbirr Exp $
|
||||
/* $Id: irq.c,v 1.37 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/i386/irq.c
|
||||
|
@ -275,9 +275,9 @@ VOID
|
|||
KeIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame,
|
||||
PKTRAP_FRAME TrapFrame)
|
||||
{
|
||||
TrapFrame->Fs = IrqTrapFrame->Fs;
|
||||
TrapFrame->Es = IrqTrapFrame->Es;
|
||||
TrapFrame->Ds = IrqTrapFrame->Ds;
|
||||
TrapFrame->Fs = (USHORT)IrqTrapFrame->Fs;
|
||||
TrapFrame->Es = (USHORT)IrqTrapFrame->Es;
|
||||
TrapFrame->Ds = (USHORT)IrqTrapFrame->Ds;
|
||||
TrapFrame->Eax = IrqTrapFrame->Eax;
|
||||
TrapFrame->Ecx = IrqTrapFrame->Ecx;
|
||||
TrapFrame->Edx = IrqTrapFrame->Edx;
|
||||
|
@ -480,7 +480,7 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
|
|||
* default HAL this will send an EOI to the PIC and alter the IRQL.
|
||||
*/
|
||||
if (!HalBeginSystemInterrupt (irq + IRQ_BASE,
|
||||
PROFILE_LEVEL - irq,
|
||||
(KIRQL)(PROFILE_LEVEL - irq),
|
||||
&old_level))
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -66,7 +66,7 @@ KeApplicationProcessorInit(VOID)
|
|||
PAGE_READWRITE,
|
||||
PcrPages[Offset]);
|
||||
memset(KPCR, 0, PAGE_SIZE);
|
||||
KPCR->ProcessorNumber = Offset;
|
||||
KPCR->ProcessorNumber = (UCHAR)Offset;
|
||||
KPCR->Self = KPCR;
|
||||
KPCR->Irql = HIGH_LEVEL;
|
||||
|
||||
|
|
|
@ -131,19 +131,26 @@ NtSetLdtEntries (ULONG Selector1,
|
|||
memcpy((PVOID) NewLdtBase, (PVOID) LdtBase, LdtLimit+1);
|
||||
}
|
||||
|
||||
LdtDescriptor[0] = (--NewLdtSize) & 0xffff;
|
||||
LdtDescriptor[1] = NewLdtBase & 0xffff;
|
||||
LdtDescriptor[2] = ((NewLdtBase & 0xff0000) >> 16) | 0x8200;
|
||||
LdtDescriptor[3] = ((NewLdtSize & 0xf0000) >> 16) |
|
||||
((NewLdtBase & 0xff000000) >> 16);
|
||||
LdtDescriptor[0] = (USHORT)((--NewLdtSize) & 0xffff);
|
||||
LdtDescriptor[1] = (USHORT)(NewLdtBase & 0xffff);
|
||||
LdtDescriptor[2] = (USHORT)(((NewLdtBase & 0xff0000) >> 16) | 0x8200);
|
||||
LdtDescriptor[3] = (USHORT)(((NewLdtSize & 0xf0000) >> 16) |
|
||||
((NewLdtBase & 0xff000000) >> 16));
|
||||
|
||||
KeSetGdtSelector(LDT_SELECTOR,
|
||||
((PULONG) LdtDescriptor)[0],
|
||||
((PULONG) LdtDescriptor)[1]);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__asm__("lldtw %%ax"
|
||||
: /* no output */
|
||||
: "a" (LDT_SELECTOR));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov ax, LDT_SELECTOR
|
||||
__asm lldt ax
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
if(LdtBase)
|
||||
{
|
||||
|
@ -155,14 +162,14 @@ NtSetLdtEntries (ULONG Selector1,
|
|||
|
||||
if(Selector1)
|
||||
{
|
||||
memcpy((PVOID) LdtBase + Selector1,
|
||||
memcpy((char*)LdtBase + Selector1,
|
||||
&LdtEntry1,
|
||||
sizeof(LDT_ENTRY));
|
||||
}
|
||||
|
||||
if(Selector2)
|
||||
{
|
||||
memcpy((PVOID) LdtBase + Selector2,
|
||||
memcpy((char*)LdtBase + Selector2,
|
||||
&LdtEntry2,
|
||||
sizeof(LDT_ENTRY));
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
|
|||
|
||||
InitSize = 5 * sizeof(DWORD) + sizeof(DWORD) + 6 * sizeof(DWORD) +
|
||||
sizeof(FLOATING_SAVE_AREA) + sizeof(KTRAP_FRAME);
|
||||
KernelStack = (PULONG)(Thread->KernelStack - InitSize);
|
||||
KernelStack = (PULONG)((char*)Thread->KernelStack - InitSize);
|
||||
|
||||
/* Set up the initial frame for the return from the dispatcher. */
|
||||
KernelStack[0] = 0; /* EDI */
|
||||
|
@ -132,16 +132,16 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
|
|||
|
||||
/* Set up a trap frame from the context. */
|
||||
TrapFrame = (PKTRAP_FRAME)
|
||||
((PVOID)KernelStack + 12 * sizeof(DWORD) + sizeof(FLOATING_SAVE_AREA));
|
||||
((char*)KernelStack + 12 * sizeof(DWORD) + sizeof(FLOATING_SAVE_AREA));
|
||||
TrapFrame->DebugEbp = (PVOID)Context->Ebp;
|
||||
TrapFrame->DebugEip = (PVOID)Context->Eip;
|
||||
TrapFrame->DebugArgMark = 0;
|
||||
TrapFrame->DebugPointer = 0;
|
||||
TrapFrame->TempCs = 0;
|
||||
TrapFrame->TempEip = 0;
|
||||
TrapFrame->Gs = Context->SegGs;
|
||||
TrapFrame->Es = Context->SegEs;
|
||||
TrapFrame->Ds = Context->SegDs;
|
||||
TrapFrame->Gs = (USHORT)Context->SegGs;
|
||||
TrapFrame->Es = (USHORT)Context->SegEs;
|
||||
TrapFrame->Ds = (USHORT)Context->SegDs;
|
||||
TrapFrame->Edx = Context->Edx;
|
||||
TrapFrame->Ecx = Context->Ecx;
|
||||
TrapFrame->Eax = Context->Eax;
|
||||
|
@ -158,7 +158,7 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
|
|||
TrapFrame->Eflags = Context->EFlags | FLAG_IF;
|
||||
TrapFrame->Eflags &= ~(FLAG_VM | FLAG_NT | FLAG_IOPL);
|
||||
TrapFrame->Esp = Context->Esp;
|
||||
TrapFrame->Ss = Context->SegSs;
|
||||
TrapFrame->Ss = (USHORT)Context->SegSs;
|
||||
/* FIXME: Should check for a v86 mode context here. */
|
||||
|
||||
/* Save back the new value of the kernel stack. */
|
||||
|
@ -181,7 +181,7 @@ Ke386InitThread(PKTHREAD Thread,
|
|||
* Setup a stack frame for exit from the task switching routine
|
||||
*/
|
||||
|
||||
KernelStack = (PULONG)(Thread->KernelStack - (8*4));
|
||||
KernelStack = (PULONG)((char*)Thread->KernelStack - (8*4));
|
||||
KernelStack[0] = 0; /* EDI */
|
||||
KernelStack[1] = 0; /* ESI */
|
||||
KernelStack[2] = 0; /* EBX */
|
||||
|
|
|
@ -115,7 +115,7 @@ Ke386QueryIoAccessMap(DWORD MapNumber, PULONG IOMapStart)
|
|||
VOID
|
||||
Ki386ApplicationProcessorInitializeTSS(VOID)
|
||||
{
|
||||
ULONG cr3;
|
||||
ULONG cr3_;
|
||||
KTSS* Tss;
|
||||
KTSSNOIOPM* TrapTss;
|
||||
PVOID TrapStack;
|
||||
|
@ -126,7 +126,14 @@ Ki386ApplicationProcessorInitializeTSS(VOID)
|
|||
Id = KeGetCurrentProcessorNumber();
|
||||
Gdt = KeGetCurrentKPCR()->GDT;
|
||||
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3));
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr3;
|
||||
__asm mov cr3_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
Tss = ExAllocatePool(NonPagedPool, sizeof(KTSS));
|
||||
TrapTss = ExAllocatePool(NonPagedPool, sizeof(KTSSNOIOPM));
|
||||
|
@ -150,11 +157,11 @@ Ki386ApplicationProcessorInitializeTSS(VOID)
|
|||
base = (ULONG)Tss;
|
||||
length = sizeof(KTSS) - 1;
|
||||
|
||||
Gdt[(TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
|
||||
Gdt[(TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
|
||||
Gdt[(TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
|
||||
Gdt[(TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
|
||||
((base & 0xFF000000) >> 16);
|
||||
Gdt[(TSS_SELECTOR / 2) + 0] = (USHORT)(length & 0xFFFF);
|
||||
Gdt[(TSS_SELECTOR / 2) + 1] = (USHORT)(base & 0xFFFF);
|
||||
Gdt[(TSS_SELECTOR / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900);
|
||||
Gdt[(TSS_SELECTOR / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) |
|
||||
((base & 0xFF000000) >> 16));
|
||||
|
||||
/* Initialize the TSS used for handling double faults. */
|
||||
TrapTss->Eflags = 0;
|
||||
|
@ -170,7 +177,7 @@ Ki386ApplicationProcessorInitializeTSS(VOID)
|
|||
TrapTss->IoMapBase = 0xFFFF; /* No i/o bitmap */
|
||||
TrapTss->IoBitmap[0] = 0xFF;
|
||||
TrapTss->Ldt = 0;
|
||||
TrapTss->Cr3 = cr3;
|
||||
TrapTss->Cr3 = cr3_;
|
||||
|
||||
/*
|
||||
* Initialize a descriptor for the trap TSS.
|
||||
|
@ -178,29 +185,43 @@ Ki386ApplicationProcessorInitializeTSS(VOID)
|
|||
base = (ULONG)TrapTss;
|
||||
length = sizeof(KTSSNOIOPM) - 1;
|
||||
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
|
||||
((base & 0xFF000000) >> 16);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 0] = (USHORT)(length & 0xFFFF);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 1] = (USHORT)(base & 0xFFFF);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900);
|
||||
Gdt[(TRAP_TSS_SELECTOR / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) |
|
||||
((base & 0xFF000000) >> 16));
|
||||
|
||||
/*
|
||||
* Load the task register
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
__asm__("ltr %%ax"
|
||||
: /* no output */
|
||||
: "a" (TSS_SELECTOR));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov ax, TSS_SELECTOR
|
||||
__asm ltr ax
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
Ki386BootInitializeTSS(VOID)
|
||||
{
|
||||
ULONG cr3;
|
||||
ULONG cr3_;
|
||||
extern unsigned int init_stack, init_stack_top;
|
||||
extern unsigned int trap_stack, trap_stack_top;
|
||||
unsigned int base, length;
|
||||
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3));
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr3,%0\n\t" : "=d" (cr3_));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr3;
|
||||
__asm mov cr3_, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
Ki386TssArray[0] = &KiBootTss;
|
||||
Ki386TrapTssArray[0] = &KiBootTrapTss;
|
||||
|
@ -241,7 +262,7 @@ Ki386BootInitializeTSS(VOID)
|
|||
KiBootTrapTss.IoMapBase = 0xFFFF; /* No i/o bitmap */
|
||||
KiBootTrapTss.IoBitmap[0] = 0xFF;
|
||||
KiBootTrapTss.Ldt = 0x0;
|
||||
KiBootTrapTss.Cr3 = cr3;
|
||||
KiBootTrapTss.Cr3 = cr3_;
|
||||
|
||||
/*
|
||||
* Initialize a descriptor for the trap TSS.
|
||||
|
@ -258,9 +279,16 @@ Ki386BootInitializeTSS(VOID)
|
|||
/*
|
||||
* Load the task register
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
__asm__("ltr %%ax"
|
||||
: /* no output */
|
||||
: "a" (TSS_SELECTOR));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov ax, TSS_SELECTOR
|
||||
__asm ltr ax
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ print_user_address(PVOID address)
|
|||
CONTAINING_RECORD(current_entry, LDR_MODULE, InLoadOrderModuleList);
|
||||
|
||||
if (address >= (PVOID)current->BaseAddress &&
|
||||
address < (PVOID)(current->BaseAddress + current->SizeOfImage))
|
||||
address < (PVOID)((char*)current->BaseAddress + current->SizeOfImage))
|
||||
{
|
||||
RelativeAddress =
|
||||
(ULONG_PTR) address - (ULONG_PTR)current->BaseAddress;
|
||||
|
|
|
@ -137,14 +137,14 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
{
|
||||
Tf->Esp = Tf->Esp - 2;
|
||||
sp = sp - 1;
|
||||
sp[0] = Tf->Eflags & 0xFFFF;
|
||||
sp[0] = (USHORT)(Tf->Eflags & 0xFFFF);
|
||||
if (VTf->regs->Vif == 1)
|
||||
{
|
||||
sp[0] = sp[0] | INTERRUPT_FLAG;
|
||||
sp[0] = (USHORT)(sp[0] | INTERRUPT_FLAG);
|
||||
}
|
||||
else
|
||||
{
|
||||
sp[0] = sp[0] & (~INTERRUPT_FLAG);
|
||||
sp[0] = (USHORT)(sp[0] & (~INTERRUPT_FLAG));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -250,7 +250,7 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
{
|
||||
DPRINT("outb %d, %x\n", (ULONG)ip[i + 1], Tf->Eax & 0xFF);
|
||||
WRITE_PORT_UCHAR((PUCHAR)(ULONG)ip[i + 1],
|
||||
Tf->Eax & 0xFF);
|
||||
(UCHAR)(Tf->Eax & 0xFF));
|
||||
Tf->Eip = Tf->Eip + 2;
|
||||
return(0);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
if (!BigDataPrefix)
|
||||
{
|
||||
DPRINT("outw %d, %x\n", (ULONG)ip[i + 1], Tf->Eax & 0xFFFF);
|
||||
WRITE_PORT_USHORT((PUSHORT)(ULONG)ip[1], Tf->Eax & 0xFFFF);
|
||||
WRITE_PORT_USHORT((PUSHORT)(ULONG)ip[1], (USHORT)(Tf->Eax & 0xFFFF));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
if (VTf->regs->Flags & KV86M_ALLOW_IO_PORT_ACCESS)
|
||||
{
|
||||
DPRINT("outb %d, %x\n", Tf->Edx & 0xFFFF, Tf->Eax & 0xFF);
|
||||
WRITE_PORT_UCHAR((PUCHAR)(Tf->Edx & 0xFFFF), Tf->Eax & 0xFF);
|
||||
WRITE_PORT_UCHAR((PUCHAR)(Tf->Edx & 0xFFFF), (UCHAR)(Tf->Eax & 0xFF));
|
||||
Tf->Eip = Tf->Eip + 1;
|
||||
return(0);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
{
|
||||
DPRINT("outw %d, %x\n", Tf->Edx & 0xFFFF, Tf->Eax & 0xFFFF);
|
||||
WRITE_PORT_USHORT((PUSHORT)(Tf->Edx & 0xFFFF),
|
||||
Tf->Eax & 0xFFFF);
|
||||
(USHORT)(Tf->Eax & 0xFFFF));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -676,12 +676,12 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
|
|||
Tf->Esp = Tf->Esp - 6;
|
||||
sp = sp - 3;
|
||||
|
||||
sp[0] = (Tf->Eip & 0xFFFF) + 2;
|
||||
sp[1] = Tf->Cs & 0xFFFF;
|
||||
sp[2] = Tf->Eflags & 0xFFFF;
|
||||
sp[0] = (USHORT)((Tf->Eip & 0xFFFF) + 2);
|
||||
sp[1] = (USHORT)(Tf->Cs & 0xFFFF);
|
||||
sp[2] = (USHORT)(Tf->Eflags & 0xFFFF);
|
||||
if (VTf->regs->Vif == 1)
|
||||
{
|
||||
sp[2] = sp[2] | INTERRUPT_FLAG;
|
||||
sp[2] = (USHORT)(sp[2] | INTERRUPT_FLAG);
|
||||
}
|
||||
DPRINT("sp[0] %x sp[1] %x sp[2] %x\n", sp[0], sp[1], sp[2]);
|
||||
Tf->Eip = entry & 0xFFFF;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: kthread.c,v 1.44 2003/11/30 19:00:02 gdalsnes Exp $
|
||||
/* $Id: kthread.c,v 1.45 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* FILE: ntoskrnl/ke/kthread.c
|
||||
* PURPOSE: Microkernel thread support
|
||||
|
@ -124,15 +124,15 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
|||
KEBUGCHECK(0);
|
||||
}
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
KernelStack + (i * PAGE_SIZE),
|
||||
(char*)KernelStack + (i * PAGE_SIZE),
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
Page,
|
||||
TRUE);
|
||||
}
|
||||
Thread->InitialStack = KernelStack + MM_STACK_SIZE;
|
||||
Thread->StackBase = KernelStack + MM_STACK_SIZE;
|
||||
Thread->StackLimit = (ULONG)KernelStack;
|
||||
Thread->KernelStack = KernelStack + MM_STACK_SIZE;
|
||||
Thread->InitialStack = (char*)KernelStack + MM_STACK_SIZE;
|
||||
Thread->StackBase = (char*)KernelStack + MM_STACK_SIZE;
|
||||
Thread->StackLimit = (ULONG)KernelStack;
|
||||
Thread->KernelStack = (char*)KernelStack + MM_STACK_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -208,6 +208,7 @@ crashes. I'm disabling it again, until we fix the APC implementation...
|
|||
Thread->Queue = NULL;
|
||||
KeInitializeSpinLock(&Thread->ApcQueueLock);
|
||||
memset(&Thread->Timer, 0, sizeof(KTIMER));
|
||||
KeInitializeTimer(&Thread->Timer);
|
||||
Thread->QueueListEntry.Flink = NULL;
|
||||
Thread->QueueListEntry.Blink = NULL;
|
||||
Thread->Affinity = Process->Affinity;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: main.c,v 1.179 2003/12/14 18:16:18 hbirr Exp $
|
||||
/* $Id: main.c,v 1.180 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/main.c
|
||||
|
@ -55,7 +55,12 @@
|
|||
#ifdef HALDBG
|
||||
#include <internal/ntosdbg.h>
|
||||
#else
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||
#define ps
|
||||
#else
|
||||
#define ps(args...)
|
||||
#endif /* HALDBG */
|
||||
|
||||
#endif
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -63,12 +68,23 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
ULONG EXPORTED NtBuildNumber = KERNEL_VERSION_BUILD;
|
||||
ULONG EXPORTED NtGlobalFlag = 0;
|
||||
CHAR EXPORTED KeNumberProcessors;
|
||||
LOADER_PARAMETER_BLOCK EXPORTED KeLoaderBlock;
|
||||
ULONG EXPORTED KeDcacheFlushCount = 0;
|
||||
ULONG EXPORTED KeIcacheFlushCount = 0;
|
||||
#else
|
||||
/* Microsoft-style declarations */
|
||||
EXPORTED ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
|
||||
EXPORTED ULONG NtGlobalFlag = 0;
|
||||
EXPORTED CHAR KeNumberProcessors;
|
||||
EXPORTED LOADER_PARAMETER_BLOCK KeLoaderBlock;
|
||||
EXPORTED ULONG KeDcacheFlushCount = 0;
|
||||
EXPORTED ULONG KeIcacheFlushCount = 0;
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
static LOADER_MODULE KeLoaderModules[64];
|
||||
static UCHAR KeLoaderModuleStrings[64][256];
|
||||
static UCHAR KeLoaderCommandLine[256];
|
||||
|
@ -481,9 +497,9 @@ ExpInitializeExecutive(VOID)
|
|||
/* Allocate a stack for use when booting the processor */
|
||||
/* FIXME: The nonpaged memory for the stack is not released after use */
|
||||
ProcessorStack =
|
||||
ExAllocatePool(NonPagedPool, MM_STACK_SIZE) + MM_STACK_SIZE;
|
||||
(char*)ExAllocatePool(NonPagedPool, MM_STACK_SIZE) + MM_STACK_SIZE;
|
||||
Ki386InitialStackArray[((int)KeNumberProcessors)] =
|
||||
(PVOID)(ProcessorStack - MM_STACK_SIZE);
|
||||
(PVOID)((char*)ProcessorStack - MM_STACK_SIZE);
|
||||
HalInitializeProcessor(KeNumberProcessors, ProcessorStack);
|
||||
KeNumberProcessors++;
|
||||
}
|
||||
|
@ -714,7 +730,11 @@ ExpInitializeExecutive(VOID)
|
|||
Handles[1] = ProcessHandle;
|
||||
|
||||
/* Wait for the system to be initialized */
|
||||
#ifdef __GNUC__
|
||||
Timeout.QuadPart = -1200000000LL; /* 120 second timeout */
|
||||
#else
|
||||
Timeout.QuadPart = -1200000000; /* 120 second timeout */
|
||||
#endif
|
||||
Status = NtWaitForMultipleObjects(((LONG) sizeof(Handles) / sizeof(HANDLE)),
|
||||
Handles,
|
||||
WaitAny,
|
||||
|
@ -756,7 +776,11 @@ ExpInitializeExecutive(VOID)
|
|||
/*
|
||||
* Crash the system if the initial process terminates within 5 seconds.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
Timeout.QuadPart = -50000000LL;
|
||||
#else
|
||||
Timeout.QuadPart = -50000000;
|
||||
#endif
|
||||
Status = NtWaitForSingleObject(ProcessHandle,
|
||||
FALSE,
|
||||
&Timeout);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: process.c,v 1.17 2003/11/27 01:09:10 gdalsnes Exp $
|
||||
/* $Id: process.c,v 1.18 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/process.c
|
||||
|
@ -80,11 +80,17 @@ KeAttachProcess (PEPROCESS Process)
|
|||
CurrentThread->OldProcess = PsGetCurrentProcess();
|
||||
CurrentThread->ThreadsProcess = Process;
|
||||
PageDir = Process->Pcb.DirectoryTableBase.u.LowPart;
|
||||
DPRINT("Switching process context to %x\n",PageDir)
|
||||
DPRINT("Switching process context to %x\n",PageDir);
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %0,%%cr3\n\t"
|
||||
: /* no outputs */
|
||||
: "r" (PageDir));
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, PageDir;
|
||||
__asm mov cr3, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
KeLowerIrql(oldlvl);
|
||||
}
|
||||
|
||||
|
@ -115,10 +121,17 @@ KeDetachProcess (VOID)
|
|||
CurrentThread->ThreadsProcess = CurrentThread->OldProcess;
|
||||
CurrentThread->OldProcess = NULL;
|
||||
PageDir = CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase.u.LowPart;
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %0,%%cr3\n\t"
|
||||
: /* no inputs */
|
||||
: "r" (PageDir));
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, PageDir;
|
||||
__asm mov cr3, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
|
||||
KeLowerIrql(oldlvl);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: timer.c,v 1.63 2003/11/02 01:15:15 ekohl Exp $
|
||||
/* $Id: timer.c,v 1.64 2003/12/30 18:52:04 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <internal/ke.h>
|
||||
#include <internal/id.h>
|
||||
#include <internal/ps.h>
|
||||
#include <internal/safe.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -35,8 +36,8 @@
|
|||
/*
|
||||
* Current time
|
||||
*/
|
||||
static LARGE_INTEGER boot_time = (LARGE_INTEGER)0LL;
|
||||
static LARGE_INTEGER system_time = (LARGE_INTEGER)0LL;
|
||||
static LONGLONG boot_time = 0;
|
||||
static LONGLONG system_time = 0;
|
||||
|
||||
/*
|
||||
* Number of timer interrupts since initialisation
|
||||
|
@ -99,14 +100,27 @@ NtQueryPerformanceCounter(IN PLARGE_INTEGER Counter,
|
|||
{
|
||||
LARGE_INTEGER PerfCounter;
|
||||
LARGE_INTEGER PerfFrequency;
|
||||
NTSTATUS Status;
|
||||
|
||||
PerfCounter = KeQueryPerformanceCounter(&PerfFrequency);
|
||||
|
||||
if (Counter != NULL)
|
||||
Counter->QuadPart = PerfCounter.QuadPart;
|
||||
{
|
||||
Status = MmCopyToCaller(&Counter->QuadPart, &PerfCounter.QuadPart, sizeof(PerfCounter.QuadPart));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
|
||||
if (Frequency != NULL)
|
||||
Frequency->QuadPart = PerfFrequency.QuadPart;
|
||||
{
|
||||
Status = MmCopyToCaller(&Frequency->QuadPart, &PerfFrequency.QuadPart, sizeof(PerfFrequency.QuadPart));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -118,14 +132,20 @@ NtDelayExecution(IN ULONG Alertable,
|
|||
{
|
||||
NTSTATUS Status;
|
||||
LARGE_INTEGER Timeout;
|
||||
|
||||
|
||||
Status = MmCopyFromCaller(&Timeout, Interval, sizeof(Timeout));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
Timeout = *((PLARGE_INTEGER)Interval);
|
||||
DPRINT("NtDelayExecution(Alertable %d, Internal %x) IntervalP %x\n",
|
||||
Alertable, Internal, Timeout);
|
||||
|
||||
DPRINT("Execution delay is %d/%d\n",
|
||||
Timeout.u.HighPart, Timeout.u.LowPart);
|
||||
Status = KeDelayExecutionThread(UserMode, Alertable, &Timeout);
|
||||
Status = KeDelayExecutionThread(UserMode, (BOOLEAN)Alertable, &Timeout);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
@ -149,11 +169,10 @@ KeDelayExecutionThread (KPROCESSOR_MODE WaitMode,
|
|||
{
|
||||
PKTHREAD Thread = KeGetCurrentThread();
|
||||
|
||||
KeInitializeTimer(&Thread->Timer);
|
||||
KeSetTimer(&Thread->Timer, *Interval, NULL);
|
||||
return (KeWaitForSingleObject(&Thread->Timer,
|
||||
Executive,
|
||||
UserMode,
|
||||
(WaitMode == KernelMode) ? Executive : UserRequest, /* TMN: Was unconditionally Executive */
|
||||
WaitMode, /* TMN: Was UserMode */
|
||||
Alertable,
|
||||
NULL));
|
||||
}
|
||||
|
@ -191,8 +210,9 @@ KeQuerySystemTime(PLARGE_INTEGER CurrentTime)
|
|||
|
||||
KeRaiseIrql(PROFILE_LEVEL, &oldIrql);
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerValueLock);
|
||||
*CurrentTime = system_time;
|
||||
KeReleaseSpinLock(&TimerValueLock, oldIrql);
|
||||
CurrentTime->QuadPart = system_time;
|
||||
KeReleaseSpinLockFromDpcLevel(&TimerValueLock);
|
||||
KeLowerIrql(oldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,10 +221,12 @@ NtGetTickCount (PULONG UpTime)
|
|||
{
|
||||
LARGE_INTEGER TickCount;
|
||||
if (UpTime == NULL)
|
||||
{
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
KeQueryTickCount(&TickCount);
|
||||
*UpTime = TickCount.u.LowPart;
|
||||
return (STATUS_SUCCESS);
|
||||
return(MmCopyToCaller(UpTime, &TickCount.u.LowPart, sizeof(*UpTime)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,21 +276,19 @@ KeSetTimerEx (PKTIMER Timer,
|
|||
{
|
||||
KIRQL oldlvl;
|
||||
LARGE_INTEGER SystemTime;
|
||||
|
||||
BOOLEAN AlreadyInList;
|
||||
|
||||
DPRINT("KeSetTimerEx(Timer %x), DueTime: \n",Timer);
|
||||
|
||||
KeRaiseIrql(PROFILE_LEVEL, &oldlvl);
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerValueLock);
|
||||
assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
|
||||
|
||||
SystemTime = system_time;
|
||||
|
||||
KeReleaseSpinLock(&TimerValueLock, DISPATCH_LEVEL);
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &oldlvl);
|
||||
KeQuerySystemTime(&SystemTime);
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerListLock);
|
||||
|
||||
Timer->Dpc = Dpc;
|
||||
if (DueTime.QuadPart < 0)
|
||||
{
|
||||
|
||||
Timer->DueTime.QuadPart = SystemTime.QuadPart - DueTime.QuadPart;
|
||||
}
|
||||
else
|
||||
|
@ -277,15 +297,24 @@ KeSetTimerEx (PKTIMER Timer,
|
|||
}
|
||||
Timer->Period = Period;
|
||||
Timer->Header.SignalState = FALSE;
|
||||
if (Timer->TimerListEntry.Flink != NULL)
|
||||
AlreadyInList = (Timer->TimerListEntry.Flink == NULL) ? FALSE : TRUE;
|
||||
assert((Timer->TimerListEntry.Flink == NULL && Timer->TimerListEntry.Blink == NULL) ||
|
||||
(Timer->TimerListEntry.Flink != NULL && Timer->TimerListEntry.Blink != NULL));
|
||||
if (!AlreadyInList)
|
||||
{
|
||||
KeReleaseSpinLock(&TimerListLock, oldlvl);
|
||||
return(TRUE);
|
||||
assert(&TimerListHead != &Timer->TimerListEntry);
|
||||
InsertTailList(&TimerListHead, &Timer->TimerListEntry);
|
||||
assert(TimerListHead.Flink != &TimerListHead);
|
||||
assert(Timer->TimerListEntry.Flink != &Timer->TimerListEntry);
|
||||
}
|
||||
InsertTailList(&TimerListHead,&Timer->TimerListEntry);
|
||||
KeReleaseSpinLock(&TimerListLock, oldlvl);
|
||||
|
||||
return(FALSE);
|
||||
/*
|
||||
* TODO: Perhaps verify that the timer really is in
|
||||
* the TimerListHead list if AlreadyInList is TRUE?
|
||||
*/
|
||||
KeReleaseSpinLockFromDpcLevel(&TimerListLock);
|
||||
KeLowerIrql(oldlvl);
|
||||
|
||||
return AlreadyInList;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -304,14 +333,16 @@ KeCancelTimer (PKTIMER Timer)
|
|||
KIRQL oldlvl;
|
||||
|
||||
DPRINT("KeCancelTimer(Timer %x)\n",Timer);
|
||||
|
||||
|
||||
KeAcquireSpinLock(&TimerListLock, &oldlvl);
|
||||
|
||||
|
||||
if (Timer->TimerListEntry.Flink == NULL)
|
||||
{
|
||||
KeReleaseSpinLock(&TimerListLock, oldlvl);
|
||||
return(FALSE);
|
||||
}
|
||||
assert(&Timer->TimerListEntry != &TimerListHead);
|
||||
assert(Timer->TimerListEntry.Flink != &Timer->TimerListEntry);
|
||||
RemoveEntryList(&Timer->TimerListEntry);
|
||||
Timer->TimerListEntry.Flink = Timer->TimerListEntry.Blink = NULL;
|
||||
KeReleaseSpinLock(&TimerListLock, oldlvl);
|
||||
|
@ -325,7 +356,7 @@ KeCancelTimer (PKTIMER Timer)
|
|||
BOOLEAN STDCALL
|
||||
KeReadStateTimer (PKTIMER Timer)
|
||||
{
|
||||
return(Timer->Header.SignalState);
|
||||
return (BOOLEAN)(Timer->Header.SignalState);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -361,7 +392,7 @@ KeInitializeTimerEx (PKTIMER Timer,
|
|||
*/
|
||||
{
|
||||
ULONG IType;
|
||||
|
||||
|
||||
if (Type == NotificationTimer)
|
||||
{
|
||||
IType = InternalNotificationTimer;
|
||||
|
@ -375,7 +406,7 @@ KeInitializeTimerEx (PKTIMER Timer,
|
|||
assert(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
KeInitializeDispatcherHeader(&Timer->Header,
|
||||
IType,
|
||||
sizeof(KTIMER) / sizeof(ULONG),
|
||||
|
@ -397,34 +428,40 @@ KeQueryTickCount(PLARGE_INTEGER TickCount)
|
|||
TickCount->QuadPart = KeTickCount;
|
||||
}
|
||||
|
||||
/*
|
||||
* We enter this function at IRQL DISPATCH_LEVEL, and with the
|
||||
* TimerListLock held.
|
||||
*/
|
||||
STATIC VOID
|
||||
HandleExpiredTimer(PKTIMER current)
|
||||
HandleExpiredTimer(PKTIMER Timer)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
DPRINT("HandleExpiredTime(current %x)\n",current);
|
||||
if (current->Dpc != NULL)
|
||||
DPRINT("HandleExpiredTime(Timer %x) at IRQL: %d\n", Timer, KeGetCurrentIrql());
|
||||
if (Timer->Dpc != NULL)
|
||||
{
|
||||
DPRINT("current->Dpc %x current->Dpc->DeferredRoutine %x\n",
|
||||
current->Dpc, current->Dpc->DeferredRoutine);
|
||||
KeInsertQueueDpc(current->Dpc,
|
||||
DPRINT("Timer->Dpc %x Timer->Dpc->DeferredRoutine %x\n",
|
||||
Timer->Dpc, Timer->Dpc->DeferredRoutine);
|
||||
KeInsertQueueDpc(Timer->Dpc,
|
||||
NULL,
|
||||
NULL);
|
||||
DPRINT("Finished dpc routine\n");
|
||||
}
|
||||
OldIrql = KeAcquireDispatcherDatabaseLock ();
|
||||
current->Header.SignalState = TRUE;
|
||||
KeDispatcherObjectWake(¤t->Header);
|
||||
KeReleaseDispatcherDatabaseLock (OldIrql);
|
||||
if (current->Period != 0)
|
||||
|
||||
assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
||||
|
||||
KeAcquireDispatcherDatabaseLockAtDpcLevel();
|
||||
Timer->Header.SignalState = TRUE;
|
||||
KeDispatcherObjectWake(&Timer->Header);
|
||||
KeReleaseDispatcherDatabaseLockFromDpcLevel();
|
||||
if (Timer->Period != 0)
|
||||
{
|
||||
current->DueTime.QuadPart +=
|
||||
current->Period * SYSTEM_TIME_UNITS_PER_MSEC;
|
||||
Timer->DueTime.QuadPart +=
|
||||
Timer->Period * SYSTEM_TIME_UNITS_PER_MSEC;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveEntryList(¤t->TimerListEntry);
|
||||
current->TimerListEntry.Flink = current->TimerListEntry.Blink = NULL;
|
||||
assert(&Timer->TimerListEntry != &TimerListHead);
|
||||
RemoveEntryList(&Timer->TimerListEntry);
|
||||
Timer->TimerListEntry.Flink = Timer->TimerListEntry.Blink = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,18 +474,13 @@ KeExpireTimers(PKDPC Dpc,
|
|||
PLIST_ENTRY current_entry = NULL;
|
||||
PKTIMER current = NULL;
|
||||
ULONG Eip = (ULONG)Arg1;
|
||||
KIRQL oldIrql;
|
||||
LARGE_INTEGER SystemTime;
|
||||
|
||||
DPRINT("KeExpireTimers()\n");
|
||||
|
||||
KeRaiseIrql(PROFILE_LEVEL, &oldIrql);
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerValueLock);
|
||||
assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
||||
|
||||
SystemTime = system_time;
|
||||
|
||||
KeReleaseSpinLock(&TimerValueLock, oldIrql);
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerListLock);
|
||||
KeQuerySystemTime(&SystemTime);
|
||||
|
||||
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
|
||||
{
|
||||
|
@ -456,13 +488,19 @@ KeExpireTimers(PKDPC Dpc,
|
|||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerListLock);
|
||||
|
||||
current_entry = TimerListHead.Flink;
|
||||
|
||||
assert(current_entry);
|
||||
|
||||
while (current_entry != &TimerListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, KTIMER, TimerListEntry);
|
||||
|
||||
assert(current);
|
||||
assert(current_entry != &TimerListHead);
|
||||
assert(current_entry->Flink != current_entry);
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
if ((ULONGLONG) SystemTime.QuadPart >= current->DueTime.QuadPart)
|
||||
{
|
||||
|
@ -471,7 +509,7 @@ KeExpireTimers(PKDPC Dpc,
|
|||
}
|
||||
|
||||
KiAddProfileEvent(ProfileTime, Eip);
|
||||
|
||||
|
||||
KeReleaseSpinLockFromDpcLevel(&TimerListLock);
|
||||
}
|
||||
|
||||
|
@ -499,9 +537,9 @@ KiUpdateSystemTime(KIRQL oldIrql,
|
|||
SharedUserData->TickCountLow++;
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&TimerValueLock);
|
||||
system_time.QuadPart += CLOCK_INCREMENT;
|
||||
system_time += CLOCK_INCREMENT;
|
||||
KeReleaseSpinLockFromDpcLevel(&TimerValueLock);
|
||||
|
||||
|
||||
/*
|
||||
* Queue a DPC that will expire timers
|
||||
*/
|
||||
|
@ -530,7 +568,7 @@ KeInitializeTimerImpl(VOID)
|
|||
*/
|
||||
HalQueryRealTimeClock(&TimeFields);
|
||||
RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
|
||||
boot_time=SystemBootTime;
|
||||
boot_time=SystemBootTime.QuadPart;
|
||||
system_time=boot_time;
|
||||
|
||||
SharedUserData->TickCountLow = 0;
|
||||
|
|
|
@ -40,10 +40,10 @@ VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header,
|
|||
ULONG Size,
|
||||
ULONG SignalState)
|
||||
{
|
||||
Header->Type = Type;
|
||||
Header->Type = (UCHAR)Type;
|
||||
Header->Absolute = 0;
|
||||
Header->Inserted = 0;
|
||||
Header->Size = Size;
|
||||
Header->Size = (UCHAR)Size;
|
||||
Header->SignalState = SignalState;
|
||||
InitializeListHead(&(Header->WaitListHead));
|
||||
}
|
||||
|
@ -503,7 +503,6 @@ KeWaitForMultipleObjects(ULONG Count,
|
|||
*/
|
||||
if (Timeout != NULL && Timeout->QuadPart != 0)
|
||||
{
|
||||
KeInitializeTimer(&CurrentThread->Timer);
|
||||
KeSetTimer(&CurrentThread->Timer, *Timeout, NULL);
|
||||
}
|
||||
|
||||
|
@ -622,8 +621,8 @@ KeWaitForMultipleObjects(ULONG Count,
|
|||
|
||||
blk->Object = KiGetWaitableObjectFromObject(Object[i]);
|
||||
blk->Thread = CurrentThread;
|
||||
blk->WaitKey = STATUS_WAIT_0 + i;
|
||||
blk->WaitType = WaitType;
|
||||
blk->WaitKey = (USHORT)(STATUS_WAIT_0 + i);
|
||||
blk->WaitType = (USHORT)WaitType;
|
||||
|
||||
if (i == (Count - 1))
|
||||
{
|
||||
|
@ -680,7 +679,7 @@ KeWaitForMultipleObjects(ULONG Count,
|
|||
}
|
||||
}
|
||||
|
||||
PsBlockThread(&Status, Alertable, WaitMode, TRUE, WaitIrql, WaitReason);
|
||||
PsBlockThread(&Status, Alertable, WaitMode, TRUE, WaitIrql, (UCHAR)WaitReason);
|
||||
|
||||
//io completion
|
||||
if (CurrentThread->Queue)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: init.c,v 1.44 2003/11/17 02:12:51 hyperion Exp $
|
||||
/* $Id: init.c,v 1.45 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ldr/init.c
|
||||
|
@ -513,7 +513,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
|||
Context.FloatSave.StatusWord = 0xffff0000;
|
||||
Context.FloatSave.TagWord = 0xffffffff;
|
||||
Context.FloatSave.DataSelector = 0xffff0000;
|
||||
Context.Eip = (ULONG_PTR)(ImageBaseAddress + (ULONG_PTR)Sii.EntryPoint);
|
||||
Context.Eip = (ULONG_PTR)((char*)ImageBaseAddress + (ULONG_PTR)Sii.EntryPoint);
|
||||
Context.SegCs = USER_CS;
|
||||
Context.SegDs = USER_DS;
|
||||
Context.SegEs = USER_DS;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: loader.c,v 1.137 2003/10/15 17:04:39 navaraf Exp $
|
||||
/* $Id: loader.c,v 1.138 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -41,7 +41,11 @@
|
|||
#ifdef HALDBG
|
||||
#include <internal/ntosdbg.h>
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define ps(args...)
|
||||
#else
|
||||
#define ps
|
||||
#endif /* __GNUC__ */
|
||||
#endif
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -638,7 +642,7 @@ LdrpQueryModuleInformation(PVOID Buffer,
|
|||
Smi->Module[ModuleCount].Base = current->Base;
|
||||
Smi->Module[ModuleCount].Size = current->Length;
|
||||
Smi->Module[ModuleCount].Flags = 0; /* Flags ??? (GN) */
|
||||
Smi->Module[ModuleCount].Index = ModuleCount;
|
||||
Smi->Module[ModuleCount].Index = (USHORT)ModuleCount;
|
||||
Smi->Module[ModuleCount].NameLength = 0;
|
||||
Smi->Module[ModuleCount].LoadCount = 0; /* FIXME */
|
||||
|
||||
|
@ -842,8 +846,8 @@ PageNeedsWriteAccess(PVOID PageStart,
|
|||
Length =
|
||||
max(PESectionHeaders[Idx].Misc.VirtualSize,
|
||||
PESectionHeaders[Idx].SizeOfRawData);
|
||||
BaseAddress = PESectionHeaders[Idx].VirtualAddress + DriverBase;
|
||||
NeedsWriteAccess = BaseAddress < PageStart + PAGE_SIZE &&
|
||||
BaseAddress = PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase;
|
||||
NeedsWriteAccess = (char*)BaseAddress < (char*)PageStart + PAGE_SIZE &&
|
||||
PageStart < (PVOID)((PCHAR) BaseAddress + Length);
|
||||
}
|
||||
}
|
||||
|
@ -958,17 +962,17 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
|||
(IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA))
|
||||
{
|
||||
DPRINT("PESectionHeaders[Idx].VirtualAddress + DriverBase %x\n",
|
||||
PESectionHeaders[Idx].VirtualAddress + DriverBase);
|
||||
memcpy(PESectionHeaders[Idx].VirtualAddress + DriverBase,
|
||||
(PVOID)(ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
|
||||
PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase);
|
||||
memcpy(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
|
||||
(PVOID)((char*)ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
|
||||
PESectionHeaders[Idx].Misc.VirtualSize > PESectionHeaders[Idx].SizeOfRawData
|
||||
? PESectionHeaders[Idx].SizeOfRawData : PESectionHeaders[Idx].Misc.VirtualSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("PESectionHeaders[Idx].VirtualAddress + DriverBase %x\n",
|
||||
PESectionHeaders[Idx].VirtualAddress + DriverBase);
|
||||
memset(PESectionHeaders[Idx].VirtualAddress + DriverBase,
|
||||
PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase);
|
||||
memset(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
|
||||
'\0', PESectionHeaders[Idx].Misc.VirtualSize);
|
||||
|
||||
}
|
||||
|
@ -998,8 +1002,8 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
|||
DPRINT("Name %.8s PESectionHeader[Idx].PointerToRawData %x\n",
|
||||
PESectionHeaders[Idx].Name,
|
||||
PESectionHeaders[Idx].PointerToRawData);
|
||||
RelocDir = PESectionHeaders[Idx].PointerToRawData +
|
||||
ModuleLoadBase;
|
||||
RelocDir = (PRELOCATION_DIRECTORY)(PESectionHeaders[Idx].PointerToRawData +
|
||||
(char*)ModuleLoadBase);
|
||||
CurrentSize = PESectionHeaders[Idx].Misc.VirtualSize;
|
||||
break;
|
||||
}
|
||||
|
@ -1029,7 +1033,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
|||
|
||||
Offset = RelocEntry[Idx].TypeOffset & 0xfff;
|
||||
Type = (RelocEntry[Idx].TypeOffset >> 12) & 0xf;
|
||||
RelocItem = (PDWORD)(DriverBase + RelocDir->VirtualAddress +
|
||||
RelocItem = (PDWORD)((char*)DriverBase + RelocDir->VirtualAddress +
|
||||
Offset);
|
||||
/* DPRINT(" reloc at %08lx %x %s old:%08lx new:%08lx\n",
|
||||
RelocItem,
|
||||
|
@ -1119,7 +1123,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
|||
pName = NULL;
|
||||
|
||||
|
||||
Hint = (*FunctionNameList) & 0xffff;
|
||||
Hint = (WORD)((*FunctionNameList) & 0xffff);
|
||||
}
|
||||
else // hint-name
|
||||
{
|
||||
|
@ -1166,7 +1170,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
|||
Length =
|
||||
max(PESectionHeaders[Idx].Misc.VirtualSize,
|
||||
PESectionHeaders[Idx].SizeOfRawData);
|
||||
BaseAddress = PESectionHeaders[Idx].VirtualAddress + DriverBase;
|
||||
BaseAddress = PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase;
|
||||
PageAddress = (PVOID)PAGE_ROUND_DOWN(BaseAddress);
|
||||
if (! PageNeedsWriteAccess(PageAddress, DriverBase, PEFileHeader, PESectionHeaders))
|
||||
{
|
||||
|
@ -1349,16 +1353,16 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
|
|||
{
|
||||
//ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
|
||||
//PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase);
|
||||
memcpy(PESectionHeaders[Idx].VirtualAddress + DriverBase,
|
||||
(PVOID)(ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
|
||||
memcpy(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
|
||||
(PVOID)((char*)ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
|
||||
PESectionHeaders[Idx].Misc.VirtualSize > PESectionHeaders[Idx].SizeOfRawData ?
|
||||
PESectionHeaders[Idx].SizeOfRawData : PESectionHeaders[Idx].Misc.VirtualSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
|
||||
PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase);
|
||||
memset(PESectionHeaders[Idx].VirtualAddress + DriverBase,
|
||||
PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase);
|
||||
memset(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
|
||||
'\0',
|
||||
PESectionHeaders[Idx].Misc.VirtualSize);
|
||||
}
|
||||
|
@ -1383,7 +1387,7 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
|
|||
DPRINT("Name %.8s PESectionHeader[Idx].PointerToRawData %x\n",
|
||||
PESectionHeaders[Idx].Name,
|
||||
PESectionHeaders[Idx].PointerToRawData);
|
||||
RelocDir = PESectionHeaders[Idx].PointerToRawData + ModuleLoadBase;
|
||||
RelocDir = (PRELOCATION_DIRECTORY)(PESectionHeaders[Idx].PointerToRawData + (char*)ModuleLoadBase);
|
||||
CurrentSize = PESectionHeaders[Idx].Misc.VirtualSize;
|
||||
break;
|
||||
}
|
||||
|
@ -1406,7 +1410,7 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
|
|||
|
||||
Offset = RelocEntry[Idx].TypeOffset & 0xfff;
|
||||
Type = (RelocEntry[Idx].TypeOffset >> 12) & 0xf;
|
||||
RelocItem = (PULONG)(DriverBase + RelocDir->VirtualAddress + Offset);
|
||||
RelocItem = (PULONG)((char*)DriverBase + RelocDir->VirtualAddress + Offset);
|
||||
if (Type == 3)
|
||||
{
|
||||
(*RelocItem) += RelocDelta;
|
||||
|
@ -1475,7 +1479,7 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
|
|||
{
|
||||
/* Hint */
|
||||
pName = NULL;
|
||||
Hint = (*FunctionNameList) & 0xffff;
|
||||
Hint = (USHORT)((*FunctionNameList) & 0xffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1523,9 +1527,9 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + ModuleObject->Base);
|
||||
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + ModuleObject->Base);
|
||||
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + ModuleObject->Base);
|
||||
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + (char*)ModuleObject->Base);
|
||||
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + (char*)ModuleObject->Base);
|
||||
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + (char*)ModuleObject->Base);
|
||||
|
||||
ExportAddress = 0;
|
||||
|
||||
|
@ -1599,9 +1603,9 @@ LdrSafePEGetExportAddress(PVOID ImportModuleBase,
|
|||
ps("ExportDir %x\n", ExportDir);
|
||||
}
|
||||
|
||||
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + ImportModuleBase);
|
||||
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + ImportModuleBase);
|
||||
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + ImportModuleBase);
|
||||
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + (char*)ImportModuleBase);
|
||||
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + (char*)ImportModuleBase);
|
||||
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + (char*)ImportModuleBase);
|
||||
|
||||
ExportAddress = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtl.c,v 1.17 2003/07/11 01:23:15 royce Exp $
|
||||
/* $Id: rtl.c,v 1.18 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -33,7 +33,7 @@ RtlImageNtHeader (IN PVOID BaseAddress)
|
|||
PIMAGE_NT_HEADERS NTHeaders;
|
||||
|
||||
DosHeader = (PIMAGE_DOS_HEADER)BaseAddress;
|
||||
NTHeaders = (PIMAGE_NT_HEADERS)(BaseAddress + DosHeader->e_lfanew);
|
||||
NTHeaders = (PIMAGE_NT_HEADERS)((char*)BaseAddress + DosHeader->e_lfanew);
|
||||
if ((DosHeader->e_magic != IMAGE_DOS_MAGIC)
|
||||
|| (DosHeader->e_lfanew == 0L)
|
||||
|| (*(PULONG) NTHeaders != IMAGE_PE_MAGIC))
|
||||
|
@ -73,7 +73,7 @@ RtlImageDirectoryEntryToData (IN PVOID BaseAddress,
|
|||
*Size = NtHeader->OptionalHeader.DataDirectory[Directory].Size;
|
||||
|
||||
if (ImageLoaded)
|
||||
return (PVOID)(BaseAddress + Va);
|
||||
return (PVOID)((char*)BaseAddress + Va);
|
||||
|
||||
/* image mapped as ordinary file, we must find raw pointer */
|
||||
SectionHeader = (PIMAGE_SECTION_HEADER)(NtHeader + 1);
|
||||
|
@ -81,7 +81,7 @@ RtlImageDirectoryEntryToData (IN PVOID BaseAddress,
|
|||
while (Count--)
|
||||
{
|
||||
if (SectionHeader->VirtualAddress == Va)
|
||||
return (PVOID)(BaseAddress + SectionHeader->PointerToRawData);
|
||||
return (PVOID)((char*)BaseAddress + SectionHeader->PointerToRawData);
|
||||
SectionHeader++;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ RtlImageRvaToVa (
|
|||
*SectionHeader = Section;
|
||||
}
|
||||
|
||||
return (ULONG)(BaseAddress +
|
||||
return (ULONG)((char*)BaseAddress +
|
||||
Rva +
|
||||
Section->PointerToRawData -
|
||||
Section->VirtualAddress);
|
||||
|
@ -172,15 +172,15 @@ LdrGetProcedureAddress (IN PVOID BaseAddress,
|
|||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
AddressPtr = (PULONG)RVA(BaseAddress, ExportDir->AddressOfFunctions);
|
||||
AddressPtr = (PULONG)RVA((char*)BaseAddress, ExportDir->AddressOfFunctions);
|
||||
if (Name && Name->Length)
|
||||
{
|
||||
ULONG minn, maxn;
|
||||
|
||||
/* by name */
|
||||
OrdinalPtr =
|
||||
(PUSHORT)RVA(BaseAddress, ExportDir->AddressOfNameOrdinals);
|
||||
NamePtr = (PULONG)RVA(BaseAddress, ExportDir->AddressOfNames);
|
||||
(PUSHORT)RVA((char*)BaseAddress, ExportDir->AddressOfNameOrdinals);
|
||||
NamePtr = (PULONG)RVA((char*)BaseAddress, ExportDir->AddressOfNames);
|
||||
|
||||
minn = 0; maxn = ExportDir->NumberOfNames;
|
||||
while (minn <= maxn)
|
||||
|
@ -189,12 +189,12 @@ LdrGetProcedureAddress (IN PVOID BaseAddress,
|
|||
LONG res;
|
||||
|
||||
mid = (minn + maxn) / 2;
|
||||
res = _strnicmp(Name->Buffer, (PCH)RVA(BaseAddress, NamePtr[mid]),
|
||||
res = _strnicmp(Name->Buffer, (PCH)RVA((char*)BaseAddress, NamePtr[mid]),
|
||||
Name->Length);
|
||||
if (res == 0)
|
||||
{
|
||||
*ProcedureAddress =
|
||||
(PVOID)RVA(BaseAddress, AddressPtr[OrdinalPtr[mid]]);
|
||||
(PVOID)RVA((char*)BaseAddress, AddressPtr[OrdinalPtr[mid]]);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
else if (res > 0)
|
||||
|
@ -210,7 +210,7 @@ LdrGetProcedureAddress (IN PVOID BaseAddress,
|
|||
for (i = 0; i < ExportDir->NumberOfNames; i++, NamePtr++, OrdinalPtr++)
|
||||
{
|
||||
if (!_strnicmp(Name->Buffer,
|
||||
(char*)(BaseAddress + *NamePtr), Name->Length))
|
||||
(char*)((char*)BaseAddress + *NamePtr), Name->Length))
|
||||
{
|
||||
*ProcedureAddress =
|
||||
(PVOID)((ULONG)BaseAddress +
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: complete.c,v 1.9 2003/07/11 01:23:15 royce Exp $
|
||||
/* $Id: complete.c,v 1.10 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -26,7 +26,7 @@
|
|||
* NtCompleteConnectPort@4
|
||||
*
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtCompleteConnectPort (HANDLE PortHandle)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: connect.c,v 1.21 2003/11/20 11:06:35 ekohl Exp $
|
||||
/* $Id: connect.c,v 1.22 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -514,7 +514,7 @@ NtConnectPort (PHANDLE UnsafeConnectedPortHandle,
|
|||
*
|
||||
* RETURN VALUE
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtAcceptConnectPort (PHANDLE ServerPortHandle,
|
||||
HANDLE NamedPortHandle,
|
||||
PLPC_MESSAGE LpcMessage,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.13 2003/09/25 20:04:59 ekohl Exp $
|
||||
/* $Id: create.c,v 1.14 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -90,7 +90,7 @@ NiCreatePort (PVOID ObjectBody,
|
|||
*
|
||||
* RETURN VALUE
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtCreatePort (PHANDLE PortHandle,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
ULONG MaxConnectInfoLength,
|
||||
|
@ -168,7 +168,7 @@ NtCreatePort (PHANDLE PortHandle,
|
|||
*
|
||||
* RETURN VALUE
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtCreateWaitablePort (OUT PHANDLE PortHandle,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN ULONG MaxConnectInfoLength,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: listen.c,v 1.7 2003/07/11 01:23:15 royce Exp $
|
||||
/* $Id: listen.c,v 1.8 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
* NOTE
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtListenPort (IN HANDLE PortHandle,
|
||||
IN PLPC_MESSAGE ConnectMsg)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: query.c,v 1.7 2003/07/11 01:23:15 royce Exp $
|
||||
/* $Id: query.c,v 1.8 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -42,7 +42,7 @@
|
|||
* P. Dabak reports that this system service seems to return
|
||||
* no information.
|
||||
*/
|
||||
EXPORTED NTSTATUS STDCALL
|
||||
/*EXPORTED*/ NTSTATUS STDCALL
|
||||
NtQueryInformationPort (IN HANDLE PortHandle,
|
||||
IN CINT PortInformationClass,
|
||||
OUT PVOID PortInformation,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: anonmem.c,v 1.22 2003/11/30 17:24:22 hbirr Exp $
|
||||
/* $Id: anonmem.c,v 1.23 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/anonmem.c
|
||||
|
@ -454,19 +454,19 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
|||
LARGE_INTEGER PhysicalAddr;
|
||||
|
||||
if (MmIsPageSwapEntry(AddressSpace->Process,
|
||||
BaseAddress + (i * PAGE_SIZE)))
|
||||
(char*)BaseAddress + (i * PAGE_SIZE)))
|
||||
{
|
||||
SWAPENTRY SwapEntry;
|
||||
|
||||
MmDeletePageFileMapping(AddressSpace->Process,
|
||||
BaseAddress + (i * PAGE_SIZE),
|
||||
(char*)BaseAddress + (i * PAGE_SIZE),
|
||||
&SwapEntry);
|
||||
MmFreeSwapPage(SwapEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
MmDeleteVirtualMapping(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGE_SIZE),
|
||||
(char*)BaseAddress + (i*PAGE_SIZE),
|
||||
FALSE, NULL, &PhysicalAddr);
|
||||
if (PhysicalAddr.QuadPart != 0)
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
|||
MmSetSavedSwapEntryPage(PhysicalAddr, 0);
|
||||
}
|
||||
MmDeleteRmap(PhysicalAddr, AddressSpace->Process,
|
||||
BaseAddress + (i * PAGE_SIZE));
|
||||
(char*)BaseAddress + (i * PAGE_SIZE));
|
||||
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddr);
|
||||
}
|
||||
}
|
||||
|
@ -497,10 +497,10 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
|||
for (i=0; i < PAGE_ROUND_UP(RegionSize)/PAGE_SIZE; i++)
|
||||
{
|
||||
if (MmIsPagePresent(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGE_SIZE)))
|
||||
(char*)BaseAddress + (i*PAGE_SIZE)))
|
||||
{
|
||||
MmSetPageProtect(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGE_SIZE),
|
||||
(char*)BaseAddress + (i*PAGE_SIZE),
|
||||
NewProtect);
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ MmFreeVirtualMemory(PEPROCESS Process,
|
|||
}
|
||||
|
||||
PageOp = MmCheckForPageOp(MemoryArea, Process->UniqueProcessId,
|
||||
MemoryArea->BaseAddress + (i * PAGE_SIZE),
|
||||
(char*)MemoryArea->BaseAddress + (i * PAGE_SIZE),
|
||||
NULL, 0);
|
||||
if (PageOp != NULL)
|
||||
{
|
||||
|
@ -882,7 +882,7 @@ MmQueryAnonMem(PMEMORY_AREA MemoryArea,
|
|||
Address, &RegionBase);
|
||||
Info->AllocationBase = RegionBase;
|
||||
Info->AllocationProtect = Region->Protect; /* FIXME */
|
||||
Info->RegionSize = RegionBase + Region->Length - Info->BaseAddress;
|
||||
Info->RegionSize = (char*)RegionBase + Region->Length - (char*)Info->BaseAddress;
|
||||
Info->State = Region->Type;
|
||||
Info->Protect = Region->Protect;
|
||||
Info->Type = MEM_PRIVATE;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: balance.c,v 1.24 2003/11/24 16:15:00 gvg Exp $
|
||||
/* $Id: balance.c,v 1.25 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/balance.c
|
||||
|
@ -112,7 +112,11 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PHYSICAL_ADDRESS Page)
|
|||
PLIST_ENTRY Entry;
|
||||
KIRQL oldIrql;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
if (Page.QuadPart == 0LL)
|
||||
#else
|
||||
if (Page.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
DPRINT1("Tried to release page zero.\n");
|
||||
KEBUGCHECK(0);
|
||||
|
@ -228,7 +232,11 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
if (Consumer == MC_NPPOOL || MiIsBalancerThread())
|
||||
{
|
||||
Page = MmAllocPage(Consumer, 0);
|
||||
#if defined(__GNUC__)
|
||||
if (Page.QuadPart == 0LL)
|
||||
#else
|
||||
if (Page.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
@ -256,7 +264,11 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
}
|
||||
|
||||
/* Insert an allocation request. */
|
||||
#if defined(__GNUC__)
|
||||
Request.Page.QuadPart = 0LL;
|
||||
#else
|
||||
Request.Page.QuadPart = 0;
|
||||
#endif
|
||||
KeInitializeEvent(&Request.Event, NotificationEvent, FALSE);
|
||||
InterlockedIncrement((LONG *)&MiPagesRequired);
|
||||
|
||||
|
@ -276,7 +288,11 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
NULL);
|
||||
|
||||
Page = Request.Page;
|
||||
#if defined(__GNUC__)
|
||||
if (Page.QuadPart == 0LL)
|
||||
#else
|
||||
if (Page.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
@ -290,7 +306,11 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
* Actually allocate the page.
|
||||
*/
|
||||
Page = MmAllocPage(Consumer, 0);
|
||||
#if defined(__GNUC__)
|
||||
if (Page.QuadPart == 0LL)
|
||||
#else
|
||||
if (Page.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
@ -390,13 +410,21 @@ MiInitBalancerThread(VOID)
|
|||
{
|
||||
KPRIORITY Priority;
|
||||
NTSTATUS Status;
|
||||
#if !defined(__GNUC__)
|
||||
LARGE_INTEGER dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = -20000000; /* 2 sec */;
|
||||
#endif
|
||||
|
||||
CHECKPOINT;
|
||||
|
||||
KeInitializeEvent(&MiBalancerEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeTimerEx(&MiBalancerTimer, SynchronizationTimer);
|
||||
KeSetTimerEx(&MiBalancerTimer,
|
||||
#if defined(__GNUC__)
|
||||
(LARGE_INTEGER)(LONGLONG)-20000000LL, /* 2 sec */
|
||||
#else
|
||||
dummyJunkNeeded,
|
||||
#endif
|
||||
2000, /* 2 sec */
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: cont.c,v 1.28 2003/07/11 01:23:15 royce Exp $
|
||||
/* $Id: cont.c,v 1.29 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -62,7 +62,11 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
|||
PBase = MmGetContinuousPages(NumberOfBytes,
|
||||
HighestAcceptableAddress,
|
||||
Alignment);
|
||||
#if defined(__GNUC__)
|
||||
if (PBase.QuadPart == 0LL)
|
||||
#else
|
||||
if (PBase.QuadPart == 0)
|
||||
#endif
|
||||
{
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
||||
|
@ -75,10 +79,18 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
|||
}
|
||||
for (i = 0; i < (PAGE_ROUND_UP(NumberOfBytes) / 4096); i++)
|
||||
{
|
||||
#if !defined(__GNUC__)
|
||||
LARGE_INTEGER dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = PBase.QuadPart + (i * 4096);
|
||||
#endif
|
||||
MmCreateVirtualMapping(NULL,
|
||||
BaseAddress + (i * 4096),
|
||||
(char*)BaseAddress + (i * 4096),
|
||||
PAGE_EXECUTE_READWRITE | PAGE_SYSTEM,
|
||||
#if defined(__GNUC__)
|
||||
(LARGE_INTEGER)(PBase.QuadPart + (i * 4096)),
|
||||
#else
|
||||
dummyJunkNeeded,
|
||||
#endif
|
||||
TRUE);
|
||||
}
|
||||
return(BaseAddress);
|
||||
|
|
|
@ -96,7 +96,14 @@ MmGetLRUFirstUserPage(VOID)
|
|||
if (NextListEntry == &UsedPageListHeads[MC_USER])
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((LARGE_INTEGER)0LL);
|
||||
#if defined(__GNUC__)
|
||||
return((PHYSICAL_ADDRESS)0LL);
|
||||
#else
|
||||
{
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
|
||||
return dummyJunkNeeded;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
|
@ -144,7 +151,14 @@ MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress)
|
|||
if (NextListEntry == &UsedPageListHeads[MC_USER])
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((LARGE_INTEGER)0LL);
|
||||
#if defined(__GNUC__)
|
||||
return((PHYSICAL_ADDRESS)0LL);
|
||||
#else
|
||||
{
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
|
||||
return dummyJunkNeeded;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
|
@ -201,7 +215,14 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
|||
if (start == -1 || length != NrPages)
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((LARGE_INTEGER)(LONGLONG)0);
|
||||
#if defined(__GNUC__)
|
||||
return((PHYSICAL_ADDRESS)(LONGLONG)0);
|
||||
#else
|
||||
{
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
|
||||
return dummyJunkNeeded;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
for (i = start; i < (start + length); i++)
|
||||
{
|
||||
|
@ -216,7 +237,14 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
|||
&MmPageArray[i].ListEntry);
|
||||
}
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((LARGE_INTEGER)((LONGLONG)start * PAGE_SIZE));
|
||||
#if defined(__GNUC__)
|
||||
return((PHYSICAL_ADDRESS)((LONGLONG)start * PAGE_SIZE));
|
||||
#else
|
||||
{
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = { start * PAGE_SIZE };
|
||||
return dummyJunkNeeded;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
|
@ -349,7 +377,7 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
|
||||
LastKernelAddress = ((ULONG)LastKernelAddress + (Reserved * PAGE_SIZE));
|
||||
LastPhysKernelAddress = (PVOID)PAGE_ROUND_UP(LastPhysKernelAddress);
|
||||
LastPhysKernelAddress = LastPhysKernelAddress + (Reserved * PAGE_SIZE);
|
||||
LastPhysKernelAddress = (char*)LastPhysKernelAddress + (Reserved * PAGE_SIZE);
|
||||
|
||||
MmStats.NrTotalPages = 0;
|
||||
MmStats.NrSystemPages = 0;
|
||||
|
@ -360,17 +388,26 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
|
||||
for (i = 0; i < Reserved; i++)
|
||||
{
|
||||
PVOID Address = (PVOID)(ULONG)MmPageArray + (i * PAGE_SIZE);
|
||||
PVOID Address = (char*)(ULONG)MmPageArray + (i * PAGE_SIZE);
|
||||
if (!MmIsPagePresent(NULL, Address))
|
||||
{
|
||||
ULONG PhysicalAddress;
|
||||
PhysicalAddress = (ULONG)LastPhysKernelAddress -
|
||||
#if !defined(__GNUC__)
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = {
|
||||
(ULONG)LastPhysKernelAddress -
|
||||
(Reserved * PAGE_SIZE) + (i * PAGE_SIZE)
|
||||
};
|
||||
#endif
|
||||
ULONG PhysicalAddress = (ULONG)LastPhysKernelAddress -
|
||||
(Reserved * PAGE_SIZE) + (i * PAGE_SIZE);
|
||||
Status =
|
||||
MmCreateVirtualMappingUnsafe(NULL,
|
||||
Address,
|
||||
PAGE_READWRITE,
|
||||
#if defined(__GNUC__)
|
||||
(PHYSICAL_ADDRESS)(LONGLONG)PhysicalAddress,
|
||||
#else
|
||||
dummyJunkNeeded,
|
||||
#endif
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -378,7 +415,7 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
KEBUGCHECK(0);
|
||||
}
|
||||
}
|
||||
memset((PVOID)MmPageArray + (i * PAGE_SIZE), 0, PAGE_SIZE);
|
||||
memset((char*)MmPageArray + (i * PAGE_SIZE), 0, PAGE_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -859,7 +896,14 @@ MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry)
|
|||
{
|
||||
DPRINT1("MmAllocPage(): Out of memory\n");
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
#if defined(__GNUC__)
|
||||
return((PHYSICAL_ADDRESS)0LL);
|
||||
#else
|
||||
{
|
||||
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
|
||||
return dummyJunkNeeded;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ListEntry = RemoveTailList(&FreeUnzeroedPageListHead);
|
||||
UnzeroedPageCount--;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: page.c,v 1.60 2003/10/12 17:05:48 hbirr Exp $
|
||||
/* $Id: page.c,v 1.61 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/i386/page.c
|
||||
|
@ -61,7 +61,16 @@
|
|||
|
||||
ULONG MmGlobalKernelPageDirectory[1024] = {0, };
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define PTE_TO_PAGE(X) ((LARGE_INTEGER)(LONGLONG)(PAGE_MASK(X)))
|
||||
#else
|
||||
__inline LARGE_INTEGER PTE_TO_PAGE(ULONG npage)
|
||||
{
|
||||
LARGE_INTEGER dummy;
|
||||
dummy.QuadPart = (LONGLONG)(PAGE_MASK(npage));
|
||||
return dummy;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
|
@ -69,8 +78,15 @@ PULONG
|
|||
MmGetPageDirectory(VOID)
|
||||
{
|
||||
unsigned int page_dir=0;
|
||||
#if defined(__GNUC__)
|
||||
__asm__("movl %%cr3,%0\n\t"
|
||||
: "=r" (page_dir));
|
||||
#elif defined(_MSC_VER)
|
||||
__asm mov eax, cr3;
|
||||
__asm mov page_dir, eax;
|
||||
#else
|
||||
#error Unknown compiler for inline assembler
|
||||
#endif
|
||||
return((PULONG)page_dir);
|
||||
}
|
||||
|
||||
|
@ -140,7 +156,11 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
|
|||
}
|
||||
|
||||
MmReleasePageMemoryConsumer(MC_NPPOOL, Process->Pcb.DirectoryTableBase);
|
||||
#if defined(__GNUC__)
|
||||
Process->Pcb.DirectoryTableBase.QuadPart = 0LL;
|
||||
#else
|
||||
Process->Pcb.DirectoryTableBase.QuadPart = 0;
|
||||
#endif
|
||||
|
||||
DPRINT("Finished Mmi386ReleaseMmInfo()\n");
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -382,7 +402,14 @@ MmGetPhysicalAddressForProcess(PEPROCESS Process,
|
|||
|
||||
if (!(PageEntry & PA_PRESENT))
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return((LARGE_INTEGER)0LL);
|
||||
#else
|
||||
{
|
||||
PHYSICAL_ADDRESS dummy = { 0 };
|
||||
return dummy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return(PTE_TO_PAGE(PageEntry));
|
||||
}
|
||||
|
@ -537,7 +564,11 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
|||
}
|
||||
if (PhysicalAddr != NULL)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
*PhysicalAddr = (LARGE_INTEGER)0LL;
|
||||
#else
|
||||
PhysicalAddr->QuadPart = 0;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -838,7 +869,7 @@ PULONG MmGetPageEntry(PVOID PAddress)
|
|||
|
||||
BOOLEAN MmIsDirtyPage(PEPROCESS Process, PVOID Address)
|
||||
{
|
||||
return((MmGetPageEntryForProcess(Process, Address)) & PA_DIRTY);
|
||||
return (BOOLEAN)((MmGetPageEntryForProcess(Process, Address)) & PA_DIRTY);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
@ -867,7 +898,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
|
|||
}
|
||||
|
||||
PageEntry = MmGetPageEntry(Address);
|
||||
Accessed = (*PageEntry) & PA_ACCESSED;
|
||||
Accessed = (BOOLEAN)((*PageEntry) & PA_ACCESSED);
|
||||
if (Accessed)
|
||||
{
|
||||
(*PageEntry) = (*PageEntry) & (~PA_ACCESSED);
|
||||
|
@ -963,7 +994,7 @@ VOID MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
|
|||
|
||||
BOOLEAN MmIsPagePresent(PEPROCESS Process, PVOID Address)
|
||||
{
|
||||
return((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT);
|
||||
return (BOOLEAN)((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT);
|
||||
}
|
||||
|
||||
BOOLEAN MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
|
||||
|
@ -1006,7 +1037,7 @@ MmCreateVirtualMappingDump(PVOID Address,
|
|||
{
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
*Pte = PhysicalAddress.QuadPart | Attributes;
|
||||
*Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
|
||||
FLUSH_TLB;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -1066,7 +1097,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
|||
{
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
||||
}
|
||||
*Pte = PhysicalAddress.QuadPart | Attributes;
|
||||
*Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
|
||||
if (Process != NULL &&
|
||||
Process->AddressSpace.PageTableRefCountTable != NULL &&
|
||||
Address < (PVOID)KERNEL_BASE &&
|
||||
|
@ -1222,7 +1253,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
|||
{
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
||||
}
|
||||
*Pte = PhysicalAddress.QuadPart | Attributes;
|
||||
*Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
|
||||
if (Process != NULL &&
|
||||
Process->AddressSpace.PageTableRefCountTable != NULL &&
|
||||
Address < (PVOID)KERNEL_BASE &&
|
||||
|
@ -1341,7 +1372,7 @@ VOID
|
|||
MmUpdateStackPageDir(PULONG LocalPageDir, PKTHREAD PThread)
|
||||
{
|
||||
unsigned EntryBase = ADDR_TO_PDE_OFFSET(PThread->StackLimit);
|
||||
unsigned EntryTop = ADDR_TO_PDE_OFFSET(PThread->InitialStack - PAGE_SIZE);
|
||||
unsigned EntryTop = ADDR_TO_PDE_OFFSET((char*)PThread->InitialStack - PAGE_SIZE);
|
||||
|
||||
if (0 == LocalPageDir[EntryBase])
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: iospace.c,v 1.22 2003/12/20 21:43:21 navaraf Exp $
|
||||
/* $Id: iospace.c,v 1.23 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/iospace.c
|
||||
|
@ -103,21 +103,34 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
|||
}
|
||||
for (i = 0; (i < (PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE)); i++)
|
||||
{
|
||||
#if !defined(__GNUC__)
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = PhysicalAddress.QuadPart + (i * PAGE_SIZE);
|
||||
#endif
|
||||
Status =
|
||||
MmCreateVirtualMappingForKernel(Result + (i * PAGE_SIZE),
|
||||
MmCreateVirtualMappingForKernel((char*)Result + (i * PAGE_SIZE),
|
||||
Attributes,
|
||||
#if defined(__GNUC__)
|
||||
(PHYSICAL_ADDRESS)
|
||||
(PhysicalAddress.QuadPart +
|
||||
(i * PAGE_SIZE)));
|
||||
(i * PAGE_SIZE))
|
||||
#else
|
||||
dummyJunkNeeded
|
||||
#endif
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Unable to create virtual mapping\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
MmMarkPageMapped((PHYSICAL_ADDRESS) (PhysicalAddress.QuadPart +
|
||||
(i * PAGE_SIZE)));
|
||||
#else
|
||||
MmMarkPageMapped(dummyJunkNeeded);
|
||||
#endif
|
||||
}
|
||||
return ((PVOID)(Result + PhysicalAddress.QuadPart % PAGE_SIZE));
|
||||
return ((PVOID)((char*)Result + PhysicalAddress.QuadPart % PAGE_SIZE));
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,7 +183,7 @@ MmMapVideoDisplay (IN PHYSICAL_ADDRESS PhysicalAddress,
|
|||
IN ULONG NumberOfBytes,
|
||||
IN MEMORY_CACHING_TYPE CacheType)
|
||||
{
|
||||
return MmMapIoSpace (PhysicalAddress, NumberOfBytes, CacheType);
|
||||
return MmMapIoSpace (PhysicalAddress, NumberOfBytes, (BOOLEAN)CacheType);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: kmap.c,v 1.29 2003/10/12 17:05:48 hbirr Exp $
|
||||
/* $Id: kmap.c,v 1.30 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -40,7 +40,7 @@ VOID
|
|||
ExUnmapPage(PVOID Addr)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
ULONG Base = (Addr - MiKernelMapStart) / PAGE_SIZE;
|
||||
ULONG Base = ((char*)Addr - (char*)MiKernelMapStart) / PAGE_SIZE;
|
||||
|
||||
DPRINT("ExUnmapPage(Addr %x)\n",Addr);
|
||||
|
||||
|
@ -110,7 +110,7 @@ ExAllocatePageWithPhysPage(PHYSICAL_ADDRESS PhysPage)
|
|||
{
|
||||
AllocMapHint = Base + 1;
|
||||
KeReleaseSpinLock(&AllocMapLock, oldlvl);
|
||||
Addr = MiKernelMapStart + Base * PAGE_SIZE;
|
||||
Addr = (char*)MiKernelMapStart + Base * PAGE_SIZE;
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
Addr,
|
||||
PAGE_READWRITE | PAGE_SYSTEM,
|
||||
|
@ -139,13 +139,13 @@ VOID
|
|||
MiFreeNonPagedPoolRegion(PVOID Addr, ULONG Count, BOOLEAN Free)
|
||||
{
|
||||
ULONG i;
|
||||
ULONG Base = (Addr - MiKernelMapStart) / PAGE_SIZE;
|
||||
ULONG Base = ((char*)Addr - (char*)MiKernelMapStart) / PAGE_SIZE;
|
||||
KIRQL oldlvl;
|
||||
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
MmDeleteVirtualMapping(NULL,
|
||||
Addr + (i * PAGE_SIZE),
|
||||
(char*)Addr + (i * PAGE_SIZE),
|
||||
Free,
|
||||
NULL,
|
||||
NULL);
|
||||
|
@ -178,7 +178,7 @@ MiAllocNonPagedPoolRegion(ULONG nr_pages)
|
|||
}
|
||||
KeReleaseSpinLock(&AllocMapLock, oldlvl);
|
||||
//DPRINT("returning %x\n",NonPagedPoolBase + Base * PAGE_SIZE);
|
||||
return MiKernelMapStart + Base * PAGE_SIZE;
|
||||
return (char*)MiKernelMapStart + Base * PAGE_SIZE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ VOID MmDumpMemoryAreas(PLIST_ENTRY ListHead)
|
|||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||
DbgPrint("Base %x Length %x End %x Attributes %x Flink %x\n",
|
||||
current->BaseAddress,current->Length,
|
||||
current->BaseAddress+current->Length,current->Attributes,
|
||||
(char*)current->BaseAddress+current->Length,current->Attributes,
|
||||
current->Entry.Flink);
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ MEMORY_AREA* MmOpenMemoryAreaByAddress(PMADDRESS_SPACE AddressSpace,
|
|||
assert(current_entry->Flink->Blink == current_entry);
|
||||
assert(previous_entry->Flink == current_entry);
|
||||
if (current->BaseAddress <= Address &&
|
||||
(current->BaseAddress + current->Length) > Address)
|
||||
(PVOID)((char*)current->BaseAddress + current->Length) > Address)
|
||||
{
|
||||
DPRINT("%s() = %x\n",__FUNCTION__,current);
|
||||
return(current);
|
||||
|
@ -119,7 +119,7 @@ MEMORY_AREA* MmOpenMemoryAreaByRegion(PMADDRESS_SPACE AddressSpace,
|
|||
DPRINT("current->BaseAddress %x current->Length %x\n",
|
||||
current->BaseAddress,current->Length);
|
||||
if (current->BaseAddress >= Address &&
|
||||
current->BaseAddress < (Address+Length))
|
||||
current->BaseAddress < (PVOID)((char*)Address+Length))
|
||||
{
|
||||
DPRINT("Finished MmOpenMemoryAreaByRegion() = %x\n",
|
||||
current);
|
||||
|
@ -127,20 +127,20 @@ MEMORY_AREA* MmOpenMemoryAreaByRegion(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
Extent = (ULONG)current->BaseAddress + current->Length;
|
||||
if (Extent > (ULONG)Address &&
|
||||
Extent < (ULONG)(Address+Length))
|
||||
Extent < (ULONG)((char*)Address+Length))
|
||||
{
|
||||
DPRINT("Finished MmOpenMemoryAreaByRegion() = %x\n",
|
||||
current);
|
||||
return(current);
|
||||
}
|
||||
if (current->BaseAddress <= Address &&
|
||||
Extent >= (ULONG)(Address+Length))
|
||||
Extent >= (ULONG)((char*)Address+Length))
|
||||
{
|
||||
DPRINT("Finished MmOpenMemoryAreaByRegion() = %x\n",
|
||||
current);
|
||||
return(current);
|
||||
}
|
||||
if (current->BaseAddress >= (Address+Length))
|
||||
if (current->BaseAddress >= (PVOID)((char*)Address+Length))
|
||||
{
|
||||
DPRINT("Finished MmOpenMemoryAreaByRegion()= NULL\n",0);
|
||||
return(NULL);
|
||||
|
@ -224,10 +224,10 @@ PVOID MmFindGapBottomUp(PMADDRESS_SPACE AddressSpace, ULONG Length)
|
|||
{
|
||||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||
next = CONTAINING_RECORD(current_entry->Flink,MEMORY_AREA,Entry);
|
||||
Gap = next->BaseAddress - (current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||
Gap = (char*)next->BaseAddress - ((char*)current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||
if (Gap >= Length)
|
||||
{
|
||||
return(current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||
return((char*)current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ PVOID MmFindGapBottomUp(PMADDRESS_SPACE AddressSpace, ULONG Length)
|
|||
else
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||
Address = current->BaseAddress + PAGE_ROUND_UP(current->Length);
|
||||
Address = (char*)current->BaseAddress + PAGE_ROUND_UP(current->Length);
|
||||
}
|
||||
/* Check if enough space for the block */
|
||||
if (AddressSpace->LowestAddress < KERNEL_BASE)
|
||||
|
@ -289,30 +289,30 @@ PVOID MmFindGapTopDown(PMADDRESS_SPACE AddressSpace, ULONG Length)
|
|||
while (current_entry->Blink != ListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||
BottomAddress = current->BaseAddress + PAGE_ROUND_UP(current->Length);
|
||||
BottomAddress = (char*)current->BaseAddress + PAGE_ROUND_UP(current->Length);
|
||||
DPRINT("Base %p Length %lx\n", current->BaseAddress, PAGE_ROUND_UP(current->Length));
|
||||
|
||||
if (BottomAddress < HighestAddress)
|
||||
{
|
||||
Gap = TopAddress - BottomAddress + 1;
|
||||
Gap = (char*)TopAddress - (char*)BottomAddress + 1;
|
||||
DPRINT("Bottom %p Top %p Gap %lx\n", BottomAddress, TopAddress, Gap);
|
||||
if (Gap >= Length)
|
||||
{
|
||||
DPRINT("Found gap at %p\n", TopAddress - Length);
|
||||
return(TopAddress - Length + 1);
|
||||
DPRINT("Found gap at %p\n", (char*)TopAddress - Length);
|
||||
return((char*)TopAddress - Length + 1);
|
||||
}
|
||||
TopAddress = current->BaseAddress - 1;
|
||||
TopAddress = (char*)current->BaseAddress - 1;
|
||||
}
|
||||
current_entry = current_entry->Blink;
|
||||
}
|
||||
|
||||
if (current_entry == ListHead)
|
||||
{
|
||||
Address = (PVOID)HighestAddress - Length + 1;
|
||||
Address = (char*)HighestAddress - Length + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Address = TopAddress - Length + 1;
|
||||
Address = (char*)TopAddress - Length + 1;
|
||||
}
|
||||
|
||||
/* Check if enough space for the block */
|
||||
|
@ -388,29 +388,33 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
for (i=0; i<(PAGE_ROUND_UP(MemoryArea->Length)/PAGE_SIZE); i++)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
PHYSICAL_ADDRESS PhysAddr = (PHYSICAL_ADDRESS)0LL;
|
||||
#else
|
||||
PHYSICAL_ADDRESS PhysAddr = { 0 };
|
||||
#endif
|
||||
BOOL Dirty = FALSE;
|
||||
SWAPENTRY SwapEntry = 0;
|
||||
|
||||
if (MmIsPageSwapEntry(AddressSpace->Process,
|
||||
MemoryArea->BaseAddress + (i * PAGE_SIZE)))
|
||||
(char*)MemoryArea->BaseAddress + (i * PAGE_SIZE)))
|
||||
{
|
||||
MmDeletePageFileMapping(AddressSpace->Process,
|
||||
MemoryArea->BaseAddress + (i * PAGE_SIZE),
|
||||
(char*)MemoryArea->BaseAddress + (i * PAGE_SIZE),
|
||||
&SwapEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
MmDeleteVirtualMapping(AddressSpace->Process,
|
||||
MemoryArea->BaseAddress + (i*PAGE_SIZE),
|
||||
(char*)MemoryArea->BaseAddress + (i*PAGE_SIZE),
|
||||
FALSE, &Dirty, &PhysAddr);
|
||||
|
||||
}
|
||||
if (FreePage != NULL)
|
||||
{
|
||||
FreePage(FreePageContext, MemoryArea,
|
||||
MemoryArea->BaseAddress + (i * PAGE_SIZE), PhysAddr,
|
||||
SwapEntry, Dirty);
|
||||
(char*)MemoryArea->BaseAddress + (i * PAGE_SIZE), PhysAddr,
|
||||
SwapEntry, (BOOLEAN)Dirty);
|
||||
}
|
||||
}
|
||||
if (AddressSpace->Process != NULL &&
|
||||
|
@ -449,13 +453,13 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
|
|||
|
||||
if (BaseAddress == OriginalMemoryArea->BaseAddress)
|
||||
{
|
||||
OriginalMemoryArea->BaseAddress = BaseAddress + Length;
|
||||
OriginalMemoryArea->BaseAddress = (char*)BaseAddress + Length;
|
||||
OriginalMemoryArea->Length = OriginalMemoryArea->Length - Length;
|
||||
MmInsertMemoryArea(AddressSpace, Result);
|
||||
return(Result);
|
||||
}
|
||||
if ((BaseAddress + Length) ==
|
||||
(OriginalMemoryArea->BaseAddress + OriginalMemoryArea->Length))
|
||||
if (((char*)BaseAddress + Length) ==
|
||||
((char*)OriginalMemoryArea->BaseAddress + OriginalMemoryArea->Length))
|
||||
{
|
||||
OriginalMemoryArea->Length = OriginalMemoryArea->Length - Length;
|
||||
MmInsertMemoryArea(AddressSpace, Result);
|
||||
|
@ -466,11 +470,11 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
|
|||
Split = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
|
||||
TAG_MAREA);
|
||||
RtlCopyMemory(Split,OriginalMemoryArea,sizeof(MEMORY_AREA));
|
||||
Split->BaseAddress = BaseAddress + Length;
|
||||
Split->BaseAddress = (char*)BaseAddress + Length;
|
||||
Split->Length = OriginalMemoryArea->Length - (((ULONG)BaseAddress)
|
||||
+ Length);
|
||||
|
||||
OriginalMemoryArea->Length = BaseAddress - OriginalMemoryArea->BaseAddress;
|
||||
OriginalMemoryArea->Length = (char*)BaseAddress - (char*)OriginalMemoryArea->BaseAddress;
|
||||
|
||||
return(Split);
|
||||
}
|
||||
|
@ -513,7 +517,15 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
|||
DPRINT("No suitable gap\n");
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
(*BaseAddress)=(*BaseAddress)+PAGE_SIZE;
|
||||
#else
|
||||
{
|
||||
char* pTemp = *BaseAddress;
|
||||
pTemp += PAGE_SIZE;
|
||||
*BaseAddress = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -527,7 +539,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
|||
}
|
||||
|
||||
if (AddressSpace->LowestAddress < KERNEL_BASE &&
|
||||
(*BaseAddress) + tmpLength > (PVOID)KERNEL_BASE)
|
||||
(PVOID)((char*)(*BaseAddress) + tmpLength) > (PVOID)KERNEL_BASE)
|
||||
{
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mdl.c,v 1.54 2003/10/12 17:05:48 hbirr Exp $
|
||||
/* $Id: mdl.c,v 1.55 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -115,8 +115,15 @@ MmUnlockPages(PMDL Mdl)
|
|||
MdlPages = (PULONG)(Mdl + 1);
|
||||
for (i=0; i<(PAGE_ROUND_UP(Mdl->ByteCount+Mdl->ByteOffset)/PAGE_SIZE); i++)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
#else
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = MdlPages[i];
|
||||
MmUnlockPage(dummyJunkNeeded);
|
||||
MmDereferencePage(dummyJunkNeeded);
|
||||
#endif
|
||||
}
|
||||
Mdl->MdlFlags = Mdl->MdlFlags & (~MDL_PAGES_LOCKED);
|
||||
}
|
||||
|
@ -170,7 +177,7 @@ MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
|||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
Base = MiMdlMappingRegionBase + StartingOffset * PAGE_SIZE;
|
||||
Base = (char*)MiMdlMappingRegionBase + StartingOffset * PAGE_SIZE;
|
||||
|
||||
if (MiMdlMappingRegionHint == StartingOffset)
|
||||
{
|
||||
|
@ -184,10 +191,18 @@ MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
|||
for (i = 0; i < RegionSize; i++)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
#if !defined(__GNUC__)
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = MdlPages[i];
|
||||
#endif
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
(PVOID)((ULONG)Base+(i*PAGE_SIZE)),
|
||||
PAGE_READWRITE,
|
||||
#if defined(__GNUC__)
|
||||
(LARGE_INTEGER)(LONGLONG)MdlPages[i],
|
||||
#else
|
||||
dummyJunkNeeded,
|
||||
#endif
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -198,8 +213,8 @@ MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
|||
|
||||
/* Mark the MDL has having being mapped. */
|
||||
Mdl->MdlFlags = Mdl->MdlFlags | MDL_MAPPED_TO_SYSTEM_VA;
|
||||
Mdl->MappedSystemVa = Base + Mdl->ByteOffset;
|
||||
return(Base + Mdl->ByteOffset);
|
||||
Mdl->MappedSystemVa = (char*)Base + Mdl->ByteOffset;
|
||||
return((char*)Base + Mdl->ByteOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -232,13 +247,21 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
|||
|
||||
/* Calculate the number of pages we mapped. */
|
||||
RegionSize = PAGE_ROUND_UP(Mdl->ByteCount + Mdl->ByteOffset) / PAGE_SIZE;
|
||||
#if defined(__GNUC__)
|
||||
BaseAddress -= Mdl->ByteOffset;
|
||||
#else
|
||||
{
|
||||
char* pTemp = BaseAddress;
|
||||
pTemp -= Mdl->ByteOffset;
|
||||
BaseAddress = pTemp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Unmap all the pages. */
|
||||
for (i = 0; i < RegionSize; i++)
|
||||
{
|
||||
MmDeleteVirtualMapping(NULL,
|
||||
BaseAddress + (i * PAGE_SIZE),
|
||||
(char*)BaseAddress + (i * PAGE_SIZE),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
@ -246,7 +269,7 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
|||
|
||||
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);
|
||||
/* Deallocate all the pages used. */
|
||||
Base = (ULONG)(BaseAddress - MiMdlMappingRegionBase) / PAGE_SIZE;
|
||||
Base = (ULONG)((char*)BaseAddress - (char*)MiMdlMappingRegionBase) / PAGE_SIZE;
|
||||
|
||||
RtlClearBits(&MiMdlMappingRegionAllocMap, Base, RegionSize);
|
||||
|
||||
|
@ -335,7 +358,7 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
{
|
||||
PVOID Address;
|
||||
|
||||
Address = Mdl->StartVa + (i*PAGE_SIZE);
|
||||
Address = (char*)Mdl->StartVa + (i*PAGE_SIZE);
|
||||
|
||||
if (!MmIsPagePresent(NULL, Address))
|
||||
{
|
||||
|
@ -344,8 +367,15 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
{
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
#else
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = MdlPages[j];
|
||||
MmUnlockPage(dummyJunkNeeded);
|
||||
MmDereferencePage(dummyJunkNeeded);
|
||||
#endif
|
||||
}
|
||||
ExRaiseStatus(Status);
|
||||
}
|
||||
|
@ -362,15 +392,30 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
{
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
MmDereferencePage(
|
||||
(LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
#else
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = MdlPages[j];
|
||||
MmUnlockPage(dummyJunkNeeded);
|
||||
MmDereferencePage(dummyJunkNeeded);
|
||||
#endif
|
||||
}
|
||||
ExRaiseStatus(Status);
|
||||
}
|
||||
}
|
||||
MdlPages[i] = MmGetPhysicalAddressForProcess(NULL, Address).u.LowPart;
|
||||
#if defined(__GNUC__)
|
||||
MmReferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
#else
|
||||
{
|
||||
PHYSICAL_ADDRESS dummyJunkNeeded;
|
||||
dummyJunkNeeded.QuadPart = MdlPages[i];
|
||||
MmReferencePage(dummyJunkNeeded);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
MmUnlockAddressSpace(&Mdl->Process->AddressSpace);
|
||||
if (Mode == UserMode && Mdl->Process != CurrentProcess)
|
||||
|
@ -421,9 +466,9 @@ MmBuildMdlForNonPagedPool (PMDL Mdl)
|
|||
for (va=0; va < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); va++)
|
||||
{
|
||||
((PULONG)(Mdl + 1))[va] =
|
||||
(MmGetPhysicalAddress(Mdl->StartVa + (va * PAGE_SIZE))).u.LowPart;
|
||||
(MmGetPhysicalAddress((char*)Mdl->StartVa + (va * PAGE_SIZE))).u.LowPart;
|
||||
}
|
||||
Mdl->MappedSystemVa = Mdl->StartVa + Mdl->ByteOffset;
|
||||
Mdl->MappedSystemVa = (char*)Mdl->StartVa + Mdl->ByteOffset;
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,9 +501,9 @@ MmCreateMdl (PMDL MemoryDescriptorList,
|
|||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
MmInitializeMdl(MemoryDescriptorList,Base,Length);
|
||||
|
||||
|
||||
MmInitializeMdl(MemoryDescriptorList, (char*)Base, Length);
|
||||
|
||||
return(MemoryDescriptorList);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: mm.c,v 1.66 2003/07/26 12:45:37 hbirr Exp $
|
||||
/* $Id: mm.c,v 1.67 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -56,7 +56,7 @@ NTSTATUS MmReleaseMemoryArea(PEPROCESS Process, PMEMORY_AREA Marea)
|
|||
DPRINT("MmReleaseMemoryArea(Process %x, Marea %x)\n",Process,Marea);
|
||||
|
||||
DPRINT("Releasing %x between %x %x (type %d)\n",
|
||||
Marea, Marea->BaseAddress, Marea->BaseAddress + Marea->Length,
|
||||
Marea, Marea->BaseAddress, (char*)Marea->BaseAddress + Marea->Length,
|
||||
Marea->Type);
|
||||
|
||||
switch (Marea->Type)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mminit.c,v 1.57 2003/11/30 17:17:02 hbirr Exp $
|
||||
/* $Id: mminit.c,v 1.58 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -39,11 +39,17 @@ extern unsigned int _text_end__;
|
|||
extern unsigned int _init_start__;
|
||||
extern unsigned int _init_end__;
|
||||
|
||||
extern unsigned int _bss_end__;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#pragma message("This will never work until we somehow fix these!")
|
||||
|
||||
#endif
|
||||
|
||||
static BOOLEAN IsThisAnNtAsSystem = FALSE;
|
||||
static MM_SYSTEM_SIZE MmSystemSize = MmSmallSystem;
|
||||
|
||||
extern unsigned int _bss_end__;
|
||||
|
||||
static MEMORY_AREA* kernel_text_desc = NULL;
|
||||
static MEMORY_AREA* kernel_init_desc = NULL;
|
||||
static MEMORY_AREA* kernel_map_desc = NULL;
|
||||
|
@ -108,13 +114,13 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
|||
MmInitMemoryAreas();
|
||||
|
||||
/* Don't change the start of kernel map. Pte's must always exist for this region. */
|
||||
MiKernelMapStart = (PVOID)LastKernelAddress + PAGE_SIZE;
|
||||
MiKernelMapStart = (char*)LastKernelAddress + PAGE_SIZE;
|
||||
MiKernelMapLength = MM_KERNEL_MAP_SIZE;
|
||||
|
||||
MiNonPagedPoolStart = MiKernelMapStart + MiKernelMapLength + PAGE_SIZE;
|
||||
MiNonPagedPoolStart = (char*)MiKernelMapStart + MiKernelMapLength + PAGE_SIZE;
|
||||
MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE;
|
||||
|
||||
MmPagedPoolBase = MiNonPagedPoolStart + MiNonPagedPoolLength + PAGE_SIZE;
|
||||
MmPagedPoolBase = (char*)MiNonPagedPoolStart + MiNonPagedPoolLength + PAGE_SIZE;
|
||||
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: mpw.c,v 1.16 2003/07/21 21:53:53 royce Exp $
|
||||
/* $Id: mpw.c,v 1.17 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/mpw.c
|
||||
|
@ -54,7 +54,11 @@ MmWriteDirtyPages(ULONG Target, PULONG Actual)
|
|||
NTSTATUS Status;
|
||||
|
||||
Page = MmGetLRUFirstUserPage();
|
||||
#if defined(__GNUC__)
|
||||
while (Page.QuadPart != 0LL && Target > 0)
|
||||
#else
|
||||
while (Page.QuadPart && Target > 0)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* FIXME: While the current page is write back it is possible
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ncache.c,v 1.25 2003/07/10 21:05:03 royce Exp $
|
||||
/* $Id: ncache.c,v 1.26 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -79,7 +79,7 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes)
|
|||
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &NPage);
|
||||
MmCreateVirtualMapping (NULL,
|
||||
Result + (i * PAGE_SIZE),
|
||||
(char*)Result + (i * PAGE_SIZE),
|
||||
Attributes,
|
||||
NPage,
|
||||
TRUE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: npool.c,v 1.79 2003/12/14 17:56:23 hbirr Exp $
|
||||
/* $Id: npool.c,v 1.80 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -46,7 +46,11 @@
|
|||
#if 0
|
||||
#define POOL_TRACE(args...) do { DbgPrint(args); } while(0);
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define POOL_TRACE(args...)
|
||||
#else
|
||||
#define POOL_TRACE
|
||||
#endif /* __GNUC__ */
|
||||
#endif
|
||||
|
||||
/* avl types ****************************************************************/
|
||||
|
@ -778,10 +782,10 @@ MiDumpTagStats(ULONG CurrentTag, ULONG CurrentNrBlocks, ULONG CurrentSize)
|
|||
{
|
||||
CHAR c1, c2, c3, c4;
|
||||
|
||||
c1 = (CurrentTag >> 24) & 0xFF;
|
||||
c2 = (CurrentTag >> 16) & 0xFF;
|
||||
c3 = (CurrentTag >> 8) & 0xFF;
|
||||
c4 = CurrentTag & 0xFF;
|
||||
c1 = (CHAR)((CurrentTag >> 24) & 0xFF);
|
||||
c2 = (CHAR)((CurrentTag >> 16) & 0xFF);
|
||||
c3 = (CHAR)((CurrentTag >> 8) & 0xFF);
|
||||
c4 = (CHAR)(CurrentTag & 0xFF);
|
||||
|
||||
if (isprint(c1) && isprint(c2) && isprint(c3) && isprint(c4))
|
||||
{
|
||||
|
@ -897,12 +901,12 @@ MiDebugDumpNonPagedPool(BOOLEAN NewOnly)
|
|||
if (!NewOnly || !current->Used.Dumped)
|
||||
{
|
||||
CHAR c1, c2, c3, c4;
|
||||
|
||||
c1 = (current->Used.Tag >> 24) & 0xFF;
|
||||
c2 = (current->Used.Tag >> 16) & 0xFF;
|
||||
c3 = (current->Used.Tag >> 8) & 0xFF;
|
||||
c4 = current->Used.Tag & 0xFF;
|
||||
|
||||
|
||||
c1 = (CHAR)((current->Used.Tag >> 24) & 0xFF);
|
||||
c2 = (CHAR)((current->Used.Tag >> 16) & 0xFF);
|
||||
c3 = (CHAR)((current->Used.Tag >> 8) & 0xFF);
|
||||
c4 = (CHAR)(current->Used.Tag & 0xFF);
|
||||
|
||||
if (isprint(c1) && isprint(c2) && isprint(c3) && isprint(c4))
|
||||
{
|
||||
DbgPrint("Size 0x%x Tag 0x%x (%c%c%c%c) Allocator 0x%x\n",
|
||||
|
@ -1182,14 +1186,14 @@ add_to_free_list(BLOCK_HDR* blk)
|
|||
}
|
||||
|
||||
current = (BLOCK_HDR*)((char*)blk + BLOCK_HDR_SIZE + blk->Size);
|
||||
if ((PVOID)current < MiNonPagedPoolStart + MiNonPagedPoolLength &&
|
||||
if ((char*)current < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength &&
|
||||
current->Magic == BLOCK_HDR_FREE_MAGIC)
|
||||
{
|
||||
remove_from_free_list(current);
|
||||
blk->Size += BLOCK_HDR_SIZE + current->Size;
|
||||
memset(current, 0xcc, BLOCK_HDR_SIZE);
|
||||
current = (BLOCK_HDR*)((char*)blk + BLOCK_HDR_SIZE + blk->Size);
|
||||
if ((PVOID)current < MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
if ((char*)current < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
{
|
||||
current->previous = blk;
|
||||
}
|
||||
|
@ -1241,7 +1245,7 @@ grow_block(BLOCK_HDR* blk, PVOID end)
|
|||
|
||||
PVOID start = (PVOID)PAGE_ROUND_UP((ULONG)((char*)blk + BLOCK_HDR_SIZE));
|
||||
end = (PVOID)PAGE_ROUND_UP(end);
|
||||
index = (ULONG)(start - MiNonPagedPoolStart) / PAGE_SIZE;
|
||||
index = (ULONG)((char*)start - (char*)MiNonPagedPoolStart) / PAGE_SIZE;
|
||||
while (start < end)
|
||||
{
|
||||
if (!(MiNonPagedPoolAllocMap[index / 32] & (1 << (index % 32))))
|
||||
|
@ -1269,7 +1273,15 @@ grow_block(BLOCK_HDR* blk, PVOID end)
|
|||
MiNonPagedPoolNrOfPages++;
|
||||
}
|
||||
index++;
|
||||
#if defined(__GNUC__)
|
||||
start += PAGE_SIZE;
|
||||
#else
|
||||
{
|
||||
char* pTemp = start;
|
||||
pTemp += PAGE_SIZE;
|
||||
start = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1373,15 +1385,15 @@ static BLOCK_HDR* get_block(unsigned int size, unsigned long alignment)
|
|||
}
|
||||
}
|
||||
|
||||
end = (PVOID)current + BLOCK_HDR_SIZE + size;
|
||||
|
||||
end = (char*)current + BLOCK_HDR_SIZE + size;
|
||||
|
||||
if (current_size >= size + BLOCK_HDR_SIZE + MM_POOL_ALIGNMENT)
|
||||
{
|
||||
/* create a new free block after our block, if the memory size is >= 4 byte for this block */
|
||||
next = (BLOCK_HDR*)((ULONG)current + size + BLOCK_HDR_SIZE);
|
||||
next_size = current_size - size - BLOCK_HDR_SIZE;
|
||||
current_size = size;
|
||||
end = (PVOID)next + BLOCK_HDR_SIZE;
|
||||
end = (char*)next + BLOCK_HDR_SIZE;
|
||||
}
|
||||
|
||||
if (previous)
|
||||
|
@ -1400,7 +1412,7 @@ static BLOCK_HDR* get_block(unsigned int size, unsigned long alignment)
|
|||
if (next == NULL)
|
||||
{
|
||||
blk = (BLOCK_HDR*)((char*)current + BLOCK_HDR_SIZE + current->Size);
|
||||
if ((PVOID)blk < MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
if ((char*)blk < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
{
|
||||
blk->previous = current;
|
||||
}
|
||||
|
@ -1433,7 +1445,7 @@ static BLOCK_HDR* get_block(unsigned int size, unsigned long alignment)
|
|||
next->Magic = BLOCK_HDR_FREE_MAGIC;
|
||||
next->previous = current;
|
||||
blk = (BLOCK_HDR*)((char*)next + BLOCK_HDR_SIZE + next->Size);
|
||||
if ((PVOID)blk < MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
if ((char*)blk < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength)
|
||||
{
|
||||
blk->previous = next;
|
||||
}
|
||||
|
@ -1484,7 +1496,7 @@ VOID STDCALL ExFreeNonPagedPool (PVOID block)
|
|||
|
||||
DPRINT("freeing block %x\n",blk);
|
||||
|
||||
POOL_TRACE("ExFreePool(block %x), size %d, caller %x\n",block,blk->size,
|
||||
POOL_TRACE("ExFreePool(block %x), size %d, caller %x\n",block,blk->Size,
|
||||
((PULONG)&block)[-1]);
|
||||
|
||||
KeAcquireSpinLock(&MmNpoolLock, &oldIrql);
|
||||
|
@ -1766,7 +1778,15 @@ MiInitializeNonPagedPool(VOID)
|
|||
KEBUGCHECK(0);
|
||||
}
|
||||
MiNonPagedPoolAllocMap[i / 32] |= (1 << (i % 32));
|
||||
#if defined(__GNUC__)
|
||||
Address += PAGE_SIZE;
|
||||
#else
|
||||
{
|
||||
char* pTemp = Address;
|
||||
pTemp += PAGE_SIZE;
|
||||
Address = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* the first block contains the non paged pool bitmap */
|
||||
blk = (BLOCK_HDR*)MiNonPagedPoolStart;
|
||||
|
@ -1784,7 +1804,7 @@ MiInitializeNonPagedPool(VOID)
|
|||
/* the second block is the first free block */
|
||||
blk = (BLOCK_HDR*)((char*)blk + BLOCK_HDR_SIZE + blk->Size);
|
||||
memset(blk, 0, BLOCK_HDR_SIZE);
|
||||
memset((PVOID)blk + BLOCK_HDR_SIZE, 0x0cc, MiNonPagedPoolNrOfPages * PAGE_SIZE - ((ULONG)blk + BLOCK_HDR_SIZE - (ULONG)MiNonPagedPoolStart));
|
||||
memset((char*)blk + BLOCK_HDR_SIZE, 0x0cc, MiNonPagedPoolNrOfPages * PAGE_SIZE - ((ULONG)blk + BLOCK_HDR_SIZE - (ULONG)MiNonPagedPoolStart));
|
||||
blk->Magic = BLOCK_HDR_FREE_MAGIC;
|
||||
blk->Size = MiNonPagedPoolLength - ((ULONG)blk + BLOCK_HDR_SIZE - (ULONG)MiNonPagedPoolStart);
|
||||
blk->previous = (BLOCK_HDR*)MiNonPagedPoolStart;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: pagefile.c,v 1.40 2003/12/14 17:54:22 hbirr Exp $
|
||||
/* $Id: pagefile.c,v 1.41 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/pagefile.c
|
||||
|
@ -175,7 +175,14 @@ MmGetOffsetPageFile(PGET_RETRIEVAL_DESCRIPTOR RetrievalPointers, LARGE_INTEGER O
|
|||
}
|
||||
}
|
||||
KEBUGCHECK(0);
|
||||
#if defined(__GNUC__)
|
||||
return (LARGE_INTEGER)0LL;
|
||||
#else
|
||||
{
|
||||
const LARGE_INTEGER dummy = { 0 };
|
||||
return dummy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||
|
@ -497,7 +504,7 @@ MmDumpToPagingFile(ULONG BugCode,
|
|||
Headers->BugCheckParameters[3] = BugCodeParameter4;
|
||||
Headers->FaultingStackBase = (PVOID)Thread->Tcb.StackLimit;
|
||||
Headers->FaultingStackSize = StackSize =
|
||||
(ULONG)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
|
||||
(ULONG)((char*)Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
|
||||
Headers->PhysicalMemorySize = MmStats.NrTotalPages * PAGE_SIZE;
|
||||
|
||||
/* Initialize the dump device. */
|
||||
|
@ -525,7 +532,14 @@ MmDumpToPagingFile(ULONG BugCode,
|
|||
|
||||
/* Dump the header. */
|
||||
MdlMap[0] = MmGetPhysicalAddress(MmCoreDumpPageFrame).u.LowPart;
|
||||
#if defined(__GNUC__)
|
||||
DiskOffset = MmGetOffsetPageFile(RetrievalPointers, (LARGE_INTEGER)0LL);
|
||||
#else
|
||||
{
|
||||
const LARGE_INTEGER dummy = { 0 };
|
||||
DiskOffset = MmGetOffsetPageFile(RetrievalPointers, dummy);
|
||||
}
|
||||
#endif
|
||||
DiskOffset.QuadPart += MmCoreDumpLcnMapping.LcnDiskOffset.QuadPart;
|
||||
Status = MmCoreDumpFunctions->DumpWrite(DiskOffset, Mdl);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -548,8 +562,16 @@ MmDumpToPagingFile(ULONG BugCode,
|
|||
MmCreateVirtualMappingDump(MmCoreDumpPageFrame,
|
||||
PAGE_READWRITE,
|
||||
PhysicalAddress);
|
||||
#if defined(__GNUC__)
|
||||
DiskOffset = MmGetOffsetPageFile(RetrievalPointers,
|
||||
(LARGE_INTEGER)NextOffset);
|
||||
#else
|
||||
{
|
||||
LARGE_INTEGER dummy;
|
||||
dummy.QuadPart = NextOffset;
|
||||
DiskOffset = MmGetOffsetPageFile(RetrievalPointers, dummy);
|
||||
}
|
||||
#endif
|
||||
DiskOffset.QuadPart += MmCoreDumpLcnMapping.LcnDiskOffset.QuadPart;
|
||||
Status = MmCoreDumpFunctions->DumpWrite(DiskOffset, Mdl);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -789,9 +811,13 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
|||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
Vcn.QuadPart = 0LL;
|
||||
#else
|
||||
Vcn.QuadPart = 0;
|
||||
#endif
|
||||
ExtentCount = 0;
|
||||
MaxVcn = (InitialSize->QuadPart + BytesPerAllocationUnit - 1) / BytesPerAllocationUnit;
|
||||
MaxVcn = (ULONG)((InitialSize->QuadPart + BytesPerAllocationUnit - 1) / BytesPerAllocationUnit);
|
||||
while(1)
|
||||
{
|
||||
Status = NtFsControlFile(FileHandle,
|
||||
|
@ -858,7 +884,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
|||
PagingFile->FileObject = FileObject;
|
||||
PagingFile->MaximumSize.QuadPart = MaximumSize->QuadPart;
|
||||
PagingFile->CurrentSize.QuadPart = InitialSize->QuadPart;
|
||||
PagingFile->FreePages = InitialSize->QuadPart / PAGE_SIZE;
|
||||
PagingFile->FreePages = (ULONG)(InitialSize->QuadPart / PAGE_SIZE);
|
||||
PagingFile->UsedPages = 0;
|
||||
KeInitializeSpinLock(&PagingFile->AllocMapLock);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pool.c,v 1.25 2003/12/14 17:44:02 hbirr Exp $
|
||||
/* $Id: pool.c,v 1.26 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -23,7 +23,11 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
PVOID STDCALL STATIC
|
||||
#else
|
||||
STATIC PVOID STDCALL
|
||||
#endif
|
||||
EiAllocatePool(POOL_TYPE PoolType,
|
||||
ULONG NumberOfBytes,
|
||||
ULONG Tag,
|
||||
|
@ -90,10 +94,19 @@ ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
|
|||
*/
|
||||
{
|
||||
PVOID Block;
|
||||
#if defined(__GNUC__)
|
||||
Block = EiAllocatePool(PoolType,
|
||||
NumberOfBytes,
|
||||
TAG_NONE,
|
||||
(PVOID)__builtin_return_address(0));
|
||||
#elif defined(_MSC_VER)
|
||||
Block = EiAllocatePool(PoolType,
|
||||
NumberOfBytes,
|
||||
TAG_NONE,
|
||||
&ExAllocatePool);
|
||||
#else
|
||||
#error Unknown compiler
|
||||
#endif
|
||||
return(Block);
|
||||
}
|
||||
|
||||
|
@ -105,10 +118,19 @@ PVOID STDCALL
|
|||
ExAllocatePoolWithTag (ULONG PoolType, ULONG NumberOfBytes, ULONG Tag)
|
||||
{
|
||||
PVOID Block;
|
||||
#if defined(__GNUC__)
|
||||
Block = EiAllocatePool(PoolType,
|
||||
NumberOfBytes,
|
||||
Tag,
|
||||
(PVOID)__builtin_return_address(0));
|
||||
#elif defined(_MSC_VER)
|
||||
Block = EiAllocatePool(PoolType,
|
||||
NumberOfBytes,
|
||||
Tag,
|
||||
&ExAllocatePoolWithTag);
|
||||
#else
|
||||
#error Unknown compiler
|
||||
#endif
|
||||
return(Block);
|
||||
}
|
||||
|
||||
|
@ -150,7 +172,7 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
|
|||
VOID STDCALL
|
||||
ExFreePool(IN PVOID Block)
|
||||
{
|
||||
if (Block >= MmPagedPoolBase && Block < (MmPagedPoolBase + MmPagedPoolSize))
|
||||
if (Block >= MmPagedPoolBase && (char*)Block < ((char*)MmPagedPoolBase + MmPagedPoolSize))
|
||||
{
|
||||
ExFreePagedPool(Block);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ppool.c,v 1.23 2003/12/14 18:36:15 navaraf Exp $
|
||||
/* $Id: ppool.c,v 1.24 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -26,7 +26,7 @@
|
|||
#undef assert
|
||||
#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
|
||||
#define ASSERT_SIZE(n) assert ( (n) <= MmPagedPoolSize && (n) >= 0 )
|
||||
#define ASSERT_PTR(p) assert ( ((size_t)(p)) >= ((size_t)MmPagedPoolBase) && ((size_t)(p)) < ((size_t)(MmPagedPoolBase+MmPagedPoolSize)) )
|
||||
#define ASSERT_PTR(p) assert ( ((size_t)(p)) >= ((size_t)MmPagedPoolBase) && ((size_t)(p)) < ((size_t)((size_t)MmPagedPoolBase+MmPagedPoolSize)) )
|
||||
|
||||
// to disable buffer over/under-run detection, set the following macro to 0
|
||||
#define MM_PPOOL_REDZONE_BYTES 4
|
||||
|
@ -221,10 +221,10 @@ ExAllocatePagedPoolWithTag (IN POOL_TYPE PoolType,
|
|||
while ( CurrentBlock != NULL )
|
||||
{
|
||||
PVOID Addr = block_to_address(CurrentBlock);
|
||||
PVOID CurrentBlockEnd = (PVOID)CurrentBlock + CurrentBlock->Size;
|
||||
PVOID CurrentBlockEnd = (char*)CurrentBlock + CurrentBlock->Size;
|
||||
/* calculate last size-aligned address available within this block */
|
||||
PVOID AlignedAddr = MM_ROUND_DOWN(CurrentBlockEnd-NumberOfBytes-MM_PPOOL_REDZONE_BYTES, Alignment);
|
||||
assert ( AlignedAddr+NumberOfBytes+MM_PPOOL_REDZONE_BYTES <= CurrentBlockEnd );
|
||||
PVOID AlignedAddr = MM_ROUND_DOWN((char*)CurrentBlockEnd-NumberOfBytes-MM_PPOOL_REDZONE_BYTES, Alignment);
|
||||
assert ( (char*)AlignedAddr+NumberOfBytes+MM_PPOOL_REDZONE_BYTES <= (char*)CurrentBlockEnd );
|
||||
|
||||
/* special case, this address is already size-aligned, and the right size */
|
||||
if ( Addr == AlignedAddr )
|
||||
|
@ -265,7 +265,7 @@ ExAllocatePagedPoolWithTag (IN POOL_TYPE PoolType,
|
|||
PMM_PPOOL_FREE_BLOCK_HEADER NewFreeBlock =
|
||||
(PMM_PPOOL_FREE_BLOCK_HEADER)address_to_block(BestAlignedAddr);
|
||||
assert ( BestAlignedAddr > Addr );
|
||||
NewFreeBlock->Size = Addr + BestBlock->Size - BestAlignedAddr;
|
||||
NewFreeBlock->Size = (char*)Addr + BestBlock->Size - (char*)BestAlignedAddr;
|
||||
ASSERT_SIZE(NewFreeBlock->Size);
|
||||
BestBlock->Size = (size_t)NewFreeBlock - (size_t)Addr;
|
||||
ASSERT_SIZE(BestBlock->Size);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: region.c,v 1.5 2003/01/02 16:41:56 hbirr Exp $
|
||||
/* $Id: region.c,v 1.6 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/region.c
|
||||
|
@ -86,7 +86,7 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress,
|
|||
}
|
||||
NewRegion1->Type = NewType;
|
||||
NewRegion1->Protect = NewProtect;
|
||||
InternalLength = (InitialBaseAddress + InitialRegion->Length) - StartAddress;
|
||||
InternalLength = ((char*)InitialBaseAddress + InitialRegion->Length) - (char*)StartAddress;
|
||||
InternalLength = min(InternalLength, Length);
|
||||
NewRegion1->Length = InternalLength;
|
||||
InsertAfterEntry(&InitialRegion->RegionListEntry,
|
||||
|
@ -103,12 +103,12 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress,
|
|||
* If necessary create a new region for the portion of the initial region
|
||||
* beyond the range of addresses to alter.
|
||||
*/
|
||||
if ((InitialBaseAddress + InitialRegion->Length) > (StartAddress + Length))
|
||||
if (((char*)InitialBaseAddress + InitialRegion->Length) > ((char*)StartAddress + Length))
|
||||
{
|
||||
NewRegion2->Type = InitialRegion->Type;
|
||||
NewRegion2->Protect = InitialRegion->Protect;
|
||||
NewRegion2->Length = (InitialBaseAddress + InitialRegion->Length) -
|
||||
(StartAddress + Length);
|
||||
NewRegion2->Length = ((char*)InitialBaseAddress + InitialRegion->Length) -
|
||||
((char*)StartAddress + Length);
|
||||
InsertAfterEntry(&NewRegion1->RegionListEntry,
|
||||
&NewRegion2->RegionListEntry);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress,
|
|||
}
|
||||
else
|
||||
{
|
||||
InitialRegion->Length = StartAddress - InitialBaseAddress;
|
||||
InitialRegion->Length = (char*)StartAddress - (char*)InitialBaseAddress;
|
||||
}
|
||||
|
||||
return(NewRegion1);
|
||||
|
@ -150,11 +150,11 @@ MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
|
|||
*/
|
||||
InitialRegion = MmFindRegion(BaseAddress, RegionListHead, StartAddress,
|
||||
&InitialBaseAddress);
|
||||
if ((StartAddress + Length) >
|
||||
(InitialBaseAddress + InitialRegion->Length))
|
||||
if (((char*)StartAddress + Length) >
|
||||
((char*)InitialBaseAddress + InitialRegion->Length))
|
||||
{
|
||||
RemainingLength = (StartAddress + Length) -
|
||||
(InitialBaseAddress + InitialRegion->Length);
|
||||
RemainingLength = ((char*)StartAddress + Length) -
|
||||
((char*)InitialBaseAddress + InitialRegion->Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
|
|||
CurrentEntry = NewRegion->RegionListEntry.Flink;
|
||||
CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION,
|
||||
RegionListEntry);
|
||||
CurrentBaseAddress = StartAddress + NewRegion->Length;
|
||||
CurrentBaseAddress = (char*)StartAddress + NewRegion->Length;
|
||||
while (RemainingLength > 0 && CurrentRegion->Length <= RemainingLength)
|
||||
{
|
||||
if (CurrentRegion->Type != NewType &&
|
||||
|
@ -195,7 +195,15 @@ MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
|
|||
CurrentRegion->Type, CurrentRegion->Protect,
|
||||
NewType, NewProtect);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
CurrentBaseAddress += CurrentRegion->Length;
|
||||
#else
|
||||
{
|
||||
char* pTemp = CurrentBaseAddress;
|
||||
pTemp += CurrentRegion->Length;
|
||||
CurrentBaseAddress = pTemp;
|
||||
}
|
||||
#endif
|
||||
NewRegion->Length += CurrentRegion->Length;
|
||||
RemainingLength -= CurrentRegion->Length;
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
|
@ -289,7 +297,7 @@ MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Address,
|
|||
current = CONTAINING_RECORD(current_entry, MM_REGION, RegionListEntry);
|
||||
|
||||
if (StartAddress <= Address &&
|
||||
(StartAddress + current->Length) > Address)
|
||||
((char*)StartAddress + current->Length) > (char*)Address)
|
||||
{
|
||||
if (RegionBaseAddress != NULL)
|
||||
{
|
||||
|
@ -299,7 +307,15 @@ MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Address,
|
|||
}
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
#if defined(__GNUC__)
|
||||
StartAddress += current->Length;
|
||||
#else
|
||||
{
|
||||
char* pTemp = StartAddress;
|
||||
pTemp += current->Length;
|
||||
StartAddress = pTemp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: rmap.c,v 1.25 2003/10/22 18:26:34 hbirr Exp $
|
||||
/* $Id: rmap.c,v 1.26 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -133,7 +133,7 @@ MmWritePagePhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
|||
Type = MemoryArea->Type;
|
||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||
{
|
||||
Offset = (ULONG)(Address - (ULONG)MemoryArea->BaseAddress);
|
||||
Offset = (ULONG)((char*)Address - (ULONG)MemoryArea->BaseAddress);
|
||||
|
||||
/*
|
||||
* Get or create a pageop
|
||||
|
@ -271,7 +271,7 @@ MmPageOutPhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
|||
Type = MemoryArea->Type;
|
||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||
{
|
||||
Offset = (ULONG)(Address - (ULONG)MemoryArea->BaseAddress);
|
||||
Offset = (ULONG)((char*)Address - (ULONG)MemoryArea->BaseAddress);
|
||||
|
||||
/*
|
||||
* Get or create a pageop
|
||||
|
@ -438,7 +438,7 @@ MmInsertRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
|||
DPRINT1("Insert rmap (%d, 0x%.8X) 0x%.8X which doesn't match physical "
|
||||
"address 0x%.8X\n", Process->UniqueProcessId, Address,
|
||||
MmGetPhysicalAddressForProcess(Process, Address).u.LowPart,
|
||||
PhysicalAddress.u.LowPart)
|
||||
PhysicalAddress.u.LowPart);
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: slab.c,v 1.9 2003/07/21 21:53:53 royce Exp $
|
||||
/* $Id: slab.c,v 1.10 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -123,12 +123,12 @@ ExGrowSlabCache(PSLAB_CACHE Slab)
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
SlabPage = (PSLAB_CACHE_PAGE)(Page + PAGE_SIZE - sizeof(SLAB_CACHE_PAGE));
|
||||
SlabPage = (PSLAB_CACHE_PAGE)((char*)Page + PAGE_SIZE - sizeof(SLAB_CACHE_PAGE));
|
||||
SlabPage->ReferenceCount = 0;
|
||||
SlabPage->FirstFreeBuffer = (PSLAB_CACHE_BUFCTL)Page;
|
||||
for (i = 0; i < Slab->ObjectsPerPage; i++)
|
||||
{
|
||||
BufCtl = (PSLAB_CACHE_BUFCTL)(Page + (i * Slab->ObjectSize));
|
||||
BufCtl = (PSLAB_CACHE_BUFCTL)((char*)Page + (i * Slab->ObjectSize));
|
||||
Object = (PVOID)(BufCtl + 1);
|
||||
if (Slab->Constructor != NULL)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ ExGrowSlabCache(PSLAB_CACHE Slab)
|
|||
if (i == (Slab->ObjectsPerPage - 1))
|
||||
{
|
||||
BufCtl->NextFree =
|
||||
(PSLAB_CACHE_BUFCTL)(Page + ((i + 1) * Slab->ObjectSize));
|
||||
(PSLAB_CACHE_BUFCTL)((char*)Page + ((i + 1) * Slab->ObjectSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ ExAllocateSlabCache(PSLAB_CACHE Slab, BOOLEAN MayWait)
|
|||
/*
|
||||
* Allocate the first free object from the page.
|
||||
*/
|
||||
Object = (PVOID)Page->FirstFreeBuffer + sizeof(SLAB_CACHE_BUFCTL);
|
||||
Object = (PVOID)((char*)Page->FirstFreeBuffer + sizeof(SLAB_CACHE_BUFCTL));
|
||||
Page->FirstFreeBuffer = Page->FirstFreeBuffer->NextFree;
|
||||
Page->ReferenceCount++;
|
||||
|
||||
|
@ -239,7 +239,7 @@ ExFreeFromPageSlabCache(PSLAB_CACHE Slab,
|
|||
{
|
||||
PSLAB_CACHE_BUFCTL BufCtl;
|
||||
|
||||
BufCtl = (PSLAB_CACHE_BUFCTL)(Object - sizeof(SLAB_CACHE_BUFCTL));
|
||||
BufCtl = (PSLAB_CACHE_BUFCTL)((char*)Object - sizeof(SLAB_CACHE_BUFCTL));
|
||||
BufCtl->NextFree = Page->FirstFreeBuffer;
|
||||
Page->FirstFreeBuffer = BufCtl;
|
||||
Page->ReferenceCount--;
|
||||
|
@ -261,10 +261,10 @@ ExFreeSlabCache(PSLAB_CACHE Slab, PVOID Object)
|
|||
current = CONTAINING_RECORD(current_entry,
|
||||
SLAB_CACHE_PAGE,
|
||||
PageListEntry);
|
||||
Base = (PVOID)current + sizeof(SLAB_CACHE_PAGE) - PAGE_SIZE;
|
||||
Base = (PVOID)((char*)current + sizeof(SLAB_CACHE_PAGE) - PAGE_SIZE);
|
||||
if (Base >= Object &&
|
||||
(Base + PAGE_SIZE - sizeof(SLAB_CACHE_PAGE)) >=
|
||||
(Object + Slab->ObjectSize))
|
||||
((char*)Base + PAGE_SIZE - sizeof(SLAB_CACHE_PAGE)) >=
|
||||
((char*)Object + Slab->ObjectSize))
|
||||
{
|
||||
ExFreeFromPageSlabCache(Slab, current, Object);
|
||||
/*
|
||||
|
@ -304,12 +304,12 @@ ExDestroySlabCache(PSLAB_CACHE Slab)
|
|||
current = CONTAINING_RECORD(current_entry,
|
||||
SLAB_CACHE_PAGE,
|
||||
PageListEntry);
|
||||
Base = (PVOID)current + sizeof(SLAB_CACHE_PAGE) - PAGE_SIZE;
|
||||
Base = (PVOID)((char*)current + sizeof(SLAB_CACHE_PAGE) - PAGE_SIZE);
|
||||
if (Slab->Destructor != NULL)
|
||||
{
|
||||
for (i = 0; i < Slab->ObjectsPerPage; i++)
|
||||
{
|
||||
Object = Base + (i * Slab->ObjectSize) +
|
||||
Object = (char*)Base + (i * Slab->ObjectSize) +
|
||||
sizeof(SLAB_CACHE_BUFCTL);
|
||||
Slab->Destructor(Object, Slab->BaseSize);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: evtpair.c,v 1.19 2003/10/12 17:05:48 hbirr Exp $
|
||||
/* $Id: evtpair.c,v 1.20 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -342,8 +342,8 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
|
|||
* eventpair via NtSetInformationThread.
|
||||
* @implemented
|
||||
*/
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTSYSAPI
|
||||
NTAPI
|
||||
NtSetLowWaitHighThread(
|
||||
VOID
|
||||
|
@ -396,8 +396,8 @@ NtSetLowWaitHighThread(
|
|||
* eventpair via NtSetInformationThread.
|
||||
* @implemented
|
||||
*/
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTSYSAPI
|
||||
NTAPI
|
||||
NtSetHighWaitLowThread(
|
||||
VOID
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: nttimer.c,v 1.22 2003/10/12 17:05:48 hbirr Exp $
|
||||
/* $Id: nttimer.c,v 1.23 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -84,7 +84,7 @@ NtpDeleteTimer(PVOID ObjectBody)
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
VOID STDCALL
|
||||
NtpTimerDpcRoutine(PKDPC Dpc,
|
||||
PVOID DeferredContext,
|
||||
PVOID SystemArgument1,
|
||||
|
@ -98,15 +98,15 @@ NtpTimerDpcRoutine(PKDPC Dpc,
|
|||
|
||||
if ( Timer->Running )
|
||||
{
|
||||
KeInsertQueueApc(&Timer->Apc,
|
||||
SystemArgument1,
|
||||
SystemArgument2,
|
||||
IO_NO_INCREMENT);
|
||||
KeInsertQueueApc(&Timer->Apc,
|
||||
SystemArgument1,
|
||||
SystemArgument2,
|
||||
IO_NO_INCREMENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
VOID STDCALL
|
||||
NtpTimerApcKernelRoutine(PKAPC Apc,
|
||||
PKNORMAL_ROUTINE* NormalRoutine,
|
||||
PVOID* NormalContext,
|
||||
|
@ -121,6 +121,7 @@ NtpTimerApcKernelRoutine(PKAPC Apc,
|
|||
VOID INIT_FUNCTION
|
||||
NtInitializeTimerImplementation(VOID)
|
||||
{
|
||||
assert(!ExTimerType)
|
||||
ExTimerType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
||||
|
||||
RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer");
|
||||
|
@ -211,9 +212,9 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
|
|||
KeInitializeTimerEx(&Timer->Timer,
|
||||
TimerType);
|
||||
|
||||
KeInitializeDpc (&Timer->Dpc,
|
||||
(PKDEFERRED_ROUTINE)NtpTimerDpcRoutine,
|
||||
(PVOID)Timer);
|
||||
KeInitializeDpc(&Timer->Dpc,
|
||||
&NtpTimerDpcRoutine,
|
||||
Timer);
|
||||
|
||||
Timer->Running = FALSE;
|
||||
|
||||
|
@ -263,7 +264,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
|
|||
Status = ObReferenceObjectByHandle(TimerHandle,
|
||||
TIMER_QUERY_STATE,
|
||||
ExTimerType,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
(PVOID*)&Timer,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -284,7 +285,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
|
|||
|
||||
memcpy(&TimerInformation.TimeRemaining, &Timer->Timer.DueTime,
|
||||
sizeof(LARGE_INTEGER));
|
||||
TimerInformation.SignalState = Timer->Timer.Header.SignalState;
|
||||
TimerInformation.SignalState = (BOOLEAN)Timer->Timer.Header.SignalState;
|
||||
ResultLength = sizeof(TIMER_BASIC_INFORMATION);
|
||||
|
||||
Status = MmCopyToCaller(UnsafeTimerInformation, &TimerInformation,
|
||||
|
@ -322,7 +323,6 @@ NtSetTimer(IN HANDLE TimerHandle,
|
|||
PNTTIMER Timer;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Result;
|
||||
KIRQL OldIrql;
|
||||
BOOLEAN State;
|
||||
|
||||
DPRINT("NtSetTimer()\n");
|
||||
|
@ -330,38 +330,43 @@ NtSetTimer(IN HANDLE TimerHandle,
|
|||
Status = ObReferenceObjectByHandle(TimerHandle,
|
||||
TIMER_ALL_ACCESS,
|
||||
ExTimerType,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
(PVOID*)&Timer,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
State = KeReadStateTimer(&Timer->Timer);
|
||||
|
||||
if (Timer->Running == TRUE)
|
||||
{
|
||||
/* cancel running timer */
|
||||
OldIrql = KeRaiseIrqlToDpcLevel();
|
||||
const KIRQL OldIrql = KeRaiseIrqlToDpcLevel();
|
||||
KeCancelTimer(&Timer->Timer);
|
||||
KeRemoveQueueDpc(&Timer->Dpc);
|
||||
KeRemoveQueueApc(&Timer->Apc);
|
||||
Timer->Running = FALSE;
|
||||
KeLowerIrql(OldIrql);
|
||||
}
|
||||
if( TimerApcRoutine )
|
||||
KeInitializeApc(&Timer->Apc,
|
||||
KeGetCurrentThread(),
|
||||
OriginalApcEnvironment,
|
||||
(PKKERNEL_ROUTINE)NtpTimerApcKernelRoutine,
|
||||
(PKRUNDOWN_ROUTINE)NULL,
|
||||
(PKNORMAL_ROUTINE)TimerApcRoutine,
|
||||
KeGetPreviousMode(),
|
||||
TimerContext);
|
||||
|
||||
Result = KeSetTimerEx (&Timer->Timer,
|
||||
*DueTime,
|
||||
Period,
|
||||
TimerApcRoutine ? &Timer->Dpc : 0 );
|
||||
if (TimerApcRoutine)
|
||||
{
|
||||
KeInitializeApc(&Timer->Apc,
|
||||
KeGetCurrentThread(),
|
||||
OriginalApcEnvironment,
|
||||
&NtpTimerApcKernelRoutine,
|
||||
(PKRUNDOWN_ROUTINE)NULL,
|
||||
(PKNORMAL_ROUTINE)TimerApcRoutine,
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
TimerContext);
|
||||
}
|
||||
|
||||
Result = KeSetTimerEx(&Timer->Timer,
|
||||
*DueTime,
|
||||
Period,
|
||||
TimerApcRoutine ? &Timer->Dpc : 0 );
|
||||
if (Result == TRUE)
|
||||
{
|
||||
ObDereferenceObject(Timer);
|
||||
|
|
|
@ -150,12 +150,12 @@ KiAddProfileEventToProcess(PLIST_ENTRY ListHead, PVOID Eip)
|
|||
return;
|
||||
}
|
||||
|
||||
if (current->Base <= Eip && (current->Base + current->Size) > Eip &&
|
||||
if (current->Base <= Eip && ((char*)current->Base + current->Size) > (char*)Eip &&
|
||||
current->Started)
|
||||
{
|
||||
ULONG Bucket;
|
||||
|
||||
Bucket = ((ULONG)(Eip - current->Base)) >> current->BucketShift;
|
||||
Bucket = ((ULONG)((char*)Eip - (char*)current->Base)) >> current->BucketShift;
|
||||
|
||||
if ((Bucket*4) < current->BufferSize)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ntobj.c,v 1.18 2003/11/16 13:47:20 ekohl Exp $
|
||||
/* $Id: ntobj.c,v 1.19 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -51,7 +51,7 @@ NtSetInformationObject (IN HANDLE ObjectHandle,
|
|||
Status = ObReferenceObjectByHandle (ObjectHandle,
|
||||
0,
|
||||
NULL,
|
||||
KeGetPreviousMode (),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode (),
|
||||
&Object,
|
||||
NULL);
|
||||
if (!NT_SUCCESS (Status))
|
||||
|
@ -96,7 +96,7 @@ NtQueryObject (IN HANDLE ObjectHandle,
|
|||
Status = ObReferenceObjectByHandle (ObjectHandle,
|
||||
0,
|
||||
NULL,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
&Object,
|
||||
&HandleInfo);
|
||||
if (!NT_SUCCESS (Status))
|
||||
|
@ -135,7 +135,11 @@ NtQueryObject (IN HANDLE ObjectHandle,
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
BasicInfo->CreateTime.QuadPart = 0ULL;
|
||||
#else
|
||||
BasicInfo->CreateTime.QuadPart = 0;
|
||||
#endif
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -255,7 +259,7 @@ NtMakeTemporaryObject (IN HANDLE Handle)
|
|||
Status = ObReferenceObjectByHandle(Handle,
|
||||
0,
|
||||
NULL,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
& Object,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: object.c,v 1.72 2003/11/09 23:20:27 gvg Exp $
|
||||
/* $Id: object.c,v 1.73 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -36,7 +36,7 @@ typedef struct _RETENTION_CHECK_PARAMS
|
|||
|
||||
PVOID HEADER_TO_BODY(POBJECT_HEADER obj)
|
||||
{
|
||||
return(((void *)obj)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER));
|
||||
return(((char*)obj)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER));
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,7 +228,7 @@ ObQueryNameString (IN PVOID Object,
|
|||
if (Length < sizeof(OBJECT_NAME_INFORMATION) + sizeof(WCHAR))
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
|
||||
ObjectNameInfo->Name.MaximumLength = Length - sizeof(OBJECT_NAME_INFORMATION);
|
||||
ObjectNameInfo->Name.MaximumLength = (USHORT)(Length - sizeof(OBJECT_NAME_INFORMATION));
|
||||
ObjectNameInfo->Name.Length = 0;
|
||||
ObjectNameInfo->Name.Buffer =
|
||||
(PWCHAR)((ULONG_PTR)ObjectNameInfo + sizeof(OBJECT_NAME_INFORMATION));
|
||||
|
@ -554,7 +554,7 @@ ObOpenObjectByPointer(IN POBJECT Object,
|
|||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
HandleAttributes & OBJ_INHERIT,
|
||||
(BOOLEAN)(HandleAttributes & OBJ_INHERIT),
|
||||
Handle);
|
||||
|
||||
ObDereferenceObject(Object);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: symlink.c,v 1.7 2003/11/17 02:12:51 hyperion Exp $
|
||||
/* $Id: symlink.c,v 1.8 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -294,7 +294,7 @@ NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle,
|
|||
return(ObOpenObjectByName(ObjectAttributes,
|
||||
ObSymbolicLinkType,
|
||||
NULL,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
LinkHandle));
|
||||
|
@ -325,7 +325,7 @@ NtQuerySymbolicLinkObject(IN HANDLE LinkHandle,
|
|||
Status = ObReferenceObjectByHandle(LinkHandle,
|
||||
SYMBOLIC_LINK_QUERY,
|
||||
ObSymbolicLinkType,
|
||||
KeGetPreviousMode(),
|
||||
(KPROCESSOR_MODE)KeGetPreviousMode(),
|
||||
(PVOID *)&SymlinkObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: tinfo.c,v 1.23 2003/09/14 10:53:32 hbirr Exp $
|
||||
/* $Id: tinfo.c,v 1.24 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -366,7 +366,7 @@ NtQueryInformationThread (IN HANDLE ThreadHandle,
|
|||
|
||||
VOID KeSetPreviousMode(ULONG Mode)
|
||||
{
|
||||
PsGetCurrentThread()->Tcb.PreviousMode = Mode;
|
||||
PsGetCurrentThread()->Tcb.PreviousMode = (UCHAR)Mode;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -381,10 +381,10 @@ KeGetPreviousMode (VOID)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
ULONG STDCALL
|
||||
KPROCESSOR_MODE STDCALL
|
||||
ExGetPreviousMode (VOID)
|
||||
{
|
||||
return (ULONG)PsGetCurrentThread()->Tcb.PreviousMode;
|
||||
return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: w32call.c,v 1.9 2003/10/12 17:05:50 hbirr Exp $
|
||||
/* $Id: w32call.c,v 1.10 2003/12/30 18:52:05 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -209,7 +209,7 @@ PsAllocateCallbackStack(ULONG StackSize)
|
|||
return(NULL);
|
||||
}
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
KernelStack + (i * PAGE_SIZE),
|
||||
(char*)KernelStack + (i * PAGE_SIZE),
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
Page,
|
||||
TRUE);
|
||||
|
@ -240,7 +240,7 @@ NtW32Call (IN ULONG RoutineIndex,
|
|||
Thread = PsGetCurrentThread();
|
||||
|
||||
/* Set up the new kernel and user environment. */
|
||||
StackSize = (ULONG)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
|
||||
StackSize = (ULONG)((char*)Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
|
||||
if (IsListEmpty(&CallbackStackListHead))
|
||||
{
|
||||
NewStack = PsAllocateCallbackStack(StackSize);
|
||||
|
@ -250,7 +250,7 @@ NtW32Call (IN ULONG RoutineIndex,
|
|||
}
|
||||
else
|
||||
{
|
||||
PLIST_ENTRY StackEntry;
|
||||
PLIST_ENTRY StackEntry;
|
||||
|
||||
StackEntry = RemoveHeadList(&CallbackStackListHead);
|
||||
AssignedStack = CONTAINING_RECORD(StackEntry, NTW32CALL_CALLBACK_STACK,
|
||||
|
@ -258,9 +258,9 @@ NtW32Call (IN ULONG RoutineIndex,
|
|||
NewStack = AssignedStack->BaseAddress;
|
||||
}
|
||||
/* FIXME: Need to check whether we were interrupted from v86 mode. */
|
||||
memcpy(NewStack + StackSize - sizeof(KTRAP_FRAME), Thread->Tcb.TrapFrame,
|
||||
memcpy((char*)NewStack + StackSize - sizeof(KTRAP_FRAME), Thread->Tcb.TrapFrame,
|
||||
sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));
|
||||
NewFrame = (PKTRAP_FRAME)(NewStack + StackSize - sizeof(KTRAP_FRAME));
|
||||
NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME));
|
||||
NewFrame->Esp -= (ArgumentLength + (4 * sizeof(ULONG)));
|
||||
NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher();
|
||||
UserEsp = (PULONG)NewFrame->Esp;
|
||||
|
@ -280,9 +280,9 @@ NtW32Call (IN ULONG RoutineIndex,
|
|||
SavedState.CallbackStatus = &CallbackStatus;
|
||||
SavedState.SavedTrapFrame = Thread->Tcb.TrapFrame;
|
||||
SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack;
|
||||
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = NewStack + StackSize;
|
||||
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)NewStack + StackSize;
|
||||
Thread->Tcb.StackLimit = (ULONG)NewStack;
|
||||
Thread->Tcb.KernelStack = NewStack + StackSize - sizeof(KTRAP_FRAME);
|
||||
Thread->Tcb.KernelStack = (char*)NewStack + StackSize - sizeof(KTRAP_FRAME);
|
||||
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
|
||||
KePushAndStackSwitchAndSysRet((ULONG)&SavedState, Thread->Tcb.KernelStack);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: handle.c,v 1.4 2003/06/14 09:52:57 gvg Exp $
|
||||
/* $Id: handle.c,v 1.5 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -77,7 +77,7 @@ RtlpAllocateHandle(PRTL_HANDLE_TABLE HandleTable,
|
|||
|
||||
/* update handle array pointers */
|
||||
HandleTable->Handles = (PRTL_HANDLE)ArrayPointer;
|
||||
HandleTable->Limit = (PRTL_HANDLE)(ArrayPointer + ArraySize);
|
||||
HandleTable->Limit = (PRTL_HANDLE)((char*)ArrayPointer + ArraySize);
|
||||
HandleTable->LastUsed = (PRTL_HANDLE)ArrayPointer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: exception.c,v 1.8 2003/07/27 11:49:32 dwelch Exp $
|
||||
/* $Id: exception.c,v 1.9 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -26,6 +26,13 @@ MsvcrtDebug(ULONG Value)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
/*
|
||||
* When compiling this file with MSVC itself, don't compile these functions.
|
||||
* They are replacements for MS compiler and/or C runtime library functions,
|
||||
* which are already provided by the MSVC compiler and C runtime library.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -64,6 +71,8 @@ __ret_label:
|
|||
return;
|
||||
}
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
/* Implemented in except.s */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sprintf.c,v 1.14 2003/12/14 18:06:44 hbirr Exp $
|
||||
/* $Id: sprintf.c,v 1.15 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -39,12 +39,26 @@
|
|||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#define do_div(n,base) ({ \
|
||||
int __res; \
|
||||
__res = ((unsigned long long) n) % (unsigned) base; \
|
||||
n = ((unsigned long long) n) / (unsigned) base; \
|
||||
__res; })
|
||||
|
||||
#else /* __GNUC__ */
|
||||
/* n /= base, "returns" remainder */
|
||||
__inline int int_do_div(__int64* n, int base)
|
||||
{
|
||||
int __res = (int)(((unsigned __int64)*n) % (unsigned) base);
|
||||
*n = (int)(((unsigned __int64)*n) / (unsigned) base);
|
||||
return __res;
|
||||
}
|
||||
#define do_div(n,base) int_do_div(&n, base)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
static int skip_atoi(const char **s)
|
||||
{
|
||||
|
@ -57,7 +71,11 @@ static int skip_atoi(const char **s)
|
|||
|
||||
|
||||
static char *
|
||||
#if defined(__GNUC__)
|
||||
number(char *buf, char *end, long long num, int base, int size, int precision, int type)
|
||||
#else
|
||||
number(char *buf, char *end, __int64 num, int base, int size, int precision, int type)
|
||||
#endif
|
||||
{
|
||||
char c,sign,tmp[66];
|
||||
const char *digits;
|
||||
|
@ -246,7 +264,11 @@ stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int p
|
|||
int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
||||
{
|
||||
int len;
|
||||
#if defined(__GNUC__)
|
||||
unsigned long long num;
|
||||
#else
|
||||
unsigned __int64 num;
|
||||
#endif
|
||||
int base;
|
||||
char *str, *end;
|
||||
const char *s;
|
||||
|
@ -496,7 +518,11 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
|||
}
|
||||
|
||||
if (qualifier == 'I')
|
||||
#if defined(__GNUC__)
|
||||
num = va_arg(args, unsigned long long);
|
||||
#else
|
||||
num = va_arg(args, unsigned __int64);
|
||||
#endif
|
||||
else if (qualifier == 'l')
|
||||
num = va_arg(args, unsigned long);
|
||||
else if (qualifier == 'h') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stdlib.c,v 1.9 2003/12/14 18:06:44 hbirr Exp $
|
||||
/* $Id: stdlib.c,v 1.10 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -19,7 +19,11 @@
|
|||
|
||||
/* GLOBALS ****************************************************************/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
static unsigned long long next = 0;
|
||||
#else
|
||||
static unsigned __int64 next = 0;
|
||||
#endif
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -154,7 +158,11 @@ char *_itoa (int value, char *string, int radix)
|
|||
*/
|
||||
int rand(void)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
next = next * 0x5deece66dLL + 11;
|
||||
#else
|
||||
next = next * 0x5deece66di64 + 11;
|
||||
#endif
|
||||
return (int)((next >> 16) & RAND_MAX);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: swprintf.c,v 1.12 2003/12/14 18:06:44 hbirr Exp $
|
||||
/* $Id: swprintf.c,v 1.13 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -33,6 +33,15 @@
|
|||
#include <internal/debug.h>
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
typedef long long SWPRINT_INT64;
|
||||
typedef unsigned long long SWPRINT_UINT64;
|
||||
#else
|
||||
typedef __int64 SWPRINT_INT64;
|
||||
typedef unsigned __int64 SWPRINT_UINT64;
|
||||
#endif
|
||||
|
||||
|
||||
#define ZEROPAD 1 /* pad with zero */
|
||||
#define SIGN 2 /* unsigned/signed long */
|
||||
#define PLUS 4 /* show plus */
|
||||
|
@ -42,12 +51,29 @@
|
|||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#define do_div(n,base) ({ \
|
||||
int __res; \
|
||||
__res = ((unsigned long long) n) % (unsigned) base; \
|
||||
n = ((unsigned long long) n) / (unsigned) base; \
|
||||
__res = ((SWPRINT_UINT64) n) % (unsigned) base; \
|
||||
n = ((SWPRINT_UINT64) n) / (unsigned) base; \
|
||||
__res; })
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
static __inline int do_foo_div(SWPRINT_INT64* n, int base)
|
||||
{
|
||||
int __res = (int)(((SWPRINT_UINT64) *n) % (unsigned) base);
|
||||
*n = (int)(((SWPRINT_UINT64) *n) / (unsigned) base);
|
||||
return __res;
|
||||
}
|
||||
#define do_div(n,base) do_foo_div(&n,base)
|
||||
|
||||
#else
|
||||
#error Unknown compiler for this special compiler trickery
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static int skip_atoi(const wchar_t **s)
|
||||
{
|
||||
|
@ -60,7 +86,7 @@ static int skip_atoi(const wchar_t **s)
|
|||
|
||||
|
||||
static wchar_t *
|
||||
number(wchar_t * buf, wchar_t * end, long long num, int base, int size, int precision, int type)
|
||||
number(wchar_t * buf, wchar_t * end, SWPRINT_INT64 num, int base, int size, int precision, int type)
|
||||
{
|
||||
wchar_t c,sign, tmp[66];
|
||||
const wchar_t *digits;
|
||||
|
@ -246,7 +272,7 @@ stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width,
|
|||
int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
|
||||
{
|
||||
int len;
|
||||
unsigned long long num;
|
||||
SWPRINT_UINT64 num;
|
||||
int base;
|
||||
wchar_t * str, * end;
|
||||
const char *s;
|
||||
|
@ -483,7 +509,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
|
|||
}
|
||||
|
||||
if (qualifier == 'I')
|
||||
num = va_arg(args, unsigned long long);
|
||||
num = va_arg(args, SWPRINT_UINT64);
|
||||
else if (qualifier == 'l')
|
||||
num = va_arg(args, unsigned long);
|
||||
else if (qualifier == 'h') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: time.c,v 1.17 2003/07/11 01:23:16 royce Exp $
|
||||
/* $Id: time.c,v 1.18 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -32,8 +32,13 @@
|
|||
#define DAYSPERLEAPYEAR 366
|
||||
#define MONSPERYEAR 12
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define TICKSTO1970 0x019db1ded53e8000LL
|
||||
#define TICKSTO1980 0x01a8e79fe1d58000LL
|
||||
#else
|
||||
#define TICKSTO1970 0x019db1ded53e8000i64
|
||||
#define TICKSTO1980 0x01a8e79fe1d58000i64
|
||||
#endif
|
||||
|
||||
|
||||
static const int YearLengths[2] = {DAYSPERNORMALYEAR, DAYSPERLEAPYEAR};
|
||||
|
@ -71,7 +76,11 @@ RtlTimeToTimeFields(
|
|||
int LeapSecondCorrections, SecondsInDay, CurYear;
|
||||
int LeapYear, CurMonth, GMTOffset;
|
||||
long int Days;
|
||||
#if defined(__GNUC__)
|
||||
long long int Time = (long long int)liTime->QuadPart;
|
||||
#else
|
||||
__int64 Time = (__int64)liTime->QuadPart;
|
||||
#endif
|
||||
|
||||
/* Extract millisecond from time and convert time into seconds */
|
||||
TimeFields->Milliseconds = (CSHORT) ((Time % TICKSPERSEC) / TICKSPERMSEC);
|
||||
|
@ -151,7 +160,11 @@ RtlTimeFieldsToTime(
|
|||
PLARGE_INTEGER Time)
|
||||
{
|
||||
int CurMonth;
|
||||
#if defined(__GNUC__)
|
||||
long long int rcTime;
|
||||
#else
|
||||
__int64 rcTime;
|
||||
#endif
|
||||
TIME_FIELDS TimeFields = *tfTimeFields;
|
||||
const int *Months;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: unicode.c,v 1.33 2003/12/14 18:06:44 hbirr Exp $
|
||||
/* $Id: unicode.c,v 1.34 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -201,7 +201,7 @@ RtlAppendUnicodeStringToString(IN OUT PUNICODE_STRING Destination,
|
|||
if ((Source->Length + Destination->Length) >= Destination->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
memcpy((PVOID)Destination->Buffer + Destination->Length, Source->Buffer, Source->Length);
|
||||
memcpy((char*)Destination->Buffer + Destination->Length, Source->Buffer, Source->Length);
|
||||
Destination->Length += Source->Length;
|
||||
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = 0;
|
||||
|
||||
|
@ -223,7 +223,7 @@ RtlAppendUnicodeToString(IN OUT PUNICODE_STRING Destination,
|
|||
if (Destination->Length + slen >= Destination->MaximumLength)
|
||||
return(STATUS_BUFFER_TOO_SMALL);
|
||||
|
||||
memcpy((PVOID)Destination->Buffer + Destination->Length, Source, slen + sizeof(WCHAR));
|
||||
memcpy((char*)Destination->Buffer + Destination->Length, Source, slen + sizeof(WCHAR));
|
||||
Destination->Length += slen;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: acl.c,v 1.13 2003/10/12 17:05:50 hbirr Exp $
|
||||
/* $Id: acl.c,v 1.14 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -147,7 +147,7 @@ RtlFirstFreeAce(PACL Acl,
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
AclEnd = Acl->AclSize + (PVOID)Acl;
|
||||
AclEnd = Acl->AclSize + (char*)Acl;
|
||||
do
|
||||
{
|
||||
if ((PVOID)Current >= AclEnd)
|
||||
|
@ -162,7 +162,7 @@ RtlFirstFreeAce(PACL Acl,
|
|||
return(FALSE);
|
||||
}
|
||||
}
|
||||
Current = (PACE)((PVOID)Current + (ULONG)Current->Header.AceSize);
|
||||
Current = (PACE)((char*)Current + (ULONG)Current->Header.AceSize);
|
||||
i++;
|
||||
}
|
||||
while (i < Acl->AceCount);
|
||||
|
@ -206,8 +206,8 @@ RtlpAddKnownAce(PACL Acl,
|
|||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
if (((PVOID)Ace + RtlLengthSid(Sid) + sizeof(ACE)) >=
|
||||
((PVOID)Acl + Acl->AclSize))
|
||||
if (((char*)Ace + RtlLengthSid(Sid) + sizeof(ACE)) >=
|
||||
((char*)Acl + Acl->AclSize))
|
||||
{
|
||||
return(STATUS_BUFFER_TOO_SMALL);
|
||||
}
|
||||
|
@ -263,26 +263,26 @@ RtlAddAce(PACL Acl,
|
|||
{
|
||||
AclRevision = Acl->AclRevision;
|
||||
}
|
||||
if (((PVOID)AceList + AceListLength) <= (PVOID)AceList)
|
||||
if ((PVOID)((char*)AceList + AceListLength) <= (PVOID)AceList)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
i = 0;
|
||||
Current = (PACE)(Acl + 1);
|
||||
while ((PVOID)Current < ((PVOID)AceList + AceListLength))
|
||||
while ((char*)Current < ((char*)AceList + AceListLength))
|
||||
{
|
||||
if (AceList->Header.AceType == 4 &&
|
||||
AclRevision < 3)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
Current = (PACE)((PVOID)Current + Current->Header.AceSize);
|
||||
Current = (PACE)((char*)Current + Current->Header.AceSize);
|
||||
}
|
||||
if (Ace == NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
if (((PVOID)Ace + AceListLength) >= ((PVOID)Acl + Acl->AclSize))
|
||||
if (((char*)Ace + AceListLength) >= ((char*)Acl + Acl->AclSize))
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ RtlAddAce(PACL Acl,
|
|||
Current = (PACE)(Acl + 1);
|
||||
for (j = 0; j < StartingIndex; j++)
|
||||
{
|
||||
Current = (PACE)((PVOID)Current + Current->Header.AceSize);
|
||||
Current = (PACE)((char*)Current + Current->Header.AceSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sd.c,v 1.12 2003/10/15 11:02:04 ekohl Exp $
|
||||
/* $Id: sd.c,v 1.13 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -177,7 +177,7 @@ RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
|
|||
Dacl = SecurityDescriptor->Dacl;
|
||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
Dacl = (PACL)((ULONG)Dacl + (PVOID)SecurityDescriptor);
|
||||
Dacl = (PACL)((ULONG)Dacl + (char*)SecurityDescriptor);
|
||||
}
|
||||
Length = Length + ((Dacl->AclSize + 3) & 0xfc);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
|
|||
Sacl = SecurityDescriptor->Sacl;
|
||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
Sacl = (PACL)((ULONG)Sacl + (PVOID)SecurityDescriptor);
|
||||
Sacl = (PACL)((ULONG)Sacl + (char*)SecurityDescriptor);
|
||||
}
|
||||
Length = Length + ((Sacl->AclSize + 3) & 0xfc);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
*Dacl = (PACL)((ULONG)SecurityDescriptor->Dacl +
|
||||
(PVOID)SecurityDescriptor);
|
||||
(char*)SecurityDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
*Owner = (PSID)((ULONG)SecurityDescriptor->Owner +
|
||||
(PVOID)SecurityDescriptor);
|
||||
(char*)SecurityDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -477,7 +477,7 @@ RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
*Group = (PSID)((ULONG)SecurityDescriptor->Group +
|
||||
(PVOID)SecurityDescriptor);
|
||||
(char*)SecurityDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -532,7 +532,7 @@ RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
||||
{
|
||||
*Sacl = (PACL)((ULONG)SecurityDescriptor->Sacl +
|
||||
(PVOID)SecurityDescriptor);
|
||||
(char*)SecurityDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sid.c,v 1.15 2003/10/12 17:05:50 hbirr Exp $
|
||||
/* $Id: sid.c,v 1.16 2003/12/30 18:52:06 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -609,7 +609,7 @@ RtlCopySidAndAttributesArray(ULONG Count,
|
|||
Dest[i].Sid = SidArea;
|
||||
Dest[i].Attributes = Src[i].Attributes;
|
||||
RtlCopySid(RtlLengthSid(Src[i].Sid), SidArea, Src[i].Sid);
|
||||
SidArea = SidArea + RtlLengthSid(Src[i].Sid);
|
||||
SidArea = (char*)SidArea + RtlLengthSid(Src[i].Sid);
|
||||
}
|
||||
*RemainingSidArea = SidArea;
|
||||
*RemainingSidAreaSize = Length;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue