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 SYS_APPS = shell winlogon services
APPS = args hello test cat bench apc shm lpc thread event file gditest \ 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 # 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -22,7 +22,8 @@
/* FUNCTIONS ****************************************************************/ /* 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 * FUNCTION: Retrieve the next FAT32 cluster from the FAT table via a physical
* disk read * disk read
@ -44,7 +45,8 @@ ULONG Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(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 * FUNCTION: Retrieve the next FAT16 cluster from the FAT table from the
* in-memory FAT * in-memory FAT
@ -59,7 +61,8 @@ ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(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 * FUNCTION: Retrieve the next FAT12 cluster from the FAT table from the
* in-memory FAT * in-memory FAT
@ -87,7 +90,8 @@ ULONG Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(Entry); 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 * FUNCTION: Retrieve the next cluster depending on the FAT type
*/ */
@ -117,7 +121,8 @@ ULONG GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
return(NextCluster); return(NextCluster);
} }
ULONG FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt) ULONG
FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Finds the first available cluster in a FAT16 table * FUNCTION: Finds the first available cluster in a FAT16 table
*/ */
@ -132,7 +137,8 @@ ULONG FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0; return 0;
} }
ULONG FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt) ULONG
FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Finds the first available cluster in a FAT12 table * FUNCTION: Finds the first available cluster in a FAT12 table
*/ */
@ -162,7 +168,8 @@ ULONG FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0; return 0;
} }
ULONG FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt) ULONG
FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Finds the first available cluster in a FAT32 table * FUNCTION: Finds the first available cluster in a FAT32 table
*/ */
@ -192,7 +199,8 @@ ULONG FAT32FindAvailableCluster(PDEVICE_EXTENSION DeviceExt)
return 0; return 0;
} }
ULONG FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) ULONG
FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Counts free cluster in a FAT12 table * FUNCTION: Counts free cluster in a FAT12 table
*/ */
@ -227,7 +235,8 @@ ULONG FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount; return ulCount;
} }
ULONG FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) ULONG
FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Counts free clusters in a FAT16 table * FUNCTION: Counts free clusters in a FAT16 table
*/ */
@ -250,7 +259,8 @@ ULONG FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount; return ulCount;
} }
ULONG FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) ULONG
FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
/* /*
* FUNCTION: Counts free clusters in a FAT32 table * FUNCTION: Counts free clusters in a FAT32 table
*/ */
@ -282,7 +292,8 @@ ULONG FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
return ulCount; return ulCount;
} }
void FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite, VOID
FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue) ULONG NewValue)
/* /*
* FUNCTION: Writes a cluster to the FAT12 physical and in-memory tables * 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) ULONG NewValue)
/* /*
* FUNCTION: Writes a cluster to the FAT16 physical and in-memory tables * 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) ULONG NewValue)
/* /*
* FUNCTION: Writes a cluster to the FAT32 physical tables * FUNCTION: Writes a cluster to the FAT32 physical tables
@ -397,7 +410,8 @@ DbgPrint("FAT32WriteCluster %u : %u\n",ClusterToWrite,NewValue);
ExFreePool(Block); ExFreePool(Block);
} }
void WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite, VOID
WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
ULONG NewValue) ULONG NewValue)
/* /*
* FUNCTION: Write a changed FAT entry * 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 * 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) unsigned long Cluster)
/* /*
* FUNCTION: Converts the cluster number to a sector number for this physical * 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); 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 * 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"); 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 * 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/smss/smss.exe $1/reactos/system32
cp subsys/csrss/csrss.exe $1/reactos/system32 cp subsys/csrss/csrss.exe $1/reactos/system32
cp subsys/win32k/win32k.sys $1/reactos/system32/drivers 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/apc/apc.exe $1/reactos/bin
cp apps/shm/shmsrv.exe $1/reactos/bin cp apps/shm/shmsrv.exe $1/reactos/bin
cp apps/shm/shmclt.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/vmtest/vmtest.exe $1/reactos/bin
cp apps/uitest/uitest.exe $1/reactos/bin/ cp apps/uitest/uitest.exe $1/reactos/bin/
cp apps/gditest/gditest.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 #ifndef __INCLUDE_INTERNAL_CC_H
#define __INCLUDE_INTERNAL_CCS_H #define __INCLUDE_INTERNAL_CCS_H
/* $Id: cc.h,v 1.1 2000/06/29 23:35:36 dwelch Exp $ */ /* $Id: cc.h,v 1.2 2000/12/28 03:38:07 dwelch Exp $ */
VOID VOID STDCALL
STDCALL CcMdlReadCompleteDev (IN PMDL MdlChain,
CcMdlReadCompleteDev ( IN PDEVICE_OBJECT DeviceObject);
IN PMDL MdlChain,
IN PDEVICE_OBJECT DeviceObject
);
#endif #endif

View file

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

View file

@ -2,8 +2,8 @@
* internal executive prototypes * internal executive prototypes
*/ */
#ifndef _INCLUDE_INTERNAL_EXECUTIVE_H #ifndef __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H
#define _INCLUDE_INTERNAL_EXECUTIVE_H #define __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ntos/time.h> #include <ntos/time.h>
@ -14,10 +14,13 @@ TIME_ZONE_INFORMATION SystemTimeZoneInfo;
/* INITIALIZATION FUNCTIONS *************************************************/ /* INITIALIZATION FUNCTIONS *************************************************/
VOID ExInit (VOID); VOID
VOID ExInitTimeZoneInfo (VOID); ExInit (VOID);
VOID ExInitializeWorkerThreads(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 * FILE: ntoskrnl/include/internal/i386/segment.h
* PURPOSE: Segment selector definitions * PURPOSE: Segment selector definitions
* PROGRAMMER: David Welch (welch@cwcom.net) * PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created ??/??/??
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#ifndef __INCLUDE_INTERNAL_I386_SEGMENT_H #ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_SEGMENT_H
#define __INCLUDE_INTERNAL_i386_SEGMENT_H #define __NTOSKRNL_INCLUDE_INTERNAL_i386_SEGMENT_H
#define NULL_SELECTOR (0x0) #define NULL_SELECTOR (0x0)
#define KERNEL_CS (0x8) #define KERNEL_CS (0x8)
#define KERNEL_DS (0x10) #define KERNEL_DS (0x10)
#define USER_CS (0x18 + 0x3) #define USER_CS (0x18 + 0x3)
#define USER_DS (0x20 + 0x3) #define USER_DS (0x20 + 0x3)
/* /* Task State Segment */
* FIXME: We actually have one TSS per thread
*/
#define TSS_SELECTOR (0x28) #define TSS_SELECTOR (0x28)
/* Processor Control Region */
#define PCR_SELECTOR (0x30) #define PCR_SELECTOR (0x30)
/* Thread Environment Block */
#define TEB_SELECTOR (0x38 + 0x3) #define TEB_SELECTOR (0x38 + 0x3)
#define RESERVED1_SELECTOR (0x40) #define RESERVED_SELECTOR (0x40)
/* Local Descriptor Table */
#define LDT_SELECTOR (0x48) #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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -9,8 +27,8 @@
* 28/05/97: Created * 28/05/97: Created
*/ */
#ifndef __INCLUDE_INTERNAL_IO_H #ifndef __NTOSKRNL_INCLUDE_INTERNAL_IO_H
#define __INCLUDE_INTERNAL_IO_H #define __NTOSKRNL_INCLUDE_INTERNAL_IO_H
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
@ -23,14 +41,17 @@ extern POBJECT_TYPE IoSymbolicLinkType;
* entry = pointer to the driver initialization routine * entry = pointer to the driver initialization routine
* RETURNS: Success or failure * RETURNS: Success or failure
*/ */
NTSTATUS IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry); NTSTATUS
IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
VOID
IoInitCancelHandling(VOID);
VOID IoInitCancelHandling(VOID); VOID
VOID IoInitSymbolicLinkImplementation(VOID); IoInitSymbolicLinkImplementation(VOID);
VOID IoInitFileSystemImplementation(VOID); VOID
VOID IoInitVpbImplementation (VOID); IoInitFileSystemImplementation(VOID);
VOID
IoInitVpbImplementation (VOID);
NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject); NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject);
POBJECT IoOpenSymlink(POBJECT SymbolicLink); 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 * kernel debugger prototypes
*/ */
@ -6,8 +6,7 @@
#ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H #ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
#define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H #define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
ULONG
ULONG KdpPrintString (PANSI_STRING String); KdpPrintString (PANSI_STRING String);
#endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */ #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 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_KERNEL_H
#define __INCLUDE_INTERNAL_KERNEL_H #define __NTOSKRNL_INCLUDE_INTERNAL_KERNEL_H
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/

View file

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

View file

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

View file

@ -3,8 +3,6 @@
#define KERNEL_BASE (0xc0000000) #define KERNEL_BASE (0xc0000000)
#define NR_TASKS (128)
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002) #define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
#define MULTIBOOT_HEADER_FLAGS (0x00010003) #define MULTIBOOT_HEADER_FLAGS (0x00010003)
@ -708,7 +706,7 @@ lowmem_pagetable:
.long 0x3f8007,0x3f9007,0x3fa007,0x3fb007,0x3fc007,0x3fd007,0x3fe007,0x3ff007 .long 0x3f8007,0x3f9007,0x3fa007,0x3fb007,0x3fc007,0x3fd007,0x3fe007,0x3ff007
_gdt_descr: _gdt_descr:
.word ((8+NR_TASKS)*8)-1 .word (10*8)-1
.long _KiGdt .long _KiGdt
_idt_descr: _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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -20,30 +20,26 @@
#include <internal/debug.h> #include <internal/debug.h>
VOID VOID STDCALL
STDCALL EiEnqueueMessagePort (IN OUT PEPORT Port,
EiEnqueueMessagePort ( IN PQUEUEDMESSAGE Message)
IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message
)
{ {
InsertTailList ( InsertTailList (&Port->QueueListHead,
& Port->QueueListHead, &Message->QueueListEntry);
& Message->QueueListEntry
);
Port->QueueLength++; Port->QueueLength++;
} }
PQUEUEDMESSAGE PQUEUEDMESSAGE STDCALL
STDCALL EiDequeueMessagePort (IN OUT PEPORT Port)
EiDequeueMessagePort (
IN OUT PEPORT Port
)
{ {
PQUEUEDMESSAGE Message; PQUEUEDMESSAGE Message;
PLIST_ENTRY entry; PLIST_ENTRY entry;
if (IsListEmpty(&Port->QueueListHead))
{
return(NULL);
}
entry = RemoveHeadList (&Port->QueueListHead); entry = RemoveHeadList (&Port->QueueListHead);
Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry); Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
Port->QueueLength--; Port->QueueLength--;
@ -52,30 +48,26 @@ EiDequeueMessagePort (
} }
VOID VOID STDCALL
STDCALL EiEnqueueConnectMessagePort (IN OUT PEPORT Port,
EiEnqueueConnectMessagePort ( IN PQUEUEDMESSAGE Message)
IN OUT PEPORT Port,
IN PQUEUEDMESSAGE Message
)
{ {
InsertTailList ( InsertTailList (&Port->ConnectQueueListHead,
& Port->ConnectQueueListHead, &Message->QueueListEntry);
& Message->QueueListEntry
);
Port->ConnectQueueLength++; Port->ConnectQueueLength++;
} }
PQUEUEDMESSAGE PQUEUEDMESSAGE STDCALL
STDCALL EiDequeueConnectMessagePort (IN OUT PEPORT Port)
EiDequeueConnectMessagePort (
IN OUT PEPORT Port
)
{ {
PQUEUEDMESSAGE Message; PQUEUEDMESSAGE Message;
PLIST_ENTRY entry; PLIST_ENTRY entry;
if (IsListEmpty(&Port->ConnectQueueListHead))
{
return(NULL);
}
entry = RemoveHeadList (&Port->ConnectQueueListHead); entry = RemoveHeadList (&Port->ConnectQueueListHead);
Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry); Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
Port->ConnectQueueLength--; 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -9,7 +9,7 @@
* Created 22/05/98 * Created 22/05/98
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES ******************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
@ -19,7 +19,7 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/********************************************************************** /**********************************************************************
* NAME * NAME
@ -33,14 +33,11 @@
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS NTSTATUS STDCALL
STDCALL EiReplyOrRequestPort (IN PEPORT Port,
EiReplyOrRequestPort (
IN PEPORT Port,
IN PLPC_MESSAGE LpcReply, IN PLPC_MESSAGE LpcReply,
IN ULONG MessageType, IN ULONG MessageType,
IN PEPORT Sender IN PEPORT Sender)
)
{ {
KIRQL oldIrql; KIRQL oldIrql;
PQUEUEDMESSAGE MessageReply; PQUEUEDMESSAGE MessageReply;
@ -78,12 +75,9 @@ EiReplyOrRequestPort (
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS NTSTATUS STDCALL
STDCALL NtReplyPort (IN HANDLE PortHandle,
NtReplyPort ( IN PLPC_MESSAGE LpcReply)
IN HANDLE PortHandle,
IN PLPC_MESSAGE LpcReply
)
{ {
NTSTATUS Status; NTSTATUS Status;
PEPORT Port; PEPORT Port;
@ -126,14 +120,11 @@ NtReplyPort (
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS NTSTATUS STDCALL
STDCALL NtReplyWaitReceivePort (HANDLE PortHandle,
NtReplyWaitReceivePort (
HANDLE PortHandle,
PULONG PortId, PULONG PortId,
PLPC_MESSAGE LpcReply, PLPC_MESSAGE LpcReply,
PLPC_MESSAGE LpcMessage PLPC_MESSAGE LpcMessage)
)
{ {
NTSTATUS Status; NTSTATUS Status;
PEPORT Port; PEPORT Port;
@ -176,19 +167,35 @@ NtReplyWaitReceivePort (
/* /*
* Want for a message to be received * Want for a message to be received
*/ */
DPRINT("Entering wait for message\n"); do
KeWaitForSingleObject(&Port->Event, {
Status = KeWaitForSingleObject(&Port->Event,
UserRequest, UserRequest,
UserMode, UserMode,
FALSE, FALSE,
NULL); NULL);
DPRINT("Woke from wait for message\n"); if (!NT_SUCCESS(Status))
{
return(Status);
}
/* /*
* Dequeue the message * Dequeue the message
*/ */
KeAcquireSpinLock(&Port->Lock, &oldIrql); KeAcquireSpinLock(&Port->Lock, &oldIrql);
Request = EiDequeueMessagePort(Port); 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); memcpy(LpcMessage, &Request->Message, Request->Message.MessageSize);
if (Request->Message.MessageType == LPC_CONNECTION_REQUEST) if (Request->Message.MessageType == LPC_CONNECTION_REQUEST)
{ {
@ -202,7 +209,7 @@ NtReplyWaitReceivePort (
} }
/* /*
* * Dereference the port
*/ */
ObDereferenceObject(Port); ObDereferenceObject(Port);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
@ -221,12 +228,9 @@ NtReplyWaitReceivePort (
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS NTSTATUS STDCALL
STDCALL NtReplyWaitReplyPort (HANDLE PortHandle,
NtReplyWaitReplyPort ( PLPC_MESSAGE ReplyMessage)
HANDLE PortHandle,
PLPC_MESSAGE ReplyMessage
)
{ {
UNIMPLEMENTED; 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 * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -273,6 +273,8 @@ VOID MmInit2(VOID)
VOID MmInit3(VOID) VOID MmInit3(VOID)
{ {
MmInitPagerThread(); MmInitPagerThread();
MmCreatePhysicalMemorySection();
/* FIXME: Read parameters from memory */ /* 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -43,12 +43,14 @@ VOID MmLockSection(PSECTION_OBJECT Section)
NULL); NULL);
} }
VOID MmUnlockSection(PSECTION_OBJECT Section) VOID
MmUnlockSection(PSECTION_OBJECT Section)
{ {
KeReleaseMutex(&Section->Lock, FALSE); KeReleaseMutex(&Section->Lock, FALSE);
} }
VOID MmSetPageEntrySection(PSECTION_OBJECT Section, VOID
MmSetPageEntrySection(PSECTION_OBJECT Section,
ULONG Offset, ULONG Offset,
ULONG Entry) ULONG Entry)
{ {
@ -70,7 +72,8 @@ VOID MmSetPageEntrySection(PSECTION_OBJECT Section,
Table->Pages[TableOffset] = Entry; Table->Pages[TableOffset] = Entry;
} }
ULONG MmGetPageEntrySection(PSECTION_OBJECT Section, ULONG
MmGetPageEntrySection(PSECTION_OBJECT Section,
ULONG Offset) ULONG Offset)
{ {
PSECTION_PAGE_TABLE Table; PSECTION_PAGE_TABLE Table;
@ -92,7 +95,8 @@ ULONG MmGetPageEntrySection(PSECTION_OBJECT Section,
return(Entry); return(Entry);
} }
NTSTATUS MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace, NTSTATUS
MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea, MEMORY_AREA* MemoryArea,
PVOID Address) PVOID Address)
{ {
@ -128,6 +132,15 @@ NTSTATUS MmUnalignedLoadPageForSection(PMADDRESS_SPACE AddressSpace,
MmLockSection(Section); 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); Page = MmAllocPageMaybeSwap(0);
Mdl = MmCreateMdl(NULL, NULL, PAGESIZE); Mdl = MmCreateMdl(NULL, NULL, PAGESIZE);
MmBuildMdlFromPages(Mdl, (PULONG)&Page); 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, PMEMORY_AREA MemoryArea,
PVOID Address, PVOID Address,
PSECTION_OBJECT Section, PSECTION_OBJECT Section,
@ -264,7 +278,8 @@ NTSTATUS MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace, NTSTATUS
MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea, MEMORY_AREA* MemoryArea,
PVOID Address) PVOID Address)
{ {
@ -308,17 +323,25 @@ NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Address)); 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 * Lock the section
*/ */
Section = MemoryArea->Data.SectionData.Section; Section = MemoryArea->Data.SectionData.Section;
MmLockSection(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 * 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, MEMORY_AREA* MemoryArea,
PVOID Address, PVOID Address,
PBOOLEAN Ul) PBOOLEAN Ul)
@ -505,12 +529,14 @@ ULONG MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
return(0); return(0);
} }
VOID MmpDeleteSection(PVOID ObjectBody) VOID
MmpDeleteSection(PVOID ObjectBody)
{ {
DPRINT("MmpDeleteSection(ObjectBody %x)\n", ObjectBody); DPRINT("MmpDeleteSection(ObjectBody %x)\n", ObjectBody);
} }
VOID MmpCloseSection(PVOID ObjectBody, VOID
MmpCloseSection(PVOID ObjectBody,
ULONG HandleCount) ULONG HandleCount)
{ {
DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n", DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
@ -552,7 +578,57 @@ NTSTATUS MmpCreateSection(PVOID ObjectBody,
return(STATUS_SUCCESS); 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)); MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
@ -579,7 +655,8 @@ NTSTATUS MmInitSectionImplementation(VOID)
/* FIXME: NtCS should call MmCS */ /* FIXME: NtCS should call MmCS */
NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle, NTSTATUS STDCALL
NtCreateSection (OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL,
@ -640,8 +717,9 @@ NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
KeInitializeSpinLock(&Section->ViewListLock); KeInitializeSpinLock(&Section->ViewListLock);
KeInitializeMutex(&Section->Lock, 0); KeInitializeMutex(&Section->Lock, 0);
memset(&Section->PageDirectory, 0, sizeof(Section->PageDirectory)); memset(&Section->PageDirectory, 0, sizeof(Section->PageDirectory));
Section->Flags = 0;
if (FileHandle != (HANDLE)0xffffffff) if (FileHandle != (HANDLE)0)
{ {
Status = ObReferenceObjectByHandle(FileHandle, Status = ObReferenceObjectByHandle(FileHandle,
FILE_READ_DATA, FILE_READ_DATA,
@ -686,7 +764,8 @@ NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS STDCALL NtOpenSection(PHANDLE SectionHandle, NTSTATUS STDCALL
NtOpenSection(PHANDLE SectionHandle,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes) POBJECT_ATTRIBUTES ObjectAttributes)
{ {
@ -765,7 +844,8 @@ NTSTATUS STDCALL NtOpenSection(PHANDLE SectionHandle,
* RETURN VALUE * RETURN VALUE
* Status. * Status.
*/ */
NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle, NTSTATUS STDCALL
NtMapViewOfSection(HANDLE SectionHandle,
HANDLE ProcessHandle, HANDLE ProcessHandle,
PVOID* BaseAddress, PVOID* BaseAddress,
ULONG ZeroBits, ULONG ZeroBits,
@ -803,7 +883,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
if (!(NT_SUCCESS(Status))) if (!(NT_SUCCESS(Status)))
{ {
DPRINT("ObReference failed rc=%x\n",Status); DPRINT("ObReference failed rc=%x\n",Status);
return Status; return(Status);
} }
DPRINT("Section %x\n",Section); DPRINT("Section %x\n",Section);
@ -821,7 +901,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
Status); Status);
MmUnlockSection(Section); MmUnlockSection(Section);
ObDereferenceObject(Section); ObDereferenceObject(Section);
return Status; return(Status);
} }
AddressSpace = &Process->AddressSpace; AddressSpace = &Process->AddressSpace;
@ -861,7 +941,7 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
MmUnlockSection(Section); MmUnlockSection(Section);
ObDereferenceObject(Section); ObDereferenceObject(Section);
return Status; return(Status);
} }
KeAcquireSpinLock(&Section->ViewListLock, &oldIrql); KeAcquireSpinLock(&Section->ViewListLock, &oldIrql);
@ -884,7 +964,8 @@ NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL MmUnmapViewOfSection(PEPROCESS Process, NTSTATUS STDCALL
MmUnmapViewOfSection(PEPROCESS Process,
PMEMORY_AREA MemoryArea) PMEMORY_AREA MemoryArea)
{ {
PSECTION_OBJECT Section; PSECTION_OBJECT Section;
@ -922,7 +1003,8 @@ NTSTATUS STDCALL MmUnmapViewOfSection(PEPROCESS Process,
* REVISIONS * REVISIONS
* *
*/ */
NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle, NTSTATUS STDCALL
NtUnmapViewOfSection (HANDLE ProcessHandle,
PVOID BaseAddress) PVOID BaseAddress)
{ {
PEPROCESS Process; PEPROCESS Process;
@ -964,10 +1046,20 @@ NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle,
MemoryArea); MemoryArea);
DPRINT("MmFreeMemoryArea()\n"); DPRINT("MmFreeMemoryArea()\n");
if (MemoryArea->Data.SectionData.Section->Flags & SO_PHYSICAL_MEMORY)
{
Status = MmFreeMemoryArea(&Process->AddressSpace,
BaseAddress,
0,
FALSE);
}
else
{
Status = MmFreeMemoryArea(&Process->AddressSpace, Status = MmFreeMemoryArea(&Process->AddressSpace,
BaseAddress, BaseAddress,
0, 0,
TRUE); TRUE);
}
MmUnlockAddressSpace(AddressSpace); MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process); 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, IN CINT SectionInformationClass,
OUT PVOID SectionInformation, OUT PVOID SectionInformation,
IN ULONG Length, 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) IN ULONG NewMaximumSize)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
@ -1021,7 +1115,8 @@ NTSTATUS STDCALL NtExtendSection(IN HANDLE SectionHandle,
* REVISIONS * REVISIONS
* *
*/ */
PVOID STDCALL MmAllocateSection (IN ULONG Length) PVOID STDCALL
MmAllocateSection (IN ULONG Length)
{ {
PVOID Result; PVOID Result;
MEMORY_AREA* marea; MEMORY_AREA* marea;
@ -1077,10 +1172,8 @@ PVOID STDCALL MmAllocateSection (IN ULONG Length)
* Status. * Status.
* *
*/ */
PVOID PVOID STDCALL
STDCALL MmMapViewOfSection (DWORD Unknown0,
MmMapViewOfSection (
DWORD Unknown0,
DWORD Unknown1, DWORD Unknown1,
DWORD Unknown2, DWORD Unknown2,
DWORD Unknown3, DWORD Unknown3,
@ -1089,92 +1182,70 @@ MmMapViewOfSection (
DWORD Unknown6, DWORD Unknown6,
DWORD Unknown7, DWORD Unknown7,
DWORD Unknown8, DWORD Unknown8,
DWORD Unknown9 DWORD Unknown9)
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (NULL); return (NULL);
} }
BOOLEAN BOOLEAN STDCALL
STDCALL MmCanFileBeTruncated (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
MmCanFileBeTruncated ( IN PLARGE_INTEGER NewFileSize)
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN PLARGE_INTEGER NewFileSize
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (FALSE); return (FALSE);
} }
BOOLEAN BOOLEAN STDCALL
STDCALL MmDisableModifiedWriteOfSection (DWORD Unknown0)
MmDisableModifiedWriteOfSection (
DWORD Unknown0
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (FALSE); return (FALSE);
} }
BOOLEAN BOOLEAN STDCALL
STDCALL MmFlushImageSection (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
MmFlushImageSection ( IN MMFLUSH_TYPE FlushType)
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN MMFLUSH_TYPE FlushType
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (FALSE); return (FALSE);
} }
BOOLEAN BOOLEAN STDCALL
STDCALL MmForceSectionClosed (DWORD Unknown0,
MmForceSectionClosed ( DWORD Unknown1)
DWORD Unknown0,
DWORD Unknown1
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (FALSE); return (FALSE);
} }
NTSTATUS NTSTATUS STDCALL
STDCALL MmMapViewInSystemSpace (IN PVOID Section,
MmMapViewInSystemSpace (
IN PVOID Section,
OUT PVOID * MappedBase, OUT PVOID * MappedBase,
IN PULONG ViewSize IN PULONG ViewSize)
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED); return (STATUS_NOT_IMPLEMENTED);
} }
NTSTATUS NTSTATUS STDCALL
STDCALL MmUnmapViewInSystemSpace (DWORD Unknown0)
MmUnmapViewInSystemSpace (
DWORD Unknown0
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED); return (STATUS_NOT_IMPLEMENTED);
} }
NTSTATUS NTSTATUS STDCALL
STDCALL MmSetBankedSection (DWORD Unknown0,
MmSetBankedSection (
DWORD Unknown0,
DWORD Unknown1, DWORD Unknown1,
DWORD Unknown2, DWORD Unknown2,
DWORD Unknown3, DWORD Unknown3,
DWORD Unknown4, DWORD Unknown4,
DWORD Unknown5 DWORD Unknown5)
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (STATUS_NOT_IMPLEMENTED); return (STATUS_NOT_IMPLEMENTED);
@ -1234,20 +1305,23 @@ MmSetBankedSection (
* RETURN VALUE * RETURN VALUE
* Status. * Status.
*/ */
NTSTATUS NTSTATUS STDCALL
STDCALL MmCreateSection (OUT PSECTION_OBJECT * SectionObject,
MmCreateSection (
OUT PSECTION_OBJECT * SectionObject,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize, IN PLARGE_INTEGER MaximumSize,
IN ULONG SectionPageProtection, IN ULONG SectionPageProtection,
IN ULONG AllocationAttributes, IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL, IN HANDLE FileHandle OPTIONAL,
IN PFILE_OBJECT File OPTIONAL IN PFILE_OBJECT File OPTIONAL)
)
{ {
return (STATUS_NOT_IMPLEMENTED); return (STATUS_NOT_IMPLEMENTED);
} }
/* EOF */ /* EOF */