Fixed LPC section bug

svn path=/trunk/; revision=2480
This commit is contained in:
David Welch 2002-01-03 22:52:29 +00:00
parent 059a7a0f64
commit c79d00b49a
3 changed files with 22 additions and 15 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.2 2001/08/22 03:53:51 rex Exp $ # $Id: Makefile,v 1.3 2002/01/03 22:52:29 dwelch Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -24,7 +24,7 @@ TARGET_LIBPATH = .
TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__
TARGET_CFLAGS = -I./include -I$(PATH_TO_TOP)/ntoskrnl/include TARGET_CFLAGS = -I./include -I$(PATH_TO_TOP)/ntoskrnl/include -g
TARGET_NAME_UP = halx86up TARGET_NAME_UP = halx86up

View file

@ -1,4 +1,4 @@
/* $Id: connect.c,v 1.9 2001/12/31 01:53:45 dwelch Exp $ /* $Id: connect.c,v 1.10 2002/01/03 22:52:29 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -584,7 +584,6 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
sizeof(LPC_MESSAGE_HEADER); sizeof(LPC_MESSAGE_HEADER);
CReply->ConnectDataLength = 0; CReply->ConnectDataLength = 0;
} }
if (AcceptIt != 1) if (AcceptIt != 1)
{ {
EiReplyOrRequestPort(ConnectionRequest->Sender, EiReplyOrRequestPort(ConnectionRequest->Sender,
@ -697,13 +696,14 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
} }
CReply->MaximumMessageSize = 0x148; CReply->MaximumMessageSize = 0x148;
/* /*
* Connect the two ports * Connect the two ports
*/ */
OurPort->OtherPort = ConnectionRequest->Sender; OurPort->OtherPort = ConnectionRequest->Sender;
OurPort->OtherPort->OtherPort = OurPort; OurPort->OtherPort->OtherPort = OurPort;
EiReplyOrRequestPort(ConnectionRequest->Sender, EiReplyOrRequestPort(ConnectionRequest->Sender,
LpcMessage, (PLPC_MESSAGE)CReply,
LPC_REPLY, LPC_REPLY,
OurPort); OurPort);
ExFreePool(ConnectionRequest); ExFreePool(ConnectionRequest);

View file

@ -16,12 +16,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: slab.c,v 1.1 2001/12/31 19:06:48 dwelch Exp $ /* $Id: slab.c,v 1.2 2002/01/03 22:52:29 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top directory * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/slab.c * FILE: ntoskrnl/mm/slab.c
* PURPOSE: kernel memory managment functions * PURPOSE: Slab allocator.
* PROGRAMMER: David Welch (welch@cwcom.net) * PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 27/12/01 * Created 27/12/01
@ -91,7 +91,8 @@ ExCreateSlabCache(PUNICODE_STRING Name, ULONG Size, ULONG Align,
ObjectSize = Size + sizeof(SLAB_CACHE_BUFCTL); ObjectSize = Size + sizeof(SLAB_CACHE_BUFCTL);
AlignSize = Align - (ObjectSize % Align); AlignSize = Align - (ObjectSize % Align);
Slab->ObjectSize = ObjectSize + AlignSize; Slab->ObjectSize = ObjectSize + AlignSize;
Slab->ObjectsPerPage = (PAGESIZE - sizeof(SLAB_CACHE_PAGE)) / Slab->ObjectSize; Slab->ObjectsPerPage =
(PAGESIZE - sizeof(SLAB_CACHE_PAGE)) / Slab->ObjectSize;
InitializeListHead(&Slab->PageListHead); InitializeListHead(&Slab->PageListHead);
KeInitializeSpinLock(&Slab->SlabLock); KeInitializeSpinLock(&Slab->SlabLock);
@ -135,7 +136,8 @@ ExGrowSlabCache(PSLAB_CACHE Slab)
} }
if (i == (Slab->ObjectsPerPage - 1)) if (i == (Slab->ObjectsPerPage - 1))
{ {
BufCtl->NextFree = (PSLAB_CACHE_BUFCTL)(Page + ((i + 1) * Slab->ObjectSize)); BufCtl->NextFree =
(PSLAB_CACHE_BUFCTL)(Page + ((i + 1) * Slab->ObjectSize));
} }
else else
{ {
@ -155,9 +157,10 @@ ExAllocateSlabCache(PSLAB_CACHE Slab, BOOLEAN MayWait)
BOOLEAN NewPage; BOOLEAN NewPage;
KeAcquireSpinLock(&Slab->SlabLock, &oldIrql); KeAcquireSpinLock(&Slab->SlabLock, &oldIrql);
/* /*
* Check if there is a slab with free objects * Check if there is a page with free objects
* present, if so allocation from it, if * present, if so allocate from it, if
* not grow the slab. * not grow the slab.
*/ */
if (Slab->FirstFreePage == NULL) if (Slab->FirstFreePage == NULL)
@ -172,22 +175,25 @@ ExAllocateSlabCache(PSLAB_CACHE Slab, BOOLEAN MayWait)
Page = Slab->FirstFreePage; Page = Slab->FirstFreePage;
NewPage = FALSE; NewPage = FALSE;
} }
/* /*
* We shouldn't have got a page without free buffer. * We shouldn't have got a page without free buffers.
*/ */
if (Page->FirstFreeBuffer == NULL) if (Page->FirstFreeBuffer == NULL)
{ {
DPRINT1("First free page had no free buffers.\n"); DPRINT1("First free page had no free buffers.\n");
KeBugCheck(0); KeBugCheck(0);
} }
/* /*
* Allocate the first free object from the page. * Allocate the first free object from the page.
*/ */
Object = (PVOID)Page->FirstFreeBuffer + sizeof(SLAB_CACHE_BUFCTL); Object = (PVOID)Page->FirstFreeBuffer + sizeof(SLAB_CACHE_BUFCTL);
Page->FirstFreeBuffer = Page->FirstFreeBuffer->NextFree; Page->FirstFreeBuffer = Page->FirstFreeBuffer->NextFree;
Page->ReferenceCount++; Page->ReferenceCount++;
/* /*
* If we just allocate all the objects from this page * If we just allocated all the objects from this page
* and it was the first free page then adjust the * and it was the first free page then adjust the
* first free page pointer and move the page to the head * first free page pointer and move the page to the head
* of the list. * of the list.
@ -264,7 +270,7 @@ ExFreeSlabCache(PSLAB_CACHE Slab, PVOID Object)
/* /*
* If the page just become free then rearrange things. * If the page just become free then rearrange things.
*/ */
if (current->ReferenceCount == (Slab->ObjectsPerPage - 1)) if (current->ReferenceCount == 0)
{ {
RemoveEntryList(&current->PageListEntry); RemoveEntryList(&current->PageListEntry);
InsertTailList(&Slab->PageListHead, &current->PageListEntry); InsertTailList(&Slab->PageListHead, &current->PageListEntry);
@ -303,7 +309,8 @@ ExDestroySlabCache(PSLAB_CACHE Slab)
{ {
for (i = 0; i < Slab->ObjectsPerPage; i++) for (i = 0; i < Slab->ObjectsPerPage; i++)
{ {
Object = Base + (i * Slab->ObjectSize) + sizeof(SLAB_CACHE_BUFCTL); Object = Base + (i * Slab->ObjectSize) +
sizeof(SLAB_CACHE_BUFCTL);
Slab->Destructor(Object, Slab->BaseSize); Slab->Destructor(Object, Slab->BaseSize);
} }
} }