From 0bcca89137af290402b25b9b174aa74dd3bb349d Mon Sep 17 00:00:00 2001 From: David Welch Date: Thu, 28 Jan 1999 15:54:26 +0000 Subject: [PATCH] no message svn path=/trunk/; revision=193 --- reactos/apps/utils/shell/shell.c | 33 ++++---- reactos/copying.dj | 141 ++++++++++++++++++++----------- reactos/include/ddk/ntddk.h | 1 + reactos/include/internal/ke.h | 2 +- reactos/lib/kernel32/file/find.c | 1 + reactos/lib/kernel32/mem/heap.c | 8 +- reactos/ntoskrnl/cc/view.c | 71 +++++++++------- reactos/ntoskrnl/hal/x86/exp.c | 4 +- reactos/ntoskrnl/io/irp.c | 7 +- reactos/ntoskrnl/ke/bug.c | 2 +- reactos/ntoskrnl/mm/npool.c | 2 +- 11 files changed, 169 insertions(+), 103 deletions(-) diff --git a/reactos/apps/utils/shell/shell.c b/reactos/apps/utils/shell/shell.c index 36551675325..8a3642fa179 100644 --- a/reactos/apps/utils/shell/shell.c +++ b/reactos/apps/utils/shell/shell.c @@ -55,25 +55,26 @@ void ExecuteDir(char* cmdline) TIME_FIELDS fTime; shandle = FindFirstFile("*",&FindData); - - if (shandle==INVALID_HANDLE_VALUE) - { - return; - } - do - { - debug_printf("%-15.15s",FindData.cAlternateFileName); - if(FindData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY) - debug_printf(" "),nRep++; - else - debug_printf(" %10d ",FindData.nFileSizeLow),nFile++; -// RtlTimeToTimeFields(&FindData.ftLastWriteTime ,&fTime); + + if (shandle==INVALID_HANDLE_VALUE) + { + debug_printf("Invalid directory\n"); + return; + } + do + { + debug_printf("%-15.15s",FindData.cAlternateFileName); + if(FindData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY) + debug_printf(" "),nRep++; + else + debug_printf(" %10d ",FindData.nFileSizeLow),nFile++; + // RtlTimeToTimeFields(&FindData.ftLastWriteTime ,&fTime); // debug_printf("%02d/%02d/%04d %02d:%02d:%02d " // ,fTime.Month,fTime.Day,fTime.Year // ,fTime.Hour,fTime.Minute,fTime.Second); - debug_printf("%s\n",FindData.cFileName); - } while(FindNextFile(shandle,&FindData)); - debug_printf("\n %d files\n %d directories\n\n",nFile,nRep); + debug_printf("%s\n",FindData.cFileName); + } while(FindNextFile(shandle,&FindData)); + debug_printf("\n %d files\n %d directories\n\n",nFile,nRep); } void ExecuteType(char* cmdline) diff --git a/reactos/copying.dj b/reactos/copying.dj index 49d7be96f3a..e32af57939f 100644 --- a/reactos/copying.dj +++ b/reactos/copying.dj @@ -1,47 +1,94 @@ -This is the file "copying.dj". It does NOT apply to any sources or -binaries copyrighted by UCB Berkeley, the Free Software Foundation, or -any other agency besides DJ Delorie and others who have agreed to -allow their sources to be distributed under these terms. - - Copyright Information for sources and executables that are marked - Copyright (C) DJ Delorie - 7 Kim Lane - Rochester NH 03867-2954 - -This document is Copyright (C) DJ Delorie and may be distributed -verbatim, but changing it is not allowed. - -Source code copyright DJ Delorie is distributed under the terms of the -GNU General Public Licence, with the following exceptions: - -* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and - libemu.a are distributed under the terms of the GNU Library General - Public License, rather than the GNU GPL. - -* Any existing copyright or authorship information in any given source - file must remain intact. If you modify a source file, a notice to that - effect must be added to the authorship information in the source file. - -* Runtime binaries, as provided by DJ in DJGPP, may be distributed - without sources ONLY if the recipient is given sufficient information - to obtain a copy of djgpp themselves. This primarily applies to - go32-v2.exe, emu387.dxe, and stubedit.exe. - -* Runtime objects and libraries, as provided by DJ in DJGPP, when - linked into an application, may be distributed without sources ONLY - if the recipient is given sufficient information to obtain a copy of - djgpp themselves. This primarily applies to crt0.o and libc.a. - ------ - -Changes to source code copyright BSD or FSF by DJ Delorie fall under -the terms of the original copyright. - -A copy of the files "COPYING" and "COPYING.LIB" are included with this -document. If you did not receive a copy of these files, you may -obtain one from whence this document was obtained, or by writing: - - Free Software Foundation - 675 Mass Ave - Cambridge, MA 02139 - USA +This is the file "copying.dj". It does NOT apply to any sources or + +binaries copyrighted by UCB Berkeley, the Free Software Foundation, or + +any other agency besides DJ Delorie and others who have agreed to + +allow their sources to be distributed under these terms. + + + + Copyright Information for sources and executables that are marked + + Copyright (C) DJ Delorie + + 7 Kim Lane + + Rochester NH 03867-2954 + + + +This document is Copyright (C) DJ Delorie and may be distributed + +verbatim, but changing it is not allowed. + + + +Source code copyright DJ Delorie is distributed under the terms of the + +GNU General Public Licence, with the following exceptions: + + + +* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and + + libemu.a are distributed under the terms of the GNU Library General + + Public License, rather than the GNU GPL. + + + +* Any existing copyright or authorship information in any given source + + file must remain intact. If you modify a source file, a notice to that + + effect must be added to the authorship information in the source file. + + + +* Runtime binaries, as provided by DJ in DJGPP, may be distributed + + without sources ONLY if the recipient is given sufficient information + + to obtain a copy of djgpp themselves. This primarily applies to + + go32-v2.exe, emu387.dxe, and stubedit.exe. + + + +* Runtime objects and libraries, as provided by DJ in DJGPP, when + + linked into an application, may be distributed without sources ONLY + + if the recipient is given sufficient information to obtain a copy of + + djgpp themselves. This primarily applies to crt0.o and libc.a. + + + +----- + + + +Changes to source code copyright BSD or FSF by DJ Delorie fall under + +the terms of the original copyright. + + + +A copy of the files "COPYING" and "COPYING.LIB" are included with this + +document. If you did not receive a copy of these files, you may + +obtain one from whence this document was obtained, or by writing: + + + + Free Software Foundation + + 675 Mass Ave + + Cambridge, MA 02139 + + USA + diff --git a/reactos/include/ddk/ntddk.h b/reactos/include/ddk/ntddk.h index 4f805ada2fc..3e465507946 100644 --- a/reactos/include/ddk/ntddk.h +++ b/reactos/include/ddk/ntddk.h @@ -22,6 +22,7 @@ extern "C" #include +#include #include #include #include diff --git a/reactos/include/internal/ke.h b/reactos/include/internal/ke.h index 3a1771488fa..8a01456957c 100644 --- a/reactos/include/internal/ke.h +++ b/reactos/include/internal/ke.h @@ -28,7 +28,7 @@ NTSTATUS KeAddThreadTimeout(PKTHREAD Thread, PLARGE_INTEGER Interval); VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type, ULONG Size, ULONG SignalState); -VOID KeDumpStackFrames(ULONG DummyArg); +VOID KeDumpStackFrames(ULONG DummyArg, ULONG NrFrames); /* INITIALIZATION FUNCTIONS *************************************************/ diff --git a/reactos/lib/kernel32/file/find.c b/reactos/lib/kernel32/file/find.c index e0685c8e390..e9fb899d519 100644 --- a/reactos/lib/kernel32/file/find.c +++ b/reactos/lib/kernel32/file/find.c @@ -1,3 +1,4 @@ + /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/kernel32/mem/heap.c b/reactos/lib/kernel32/mem/heap.c index e973cc37749..c84bf6cf141 100644 --- a/reactos/lib/kernel32/mem/heap.c +++ b/reactos/lib/kernel32/mem/heap.c @@ -48,7 +48,7 @@ static HEAP_BUCKET __HeapDefaultBuckets[]= { NULL, 256, 15, 4088 }, }; -PHEAP __ProcessHeap; +PHEAP __ProcessHeap = NULL; static BOOL __HeapCommit(PHEAP pheap, LPVOID start, LPVOID end); static BOOL __HeapDecommit(PHEAP pheap, LPVOID start, LPVOID end); @@ -604,8 +604,10 @@ PHEAP __HeapPrepare(LPVOID base, ULONG minsize, ULONG maxsize, ULONG flags) pheap->End= ((LPVOID)pheap)+minsize; pheap->Flags=flags; pheap->LastBlock=(LPVOID)pheap + PAGESIZE; - CopyMemory(pheap->Bucket,__HeapDefaultBuckets,sizeof(__HeapDefaultBuckets)); - if(__ProcessHeap) + CopyMemory(pheap->Bucket, + __HeapDefaultBuckets, + sizeof(__HeapDefaultBuckets)); + if (__ProcessHeap) { pheap->NextHeap=__ProcessHeap->NextHeap; __ProcessHeap->NextHeap=pheap; diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index 27782c4da94..1181f0b4033 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -18,6 +18,8 @@ /* TYPES *********************************************************************/ +#define CACHE_SEGMENT_SIZE (0x10000) + #define CACHE_SEGMENT_INVALID (0) // Isn't valid #define CACHE_SEGMENT_WRITTEN (1) // Written #define CACHE_SEGMENT_READ (2) @@ -28,7 +30,7 @@ typedef struct _CACHE_SEGMENT ULONG Size; LIST_ENTRY ListEntry; // Entry in the per-open list of segments PVOID BaseAddress; // Base address of the mapping - ULONG Length; // Length of the mapping + ULONG ValidLength; // Length of the mapping ULONG State; // Information MEMORY_AREA* MemoryArea; // Memory area for the mapping ULONG FileOffset; // Offset within the file of the mapping @@ -59,51 +61,56 @@ PVOID Cc1PurgeView(PCC1_CCB CacheDesc, { } -BOOLEAN Cc1AcquireCacheSegment(PCACHE_SEGMENT CacheSegment, - BOOLEAN AcquireForWrite, - BOOLEAN Wait) -{ - -} + -PVOID Cc1RequestView(PCC1_CCB CacheDesc, - ULONG FileOffset, - ULONG Length, - BOOLEAN Wait, - BOOLEAN AcquireForWrite) +NTSTATUS Cc1RequestView(PCC1_CCB CacheDesc, + ULONG FileOffset, + ULONG Length, + PCACHE_SEGMENT ReturnedSegments[], + PULONG NrSegments) /* * FUNCTION: Request a view for caching data - * ARGUMENTS: - * FileObject = File to have information cached in the view - * FileOffset = Offset within the file of the cached information - * Length = Length of the information to be cached - * Wait = If the view is being created then wait for the creater - * to make the view valid - * AcquireForWrite = True if the view is being acquired for writing - * Buffer = Pointer to a variable to hold the base address of the view - * RETURNS: True if the view contains valid data, - * False otherwise */ { PLIST_ENTRY current_entry; PCACHE_SEGMENT current; + PCACHE_SEGMENT new_segment; + ULONG MaxSegments; + ULONG LengthDelta; + + MaxSegments = *NrSegments; + (*NrSegments) = 0; KeAcquireSpinLock(&CacheDesc->CacheSegmentListLock); current_entry = CacheDesc->CacheSegmentListHead.Flink; - while (current_entry != &CacheDesc->CacheSegmentListHead) + while (current_entry != &(CacheDesc->CacheSegmentListHead)) { - current = CONTAING_RECORD(current_entry, CACHE_SEGMENT, ListEntry); + current = CONTAING_RECORD(current_entry, CACHE_SEGMENT, ListEntry); if (current->FileOffset <= FileOffset && - (current->FileOffset + current->length) >= (FileOffset + Length)) + (current->FileOffset + current->ValidLength) > FileOffset) { - if (!Cc1AcquireCacheSegment(AcquireForWrite, Wait)) + ReturnedSegments[(*NrSegments)] = current; + (*NrSegments)++; + FileOffset = current->FileOffset + current->ValidLength; + LengthDelta = (FileOffset - current->FileOffset); + if (Length <= LengthDelta) { - return(NULL); + KeReleaseSpinLock(&CacheDesc->CacheSegmentListLock); + return(STATUS_SUCCESS); } - return(current->BaseAddress + (FileOffset - current->FileOffset)); + Length = Length - LengthDelta; } + else if (current->FileOffset <= (FileOffset + Length) && + (current->FileOffset + current->ValidLength) > + (FileOffset + Length)) + { + ReturnedSegments[(*NrSegments)] = current; + (*NrSegments)++; + Length = Length - ((FileOffset + Length) - current->FileOffset); + } + current_entry = current_entry->Flink; } @@ -118,8 +125,14 @@ PCC1_CCB Cc1InitializeFileCache(PFILE_OBJECT FileObject) PCC1_CCB CacheDesc; CacheDesc = ExAllocatePool(NonPagedPool, sizeof(CC1_CCB)); + if (CacheDesc == NULL) + { + return(NULL); + } + + CacheDesc->Type = CC1_CCB_ID; InitializeListHead(&CacheDesc->CacheSegmentListHead); - KeAcquireSpinLock(&CacheDesc->CacheSegmentListLock); + KeInitializeSpinLock(&CacheDesc->CacheSegmentListLock); return(CacheDesc); } diff --git a/reactos/ntoskrnl/hal/x86/exp.c b/reactos/ntoskrnl/hal/x86/exp.c index 7ad090c3a6a..fb5fabe597c 100644 --- a/reactos/ntoskrnl/hal/x86/exp.c +++ b/reactos/ntoskrnl/hal/x86/exp.c @@ -255,7 +255,7 @@ asmlinkage void exception_handler(unsigned int edi, for(;;); } -VOID KeDumpStackFrames(ULONG DummyArg) +VOID KeDumpStackFrames(ULONG DummyArg, ULONG NrFrames) { PULONG Stack = &((&DummyArg)[-1]); ULONG i; @@ -263,7 +263,7 @@ VOID KeDumpStackFrames(ULONG DummyArg) Stack = (PVOID)(((ULONG)Stack) & (~0x3)); DbgPrint("Frames:\n"); - for (i=0; i<32; i++) + for (i=0; i KERNEL_BASE && Stack[i] < ((ULONG)&etext)) { diff --git a/reactos/ntoskrnl/io/irp.c b/reactos/ntoskrnl/io/irp.c index 889f2ab0708..40f08370fd1 100644 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@ -194,11 +194,12 @@ PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota) { PIRP Irp; - DPRINT("IoAllocateIrp(StackSize %d ChargeQuota %d)\n", + DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n", StackSize, ChargeQuota); -// if (ChargeQuota) - if (0) + KeDumpStackFrames(0,8); + + if (ChargeQuota) { Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize)); } diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 03c1b8ffefe..8dd54becf29 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -65,7 +65,7 @@ VOID KeBugCheckEx(ULONG BugCheckCode, DbgPrint("Bug detected (code %x param %x %x %x %x)\n",BugCheckCode, BugCheckParameter1,BugCheckParameter2,BugCheckParameter3, BugCheckParameter4); - KeDumpStackFrames(); + KeDumpStackFrames(0,32); for(;;); } diff --git a/reactos/ntoskrnl/mm/npool.c b/reactos/ntoskrnl/mm/npool.c index 039fc83dfa6..b289e51d2ad 100644 --- a/reactos/ntoskrnl/mm/npool.c +++ b/reactos/ntoskrnl/mm/npool.c @@ -34,7 +34,7 @@ #define VALIDATE_POOL #endif -#if 0 +#if 1 #define POOL_TRACE(args...) do { DbgPrint(args); } while(0); #else #define POOL_TRACE(args...)