Corrected bug when booting with loadros

Began work on fixing up APCs.

svn path=/trunk/; revision=1212
This commit is contained in:
David Welch 2000-06-27 19:20:45 +00:00
parent 17e1656941
commit 109fef6e75
8 changed files with 52 additions and 30 deletions

View file

@ -1,5 +1,5 @@
/* $Id: zw.h,v 1.30 2000/05/13 13:50:55 dwelch Exp $
/* $Id: zw.h,v 1.31 2000/06/27 19:20:42 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -479,7 +479,7 @@ NTSTATUS
STDCALL
NtContinue(
IN PCONTEXT Context,
IN CINT IrqLevel
IN BOOLEAN TestAlert
);
NTSTATUS STDCALL ZwContinue(IN PCONTEXT Context, IN CINT IrqLevel);

View file

@ -4,10 +4,10 @@ mkdir -p $1/reactos/system32/drivers
mkdir -p $1/reactos/bin
#cp fdisk.exe $1
#cp format.exe $1
#cp loaders/dos/loadros.com $1
#cp ntoskrnl/ntoskrnl.exe $1
#cp services/fs/vfat/vfatfs.sys $1
#cp services/dd/ide/ide.sys $1
cp loaders/dos/loadros.com $1
cp ntoskrnl/ntoskrnl.exe $1
cp services/fs/vfat/vfatfs.sys $1
cp services/dd/ide/ide.sys $1
cp ntoskrnl/ntoskrnl.exe $1/reactos/system32/
cp services/fs/vfat/vfatfs.sys $1/reactos/system32/drivers/
cp services/dd/ide/ide.sys $1/reactos/system32/drivers/

View file

@ -1,4 +1,4 @@
/* $Id: apc.c,v 1.1 2000/05/13 13:50:57 dwelch Exp $
/* $Id: apc.c,v 1.2 2000/06/27 19:20:43 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -16,11 +16,11 @@
/* FUNCTIONS ***************************************************************/
VOID KiUserApcDispatcher(PIO_APC_ROUTINE ApcRoutine,
PVOID ApcContext,
PIO_STATUS_BLOCK Iosb,
ULONG Reserved,
PCONTEXT Context)
VOID STDCALL KiUserApcDispatcher(PIO_APC_ROUTINE ApcRoutine,
PVOID ApcContext,
PIO_STATUS_BLOCK Iosb,
ULONG Reserved,
PCONTEXT Context)
{
ApcRoutine(ApcContext,
Iosb,

View file

@ -81,6 +81,18 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
Esp = (PULONG)UserContext->Esp;
memcpy(&SavedContext, UserContext, sizeof(CONTEXT));
Esp = Esp - (sizeof(CONTEXT) + (5 * sizeof(ULONG)));
memcpy(Esp, &SavedContext, sizeof(CONTEXT));
Top = sizeof(CONTEXT) / 4;
Esp[Top] = (ULONG)Apc->NormalRoutine;
Esp[Top + 1] = (ULONG)Apc->NormalContext;
Esp[Top + 2] = (ULONG)Apc->SystemArgument1;
Esp[Top + 3] = (ULONG)Apc->SystemArgument2;
Esp[Top + 4] = (ULONG)Esp - sizeof(CONTEXT);
UserContext->Eip = 0; // KiUserApcDispatcher
KeReleaseSpinLock(&PiApcLock, oldlvl);
/*
* Now call for the kernel routine for the APC, which will free
@ -88,18 +100,6 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
*/
KeCallKernelRoutineApc(Apc);
Esp = Esp - (sizeof(CONTEXT) + (4 * sizeof(ULONG)));
memcpy(Esp, &SavedContext, sizeof(CONTEXT));
Top = sizeof(CONTEXT) / 4;
Esp[Top] = (ULONG)Apc->SystemArgument2;
Esp[Top + 1] = (ULONG)Apc->SystemArgument1;
Esp[Top + 2] = (ULONG)Apc->NormalContext;
Esp[Top + 3] = (ULONG)Apc->NormalRoutine;
UserContext->Eip = 0;
current_entry = current_entry->Flink;
return(TRUE);
}

View file

@ -28,7 +28,7 @@
/* GLOBALS *******************************************************************/
static PVOID SystemDllEntryPoint = NULL;
//static PVOID SystemDllApcDispatcher = NULL;
static PVOID SystemDllApcDispatcher = NULL;
//static PVOID SystemDllCallbackDispatcher = NULL;
//static PVOID SystemDllExceptionDispatcher = NULL;
@ -39,6 +39,11 @@ PVOID LdrpGetSystemDllEntryPoint(VOID)
return(SystemDllEntryPoint);
}
PVOID LdrpGetSystemDllApcDispatcher(VOID)
{
return(SystemDllApcDispatcher);
}
NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
PVOID* LdrStartupAddr)
/*
@ -133,6 +138,11 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
DPRINT("LdrStartupAddr %x\n", LdrStartupAddr);
SystemDllEntryPoint = *LdrStartupAddr;
/*
* FIXME: retrieve the offset of the APC dispatcher from NTDLL
*/
SystemDllApcDispatcher = NULL;
/*
* Create a section for NTDLL
*/

View file

@ -92,6 +92,18 @@ PVOID MmInitializePageList(PVOID FirstPhysKernelAddress,
MiNrFreePages = 0;
MiNrUsedPages = 0;
for (i = 0; i < Reserved; i++)
{
if (!MmIsPagePresent(NULL,
(PVOID)((ULONG)MmPageArray + (i * PAGESIZE))))
{
MmSetPage(NULL,
(PVOID)((ULONG)MmPageArray + (i * PAGESIZE)),
PAGE_READWRITE,
(ULONG)(LastPhysKernelAddress - (i * PAGESIZE)));
}
}
i = 1;
if ((ULONG)FirstPhysKernelAddress < 0xa0000)
{
@ -109,7 +121,7 @@ PVOID MmInitializePageList(PVOID FirstPhysKernelAddress,
}
MiNrUsedPages = MiNrUsedPages +
((((ULONG)LastPhysKernelAddress) / PAGESIZE) - i);
for (; i<((ULONG)LastKernelAddress / PAGESIZE); i++)
for (; i<((ULONG)LastPhysKernelAddress / PAGESIZE); i++)
{
MmPageArray[i].Flags = PHYSICAL_PAGE_INUSE;
MmPageArray[i].ReferenceCount = 1;

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.16 2000/06/03 21:36:32 ekohl Exp $
/* $Id: create.c,v 1.17 2000/06/27 19:20:45 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -268,7 +268,7 @@ static VOID PiTimeoutThread(struct _KDPC *dpc,
VOID PiBeforeBeginThread(CONTEXT c)
{
DPRINT1("PiBeforeBeginThread(Eip %x)\n", c.Eip);
DPRINT("PiBeforeBeginThread(Eip %x)\n", c.Eip);
//KeReleaseSpinLock(&PiThreadListLock, PASSIVE_LEVEL);
KeLowerIrql(PASSIVE_LEVEL);
}

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.48 2000/06/04 19:51:05 ekohl Exp $
/* $Id: thread.c,v 1.49 2000/06/27 19:20:45 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -553,7 +553,7 @@ NTSTATUS STDCALL NtSuspendThread (IN HANDLE ThreadHandle,
NTSTATUS STDCALL NtContinue(IN PCONTEXT Context,
IN CINT IrqLevel)
IN BOOLEAN TestAlert)
{
PULONG StackTop;