mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +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 NodeByteSize;
|
||||
PBCB Bcb;
|
||||
struct _BCB* Bcb;
|
||||
LARGE_INTEGER AllocationSize;
|
||||
LARGE_INTEGER FileSize;
|
||||
LARGE_INTEGER ValidDataLength;
|
||||
|
|
|
@ -1,47 +1,35 @@
|
|||
#ifndef __INCLUDE_DDK_NTIFS_H
|
||||
#define __INCLUDE_DDK_NTIFS_H
|
||||
|
||||
typedef struct _BCB
|
||||
{
|
||||
LIST_ENTRY CacheSegmentListHead;
|
||||
PFILE_OBJECT FileObject;
|
||||
KSPIN_LOCK BcbLock;
|
||||
ULONG CacheSegmentSize;
|
||||
} BCB, *PBCB;
|
||||
struct _BCB;
|
||||
|
||||
typedef struct _BCB* PBCB;
|
||||
|
||||
struct _MEMORY_AREA;
|
||||
|
||||
typedef struct _CACHE_SEGMENT
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
struct _MEMORY_AREA* MemoryArea;
|
||||
BOOLEAN Valid;
|
||||
LIST_ENTRY ListEntry;
|
||||
ULONG FileOffset;
|
||||
KEVENT Lock;
|
||||
ULONG ReferenceCount;
|
||||
PBCB Bcb;
|
||||
} CACHE_SEGMENT, *PCACHE_SEGMENT;
|
||||
struct _CACHE_SEGMENT;
|
||||
|
||||
typedef struct _CACHE_SEGMENT* PCACHE_SEGMENT;
|
||||
|
||||
NTSTATUS STDCALL
|
||||
CcFlushCacheSegment (PCACHE_SEGMENT CacheSeg);
|
||||
CcFlushCacheSegment (struct _CACHE_SEGMENT* CacheSeg);
|
||||
NTSTATUS STDCALL
|
||||
CcReleaseCacheSegment (PBCB Bcb,
|
||||
PCACHE_SEGMENT CacheSeg,
|
||||
CcReleaseCacheSegment (struct _BCB* Bcb,
|
||||
struct _CACHE_SEGMENT* CacheSeg,
|
||||
BOOLEAN Valid);
|
||||
NTSTATUS STDCALL
|
||||
CcRequestCacheSegment (PBCB Bcb,
|
||||
CcRequestCacheSegment (struct _BCB* Bcb,
|
||||
ULONG FileOffset,
|
||||
PVOID* BaseAddress,
|
||||
PBOOLEAN UptoDate,
|
||||
PCACHE_SEGMENT* CacheSeg);
|
||||
struct _CACHE_SEGMENT** CacheSeg);
|
||||
NTSTATUS STDCALL
|
||||
CcInitializeFileCache (PFILE_OBJECT FileObject,
|
||||
PBCB* Bcb,
|
||||
struct _BCB** Bcb,
|
||||
ULONG CacheSegmentSize);
|
||||
NTSTATUS STDCALL
|
||||
CcReleaseFileCache (PFILE_OBJECT FileObject,
|
||||
PBCB Bcb);
|
||||
struct _BCB* Bcb);
|
||||
|
||||
#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
|
||||
#
|
||||
PATH_TO_TOP = ..
|
||||
|
||||
|
||||
#
|
||||
# Path to the directory containing the root makefile
|
||||
#
|
||||
PATH_TO_TOP := ..
|
||||
|
||||
#
|
||||
# Architecture to build for
|
||||
#
|
||||
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
|
||||
|
||||
ASFLAGS = -Iinclude
|
||||
CFLAGS = -Iinclude -D__NTOSKRNL__ -DDBG -g -Wall -Werror
|
||||
# -DDBGPRINT_FILE_LOG
|
||||
# -W -Wpointer-arith -Wconversion -Wstrict-prototypes -Wundef \
|
||||
# -Wmissing-prototypes -Wshadow\
|
||||
#CFLAGS = -DDBGPRINT_FILE_LOG
|
||||
CFLAGS = -Iinclude -D__NTOSKRNL__ $(CFLAGS_DBG) $(CFLAGS_KDBG) -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/cc.h>
|
||||
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
@ -37,7 +38,7 @@
|
|||
NTSTATUS
|
||||
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
|
||||
* 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -69,6 +69,9 @@
|
|||
#define TAG_CSEG TAG('C', 'S', 'E', 'G')
|
||||
#define TAG_BCB TAG('B', 'C', 'B', ' ')
|
||||
|
||||
static LIST_ENTRY BcbListHead;
|
||||
static KSPIN_LOCK BcbListLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS STDCALL
|
||||
|
@ -122,7 +125,7 @@ CcGetCacheSegment(PBCB Bcb,
|
|||
current_entry = Bcb->CacheSegmentListHead.Flink;
|
||||
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 &&
|
||||
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
|
||||
{
|
||||
|
@ -162,7 +165,7 @@ CcGetCacheSegment(PBCB Bcb,
|
|||
current->Bcb = Bcb;
|
||||
KeInitializeEvent(¤t->Lock, SynchronizationEvent, FALSE);
|
||||
current->ReferenceCount = 1;
|
||||
InsertTailList(&Bcb->CacheSegmentListHead, ¤t->ListEntry);
|
||||
InsertTailList(&Bcb->CacheSegmentListHead, ¤t->BcbListEntry);
|
||||
*UptoDate = current->Valid;
|
||||
*BaseAddress = current->BaseAddress;
|
||||
*CacheSeg = current;
|
||||
|
@ -246,7 +249,8 @@ CcReleaseFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
|
|||
current_entry = Bcb->CacheSegmentListHead.Flink;
|
||||
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;
|
||||
CcFreeCacheSegment(Bcb, current);
|
||||
}
|
||||
|
@ -339,5 +343,11 @@ CcMdlReadComplete (IN PFILE_OBJECT FileObject,
|
|||
DeviceObject);
|
||||
}
|
||||
|
||||
VOID
|
||||
CcInitView(VOID)
|
||||
{
|
||||
InitializeListHead(&BcbListHead);
|
||||
KeInitializeSpinLock(&BcbListLock);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
#ifndef __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>
|
||||
|
||||
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
|
||||
CcMdlReadCompleteDev (IN PMDL MdlChain,
|
||||
IN PDEVICE_OBJECT DeviceObject);
|
||||
|
@ -12,4 +34,7 @@ CcGetCacheSegment(PBCB Bcb,
|
|||
PVOID* BaseAddress,
|
||||
PBOOLEAN UptoDate,
|
||||
PCACHE_SEGMENT* CacheSeg);
|
||||
VOID
|
||||
CcInitView(VOID);
|
||||
|
||||
#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
|
||||
* FILE: ntoskrnl/io/cancel.c
|
||||
* PURPOSE: Cancel routine
|
||||
|
@ -18,21 +35,19 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
static KSPIN_LOCK CancelSpinLock = {0,};
|
||||
static KSPIN_LOCK CancelSpinLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCancelIoFile (
|
||||
IN HANDLE FileHandle,
|
||||
OUT PIO_STATUS_BLOCK IoStatusBlock
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
NtCancelIoFile (IN HANDLE FileHandle,
|
||||
OUT PIO_STATUS_BLOCK IoStatusBlock)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
BOOLEAN STDCALL IoCancelIrp(PIRP Irp)
|
||||
BOOLEAN STDCALL
|
||||
IoCancelIrp(PIRP Irp)
|
||||
{
|
||||
KIRQL oldlvl;
|
||||
|
||||
|
@ -49,17 +64,20 @@ BOOLEAN STDCALL IoCancelIrp(PIRP Irp)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
VOID IoInitCancelHandling(VOID)
|
||||
VOID
|
||||
IoInitCancelHandling(VOID)
|
||||
{
|
||||
KeInitializeSpinLock(&CancelSpinLock);
|
||||
}
|
||||
|
||||
VOID STDCALL IoAcquireCancelSpinLock(PKIRQL Irql)
|
||||
VOID STDCALL
|
||||
IoAcquireCancelSpinLock(PKIRQL Irql)
|
||||
{
|
||||
KeAcquireSpinLock(&CancelSpinLock,Irql);
|
||||
}
|
||||
|
||||
VOID STDCALL IoReleaseCancelSpinLock(KIRQL Irql)
|
||||
VOID STDCALL
|
||||
IoReleaseCancelSpinLock(KIRQL 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
|
||||
* FILE: kernel/base/bug.c
|
||||
* PURPOSE: Graceful system shutdown if a bug is detected
|
||||
* FILE: ntoskrnl/io/error.c
|
||||
* PURPOSE: Handle media errors
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* Created 22/05/98
|
||||
|
@ -19,21 +36,24 @@
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
VOID STDCALL IoRaiseHardError(PIRP Irp,
|
||||
PVPB Vpb,
|
||||
PDEVICE_OBJECT RealDeviceObject)
|
||||
VOID STDCALL
|
||||
IoRaiseHardError(PIRP Irp,
|
||||
PVPB Vpb,
|
||||
PDEVICE_OBJECT RealDeviceObject)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
BOOLEAN IoIsTotalDeviceFailure(NTSTATUS Status)
|
||||
BOOLEAN
|
||||
IoIsTotalDeviceFailure(NTSTATUS Status)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
BOOLEAN STDCALL IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
|
||||
PUNICODE_STRING String,
|
||||
PKTHREAD Thread)
|
||||
BOOLEAN STDCALL
|
||||
IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
|
||||
PUNICODE_STRING String,
|
||||
PKTHREAD Thread)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -205,7 +205,6 @@ IofCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
|||
{
|
||||
unsigned int i;
|
||||
NTSTATUS Status;
|
||||
PKTHREAD Thread;
|
||||
|
||||
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d) Event %x THread %x\n",
|
||||
Irp,PriorityBoost, Irp->UserEvent, PsGetCurrentThread());
|
||||
|
@ -228,12 +227,11 @@ IofCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
|||
Irp->PendingReturned = TRUE;
|
||||
}
|
||||
}
|
||||
Thread = &Irp->Tail.Overlay.Thread->Tcb;
|
||||
if ( Irp->PendingReturned && Thread != KeGetCurrentThread() )
|
||||
if (Irp->PendingReturned)
|
||||
{
|
||||
DPRINT("Dispatching APC\n");
|
||||
KeInitializeApc(&Irp->Tail.Apc,
|
||||
Thread,
|
||||
&Irp->Tail.Overlay.Thread->Tcb,
|
||||
0,
|
||||
IopCompleteRequest,
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -340,26 +340,64 @@ KeEnterKernelDebugger (VOID)
|
|||
VOID STDCALL
|
||||
KdSystemDebugControl(ULONG Code)
|
||||
{
|
||||
/* A - Dump the entire contents of the non-paged pool. */
|
||||
if (Code == 0)
|
||||
{
|
||||
MiDebugDumpNonPagedPool(FALSE);
|
||||
}
|
||||
/* B - Bug check the system. */
|
||||
else if (Code == 1)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
/*
|
||||
* C - Dump statistics about the distribution of tagged blocks in
|
||||
* the non-paged pool.
|
||||
*/
|
||||
else if (Code == 2)
|
||||
{
|
||||
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)
|
||||
{
|
||||
MiDebugDumpNonPagedPool(TRUE);
|
||||
}
|
||||
/* E - Dump statistics about the tags of newly created blocks. */
|
||||
else if (Code == 4)
|
||||
{
|
||||
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 */
|
||||
|
|
|
@ -230,9 +230,10 @@ KiDeliverUserApc(PKTRAP_FRAME TrapFrame)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
VOID STDCALL KiDeliverApc(ULONG Unknown1,
|
||||
ULONG Unknown2,
|
||||
ULONG Unknown3)
|
||||
VOID STDCALL
|
||||
KiDeliverApc(ULONG Unknown1,
|
||||
ULONG Unknown2,
|
||||
ULONG Unknown3)
|
||||
/*
|
||||
* FUNCTION: Deliver an APC to the current thread.
|
||||
* NOTES: This is called from the IRQL switching code if the current thread
|
||||
|
@ -325,11 +326,23 @@ KeInsertQueueApc (PKAPC Apc,
|
|||
}
|
||||
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
|
||||
* not inside a critical section then wake it up. Otherwise it will
|
||||
* 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
|
||||
* IPI.
|
||||
* FIXME: Check if the thread is terminating.
|
||||
|
|
|
@ -427,10 +427,10 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
unsigned int cr2, cr3;
|
||||
unsigned int i;
|
||||
// unsigned int j, sym;
|
||||
PULONG stack;
|
||||
NTSTATUS Status;
|
||||
ULONG Esp0;
|
||||
ULONG StackLimit;
|
||||
PULONG Frame;
|
||||
|
||||
/* Use the address of the trap frame as approximation to the ring0 esp */
|
||||
Esp0 = (ULONG)&Tf->Eip;
|
||||
|
@ -529,10 +529,6 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
}
|
||||
|
||||
DbgPrint("ESP %x\n", Esp0);
|
||||
stack = (PULONG) (Esp0 + 24);
|
||||
stack = (PULONG)(((ULONG)stack) & (~0x3));
|
||||
|
||||
DbgPrint("stack<%p>: ", stack);
|
||||
|
||||
if (PsGetCurrentThread() != NULL)
|
||||
{
|
||||
|
@ -543,24 +539,23 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
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",
|
||||
stack[i], stack[i+1],
|
||||
stack[i+2], stack[i+3],
|
||||
stack[i+4], stack[i+5]);
|
||||
print_address((PVOID)Frame[1]);
|
||||
Frame = (PULONG)Frame[0];
|
||||
i++;
|
||||
}
|
||||
DbgPrint("Frames:\n");
|
||||
for (i = 0; i < 32 && ((ULONG)&stack[i] < StackLimit); i++)
|
||||
if ((i % 8) != 0)
|
||||
{
|
||||
if (stack[i] > ((unsigned int) &_text_start__) &&
|
||||
!(stack[i] >= ((ULONG)&init_stack) &&
|
||||
stack[i] <= ((ULONG)&init_stack_top)))
|
||||
{
|
||||
print_address((PVOID)stack[i]);
|
||||
DbgPrint(" ");
|
||||
}
|
||||
}
|
||||
DbgPrint("\n");
|
||||
}
|
||||
|
||||
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
|
||||
* FILE: ntoskrnl/ke/mutex.c
|
||||
* PURPOSE: Implements mutex
|
||||
|
@ -19,8 +36,9 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID STDCALL KeInitializeMutex (PKMUTEX Mutex,
|
||||
ULONG Level)
|
||||
VOID STDCALL
|
||||
KeInitializeMutex (PKMUTEX Mutex,
|
||||
ULONG Level)
|
||||
{
|
||||
KeInitializeDispatcherHeader(&Mutex->Header,
|
||||
InternalMutexType,
|
||||
|
@ -28,13 +46,15 @@ VOID STDCALL KeInitializeMutex (PKMUTEX Mutex,
|
|||
1);
|
||||
}
|
||||
|
||||
LONG STDCALL KeReadStateMutex (PKMUTEX Mutex)
|
||||
LONG STDCALL
|
||||
KeReadStateMutex (PKMUTEX Mutex)
|
||||
{
|
||||
return(Mutex->Header.SignalState);
|
||||
}
|
||||
|
||||
LONG STDCALL KeReleaseMutex (PKMUTEX Mutex,
|
||||
BOOLEAN Wait)
|
||||
LONG STDCALL
|
||||
KeReleaseMutex (PKMUTEX Mutex,
|
||||
BOOLEAN Wait)
|
||||
{
|
||||
KeAcquireDispatcherDatabaseLock(Wait);
|
||||
Mutex->Header.SignalState++;
|
||||
|
@ -47,10 +67,11 @@ LONG STDCALL KeReleaseMutex (PKMUTEX Mutex,
|
|||
return(0);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL KeWaitForMutexObject (PKMUTEX Mutex,
|
||||
KWAIT_REASON WaitReason,
|
||||
KPROCESSOR_MODE WaitMode,
|
||||
BOOLEAN Alertable,
|
||||
NTSTATUS STDCALL
|
||||
KeWaitForMutexObject (PKMUTEX Mutex,
|
||||
KWAIT_REASON WaitReason,
|
||||
KPROCESSOR_MODE WaitMode,
|
||||
BOOLEAN Alertable,
|
||||
PLARGE_INTEGER Timeout)
|
||||
{
|
||||
return(KeWaitForSingleObject(Mutex,WaitReason,WaitMode,Alertable,Timeout));
|
||||
|
|
|
@ -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
|
||||
* FILE: ntoskrnl/mm/iospace.c
|
||||
* PURPOSE: Mapping I/O space
|
||||
|
@ -116,8 +133,9 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
VOID STDCALL MmUnmapIoSpace (IN PVOID BaseAddress,
|
||||
IN ULONG NumberOfBytes)
|
||||
VOID STDCALL
|
||||
MmUnmapIoSpace (IN PVOID BaseAddress,
|
||||
IN ULONG NumberOfBytes)
|
||||
{
|
||||
(VOID)MmFreeMemoryArea(&PsGetCurrentProcess()->AddressSpace,
|
||||
BaseAddress,
|
||||
|
|
|
@ -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.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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -299,42 +299,40 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
else
|
||||
|
||||
switch (MemoryArea->Type)
|
||||
{
|
||||
switch (MemoryArea->Type)
|
||||
{
|
||||
case MEMORY_AREA_SYSTEM:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
case MEMORY_AREA_SYSTEM:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_SECTION_VIEW_COMMIT:
|
||||
Status = MmNotPresentFaultSectionView(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_SECTION_VIEW_COMMIT:
|
||||
Status = MmNotPresentFaultSectionView(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_SHARED_DATA:
|
||||
Status =
|
||||
case MEMORY_AREA_SHARED_DATA:
|
||||
Status =
|
||||
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READONLY,
|
||||
(ULONG)MmSharedDataPagePhysicalAddress);
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (Status == STATUS_MM_RESTART_OPERATION);
|
||||
|
|
Loading…
Reference in a new issue