Implemented /Device/PhysicalMemory

Corrected an LPC bug when terminating a process with threads waiting for
LPC messages

svn path=/trunk/; revision=1479
This commit is contained in:
David Welch 2000-12-28 03:38:08 +00:00
parent 7f10630ab4
commit 0fc13a01ee
18 changed files with 510 additions and 405 deletions

View file

@ -54,7 +54,7 @@ NET_DEVICE_DRIVERS = ne2000
SYS_APPS = shell winlogon services
APPS = args hello test cat bench apc shm lpc thread event file gditest \
pteb consume dump_shared_data vmtest regtest
pteb consume dump_shared_data vmtest regtest ptest
# objdir

View file

@ -1,5 +1,5 @@
/*
* $Id: fat.c,v 1.7 2000/12/07 16:58:42 jean Exp $
* $Id: fat.c,v 1.8 2000/12/28 03:38:08 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -22,7 +22,8 @@
/* FUNCTIONS ****************************************************************/
ULONG Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG
Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
/*
* FUNCTION: Retrieve the next FAT32 cluster from the FAT table via a physical
* disk read
@ -44,7 +45,8 @@ ULONG Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(CurrentCluster);
}
ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG
Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
/*
* FUNCTION: Retrieve the next FAT16 cluster from the FAT table from the
* in-memory FAT
@ -59,7 +61,8 @@ ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(CurrentCluster);
}
ULONG Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG
Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
/*
* FUNCTION: Retrieve the next FAT12 cluster from the FAT table from the
* in-memory FAT
@ -87,7 +90,8 @@ ULONG Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(Entry);
}
ULONG GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG
GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
/*
* FUNCTION: Retrieve the next cluster depending on the FAT type
*/
@ -117,7 +121,8 @@ ULONG GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(NextCluster);
}
ULONG FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Finds the first available cluster in a FAT16 table
*/
@ -132,7 +137,8 @@ ULONG FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0;
}
ULONG FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Finds the first available cluster in a FAT12 table
*/
@ -162,7 +168,8 @@ ULONG FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0;
}
ULONG FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Finds the first available cluster in a FAT32 table
*/
@ -192,7 +199,8 @@ ULONG FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0;
}
ULONG FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Counts free cluster in a FAT12 table
*/
@ -227,7 +235,8 @@ ULONG FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount;
}
ULONG FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Counts free clusters in a FAT16 table
*/
@ -250,7 +259,8 @@ ULONG FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount;
}
ULONG FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
ULONG
FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/*
* FUNCTION: Counts free clusters in a FAT32 table
*/
@ -282,7 +292,8 @@ ULONG FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount;
}
void FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
VOID
FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue)
/*
* FUNCTION: Writes a cluster to the FAT12 physical and in-memory tables
@ -330,7 +341,8 @@ void FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
}
}
void FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
VOID
FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue)
/*
* FUNCTION: Writes a cluster to the FAT16 physical and in-memory tables
@ -361,7 +373,8 @@ void FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
}
}
void FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
VOID
FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue)
/*
* FUNCTION: Writes a cluster to the FAT32 physical tables
@ -397,7 +410,8 @@ DbgPrint("FAT32WriteCluster %u : %u\n",ClusterToWrite,NewValue);
ExFreePool(Block);
}
void WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
VOID
WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue)
/*
* FUNCTION: Write a changed FAT entry
@ -417,7 +431,8 @@ void WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
}
}
ULONG GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG
GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
/*
* FUNCTION: Determines the next cluster to be written
*/
@ -474,7 +489,8 @@ ULONG GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
}
}
ULONG ClusterToSector(PDEVICE_EXTENSION DeviceExt,
ULONG
ClusterToSector(PDEVICE_EXTENSION DeviceExt,
unsigned long Cluster)
/*
* FUNCTION: Converts the cluster number to a sector number for this physical
@ -484,7 +500,8 @@ ULONG ClusterToSector(PDEVICE_EXTENSION DeviceExt,
return DeviceExt->dataStart+((Cluster-2)*DeviceExt->Boot->SectorsPerCluster);
}
void VFATLoadCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
VOID
VFATLoadCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
/*
* FUNCTION: Load a cluster from the physical device
*/
@ -503,7 +520,8 @@ void VFATLoadCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
DPRINT("Finished VFATReadSectors\n");
}
void VFATWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
VOID
VFATWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
/*
* FUNCTION: Write a cluster to the physical device
*/

View file

@ -24,7 +24,7 @@ cp apps/cat/cat.exe $1/reactos/bin
cp subsys/smss/smss.exe $1/reactos/system32
cp subsys/csrss/csrss.exe $1/reactos/system32
cp subsys/win32k/win32k.sys $1/reactos/system32/drivers
#cp apps/system/winlogon/winlogon.exe $1/reactos/system32/
cp apps/system/winlogon/winlogon.exe $1/reactos/system32/
cp apps/apc/apc.exe $1/reactos/bin
cp apps/shm/shmsrv.exe $1/reactos/bin
cp apps/shm/shmclt.exe $1/reactos/bin
@ -40,3 +40,4 @@ cp apps/dump_shared_data/dump_shared_data.exe $1/reactos/bin
cp apps/vmtest/vmtest.exe $1/reactos/bin
cp apps/uitest/uitest.exe $1/reactos/bin/
cp apps/gditest/gditest.exe $1/reactos/bin/
cp apps/ptest/ptest.exe $1/reactos/bin

View file

@ -1,25 +0,0 @@
%macro DECLARE_EXTERNAL_SYMBOL 1
%ifdef coff
extern _%1
%elifdef win32
extern _%1
%elifdef elf
extern %1
_%1:
call %1
ret
%endif
%endmacro
%macro DECLARE_GLOBAL_SYMBOL 1
%ifdef coff
global _%1
_%1:
%elifdef win32
global _%1
_%1:
%elifdef elf
global %1
%1:
%endif
%endmacro

View file

@ -1,10 +1,7 @@
#ifndef __INCLUDE_INTERNAL_CC_H
#define __INCLUDE_INTERNAL_CCS_H
/* $Id: cc.h,v 1.1 2000/06/29 23:35:36 dwelch Exp $ */
VOID
STDCALL
CcMdlReadCompleteDev (
IN PMDL MdlChain,
IN PDEVICE_OBJECT DeviceObject
);
/* $Id: cc.h,v 1.2 2000/12/28 03:38:07 dwelch Exp $ */
VOID STDCALL
CcMdlReadCompleteDev (IN PMDL MdlChain,
IN PDEVICE_OBJECT DeviceObject);
#endif

View file

@ -4,7 +4,8 @@
#include <napi/dbg.h>
#include <internal/port.h>
NTSTATUS STDCALL LpcSendDebugMessagePort(PEPORT Port,
NTSTATUS STDCALL
LpcSendDebugMessagePort(PEPORT Port,
PLPC_DBG_MESSAGE Message);
#endif /* __INCLUDE_INTERNAL_DBG_H */

View file

@ -2,8 +2,8 @@
* internal executive prototypes
*/
#ifndef _INCLUDE_INTERNAL_EXECUTIVE_H
#define _INCLUDE_INTERNAL_EXECUTIVE_H
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H
#define __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H
#include <ddk/ntddk.h>
#include <ntos/time.h>
@ -14,10 +14,13 @@ TIME_ZONE_INFORMATION SystemTimeZoneInfo;
/* INITIALIZATION FUNCTIONS *************************************************/
VOID ExInit (VOID);
VOID ExInitTimeZoneInfo (VOID);
VOID ExInitializeWorkerThreads(VOID);
VOID
ExInit (VOID);
VOID
ExInitTimeZoneInfo (VOID);
VOID
ExInitializeWorkerThreads(VOID);
#endif /* _INCLUDE_INTERNAL_EXECUTIVE_H */
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H */

View file

@ -20,27 +20,26 @@
* FILE: ntoskrnl/include/internal/i386/segment.h
* PURPOSE: Segment selector definitions
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created ??/??/??
*/
/* INCLUDES *****************************************************************/
#ifndef __INCLUDE_INTERNAL_I386_SEGMENT_H
#define __INCLUDE_INTERNAL_i386_SEGMENT_H
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_SEGMENT_H
#define __NTOSKRNL_INCLUDE_INTERNAL_i386_SEGMENT_H
#define NULL_SELECTOR (0x0)
#define KERNEL_CS (0x8)
#define KERNEL_DS (0x10)
#define USER_CS (0x18 + 0x3)
#define USER_DS (0x20 + 0x3)
/*
* FIXME: We actually have one TSS per thread
*/
/* Task State Segment */
#define TSS_SELECTOR (0x28)
/* Processor Control Region */
#define PCR_SELECTOR (0x30)
/* Thread Environment Block */
#define TEB_SELECTOR (0x38 + 0x3)
#define RESERVED1_SELECTOR (0x40)
#define RESERVED_SELECTOR (0x40)
/* Local Descriptor Table */
#define LDT_SELECTOR (0x48)
#endif /* __INCLUDE_INTERNAL_I386_SEGMENT_H */
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_SEGMENT_H */

View file

@ -1,4 +1,22 @@
/* $Id: io.h,v 1.6 2000/10/05 19:12:55 ekohl Exp $
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* 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: io.h,v 1.7 2000/12/28 03:38:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -9,8 +27,8 @@
* 28/05/97: Created
*/
#ifndef __INCLUDE_INTERNAL_IO_H
#define __INCLUDE_INTERNAL_IO_H
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_IO_H
#define __NTOSKRNL_INCLUDE_INTERNAL_IO_H
#include <ddk/ntddk.h>
#include <internal/ob.h>
@ -23,14 +41,17 @@ extern POBJECT_TYPE IoSymbolicLinkType;
* entry = pointer to the driver initialization routine
* RETURNS: Success or failure
*/
NTSTATUS IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
NTSTATUS
IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
VOID IoInitCancelHandling(VOID);
VOID IoInitSymbolicLinkImplementation(VOID);
VOID IoInitFileSystemImplementation(VOID);
VOID IoInitVpbImplementation (VOID);
VOID
IoInitCancelHandling(VOID);
VOID
IoInitSymbolicLinkImplementation(VOID);
VOID
IoInitFileSystemImplementation(VOID);
VOID
IoInitVpbImplementation (VOID);
NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject);
POBJECT IoOpenSymlink(POBJECT SymbolicLink);

View file

@ -1,4 +1,4 @@
/* $Id: kd.h,v 1.1 2000/06/29 23:35:36 dwelch Exp $
/* $Id: kd.h,v 1.2 2000/12/28 03:38:07 dwelch Exp $
*
* kernel debugger prototypes
*/
@ -6,8 +6,7 @@
#ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
#define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
ULONG KdpPrintString (PANSI_STRING String);
ULONG
KdpPrintString (PANSI_STRING String);
#endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */

View file

@ -1,9 +1,24 @@
/*
* Various useful prototypes
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* 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.
*/
#ifndef __INCLUDE_INTERNAL_KERNEL_H
#define __INCLUDE_INTERNAL_KERNEL_H
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_KERNEL_H
#define __NTOSKRNL_INCLUDE_INTERNAL_KERNEL_H
/* INCLUDES *****************************************************************/

View file

@ -42,6 +42,8 @@ enum
#define SPE_DIRTY (0x8)
#define SPE_IN_PAGEFILE (0x10)
#define SO_PHYSICAL_MEMORY (0x1)
typedef struct
{
ULONG Pages[NR_SECTION_PAGE_ENTRIES];
@ -64,6 +66,7 @@ typedef struct
KSPIN_LOCK ViewListLock;
KMUTEX Lock;
SECTION_PAGE_DIRECTORY PageDirectory;
ULONG Flags;
} SECTION_OBJECT, *PSECTION_OBJECT;
typedef struct
@ -299,6 +302,8 @@ VOID MmUnlockPage(PVOID PhysicalPage);
NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, ULONG Count);
NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, ULONG Count);
NTSTATUS
MmCreatePhysicalMemorySection(VOID);
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)

View file

@ -34,9 +34,7 @@
/* GLOBALS *******************************************************************/
#define NR_TASKS 128
USHORT KiGdt[(8 + NR_TASKS) * 4] =
USHORT KiGdt[10 * 4] =
{
0x0, 0x0, 0x0, 0x0, /* Null */
0xffff, 0x0, 0x9a00, 0xcf, /* Kernel CS */
@ -53,7 +51,8 @@ static KSPIN_LOCK GdtLock;
/* FUNCTIONS *****************************************************************/
VOID KeSetBaseGdtSelector(ULONG Entry,
VOID
KeSetBaseGdtSelector(ULONG Entry,
PVOID Base)
{
KIRQL oldIrql;
@ -84,7 +83,8 @@ VOID KeSetBaseGdtSelector(ULONG Entry,
KeReleaseSpinLock(&GdtLock, oldIrql);
}
VOID KeDumpGdtSelector(ULONG Entry)
VOID
KeDumpGdtSelector(ULONG Entry)
{
USHORT a, b, c, d;
ULONG RawLimit;
@ -143,7 +143,8 @@ VOID KeFreeGdtSelector(ULONG Entry)
#endif
#if 0
ULONG KeAllocateGdtSelector(ULONG Desc[2])
ULONG
KeAllocateGdtSelector(ULONG Desc[2])
/*
* FUNCTION: Allocate a gdt selector
* ARGUMENTS:

View file

@ -3,8 +3,6 @@
#define KERNEL_BASE (0xc0000000)
#define NR_TASKS (128)
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
#define MULTIBOOT_HEADER_FLAGS (0x00010003)
@ -708,7 +706,7 @@ lowmem_pagetable:
.long 0x3f8007,0x3f9007,0x3fa007,0x3fb007,0x3fc007,0x3fd007,0x3fe007,0x3ff007
_gdt_descr:
.word ((8+NR_TASKS)*8)-1
.word (10*8)-1
.long _KiGdt
_idt_descr:

View file

@ -1,4 +1,4 @@
/* $Id: queue.c,v 1.2 2000/10/22 16:36:51 ekohl Exp $
/* $Id: queue.c,v 1.3 2000/12/28 03:38:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -20,30 +20,26 @@
#include <internal/debug.h>
VOID
STDCALL
EiEnqueueMessagePort (
IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message
)
VOID STDCALL
EiEnqueueMessagePort (IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message)
{
InsertTailList (
& Port->QueueListHead,
& Message->QueueListEntry
);
InsertTailList (&Port->QueueListHead,
&Message->QueueListEntry);
Port->QueueLength++;
}
PQUEUEDMESSAGE
STDCALL
EiDequeueMessagePort (
IN OUT PEPORT Port
)
PQUEUEDMESSAGE STDCALL
EiDequeueMessagePort (IN OUT PEPORT Port)
{
PQUEUEDMESSAGE Message;
PLIST_ENTRY entry;
if (IsListEmpty(&Port->QueueListHead))
{
return(NULL);
}
entry = RemoveHeadList (&Port->QueueListHead);
Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
Port->QueueLength--;
@ -52,30 +48,26 @@ EiDequeueMessagePort (
}
VOID
STDCALL
EiEnqueueConnectMessagePort (
IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message
)
VOID STDCALL
EiEnqueueConnectMessagePort (IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message)
{
InsertTailList (
& Port->ConnectQueueListHead,
& Message->QueueListEntry
);
InsertTailList (&Port->ConnectQueueListHead,
&Message->QueueListEntry);
Port->ConnectQueueLength++;
}
PQUEUEDMESSAGE
STDCALL
EiDequeueConnectMessagePort (
IN OUT PEPORT Port
)
PQUEUEDMESSAGE STDCALL
EiDequeueConnectMessagePort (IN OUT PEPORT Port)
{
PQUEUEDMESSAGE Message;
PLIST_ENTRY entry;
if (IsListEmpty(&Port->ConnectQueueListHead))
{
return(NULL);
}
entry = RemoveHeadList (&Port->ConnectQueueListHead);
Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
Port->ConnectQueueLength--;

View file

@ -1,4 +1,4 @@
/* $Id: reply.c,v 1.2 2000/10/22 16:36:51 ekohl Exp $
/* $Id: reply.c,v 1.3 2000/12/28 03:38:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -9,7 +9,7 @@
* Created 22/05/98
*/
/* INCLUDES *****************************************************************/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <internal/ob.h>
@ -19,7 +19,7 @@
#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/**********************************************************************
* NAME
@ -33,14 +33,11 @@
* REVISIONS
*
*/
NTSTATUS
STDCALL
EiReplyOrRequestPort (
IN PEPORT Port,
NTSTATUS STDCALL
EiReplyOrRequestPort (IN PEPORT Port,
IN PLPC_MESSAGE LpcReply,
IN ULONG MessageType,
IN PEPORT Sender
)
IN PEPORT Sender)
{
KIRQL oldIrql;
PQUEUEDMESSAGE MessageReply;
@ -78,12 +75,9 @@ EiReplyOrRequestPort (
* REVISIONS
*
*/
NTSTATUS
STDCALL
NtReplyPort (
IN HANDLE PortHandle,
IN PLPC_MESSAGE LpcReply
)
NTSTATUS STDCALL
NtReplyPort (IN HANDLE PortHandle,
IN PLPC_MESSAGE LpcReply)
{
NTSTATUS Status;
PEPORT Port;
@ -126,14 +120,11 @@ NtReplyPort (
* REVISIONS
*
*/
NTSTATUS
STDCALL
NtReplyWaitReceivePort (
HANDLE PortHandle,
NTSTATUS STDCALL
NtReplyWaitReceivePort (HANDLE PortHandle,
PULONG PortId,
PLPC_MESSAGE LpcReply,
PLPC_MESSAGE LpcMessage
)
PLPC_MESSAGE LpcMessage)
{
NTSTATUS Status;
PEPORT Port;
@ -176,19 +167,35 @@ NtReplyWaitReceivePort (
/*
* Want for a message to be received
*/
DPRINT("Entering wait for message\n");
KeWaitForSingleObject(&Port->Event,
do
{
Status = KeWaitForSingleObject(&Port->Event,
UserRequest,
UserMode,
FALSE,
NULL);
DPRINT("Woke from wait for message\n");
if (!NT_SUCCESS(Status))
{
return(Status);
}
/*
* Dequeue the message
*/
KeAcquireSpinLock(&Port->Lock, &oldIrql);
Request = EiDequeueMessagePort(Port);
/*
* There is a race between the event being set and the port being
* taken in which another thread may dequeue the same request so
* we may need to loop.
*/
if (Request == NULL)
{
KeReleaseSpinLock(&Port->Lock, oldIrql);
}
} while(Request == NULL);
memcpy(LpcMessage, &Request->Message, Request->Message.MessageSize);
if (Request->Message.MessageType == LPC_CONNECTION_REQUEST)
{
@ -202,7 +209,7 @@ NtReplyWaitReceivePort (
}
/*
*
* Dereference the port
*/
ObDereferenceObject(Port);
return(STATUS_SUCCESS);
@ -221,12 +228,9 @@ NtReplyWaitReceivePort (
* REVISIONS
*
*/
NTSTATUS
STDCALL
NtReplyWaitReplyPort (
HANDLE PortHandle,
PLPC_MESSAGE ReplyMessage
)
NTSTATUS STDCALL
NtReplyWaitReplyPort (HANDLE PortHandle,
PLPC_MESSAGE ReplyMessage)
{
UNIMPLEMENTED;
}

View file

@ -1,4 +1,4 @@
/* $Id: mminit.c,v 1.11 2000/12/20 18:44:20 jean Exp $
/* $Id: mminit.c,v 1.12 2000/12/28 03:38:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -273,6 +273,8 @@ VOID MmInit2(VOID)
VOID MmInit3(VOID)
{
MmInitPagerThread();
MmCreatePhysicalMemorySection();
/* FIXME: Read parameters from memory */
}

View file

@ -1,4 +1,4 @@
/* $Id: section.c,v 1.39 2000/10/22 16:36:52 ekohl Exp $
/* $Id: section.c,v 1.40 2000/12/28 03:38:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -43,12 +43,14 @@ VOID MmLockSection(PSECTION_OBJECT Section)
NULL);
}
VOID MmUnlockSection(PSECTION_OBJECT Section)
VOID
MmUnlockSection(PSECTION_OBJECT Section)
{
KeReleaseMutex(&Section->Lock, FALSE);
}
VOID MmSetPageEntrySection(PSECTION_OBJECT Section,
VOID
MmSetPageEntrySection(PSECTION_OBJECT Section,
ULONG Offset,
ULONG Entry)
{
@ -70,7 +72,8 @@ VOID MmSetPageEntrySection(PSECTION_OBJECT Section,
Table->Pages[TableOffset] = Entry;
}
ULONG MmGetPageEntrySection(PSECTION_OBJECT Section,
ULONG
MmGetPageEntrySection(PSECTION_OBJECT Section,
ULONG Offset)
{
PSECTION_PAGE_TABLE Table;
@ -92,7 +95,8 @@ ULONG MmGetPageEntrySection(PSECTION_OBJECT Section,
return(Entry);
}
NTSTATUS MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
NTSTATUS
MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address)
{
@ -128,6 +132,15 @@ NTSTATUS MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
MmLockSection(Section);
/*
* Don't do an unaligned mapping of physical memory
*/
if (Section->Flags & SO_PHYSICAL_MEMORY)
{
MmUnlockSection(Section);
return(STATUS_UNSUCCESSFUL);
}
Page = MmAllocPageMaybeSwap(0);
Mdl = MmCreateMdl(NULL, NULL, PAGESIZE);
MmBuildMdlFromPages(Mdl, (PULONG)&Page);
@ -162,7 +175,8 @@ NTSTATUS MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
}
NTSTATUS MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
NTSTATUS
MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
PSECTION_OBJECT Section,
@ -264,7 +278,8 @@ NTSTATUS MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
return(STATUS_SUCCESS);
}
NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
NTSTATUS
MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address)
{
@ -308,17 +323,25 @@ NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Address));
}
DPRINT("MemoryArea->BaseAddress %x\n", MemoryArea->BaseAddress);
DPRINT("MemoryArea->Data.SectionData.ViewOffset %x\n",
MemoryArea->Data.SectionData.ViewOffset);
DPRINT("Got offset %x\n", Offset.QuadPart);
/*
* Lock the section
*/
Section = MemoryArea->Data.SectionData.Section;
MmLockSection(Section);
if (Section->Flags & SO_PHYSICAL_MEMORY)
{
/*
* Just map the desired physical page
*/
Status = MmCreateVirtualMapping(NULL,
Address,
MemoryArea->Attributes,
Offset.QuadPart);
MmUnlockSection(Section);
return(STATUS_SUCCESS);
}
/*
* Get the entry corresponding to the offset within the section
*/
@ -496,7 +519,8 @@ NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
}
}
ULONG MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
ULONG
MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
PBOOLEAN Ul)
@ -505,12 +529,14 @@ ULONG MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
return(0);
}
VOID MmpDeleteSection(PVOID ObjectBody)
VOID
MmpDeleteSection(PVOID ObjectBody)
{
DPRINT("MmpDeleteSection(ObjectBody %x)\n", ObjectBody);
}
VOID MmpCloseSection(PVOID ObjectBody,
VOID
MmpCloseSection(PVOID ObjectBody,
ULONG HandleCount)
{
DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
@ -552,7 +578,57 @@ NTSTATUS MmpCreateSection(PVOID ObjectBody,
return(STATUS_SUCCESS);
}
NTSTATUS MmInitSectionImplementation(VOID)
NTSTATUS
MmCreatePhysicalMemorySection(VOID)
{
HANDLE PhysSectionH;
PSECTION_OBJECT PhysSection;
NTSTATUS Status;
OBJECT_ATTRIBUTES Obj;
UNICODE_STRING Name;
LARGE_INTEGER SectionSize;
/*
* Create the section mapping physical memory
*/
SectionSize.QuadPart = 0xFFFFFFFF;
RtlInitUnicodeString(&Name, L"\\Device\\PhysicalMemory");
InitializeObjectAttributes(&Obj,
&Name,
0,
NULL,
NULL);
Status = NtCreateSection(&PhysSectionH,
SECTION_ALL_ACCESS,
&Obj,
&SectionSize,
PAGE_EXECUTE_READWRITE,
0,
NULL);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to create PhysicalMemory section\n");
KeBugCheck(0);
}
Status = ObReferenceObjectByHandle(PhysSectionH,
SECTION_ALL_ACCESS,
NULL,
KernelMode,
(PVOID*)&PhysSection,
NULL);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to reference PhysicalMemory section\n");
KeBugCheck(0);
}
PhysSection->Flags = PhysSection->Flags | SO_PHYSICAL_MEMORY;
ObDereferenceObject((PVOID)PhysSection);
return(STATUS_SUCCESS);
}
NTSTATUS
MmInitSectionImplementation(VOID)
{
MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
@ -579,7 +655,8 @@ NTSTATUS MmInitSectionImplementation(VOID)
/* FIXME: NtCS should call MmCS */
NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
NTSTATUS STDCALL
NtCreateSection (OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize OPTIONAL,
@ -640,8 +717,9 @@ NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
KeInitializeSpinLock(&Section->ViewListLock);
KeInitializeMutex(&Section->Lock, 0);
memset(&Section->PageDirectory, 0, sizeof(Section->PageDirectory));
Section->Flags = 0;
if (FileHandle != (HANDLE)0xffffffff)
if (FileHandle != (HANDLE)0)
{
Status = ObReferenceObjectByHandle(FileHandle,
FILE_READ_DATA,
@ -686,7 +764,8 @@ NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
* REVISIONS
*
*/
NTSTATUS STDCALL NtOpenSection(PHANDLE SectionHandle,
NTSTATUS STDCALL
NtOpenSection(PHANDLE SectionHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
@ -765,7 +844,8 @@ NTSTATUS STDCALL NtOpenSection(PHANDLE SectionHandle,
* RETURN VALUE
* Status.
*/
NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
NTSTATUS STDCALL
NtMapViewOfSection(HANDLE SectionHandle,
HANDLE ProcessHandle,
PVOID* BaseAddress,
ULONG ZeroBits,
@ -803,7 +883,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
if (!(NT_SUCCESS(Status)))
{
DPRINT("ObReference failed rc=%x\n",Status);
return Status;
return(Status);
}
DPRINT("Section %x\n",Section);
@ -821,7 +901,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
Status);
MmUnlockSection(Section);
ObDereferenceObject(Section);
return Status;
return(Status);
}
AddressSpace = &Process->AddressSpace;
@ -861,7 +941,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
MmUnlockSection(Section);
ObDereferenceObject(Section);
return Status;
return(Status);
}
KeAcquireSpinLock(&Section->ViewListLock, &oldIrql);
@ -884,7 +964,8 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL MmUnmapViewOfSection(PEPROCESS Process,
NTSTATUS STDCALL
MmUnmapViewOfSection(PEPROCESS Process,
PMEMORY_AREA MemoryArea)
{
PSECTION_OBJECT Section;
@ -922,7 +1003,8 @@ NTSTATUS STDCALL MmUnmapViewOfSection(PEPROCESS Process,
* REVISIONS
*
*/
NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle,
NTSTATUS STDCALL
NtUnmapViewOfSection (HANDLE ProcessHandle,
PVOID BaseAddress)
{
PEPROCESS Process;
@ -964,10 +1046,20 @@ NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle,
MemoryArea);
DPRINT("MmFreeMemoryArea()\n");
if (MemoryArea->Data.SectionData.Section->Flags & SO_PHYSICAL_MEMORY)
{
Status = MmFreeMemoryArea(&Process->AddressSpace,
BaseAddress,
0,
FALSE);
}
else
{
Status = MmFreeMemoryArea(&Process->AddressSpace,
BaseAddress,
0,
TRUE);
}
MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process);
@ -975,7 +1067,8 @@ NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle,
}
NTSTATUS STDCALL NtQuerySection (IN HANDLE SectionHandle,
NTSTATUS STDCALL
NtQuerySection (IN HANDLE SectionHandle,
IN CINT SectionInformationClass,
OUT PVOID SectionInformation,
IN ULONG Length,
@ -997,7 +1090,8 @@ NTSTATUS STDCALL NtQuerySection (IN HANDLE SectionHandle,
}
NTSTATUS STDCALL NtExtendSection(IN HANDLE SectionHandle,
NTSTATUS STDCALL
NtExtendSection(IN HANDLE SectionHandle,
IN ULONG NewMaximumSize)
{
UNIMPLEMENTED;
@ -1021,7 +1115,8 @@ NTSTATUS STDCALL NtExtendSection(IN HANDLE SectionHandle,
* REVISIONS
*
*/
PVOID STDCALL MmAllocateSection (IN ULONG Length)
PVOID STDCALL
MmAllocateSection (IN ULONG Length)
{
PVOID Result;
MEMORY_AREA* marea;
@ -1077,10 +1172,8 @@ PVOID STDCALL MmAllocateSection (IN ULONG Length)
* Status.
*
*/
PVOID
STDCALL
MmMapViewOfSection (
DWORD Unknown0,
PVOID STDCALL
MmMapViewOfSection (DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3,
@ -1089,92 +1182,70 @@ MmMapViewOfSection (
DWORD Unknown6,
DWORD Unknown7,
DWORD Unknown8,
DWORD Unknown9
)
DWORD Unknown9)
{
UNIMPLEMENTED;
return (NULL);
}
BOOLEAN
STDCALL
MmCanFileBeTruncated (
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN PLARGE_INTEGER NewFileSize
)
BOOLEAN STDCALL
MmCanFileBeTruncated (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN PLARGE_INTEGER NewFileSize)
{
UNIMPLEMENTED;
return (FALSE);
}
BOOLEAN
STDCALL
MmDisableModifiedWriteOfSection (
DWORD Unknown0
)
BOOLEAN STDCALL
MmDisableModifiedWriteOfSection (DWORD Unknown0)
{
UNIMPLEMENTED;
return (FALSE);
}
BOOLEAN
STDCALL
MmFlushImageSection (
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN MMFLUSH_TYPE FlushType
)
BOOLEAN STDCALL
MmFlushImageSection (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN MMFLUSH_TYPE FlushType)
{
UNIMPLEMENTED;
return (FALSE);
}
BOOLEAN
STDCALL
MmForceSectionClosed (
DWORD Unknown0,
DWORD Unknown1
)
BOOLEAN STDCALL
MmForceSectionClosed (DWORD Unknown0,
DWORD Unknown1)
{
UNIMPLEMENTED;
return (FALSE);
}
NTSTATUS
STDCALL
MmMapViewInSystemSpace (
IN PVOID Section,
NTSTATUS STDCALL
MmMapViewInSystemSpace (IN PVOID Section,
OUT PVOID * MappedBase,
IN PULONG ViewSize
)
IN PULONG ViewSize)
{
UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED);
}
NTSTATUS
STDCALL
MmUnmapViewInSystemSpace (
DWORD Unknown0
)
NTSTATUS STDCALL
MmUnmapViewInSystemSpace (DWORD Unknown0)
{
UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED);
}
NTSTATUS
STDCALL
MmSetBankedSection (
DWORD Unknown0,
NTSTATUS STDCALL
MmSetBankedSection (DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3,
DWORD Unknown4,
DWORD Unknown5
)
DWORD Unknown5)
{
UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED);
@ -1234,20 +1305,23 @@ MmSetBankedSection (
* RETURN VALUE
* Status.
*/
NTSTATUS
STDCALL
MmCreateSection (
OUT PSECTION_OBJECT * SectionObject,
NTSTATUS STDCALL
MmCreateSection (OUT PSECTION_OBJECT * SectionObject,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize,
IN ULONG SectionPageProtection,
IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL,
IN PFILE_OBJECT File OPTIONAL
)
IN PFILE_OBJECT File OPTIONAL)
{
return (STATUS_NOT_IMPLEMENTED);
}
/* EOF */