mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:26:17 +00:00
Reorganised cache segment data structure
svn path=/trunk/; revision=1779
This commit is contained in:
parent
de935b3cf0
commit
db0e348770
15 changed files with 306 additions and 140 deletions
|
@ -77,7 +77,7 @@ typedef struct _REACTOS_COMMON_FCB_HEADER
|
||||||
{
|
{
|
||||||
CSHORT NodeTypeCode;
|
CSHORT NodeTypeCode;
|
||||||
CSHORT NodeByteSize;
|
CSHORT NodeByteSize;
|
||||||
PBCB Bcb;
|
struct _BCB* Bcb;
|
||||||
LARGE_INTEGER AllocationSize;
|
LARGE_INTEGER AllocationSize;
|
||||||
LARGE_INTEGER FileSize;
|
LARGE_INTEGER FileSize;
|
||||||
LARGE_INTEGER ValidDataLength;
|
LARGE_INTEGER ValidDataLength;
|
||||||
|
|
|
@ -1,47 +1,35 @@
|
||||||
#ifndef __INCLUDE_DDK_NTIFS_H
|
#ifndef __INCLUDE_DDK_NTIFS_H
|
||||||
#define __INCLUDE_DDK_NTIFS_H
|
#define __INCLUDE_DDK_NTIFS_H
|
||||||
|
|
||||||
typedef struct _BCB
|
struct _BCB;
|
||||||
{
|
|
||||||
LIST_ENTRY CacheSegmentListHead;
|
typedef struct _BCB* PBCB;
|
||||||
PFILE_OBJECT FileObject;
|
|
||||||
KSPIN_LOCK BcbLock;
|
|
||||||
ULONG CacheSegmentSize;
|
|
||||||
} BCB, *PBCB;
|
|
||||||
|
|
||||||
struct _MEMORY_AREA;
|
struct _MEMORY_AREA;
|
||||||
|
|
||||||
typedef struct _CACHE_SEGMENT
|
struct _CACHE_SEGMENT;
|
||||||
{
|
|
||||||
PVOID BaseAddress;
|
typedef struct _CACHE_SEGMENT* PCACHE_SEGMENT;
|
||||||
struct _MEMORY_AREA* MemoryArea;
|
|
||||||
BOOLEAN Valid;
|
|
||||||
LIST_ENTRY ListEntry;
|
|
||||||
ULONG FileOffset;
|
|
||||||
KEVENT Lock;
|
|
||||||
ULONG ReferenceCount;
|
|
||||||
PBCB Bcb;
|
|
||||||
} CACHE_SEGMENT, *PCACHE_SEGMENT;
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
CcFlushCacheSegment (PCACHE_SEGMENT CacheSeg);
|
CcFlushCacheSegment (struct _CACHE_SEGMENT* CacheSeg);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
CcReleaseCacheSegment (PBCB Bcb,
|
CcReleaseCacheSegment (struct _BCB* Bcb,
|
||||||
PCACHE_SEGMENT CacheSeg,
|
struct _CACHE_SEGMENT* CacheSeg,
|
||||||
BOOLEAN Valid);
|
BOOLEAN Valid);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
CcRequestCacheSegment (PBCB Bcb,
|
CcRequestCacheSegment (struct _BCB* Bcb,
|
||||||
ULONG FileOffset,
|
ULONG FileOffset,
|
||||||
PVOID* BaseAddress,
|
PVOID* BaseAddress,
|
||||||
PBOOLEAN UptoDate,
|
PBOOLEAN UptoDate,
|
||||||
PCACHE_SEGMENT* CacheSeg);
|
struct _CACHE_SEGMENT** CacheSeg);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
CcInitializeFileCache (PFILE_OBJECT FileObject,
|
CcInitializeFileCache (PFILE_OBJECT FileObject,
|
||||||
PBCB* Bcb,
|
struct _BCB** Bcb,
|
||||||
ULONG CacheSegmentSize);
|
ULONG CacheSegmentSize);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
CcReleaseFileCache (PFILE_OBJECT FileObject,
|
CcReleaseFileCache (PFILE_OBJECT FileObject,
|
||||||
PBCB Bcb);
|
struct _BCB* Bcb);
|
||||||
|
|
||||||
#include <ddk/cctypes.h>
|
#include <ddk/cctypes.h>
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,49 @@
|
||||||
# $Id: Makefile,v 1.29 2001/03/31 17:02:17 dwelch Exp $
|
# $Id: Makefile,v 1.30 2001/04/09 02:45:03 dwelch Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
PATH_TO_TOP = ..
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Path to the directory containing the root makefile
|
||||||
|
#
|
||||||
|
PATH_TO_TOP := ..
|
||||||
|
|
||||||
#
|
#
|
||||||
# Architecture to build for
|
# Architecture to build for
|
||||||
#
|
#
|
||||||
ARCH := i386
|
ARCH := i386
|
||||||
|
|
||||||
TARGETNAME = ntoskrnl
|
#
|
||||||
|
# Whether to compile in the kernel debugger
|
||||||
|
#
|
||||||
|
KDBG := 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# Whether to compile for debugging
|
||||||
|
#
|
||||||
|
DBG := 1
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
ifeq ($(DBG), 1)
|
||||||
|
CFLAGS_DBG := -g -DDBG
|
||||||
|
else
|
||||||
|
CFLAGS_DBG :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(KDBG), 1)
|
||||||
|
CFLAGS_KDBG := -DKDBG
|
||||||
|
else
|
||||||
|
CFLAGS_KDBG :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGETNAME := ntoskrnl
|
||||||
|
|
||||||
OBJECTS_PATH = objects
|
OBJECTS_PATH = objects
|
||||||
|
|
||||||
ASFLAGS = -Iinclude
|
ASFLAGS = -Iinclude
|
||||||
CFLAGS = -Iinclude -D__NTOSKRNL__ -DDBG -g -Wall -Werror
|
CFLAGS = -Iinclude -D__NTOSKRNL__ $(CFLAGS_DBG) $(CFLAGS_KDBG) -Wall -Werror
|
||||||
# -DDBGPRINT_FILE_LOG
|
|
||||||
# -W -Wpointer-arith -Wconversion -Wstrict-prototypes -Wundef \
|
|
||||||
# -Wmissing-prototypes -Wshadow\
|
|
||||||
#CFLAGS = -DDBGPRINT_FILE_LOG
|
|
||||||
|
|
||||||
include $(PATH_TO_TOP)/rules.mak
|
include $(PATH_TO_TOP)/rules.mak
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <internal/cc.h>
|
||||||
|
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CcInit(VOID)
|
CcInit(VOID)
|
||||||
{
|
{
|
||||||
/* Nothing in here at the moment */
|
CcInitView();
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: view.c,v 1.23 2001/04/03 17:25:48 dwelch Exp $
|
/* $Id: view.c,v 1.24 2001/04/09 02:45:03 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -69,6 +69,9 @@
|
||||||
#define TAG_CSEG TAG('C', 'S', 'E', 'G')
|
#define TAG_CSEG TAG('C', 'S', 'E', 'G')
|
||||||
#define TAG_BCB TAG('B', 'C', 'B', ' ')
|
#define TAG_BCB TAG('B', 'C', 'B', ' ')
|
||||||
|
|
||||||
|
static LIST_ENTRY BcbListHead;
|
||||||
|
static KSPIN_LOCK BcbListLock;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -122,7 +125,7 @@ CcGetCacheSegment(PBCB Bcb,
|
||||||
current_entry = Bcb->CacheSegmentListHead.Flink;
|
current_entry = Bcb->CacheSegmentListHead.Flink;
|
||||||
while (current_entry != &Bcb->CacheSegmentListHead)
|
while (current_entry != &Bcb->CacheSegmentListHead)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, ListEntry);
|
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbListEntry);
|
||||||
if (current->FileOffset <= FileOffset &&
|
if (current->FileOffset <= FileOffset &&
|
||||||
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
|
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +165,7 @@ CcGetCacheSegment(PBCB Bcb,
|
||||||
current->Bcb = Bcb;
|
current->Bcb = Bcb;
|
||||||
KeInitializeEvent(¤t->Lock, SynchronizationEvent, FALSE);
|
KeInitializeEvent(¤t->Lock, SynchronizationEvent, FALSE);
|
||||||
current->ReferenceCount = 1;
|
current->ReferenceCount = 1;
|
||||||
InsertTailList(&Bcb->CacheSegmentListHead, ¤t->ListEntry);
|
InsertTailList(&Bcb->CacheSegmentListHead, ¤t->BcbListEntry);
|
||||||
*UptoDate = current->Valid;
|
*UptoDate = current->Valid;
|
||||||
*BaseAddress = current->BaseAddress;
|
*BaseAddress = current->BaseAddress;
|
||||||
*CacheSeg = current;
|
*CacheSeg = current;
|
||||||
|
@ -246,7 +249,8 @@ CcReleaseFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
|
||||||
current_entry = Bcb->CacheSegmentListHead.Flink;
|
current_entry = Bcb->CacheSegmentListHead.Flink;
|
||||||
while (current_entry != &Bcb->CacheSegmentListHead)
|
while (current_entry != &Bcb->CacheSegmentListHead)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, ListEntry);
|
current =
|
||||||
|
CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbListEntry);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
CcFreeCacheSegment(Bcb, current);
|
CcFreeCacheSegment(Bcb, current);
|
||||||
}
|
}
|
||||||
|
@ -339,5 +343,11 @@ CcMdlReadComplete (IN PFILE_OBJECT FileObject,
|
||||||
DeviceObject);
|
DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CcInitView(VOID)
|
||||||
|
{
|
||||||
|
InitializeListHead(&BcbListHead);
|
||||||
|
KeInitializeSpinLock(&BcbListLock);
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,7 +1,29 @@
|
||||||
#ifndef __INCLUDE_INTERNAL_CC_H
|
#ifndef __INCLUDE_INTERNAL_CC_H
|
||||||
#define __INCLUDE_INTERNAL_CC_H
|
#define __INCLUDE_INTERNAL_CC_H
|
||||||
/* $Id: cc.h,v 1.3 2001/04/03 17:25:48 dwelch Exp $ */
|
/* $Id: cc.h,v 1.4 2001/04/09 02:45:03 dwelch Exp $ */
|
||||||
#include <ddk/ntifs.h>
|
#include <ddk/ntifs.h>
|
||||||
|
|
||||||
|
typedef struct _BCB
|
||||||
|
{
|
||||||
|
LIST_ENTRY CacheSegmentListHead;
|
||||||
|
PFILE_OBJECT FileObject;
|
||||||
|
KSPIN_LOCK BcbLock;
|
||||||
|
ULONG CacheSegmentSize;
|
||||||
|
} BCB;
|
||||||
|
|
||||||
|
typedef struct _CACHE_SEGMENT
|
||||||
|
{
|
||||||
|
PVOID BaseAddress;
|
||||||
|
struct _MEMORY_AREA* MemoryArea;
|
||||||
|
BOOLEAN Valid;
|
||||||
|
LIST_ENTRY BcbListEntry;
|
||||||
|
LIST_ENTRY DirtySegmentListEntry;
|
||||||
|
ULONG FileOffset;
|
||||||
|
KEVENT Lock;
|
||||||
|
ULONG ReferenceCount;
|
||||||
|
PBCB Bcb;
|
||||||
|
} CACHE_SEGMENT;
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
CcMdlReadCompleteDev (IN PMDL MdlChain,
|
CcMdlReadCompleteDev (IN PMDL MdlChain,
|
||||||
IN PDEVICE_OBJECT DeviceObject);
|
IN PDEVICE_OBJECT DeviceObject);
|
||||||
|
@ -12,4 +34,7 @@ CcGetCacheSegment(PBCB Bcb,
|
||||||
PVOID* BaseAddress,
|
PVOID* BaseAddress,
|
||||||
PBOOLEAN UptoDate,
|
PBOOLEAN UptoDate,
|
||||||
PCACHE_SEGMENT* CacheSeg);
|
PCACHE_SEGMENT* CacheSeg);
|
||||||
|
VOID
|
||||||
|
CcInitView(VOID);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
/* $Id: cancel.c,v 1.5 2000/06/12 14:57:10 ekohl Exp $
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: cancel.c,v 1.6 2001/04/09 02:45:03 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/io/cancel.c
|
* FILE: ntoskrnl/io/cancel.c
|
||||||
* PURPOSE: Cancel routine
|
* PURPOSE: Cancel routine
|
||||||
|
@ -18,21 +35,19 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
static KSPIN_LOCK CancelSpinLock = {0,};
|
static KSPIN_LOCK CancelSpinLock;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtCancelIoFile (IN HANDLE FileHandle,
|
||||||
NtCancelIoFile (
|
OUT PIO_STATUS_BLOCK IoStatusBlock)
|
||||||
IN HANDLE FileHandle,
|
|
||||||
OUT PIO_STATUS_BLOCK IoStatusBlock
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL IoCancelIrp(PIRP Irp)
|
BOOLEAN STDCALL
|
||||||
|
IoCancelIrp(PIRP Irp)
|
||||||
{
|
{
|
||||||
KIRQL oldlvl;
|
KIRQL oldlvl;
|
||||||
|
|
||||||
|
@ -49,17 +64,20 @@ BOOLEAN STDCALL IoCancelIrp(PIRP Irp)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IoInitCancelHandling(VOID)
|
VOID
|
||||||
|
IoInitCancelHandling(VOID)
|
||||||
{
|
{
|
||||||
KeInitializeSpinLock(&CancelSpinLock);
|
KeInitializeSpinLock(&CancelSpinLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL IoAcquireCancelSpinLock(PKIRQL Irql)
|
VOID STDCALL
|
||||||
|
IoAcquireCancelSpinLock(PKIRQL Irql)
|
||||||
{
|
{
|
||||||
KeAcquireSpinLock(&CancelSpinLock,Irql);
|
KeAcquireSpinLock(&CancelSpinLock,Irql);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL IoReleaseCancelSpinLock(KIRQL Irql)
|
VOID STDCALL
|
||||||
|
IoReleaseCancelSpinLock(KIRQL Irql)
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&CancelSpinLock,Irql);
|
KeReleaseSpinLock(&CancelSpinLock,Irql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,26 @@
|
||||||
/* $Id: error.c,v 1.5 2000/12/10 19:15:45 ekohl Exp $
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: error.c,v 1.6 2001/04/09 02:45:03 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: kernel/base/bug.c
|
* FILE: ntoskrnl/io/error.c
|
||||||
* PURPOSE: Graceful system shutdown if a bug is detected
|
* PURPOSE: Handle media errors
|
||||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* Created 22/05/98
|
* Created 22/05/98
|
||||||
|
@ -19,19 +36,22 @@
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL IoRaiseHardError(PIRP Irp,
|
VOID STDCALL
|
||||||
|
IoRaiseHardError(PIRP Irp,
|
||||||
PVPB Vpb,
|
PVPB Vpb,
|
||||||
PDEVICE_OBJECT RealDeviceObject)
|
PDEVICE_OBJECT RealDeviceObject)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN IoIsTotalDeviceFailure(NTSTATUS Status)
|
BOOLEAN
|
||||||
|
IoIsTotalDeviceFailure(NTSTATUS Status)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
|
BOOLEAN STDCALL
|
||||||
|
IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
|
||||||
PUNICODE_STRING String,
|
PUNICODE_STRING String,
|
||||||
PKTHREAD Thread)
|
PKTHREAD Thread)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: irp.c,v 1.35 2001/04/06 04:29:16 phreak Exp $
|
/* $Id: irp.c,v 1.36 2001/04/09 02:45:04 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -205,7 +205,6 @@ IofCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKTHREAD Thread;
|
|
||||||
|
|
||||||
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d) Event %x THread %x\n",
|
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d) Event %x THread %x\n",
|
||||||
Irp,PriorityBoost, Irp->UserEvent, PsGetCurrentThread());
|
Irp,PriorityBoost, Irp->UserEvent, PsGetCurrentThread());
|
||||||
|
@ -228,12 +227,11 @@ IofCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
||||||
Irp->PendingReturned = TRUE;
|
Irp->PendingReturned = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Thread = &Irp->Tail.Overlay.Thread->Tcb;
|
if (Irp->PendingReturned)
|
||||||
if ( Irp->PendingReturned && Thread != KeGetCurrentThread() )
|
|
||||||
{
|
{
|
||||||
DPRINT("Dispatching APC\n");
|
DPRINT("Dispatching APC\n");
|
||||||
KeInitializeApc(&Irp->Tail.Apc,
|
KeInitializeApc(&Irp->Tail.Apc,
|
||||||
Thread,
|
&Irp->Tail.Overlay.Thread->Tcb,
|
||||||
0,
|
0,
|
||||||
IopCompleteRequest,
|
IopCompleteRequest,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kdebug.c,v 1.21 2001/03/07 16:48:42 dwelch Exp $
|
/* $Id: kdebug.c,v 1.22 2001/04/09 02:45:04 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -340,26 +340,64 @@ KeEnterKernelDebugger (VOID)
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KdSystemDebugControl(ULONG Code)
|
KdSystemDebugControl(ULONG Code)
|
||||||
{
|
{
|
||||||
|
/* A - Dump the entire contents of the non-paged pool. */
|
||||||
if (Code == 0)
|
if (Code == 0)
|
||||||
{
|
{
|
||||||
MiDebugDumpNonPagedPool(FALSE);
|
MiDebugDumpNonPagedPool(FALSE);
|
||||||
}
|
}
|
||||||
|
/* B - Bug check the system. */
|
||||||
else if (Code == 1)
|
else if (Code == 1)
|
||||||
{
|
{
|
||||||
KeBugCheck(0);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* C - Dump statistics about the distribution of tagged blocks in
|
||||||
|
* the non-paged pool.
|
||||||
|
*/
|
||||||
else if (Code == 2)
|
else if (Code == 2)
|
||||||
{
|
{
|
||||||
MiDebugDumpNonPagedPoolStats(FALSE);
|
MiDebugDumpNonPagedPoolStats(FALSE);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* D - Dump the blocks created in the non-paged pool since the last
|
||||||
|
* SysRq + D and SysRq + E command.
|
||||||
|
*/
|
||||||
else if (Code == 3)
|
else if (Code == 3)
|
||||||
{
|
{
|
||||||
MiDebugDumpNonPagedPool(TRUE);
|
MiDebugDumpNonPagedPool(TRUE);
|
||||||
}
|
}
|
||||||
|
/* E - Dump statistics about the tags of newly created blocks. */
|
||||||
else if (Code == 4)
|
else if (Code == 4)
|
||||||
{
|
{
|
||||||
MiDebugDumpNonPagedPoolStats(TRUE);
|
MiDebugDumpNonPagedPoolStats(TRUE);
|
||||||
}
|
}
|
||||||
|
/* F */
|
||||||
|
else if (Code == 5)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* G */
|
||||||
|
else if (Code == 6)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* H */
|
||||||
|
else if (Code == 7)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* I */
|
||||||
|
else if (Code == 8)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* J */
|
||||||
|
else if (Code == 9)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* K - Enter the system debugger. */
|
||||||
|
else if (Code == 10)
|
||||||
|
{
|
||||||
|
#if KDBG
|
||||||
|
#else /* KDBG */
|
||||||
|
#endif /* not KDBG */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -230,7 +230,8 @@ KiDeliverUserApc(PKTRAP_FRAME TrapFrame)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL KiDeliverApc(ULONG Unknown1,
|
VOID STDCALL
|
||||||
|
KiDeliverApc(ULONG Unknown1,
|
||||||
ULONG Unknown2,
|
ULONG Unknown2,
|
||||||
ULONG Unknown3)
|
ULONG Unknown3)
|
||||||
/*
|
/*
|
||||||
|
@ -325,11 +326,23 @@ KeInsertQueueApc (PKAPC Apc,
|
||||||
}
|
}
|
||||||
Apc->Inserted = TRUE;
|
Apc->Inserted = TRUE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this is a kernel-mode APC for the current thread and we are not
|
||||||
|
* inside a critical section or at APC level then call it, in fact we
|
||||||
|
* rely on the side effects of dropping the IRQL level when we release
|
||||||
|
* the spinlock
|
||||||
|
*/
|
||||||
|
if (Apc->ApcMode == KernelMode && TargetThread == KeGetCurrentThread() &&
|
||||||
|
Apc->NormalRoutine == NULL)
|
||||||
|
{
|
||||||
|
KeReleaseSpinLock(&PiApcLock, oldlvl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a kernel-mode APC and it is waiting at PASSIVE_LEVEL and
|
* If this is a kernel-mode APC and it is waiting at PASSIVE_LEVEL and
|
||||||
* not inside a critical section then wake it up. Otherwise it will
|
* not inside a critical section then wake it up. Otherwise it will
|
||||||
* execute the APC as soon as it returns to PASSIVE_LEVEL.
|
* execute the APC as soon as it returns to PASSIVE_LEVEL.
|
||||||
* FIXME: Check for sending an APC to the current thread.
|
|
||||||
* FIXME: If the thread is running on another processor then send an
|
* FIXME: If the thread is running on another processor then send an
|
||||||
* IPI.
|
* IPI.
|
||||||
* FIXME: Check if the thread is terminating.
|
* FIXME: Check if the thread is terminating.
|
||||||
|
|
|
@ -427,10 +427,10 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
unsigned int cr2, cr3;
|
unsigned int cr2, cr3;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
// unsigned int j, sym;
|
// unsigned int j, sym;
|
||||||
PULONG stack;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Esp0;
|
ULONG Esp0;
|
||||||
ULONG StackLimit;
|
ULONG StackLimit;
|
||||||
|
PULONG Frame;
|
||||||
|
|
||||||
/* Use the address of the trap frame as approximation to the ring0 esp */
|
/* Use the address of the trap frame as approximation to the ring0 esp */
|
||||||
Esp0 = (ULONG)&Tf->Eip;
|
Esp0 = (ULONG)&Tf->Eip;
|
||||||
|
@ -529,10 +529,6 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgPrint("ESP %x\n", Esp0);
|
DbgPrint("ESP %x\n", Esp0);
|
||||||
stack = (PULONG) (Esp0 + 24);
|
|
||||||
stack = (PULONG)(((ULONG)stack) & (~0x3));
|
|
||||||
|
|
||||||
DbgPrint("stack<%p>: ", stack);
|
|
||||||
|
|
||||||
if (PsGetCurrentThread() != NULL)
|
if (PsGetCurrentThread() != NULL)
|
||||||
{
|
{
|
||||||
|
@ -543,24 +539,23 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
StackLimit = (ULONG)&init_stack_top;
|
StackLimit = (ULONG)&init_stack_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 18; i = i + 6)
|
/*
|
||||||
|
* Dump the stack frames
|
||||||
|
*/
|
||||||
|
DbgPrint("Frames: ");
|
||||||
|
i = 1;
|
||||||
|
Frame = (PULONG)Tf->Ebp;
|
||||||
|
while (Frame != NULL)
|
||||||
{
|
{
|
||||||
DbgPrint("%.8x %.8x %.8x %.8x\n",
|
print_address((PVOID)Frame[1]);
|
||||||
stack[i], stack[i+1],
|
Frame = (PULONG)Frame[0];
|
||||||
stack[i+2], stack[i+3],
|
i++;
|
||||||
stack[i+4], stack[i+5]);
|
|
||||||
}
|
}
|
||||||
DbgPrint("Frames:\n");
|
if ((i % 8) != 0)
|
||||||
for (i = 0; i < 32 && ((ULONG)&stack[i] < StackLimit); i++)
|
|
||||||
{
|
{
|
||||||
if (stack[i] > ((unsigned int) &_text_start__) &&
|
DbgPrint("\n");
|
||||||
!(stack[i] >= ((ULONG)&init_stack) &&
|
|
||||||
stack[i] <= ((ULONG)&init_stack_top)))
|
|
||||||
{
|
|
||||||
print_address((PVOID)stack[i]);
|
|
||||||
DbgPrint(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
/* $Id: mutex.c,v 1.7 2000/07/06 14:34:50 dwelch Exp $
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: mutex.c,v 1.8 2001/04/09 02:45:04 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/mutex.c
|
* FILE: ntoskrnl/ke/mutex.c
|
||||||
* PURPOSE: Implements mutex
|
* PURPOSE: Implements mutex
|
||||||
|
@ -19,7 +36,8 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID STDCALL KeInitializeMutex (PKMUTEX Mutex,
|
VOID STDCALL
|
||||||
|
KeInitializeMutex (PKMUTEX Mutex,
|
||||||
ULONG Level)
|
ULONG Level)
|
||||||
{
|
{
|
||||||
KeInitializeDispatcherHeader(&Mutex->Header,
|
KeInitializeDispatcherHeader(&Mutex->Header,
|
||||||
|
@ -28,12 +46,14 @@ VOID STDCALL KeInitializeMutex (PKMUTEX Mutex,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG STDCALL KeReadStateMutex (PKMUTEX Mutex)
|
LONG STDCALL
|
||||||
|
KeReadStateMutex (PKMUTEX Mutex)
|
||||||
{
|
{
|
||||||
return(Mutex->Header.SignalState);
|
return(Mutex->Header.SignalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG STDCALL KeReleaseMutex (PKMUTEX Mutex,
|
LONG STDCALL
|
||||||
|
KeReleaseMutex (PKMUTEX Mutex,
|
||||||
BOOLEAN Wait)
|
BOOLEAN Wait)
|
||||||
{
|
{
|
||||||
KeAcquireDispatcherDatabaseLock(Wait);
|
KeAcquireDispatcherDatabaseLock(Wait);
|
||||||
|
@ -47,7 +67,8 @@ LONG STDCALL KeReleaseMutex (PKMUTEX Mutex,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL KeWaitForMutexObject (PKMUTEX Mutex,
|
NTSTATUS STDCALL
|
||||||
|
KeWaitForMutexObject (PKMUTEX Mutex,
|
||||||
KWAIT_REASON WaitReason,
|
KWAIT_REASON WaitReason,
|
||||||
KPROCESSOR_MODE WaitMode,
|
KPROCESSOR_MODE WaitMode,
|
||||||
BOOLEAN Alertable,
|
BOOLEAN Alertable,
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
/* $Id: iospace.c,v 1.9 2001/03/25 02:34:28 dwelch Exp $
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* 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.10 2001/04/09 02:45:04 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/iospace.c
|
* FILE: ntoskrnl/mm/iospace.c
|
||||||
* PURPOSE: Mapping I/O space
|
* PURPOSE: Mapping I/O space
|
||||||
|
@ -116,7 +133,8 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
* REVISIONS
|
* REVISIONS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
VOID STDCALL MmUnmapIoSpace (IN PVOID BaseAddress,
|
VOID STDCALL
|
||||||
|
MmUnmapIoSpace (IN PVOID BaseAddress,
|
||||||
IN ULONG NumberOfBytes)
|
IN ULONG NumberOfBytes)
|
||||||
{
|
{
|
||||||
(VOID)MmFreeMemoryArea(&PsGetCurrentProcess()->AddressSpace,
|
(VOID)MmFreeMemoryArea(&PsGetCurrentProcess()->AddressSpace,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: mm.c,v 1.47 2001/04/04 22:21:31 dwelch Exp $
|
/* $Id: mm.c,v 1.48 2001/04/09 02:45:04 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -299,10 +299,9 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
}
|
}
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
return (STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (MemoryArea->Type)
|
switch (MemoryArea->Type)
|
||||||
{
|
{
|
||||||
case MEMORY_AREA_SYSTEM:
|
case MEMORY_AREA_SYSTEM:
|
||||||
|
@ -336,7 +335,6 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
while (Status == STATUS_MM_RESTART_OPERATION);
|
while (Status == STATUS_MM_RESTART_OPERATION);
|
||||||
|
|
||||||
DPRINT("Completed page fault handling\n");
|
DPRINT("Completed page fault handling\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue