Fixes from Casper Hornstrup

svn path=/trunk/; revision=1276
This commit is contained in:
David Welch 2000-07-30 18:22:35 +00:00
parent afde198a7d
commit 83f94cade6
15 changed files with 186 additions and 188 deletions

View file

@ -381,8 +381,8 @@ ExInitializeResourceLite (
*/
#define ExInitializeWorkItem(Item, Routine, Context) \
ASSERT_IRQL(DISPATCH_LEVEL); \
(Item)->WorkerRoutine = (Routine); \
(Item)->Parameter = (Context); \
(Item)->Routine = (Routine); \
(Item)->Context = (Context); \
(Item)->List.Flink = NULL; \
(Item)->List.Blink = NULL;

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_IOFUNCS_H
#define _INCLUDE_DDK_IOFUNCS_H
/* $Id: iofuncs.h,v 1.18 2000/07/07 10:30:54 dwelch Exp $ */
/* $Id: iofuncs.h,v 1.19 2000/07/30 18:22:32 dwelch Exp $ */
/* --- EXPORTED BY NTOSKRNL --- */
@ -901,7 +901,7 @@ IoReportResourceUsage (
((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
(ULONG)(NewCancelRoutine)));
#define IoSetCompletionRoutine (Irp,Routine,Context,Success,Error,Cancel) \
#define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
{ \
PIO_STACK_LOCATION param; \
assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \

View file

@ -225,7 +225,7 @@ static inline PNT_TEB NtCurrentTeb(VOID)
int x;
__asm__ __volatile__("movl %%fs:0x18, %0\n\t"
: "=g" (x)
: "=a" (x)
: /* no inputs */
);

View file

@ -184,14 +184,16 @@ static HEAP *HEAP_GetPtr(
HEAP *heapPtr = (HEAP *)heap;
if (!heapPtr || (heapPtr->magic != HEAP_MAGIC))
{
DPRINT(heap, "Invalid heap %08x!\n", heap );
DbgPrint(heap, "Invalid heap %08x!\n", heap );
for(;;);
// SetLastError( ERROR_INVALID_HANDLE );
return NULL;
}
if (!RtlValidateHeap( heap, 0, NULL ))
{
HEAP_Dump( heapPtr );
DPRINT("NTDLL:%s:%d: assertion failed\n",__FILE__,__LINE__);
DbgPrint("NTDLL:%s:%d: assertion failed\n",__FILE__,__LINE__);
for(;;);
// SetLastError( ERROR_INVALID_HANDLE );
return NULL;
}
@ -264,7 +266,8 @@ static BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
PAGE_EXECUTE_READWRITE);
if (!NT_SUCCESS(Status))
{
DPRINT("ZwAllocateVirtualMemory failed\n");
DbgPrint("ZwAllocateVirtualMemory failed\n");
for(;;);
return(FALSE);
}
subheap->commitSize = size;
@ -294,10 +297,11 @@ static BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
MEM_DECOMMIT);
if (!NT_SUCCESS(Status))
{
DPRINT("Could not decommit %08lx bytes at %08lx for heap %08lx\n",
DbgPrint("Could not decommit %08lx bytes at %08lx for heap %08lx\n",
subheap->commitSize - size,
(DWORD)((char *)subheap + size),
(DWORD)subheap->heap );
for(;;);
return FALSE;
}
subheap->commitSize = size;
@ -458,8 +462,9 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
PAGE_EXECUTE_READWRITE);
if (!NT_SUCCESS(Status))
{
DPRINT("Could not commit %08lx bytes for sub-heap %08lx\n",
DbgPrint("Could not commit %08lx bytes for sub-heap %08lx\n",
commitSize, (DWORD)address );
for(;;);
return FALSE;
}
@ -596,7 +601,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
if (!(heap->flags & HEAP_GROWABLE))
{
DPRINT("Not enough space in heap %08lx for %08lx bytes\n",
DbgPrint("Not enough space in heap %08lx for %08lx bytes\n",
(DWORD)heap, size );
return NULL;
}
@ -641,29 +646,33 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
/* Check magic number */
if (pArena->magic != ARENA_FREE_MAGIC)
{
DPRINT("Heap %08lx: invalid free arena magic for %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena );
DbgPrint("Heap %08lx: invalid free arena magic for %08lx (%x)\n",
(DWORD)subheap->heap, (DWORD)pArena, &pArena->magic );
for(;;);
return FALSE;
}
/* Check size flags */
if (!(pArena->size & ARENA_FLAG_FREE) ||
(pArena->size & ARENA_FLAG_PREV_FREE))
{
DPRINT("Heap %08lx: bad flags %lx for free arena %08lx\n",
DbgPrint("Heap %08lx: bad flags %lx for free arena %08lx\n",
(DWORD)subheap->heap, pArena->size & ~ARENA_SIZE_MASK, (DWORD)pArena );
for(;;);
}
/* Check arena size */
if ((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) > heapEnd)
{
DPRINT("Heap %08lx: bad size %08lx for free arena %08lx\n",
DbgPrint("Heap %08lx: bad size %08lx for free arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->size & ARENA_SIZE_MASK, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that next pointer is valid */
if (!HEAP_IsValidArenaPtr( subheap->heap, pArena->next ))
{
DPRINT("Heap %08lx: bad next ptr %08lx for arena %08lx\n",
DbgPrint("Heap %08lx: bad next ptr %08lx for arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->next, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that next arena is free */
@ -677,16 +686,18 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
/* Check that prev pointer is valid */
if (!HEAP_IsValidArenaPtr( subheap->heap, pArena->prev ))
{
DPRINT("Heap %08lx: bad prev ptr %08lx for arena %08lx\n",
DbgPrint("Heap %08lx: bad prev ptr %08lx for arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->prev, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that prev arena is free */
if (!(pArena->prev->size & ARENA_FLAG_FREE) ||
(pArena->prev->magic != ARENA_FREE_MAGIC))
{
DPRINT("Heap %08lx: prev arena %08lx invalid for %08lx\n",
DbgPrint("Heap %08lx: prev arena %08lx invalid for %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->prev, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that next block has PREV_FREE flag */
@ -695,17 +706,19 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
if (!(*(DWORD *)((char *)(pArena + 1) +
(pArena->size & ARENA_SIZE_MASK)) & ARENA_FLAG_PREV_FREE))
{
DPRINT("Heap %08lx: free arena %08lx next block has no PREV_FREE flag\n",
DbgPrint("Heap %08lx: free arena %08lx next block has no PREV_FREE flag\n",
(DWORD)subheap->heap, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check next block back pointer */
if (*((ARENA_FREE **)((char *)(pArena + 1) +
(pArena->size & ARENA_SIZE_MASK)) - 1) != pArena)
{
DPRINT("Heap %08lx: arena %08lx has wrong back ptr %08lx\n",
DbgPrint("Heap %08lx: arena %08lx has wrong back ptr %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena,
*((DWORD *)((char *)(pArena+1)+ (pArena->size & ARENA_SIZE_MASK)) - 1));
for(;;);
return FALSE;
}
}
@ -723,29 +736,33 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena )
/* Check magic number */
if (pArena->magic != ARENA_INUSE_MAGIC)
{
DPRINT("Heap %08lx: invalid in-use arena magic for %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena );
DbgPrint("Heap %08lx: invalid in-use arena magic for %08lx (%x)\n",
(DWORD)subheap->heap, (DWORD)pArena, &pArena->magic );
for(;;);
return FALSE;
}
/* Check size flags */
if (pArena->size & ARENA_FLAG_FREE)
{
DPRINT("Heap %08lx: bad flags %lx for in-use arena %08lx\n",
DbgPrint("Heap %08lx: bad flags %lx for in-use arena %08lx\n",
(DWORD)subheap->heap, pArena->size & ~ARENA_SIZE_MASK, (DWORD)pArena );
for(;;);
}
/* Check arena size */
if ((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) > heapEnd)
{
DPRINT("Heap %08lx: bad size %08lx for in-use arena %08lx\n",
DbgPrint("Heap %08lx: bad size %08lx for in-use arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pArena->size & ARENA_SIZE_MASK, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check next arena PREV_FREE flag */
if (((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK) < heapEnd) &&
(*(DWORD *)((char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK)) & ARENA_FLAG_PREV_FREE))
{
DPRINT("Heap %08lx: in-use arena %08lx next block has PREV_FREE flag\n",
DbgPrint("Heap %08lx: in-use arena %08lx next block has PREV_FREE flag\n",
(DWORD)subheap->heap, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check prev free arena */
@ -755,23 +772,26 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena )
/* Check prev pointer */
if (!HEAP_IsValidArenaPtr( subheap->heap, pPrev ))
{
DPRINT("Heap %08lx: bad back ptr %08lx for arena %08lx\n",
DbgPrint("Heap %08lx: bad back ptr %08lx for arena %08lx\n",
(DWORD)subheap->heap, (DWORD)pPrev, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that prev arena is free */
if (!(pPrev->size & ARENA_FLAG_FREE) ||
(pPrev->magic != ARENA_FREE_MAGIC))
{
DPRINT("Heap %08lx: prev arena %08lx invalid for in-use %08lx\n",
DbgPrint("Heap %08lx: prev arena %08lx invalid for in-use %08lx\n",
(DWORD)subheap->heap, (DWORD)pPrev, (DWORD)pArena );
for(;;);
return FALSE;
}
/* Check that prev arena is really the previous block */
if ((char *)(pPrev + 1) + (pPrev->size & ARENA_SIZE_MASK) != (char *)pArena)
{
DPRINT("Heap %08lx: prev arena %08lx is not prev for in-use %08lx\n",
DbgPrint("Heap %08lx: prev arena %08lx is not prev for in-use %08lx\n",
(DWORD)subheap->heap, (DWORD)pPrev, (DWORD)pArena );
for(;;);
return FALSE;
}
}
@ -844,7 +864,7 @@ HANDLE STDCALL RtlCreateHeap(ULONG flags,
maxSize)))
{
// SetLastError( ERROR_OUTOFMEMORY );
DPRINT("RtlCreateHeap() = %x\n",0);
DbgPrint("RtlCreateHeap() = %x\n",0);
return 0;
}
@ -886,37 +906,34 @@ BOOL STDCALL RtlDestroyHeap(
* Pointer to allocated memory block
* NULL: Failure
*/
PVOID STDCALL
RtlAllocateHeap(HANDLE heap, /* [in] Handle of private heap block */
ULONG flags, /* [in] Heap allocation control flags */
ULONG size /* [in] Number of bytes to allocate */)
{
ARENA_FREE* pArena;
ARENA_INUSE* pInUse;
SUBHEAP* subheap;
HEAP* heapPtr = NULL;
DPRINT("RtlAllocateHeap(heap 0x%x, flags 0x%x, size %d)\n",
heap, flags, size);
/* Validate the parameters */
heapPtr = HEAP_GetPtr(heap);
if (!heapPtr)
{
return NULL;
}
flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY;
flags |= heapPtr->flags;
if (!(flags & HEAP_NO_SERIALIZE))
PVOID STDCALL RtlAllocateHeap(
HANDLE heap, /* [in] Handle of private heap block */
ULONG flags, /* [in] Heap allocation control flags */
ULONG size /* [in] Number of bytes to allocate */
) {
ARENA_FREE *pArena;
ARENA_INUSE *pInUse;
SUBHEAP *subheap;
HEAP *heapPtr = NULL;
/* Validate the parameters */
flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY;
flags |= ((HEAP*)heap)->flags;
if (!(flags & HEAP_NO_SERIALIZE))
{
RtlLockHeap(heap);
}
size = (size + 3) & ~3;
if (size < HEAP_MIN_BLOCK_SIZE)
heapPtr = HEAP_GetPtr(heap);
if (heapPtr == NULL)
{
size = HEAP_MIN_BLOCK_SIZE;
if (!(flags & HEAP_NO_SERIALIZE))
{
RtlUnlockHeap(heap);
}
}
size = (size + 3) & ~3;
if (size < HEAP_MIN_BLOCK_SIZE) size = HEAP_MIN_BLOCK_SIZE;
/* Locate a suitable free block */
@ -924,9 +941,9 @@ RtlAllocateHeap(HANDLE heap, /* [in] Handle of private heap block */
{
DPRINT("(%08x,%08lx,%08lx): returning NULL\n",
heap, flags, size );
if (!(flags & HEAP_NO_SERIALIZE)) RtlUnlockHeap( heap );
/* SetLastError( ERROR_COMMITMENT_LIMIT ); */
return NULL;
if (!(flags & HEAP_NO_SERIALIZE)) RtlUnlockHeap( heap );
// SetLastError( ERROR_COMMITMENT_LIMIT );
return NULL;
}
/* Remove the arena from the free list */
@ -940,7 +957,7 @@ RtlAllocateHeap(HANDLE heap, /* [in] Handle of private heap block */
pInUse->size = (pInUse->size & ~ARENA_FLAG_FREE)
+ sizeof(ARENA_FREE) - sizeof(ARENA_INUSE);
pInUse->callerEIP = *((DWORD *)&heap - 1); /* hack hack */
/* pInUse->threadId = GetCurrentTask(); */
// pInUse->threadId = GetCurrentTask();
pInUse->magic = ARENA_INUSE_MAGIC;
/* Shrink the block */
@ -971,14 +988,25 @@ BOOLEAN STDCALL RtlFreeHeap(
) {
ARENA_INUSE *pInUse;
SUBHEAP *subheap;
HEAP *heapPtr = HEAP_GetPtr( heap );
HEAP *heapPtr = NULL;
/* Validate the parameters */
if (!heapPtr) return FALSE;
flags &= HEAP_NO_SERIALIZE;
flags |= heapPtr->flags;
if (!(flags & HEAP_NO_SERIALIZE)) RtlLockHeap( heap );
flags |= ((HEAP*)heap)->flags;
if (!(flags & HEAP_NO_SERIALIZE))
{
RtlLockHeap( heap );
}
heapPtr = HEAP_GetPtr(heap);
if (heapPtr == NULL)
{
if (!(flags & HEAP_NO_SERIALIZE))
{
RtlUnlockHeap(heap);
}
return(FALSE);
}
if (!ptr)
{
DPRINT("(%08x,%08lx,%08lx): asked to free NULL\n",

View file

@ -22,6 +22,7 @@ POBJECT_TYPE EXPORTED ExWindowStationObjectType = NULL;
VOID ExInit (VOID)
{
ExInitTimeZoneInfo();
ExInitializeWorkerThreads();
}

View file

@ -1,4 +1,4 @@
/* $Id: work.c,v 1.7 2000/07/02 10:48:31 ekohl Exp $
/* $Id: work.c,v 1.8 2000/07/30 18:22:33 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -135,12 +135,9 @@ VOID ExInitializeWorkerThreads(VOID)
HIGH_PRIORITY);
}
VOID
STDCALL
ExQueueWorkItem (
PWORK_QUEUE_ITEM WorkItem,
WORK_QUEUE_TYPE QueueType
)
VOID STDCALL
ExQueueWorkItem (PWORK_QUEUE_ITEM WorkItem,
WORK_QUEUE_TYPE QueueType)
/*
* FUNCTION: Inserts a work item in a queue for one of the system worker
* threads to process
@ -163,8 +160,8 @@ ExQueueWorkItem (
&WorkItem->Entry,
&EiNormalWorkQueue.Lock);
KeReleaseSemaphore(&EiNormalWorkQueue.Sem,
1,
IO_NO_INCREMENT,
1,
FALSE);
break;
@ -173,8 +170,8 @@ ExQueueWorkItem (
&WorkItem->Entry,
&EiCriticalWorkQueue.Lock);
KeReleaseSemaphore(&EiCriticalWorkQueue.Sem,
1,
IO_NO_INCREMENT,
1,
FALSE);
break;
@ -183,8 +180,8 @@ ExQueueWorkItem (
&WorkItem->Entry,
&EiHyperCriticalWorkQueue.Lock);
KeReleaseSemaphore(&EiHyperCriticalWorkQueue.Sem,
1,
IO_NO_INCREMENT,
1,
FALSE);
break;

View file

@ -16,7 +16,7 @@ TIME_ZONE_INFORMATION SystemTimeZoneInfo;
VOID ExInit (VOID);
VOID ExInitTimeZoneInfo (VOID);
VOID ExInitializeWorkerThreads(VOID);
#endif /* _INCLUDE_INTERNAL_EXECUTIVE_H */

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.30 2000/03/29 13:11:53 dwelch Exp $
/* $Id: create.c,v 1.31 2000/07/30 18:22:34 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -37,13 +37,10 @@
* REVISIONS
*
*/
NTSTATUS
STDCALL
NtDeleteFile (
IN POBJECT_ATTRIBUTES ObjectAttributes
)
NTSTATUS STDCALL
NtDeleteFile (IN POBJECT_ATTRIBUTES ObjectAttributes)
{
UNIMPLEMENTED;
UNIMPLEMENTED;
}
@ -182,12 +179,9 @@ IopCreateFile (
* REVISIONS
*
*/
PFILE_OBJECT
STDCALL
IoCreateStreamFileObject (
PFILE_OBJECT FileObject,
PDEVICE_OBJECT DeviceObject
)
PFILE_OBJECT STDCALL
IoCreateStreamFileObject (PFILE_OBJECT FileObject,
PDEVICE_OBJECT DeviceObject)
{
HANDLE FileHandle;
PFILE_OBJECT CreatedFileObject;
@ -329,13 +323,11 @@ IoCreateFile (
*FileHandle = 0;
FileObject = ObCreateObject (
FileHandle,
DesiredAccess,
ObjectAttributes,
IoFileObjectType
);
if (NULL == FileObject)
FileObject = ObCreateObject (FileHandle,
DesiredAccess,
ObjectAttributes,
IoFileObjectType);
if (FileObject == NULL)
{
return (STATUS_UNSUCCESSFUL);
}
@ -343,20 +335,15 @@ IoCreateFile (
{
//FileObject->Flags = FileObject->Flags | FO_ALERTABLE_IO;
//FileObject->Flags = FileObject->Flags | FO_SYNCHRONOUS_IO;
FileObject->Flags |= ( FO_ALERTABLE_IO
| FO_SYNCHRONOUS_IO
);
FileObject->Flags |= (FO_ALERTABLE_IO | FO_SYNCHRONOUS_IO);
}
if (CreateOptions & FILE_SYNCHRONOUS_IO_NONALERT)
{
//FileObject->Flags |= FileObject->Flags | FO_SYNCHRONOUS_IO;
FileObject->Flags |= FO_SYNCHRONOUS_IO;
}
KeInitializeEvent (
& Event,
NotificationEvent,
FALSE
);
KeInitializeEvent (&Event, NotificationEvent, FALSE);
DPRINT("FileObject %x\n", FileObject);
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
/*
@ -364,14 +351,14 @@ IoCreateFile (
* the FS driver: this may fail
* due to resource shortage.
*/
Irp = IoAllocateIrp (
FileObject->DeviceObject->StackSize,
FALSE
);
if (NULL == Irp)
Irp = IoAllocateIrp (FileObject->DeviceObject->StackSize, FALSE);
if (Irp == NULL)
{
return (STATUS_UNSUCCESSFUL);
}
Irp->AssociatedIrp.SystemBuffer = EaBuffer;
/*
* Get the stack location for the new
* IRP and prepare it.
@ -385,25 +372,21 @@ IoCreateFile (
StackLoc->FileObject = FileObject;
StackLoc->Parameters.Create.Options = (CreateOptions & FILE_VALID_OPTION_FLAGS);
StackLoc->Parameters.Create.Options |= (CreateDisposition << 24);
/*
* Now call the driver and
* possibly wait if it can
* not complete the request
* immediately.
*/
Status = IofCallDriver (
FileObject->DeviceObject,
Irp
);
if (STATUS_PENDING == Status)
Status = IofCallDriver (FileObject->DeviceObject, Irp );
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject (
& Event,
Executive,
KernelMode,
FALSE,
NULL
);
KeWaitForSingleObject (&Event,
Executive,
KernelMode,
FALSE,
NULL);
Status = IoStatusBlock->Status;
}
if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.9 2000/07/04 08:52:38 dwelch Exp $
/* $Id: process.c,v 1.10 2000/07/30 18:22:34 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -18,43 +18,31 @@
/* FUNCTIONS *****************************************************************/
PVOID
STDCALL
IoGetInitialStack (
VOID
)
PVOID STDCALL
IoGetInitialStack (VOID)
{
UNIMPLEMENTED;
}
VOID
STDCALL
IoGetStackLimits (
PULONG LowLimit,
PULONG HighLimit
)
VOID STDCALL
IoGetStackLimits (PULONG LowLimit,
PULONG HighLimit)
{
*LowLimit = (ULONG)NtCurrentTeb ()->Tib.StackLimit;
*HighLimit = (ULONG)NtCurrentTeb ()->Tib.StackBase;
}
PEPROCESS
STDCALL
IoThreadToProcess (
IN PETHREAD Thread
)
PEPROCESS STDCALL
IoThreadToProcess (IN PETHREAD Thread)
{
return (Thread->ThreadsProcess);
return (Thread->ThreadsProcess);
}
PEPROCESS
STDCALL
IoGetRequestorProcess (
IN PIRP Irp
)
PEPROCESS STDCALL
IoGetRequestorProcess (IN PIRP Irp)
{
return (Irp->Tail.Overlay.Thread->ThreadsProcess);
}
@ -73,12 +61,8 @@ IoGetRequestorProcess (
* Previous value for the current thread's hard errors
* processing policy.
*/
BOOLEAN
STDCALL
EXPORTED
IoSetThreadHardErrorMode (
IN BOOLEAN HardErrorEnabled
)
BOOLEAN STDCALL EXPORTED
IoSetThreadHardErrorMode (IN BOOLEAN HardErrorEnabled)
{
BOOLEAN PreviousHEM = NtCurrentTeb ()->HardErrorDisabled;

View file

@ -62,6 +62,7 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
CONTEXT SavedContext;
ULONG Top;
BOOL ret = FALSE;
PETHREAD EThread;
DPRINT("KiTestAlert(Thread %x, UserContext %x)\n");
while(1)
@ -106,11 +107,16 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
*/
KeCallKernelRoutineApc(Apc);
}
KeAcquireSpinLock( &PiThreadListLock, &oldlvl );
if( (CONTAINING_RECORD( Thread, ETHREAD, Tcb ))->DeadThread )
KeAcquireSpinLock(&PiThreadListLock, &oldlvl);
EThread = CONTAINING_RECORD(Thread, ETHREAD, Tcb);
if (EThread->DeadThread)
{
KeReleaseSpinLock( &PiThreadListLock, oldlvl );
PsTerminateCurrentThread( (CONTAINING_RECORD( Thread, ETHREAD, Tcb ))->ExitStatus );
KeReleaseSpinLock(&PiThreadListLock, oldlvl);
PsTerminateCurrentThread(EThread->ExitStatus);
}
else
{
KeReleaseSpinLock(&PiThreadListLock, oldlvl);
}
return ret;
}
@ -147,14 +153,10 @@ VOID STDCALL KiDeliverApc(ULONG Unknown1,
// Thread->Tcb.WaitStatus = STATUS_KERNEL_APC;
}
VOID
STDCALL
KeInsertQueueApc (
PKAPC Apc,
PVOID SystemArgument1,
PVOID SystemArgument2,
UCHAR Mode
)
VOID STDCALL KeInsertQueueApc (PKAPC Apc,
PVOID SystemArgument1,
PVOID SystemArgument2,
UCHAR Mode)
/*
* FUNCTION: Queues an APC for execution
* ARGUMENTS:
@ -202,7 +204,6 @@ KeInsertQueueApc (
{
KeRemoveAllWaitsThread(CONTAINING_RECORD(TargetThread, ETHREAD, Tcb),
STATUS_KERNEL_APC);
KeReleaseSpinLock(&PiApcLock, oldlvl);
}
if (Apc->ApcMode == UserMode && TargetThread->Alertable == TRUE &&
TargetThread->WaitMode == UserMode)
@ -214,22 +215,19 @@ KeInsertQueueApc (
Status = STATUS_USER_APC;
KeRemoveAllWaitsThread(CONTAINING_RECORD(TargetThread, ETHREAD, Tcb),
STATUS_USER_APC);
KeReleaseSpinLock(&PiApcLock, oldlvl);
}
KeReleaseSpinLock(&PiApcLock, oldlvl);
}
VOID
STDCALL
KeInitializeApc (
PKAPC Apc,
PKTHREAD Thread,
UCHAR StateIndex,
PKKERNEL_ROUTINE KernelRoutine,
PKRUNDOWN_ROUTINE RundownRoutine,
PKNORMAL_ROUTINE NormalRoutine,
UCHAR Mode,
PVOID Context
)
VOID STDCALL
KeInitializeApc (PKAPC Apc,
PKTHREAD Thread,
UCHAR StateIndex,
PKKERNEL_ROUTINE KernelRoutine,
PKRUNDOWN_ROUTINE RundownRoutine,
PKNORMAL_ROUTINE NormalRoutine,
UCHAR Mode,
PVOID Context)
/*
* FUNCTION: Initialize an APC object
* ARGUMENTS:

View file

@ -35,10 +35,10 @@ VOID KiCheckFPU(VOID)
__asm__("fstsw %0\n\t" : "=a" (status));
if (status != 0)
{
__asm__("movl %%cr0, %0\n\t" : "=g" (cr0));
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0));
cr0 = cr0 | 0x4;
__asm__("movl %0, %%cr0\n\t" :
: "g" (cr0));
: "a" (cr0));
DbgPrint("No FPU detected\n");
return;
}

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.55 2000/07/10 21:54:19 ekohl Exp $
/* $Id: main.c,v 1.56 2000/07/30 18:22:34 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -82,7 +82,7 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
/*
* Initialization phase 0
*/
HalInitSystem (0, &KeLoaderBlock);
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
KeInit1();
KeLowerIrql(DISPATCH_LEVEL);
@ -103,12 +103,12 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
PAGE_ROUND_UP(KeLoaderBlock.module_length[i]);
}
MmInit1(&KeLoaderBlock, last_kernel_address);
MmInit1((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock, last_kernel_address);
/*
* Initialize the kernel debugger
*/
KdInitSystem (0, &KeLoaderBlock);
KdInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
if (KdPollBreakIn ())
{
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
@ -118,7 +118,7 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
* Initialization phase 1
* Initalize various critical subsystems
*/
HalInitSystem (1, &KeLoaderBlock);
HalInitSystem (1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
MmInit2();
KeInit2();
@ -127,9 +127,9 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
*/
KeLowerIrql(PASSIVE_LEVEL);
ExInit();
ObInit();
PiInitProcessManager();
ExInit();
IoInit();
LdrInitModuleManagement();
CmInitializeRegistry();
@ -181,7 +181,7 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
/*
* Assign drive letters
*/
IoAssignDriveLetters (&KeLoaderBlock,
IoAssignDriveLetters ((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
NULL,
NULL,
NULL);

View file

@ -1,4 +1,4 @@
/* $Id: object.c,v 1.24 2000/06/15 18:39:25 ekohl Exp $
/* $Id: object.c,v 1.25 2000/07/30 18:22:35 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -169,6 +169,11 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
/* reparse the object path */
NextObject = RootObject;
current = PathString.Buffer;
ObReferenceObjectByPointer(NextObject,
DIRECTORY_TRAVERSE,
NULL,
UserMode);
}
if (NextObject == NULL)

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.52 2000/07/06 14:34:52 dwelch Exp $
/* $Id: thread.c,v 1.53 2000/07/30 18:22:35 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -202,7 +202,7 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
CurrentThread);
}
for (CurrentPriority = THREAD_PRIORITY_TIME_CRITICAL;
for (CurrentPriority = (THREAD_PRIORITY_TIME_CRITICAL + 1);
(CurrentPriority >= THREAD_PRIORITY_IDLE);
CurrentPriority--)
{

View file

@ -45,8 +45,10 @@ endif
#
ifeq ($(WITH_DEBUGGING),yes)
DEBUGGING_CFLAGS = -g
OPTIMIZATIONS = -O2
else
DEBUGGING_CFLAGS =
DEBUGGING_CFLAGS =
OPTIMIZATIONS = -O2
endif
ifeq ($(WARNINGS_ARE_ERRORS),yes)
@ -66,7 +68,7 @@ NATIVE_CC = gcc
NATIVE_NM = nm
CFLAGS = $(BASE_CFLAGS) \
-pipe \
-O2 \
$(OPTIMIZATIONS) \
$(LEAN_AND_MEAN_DEFINE) \
$(DEFINES) -Wall \
-Wstrict-prototypes $(DEBUGGING_CFLAGS) \