Fixes for page list initialization

V86 mode fixes

svn path=/trunk/; revision=1736
This commit is contained in:
David Welch 2001-03-26 20:46:53 +00:00
parent 51a205bc71
commit 8c86bcfe89
10 changed files with 263 additions and 291 deletions

View file

@ -1,5 +1,6 @@
file ntoskrnl/ntoskrnl.nostrip.exe file ntoskrnl/ntoskrnl.nostrip.exe
#add-symbol-file lib/ntdll/ntdll.dll 0x77f61000 #add-symbol-file lib/ntdll/ntdll.dll 0x77f61000
add-symbol-file lib/kernel32/kernel32.dll 0x77f01000
#add-symbol-file apps/exp/exp.exe 0x401000 #add-symbol-file apps/exp/exp.exe 0x401000
#add-symbol-file subsys/csrss/csrss.exe 0x401000 #add-symbol-file subsys/csrss/csrss.exe 0x401000
#add-symbol-file subsys/smss/smss.exe 0x401000 #add-symbol-file subsys/smss/smss.exe 0x401000

View file

@ -13,41 +13,43 @@ typedef struct _KTSS
{ {
USHORT PreviousTask; USHORT PreviousTask;
USHORT Reserved1; USHORT Reserved1;
ULONG Esp0; ULONG Esp0;
USHORT Ss0; USHORT Ss0;
USHORT Reserved2; USHORT Reserved2;
ULONG Esp1; ULONG Esp1;
USHORT Ss1; USHORT Ss1;
USHORT Reserved3; USHORT Reserved3;
ULONG Esp2; ULONG Esp2;
USHORT Ss2; USHORT Ss2;
USHORT Reserved4; USHORT Reserved4;
ULONG Cr3; ULONG Cr3;
ULONG Eip; ULONG Eip;
ULONG Eflags; ULONG Eflags;
ULONG Eax; ULONG Eax;
ULONG Ecx; ULONG Ecx;
ULONG Edx; ULONG Edx;
ULONG Ebx; ULONG Ebx;
ULONG Esp; ULONG Esp;
ULONG Ebp; ULONG Ebp;
ULONG Esi; ULONG Esi;
ULONG Edi; ULONG Edi;
USHORT Es; USHORT Es;
USHORT Reserved5; USHORT Reserved5;
USHORT Cs; USHORT Cs;
USHORT Reserved6; USHORT Reserved6;
USHORT Ss; USHORT Ss;
USHORT Reserved7; USHORT Reserved7;
USHORT Fs; USHORT Ds;
USHORT Reserved8; USHORT Reserved8;
USHORT Gs; USHORT Fs;
USHORT Reserved9; USHORT Reserved9;
USHORT Ldt; USHORT Gs;
USHORT Reserved10; USHORT Reserved10;
USHORT Ldt;
USHORT Reserved11;
USHORT Trap; USHORT Trap;
USHORT IoMapBase; USHORT IoMapBase;
UCHAR IoBitmap[1]; UCHAR IoBitmap[1];
} KTSS; } KTSS;
#endif /* not __ASM__ */ #endif /* not __ASM__ */

View file

@ -1,4 +1,4 @@
/* $Id: atom.c,v 1.9 2000/07/01 17:07:00 ea Exp $ /* $Id: atom.c,v 1.10 2001/03/26 20:46:52 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -97,25 +97,20 @@ DeleteAtom(
ATOM ATOM STDCALL
STDCALL GlobalAddAtomA(LPCSTR lpString)
GlobalAddAtomA(
LPCSTR lpString
)
{ {
UINT BufLen = strlen(lpString);
UINT BufLen = strlen(lpString); WCHAR* lpBuffer;
WCHAR * lpBuffer = (WCHAR *) HeapAlloc( ATOM atom;
GetProcessHeap(),
(HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY), lpBuffer = (WCHAR *) HeapAlloc(GetProcessHeap(),
(BufLen * sizeof (WCHAR)) (HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY),
); (BufLen * sizeof (WCHAR)));
ATOM atom; ansi2unicode(lpBuffer, lpString, BufLen);
atom = AWGLAddAtom(&GlobalAtomTable, lpBuffer);
ansi2unicode(lpBuffer, lpString,BufLen); HeapFree(GetProcessHeap(), 0, lpBuffer);
atom = AWGLAddAtom(&GlobalAtomTable,lpBuffer ); return(atom);
HeapFree(GetProcessHeap(),0,lpBuffer);
return atom;
} }
@ -300,91 +295,96 @@ GLDeleteAtom(
ATOM ATOM
AWGLAddAtom( AWGLAddAtom(ATOMTABLE *at, const WCHAR *lpString)
ATOMTABLE *at, const WCHAR *lpString
)
{ {
ATOM atom; ATOM atom;
ATOMID q; ATOMID q;
LPATOMENTRY lp,lpfree; LPATOMENTRY lp,lpfree;
int index,freeindex; int index,freeindex;
int atomlen; int atomlen;
int newlen; int newlen;
/* if we already have it, bump refcnt */
if((atom = AWGLFindAtom(at, lpString )))
/* if we already have it, bump refcnt */ {
if((atom = AWGLFindAtom(at, lpString ))) { lp = GetAtomPointer(at,atom - ATOMBASE);
lp = GetAtomPointer(at,atom - ATOMBASE); if(lp->idsize) lp->refcnt++;
if(lp->idsize) lp->refcnt++; return atom;
return atom; }
}
/* add to a free slot */ /* add to a free slot */
q = AtomHashString(lpString,&atomlen); q = AtomHashString(lpString,&atomlen);
lpfree = 0; lpfree = 0;
freeindex = 0; freeindex = 0;
for(index = 0;(lp = GetAtomPointer(at,index));index++) { for(index = 0;(lp = GetAtomPointer(at,index));index++)
if(lp->q == 0 && lp->refcnt == 0) { {
if(lp->idsize > atomlen) { if(lp->q == 0 && lp->refcnt == 0)
if ((lpfree == 0) || {
(lpfree->idsize > lp->idsize)) { if(lp->idsize > atomlen)
lpfree = lp; {
freeindex = index; if ((lpfree == 0) ||
} (lpfree->idsize > lp->idsize))
} {
lpfree = lp;
freeindex = index;
} }
}
} }
/* intatoms do not take space in data, but do get new entries */ }
/* an INTATOM will have length of 0 */ /* intatoms do not take space in data, but do get new entries */
if(lpfree && atomlen) { /* an INTATOM will have length of 0 */
lpfree->q = q; if(lpfree && atomlen)
lpfree->refcnt = 1; {
lstrcpynW(&at->AtomData[lpfree->idx],lpString,atomlen); lpfree->q = q;
return freeindex + ATOMBASE; lpfree->refcnt = 1;
} lstrcpynW(&at->AtomData[lpfree->idx],lpString,atomlen);
return freeindex + ATOMBASE;
}
/* no space was available, or we have an INTATOM */
/* so expand or create the table */
if(at->AtomTable == 0)
{
at->AtomTable = (ATOMENTRY *) HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,sizeof(ATOMENTRY));
at->TableSize = 1;
lp = at->AtomTable;
index = 0;
}
else
{
at->TableSize++;
at->AtomTable = (ATOMENTRY *) HeapReAlloc(GetProcessHeap(),0,
(LPVOID) at->AtomTable,
at->TableSize * sizeof(ATOMENTRY));
lp = &at->AtomTable[at->TableSize - 1];
}
/* set in the entry */
lp->refcnt = 1;
lp->q = q;
lp->idsize = atomlen;
lp->idx = 0;
/* no space was available, or we have an INTATOM */ /* add an entry if not intatom... */
/* so expand or create the table */ if(atomlen) {
if(at->AtomTable == 0) { newlen = at->DataSize + atomlen;
at->AtomTable = (ATOMENTRY *) HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,sizeof(ATOMENTRY));
at->TableSize = 1; if(at->AtomData == 0) {
lp = at->AtomTable; at->AtomData = (WCHAR *) HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,newlen*2);
index = 0; lp->idx = 0;
} else { } else {
at->TableSize++;
at->AtomTable = (ATOMENTRY *) HeapReAlloc(GetProcessHeap(),0, at->AtomData = (WCHAR *) HeapReAlloc(GetProcessHeap(),0,at->AtomData,newlen*2);
(LPVOID) at->AtomTable, lp->idx = at->DataSize;
at->TableSize * sizeof(ATOMENTRY)); }
lp = &at->AtomTable[at->TableSize - 1];
} lstrcpyW(&at->AtomData[lp->idx],lpString);
at->DataSize = newlen;
/* set in the entry */ }
lp->refcnt = 1;
lp->q = q; return index + ATOMBASE;
lp->idsize = atomlen;
lp->idx = 0;
/* add an entry if not intatom... */
if(atomlen) {
newlen = at->DataSize + atomlen;
if(at->AtomData == 0) {
at->AtomData = (WCHAR *) HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,newlen*2);
lp->idx = 0;
} else {
at->AtomData = (WCHAR *) HeapReAlloc(GetProcessHeap(),0,at->AtomData,newlen*2);
lp->idx = at->DataSize;
}
lstrcpyW(&at->AtomData[lp->idx],lpString);
at->DataSize = newlen;
}
return index + ATOMBASE;
} }
@ -397,33 +397,29 @@ AWGLAddAtom(
ATOM ATOM
AWGLFindAtom( AWGLFindAtom(ATOMTABLE *at, const WCHAR *lpString)
ATOMTABLE *at, const WCHAR *lpString
)
{ {
ATOMID q; ATOMID q;
LPATOMENTRY lp; LPATOMENTRY lp;
int index; int index;
int atomlen; int atomlen;
/* convert string to 'q', and get length */
q = AtomHashString(lpString,&atomlen);
/* convert string to 'q', and get length */
q = AtomHashString(lpString,&atomlen); /* find the q value, note: this could be INTATOM */
/* if q matches, then do case insensitive compare*/
/* find the q value, note: this could be INTATOM */ for(index = 0;(lp = GetAtomPointer(at,index));index++) {
/* if q matches, then do case insensitive compare*/ if(lp->q == q) {
for(index = 0;(lp = GetAtomPointer(at,index));index++) { if(HIWORD(lpString) == 0)
if(lp->q == q) { return ATOMBASE + index;
if(HIWORD(lpString) == 0) if(lstrcmpiW(&at->AtomData[lp->idx],lpString) == 0)
return ATOMBASE + index; return ATOMBASE + index;
if(lstrcmpiW(&at->AtomData[lp->idx],lpString) == 0) }
return ATOMBASE + index; }
} return 0;
}
return 0;
} }

View file

@ -13,88 +13,92 @@
#include <user32/dce.h> #include <user32/dce.h>
#include <user32/heapdup.h> #include <user32/heapdup.h>
CLASS *rootClass; CLASS *rootClass;
ATOM STDCALL RegisterClassA(const WNDCLASS* wc) ATOM STDCALL
RegisterClassA(const WNDCLASS* wc)
{ {
WNDCLASSEX wcex; WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = wc->style; wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = wc->lpfnWndProc; wcex.style = wc->style;
wcex.cbClsExtra = wc->cbClsExtra; wcex.lpfnWndProc = wc->lpfnWndProc;
wcex.cbWndExtra = wc->cbWndExtra; wcex.cbClsExtra = wc->cbClsExtra;
wcex.hInstance = wc->hInstance; wcex.cbWndExtra = wc->cbWndExtra;
wcex.hIcon = wc->hIcon; wcex.hInstance = wc->hInstance;
wcex.hCursor = wc->hCursor; wcex.hIcon = wc->hIcon;
wcex.hbrBackground = wc->hbrBackground; wcex.hCursor = wc->hCursor;
wcex.lpszMenuName = wc->lpszMenuName; wcex.hbrBackground = wc->hbrBackground;
wcex.lpszClassName = wc->lpszClassName; wcex.lpszMenuName = wc->lpszMenuName;
wcex.hIconSm = NULL; wcex.lpszClassName = wc->lpszClassName;
return RegisterClassExA(&wcex); wcex.hIconSm = NULL;
return RegisterClassExA(&wcex);
} }
ATOM STDCALL RegisterClassW(const WNDCLASS* wc) ATOM STDCALL
RegisterClassW(const WNDCLASS* wc)
{ {
WNDCLASSEX wcex; WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = wc->style; wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = wc->lpfnWndProc; wcex.style = wc->style;
wcex.cbClsExtra = wc->cbClsExtra; wcex.lpfnWndProc = wc->lpfnWndProc;
wcex.cbWndExtra = wc->cbWndExtra; wcex.cbClsExtra = wc->cbClsExtra;
wcex.hInstance = wc->hInstance; wcex.cbWndExtra = wc->cbWndExtra;
wcex.hIcon = wc->hIcon; wcex.hInstance = wc->hInstance;
wcex.hCursor = wc->hCursor; wcex.hIcon = wc->hIcon;
wcex.hbrBackground = wc->hbrBackground; wcex.hCursor = wc->hCursor;
wcex.lpszMenuName = wc->lpszMenuName; wcex.hbrBackground = wc->hbrBackground;
wcex.lpszClassName = wc->lpszClassName; wcex.lpszMenuName = wc->lpszMenuName;
wcex.hIconSm = NULL; wcex.lpszClassName = wc->lpszClassName;
return RegisterClassExW(&wcex); wcex.hIconSm = NULL;
return RegisterClassExW(&wcex);
} }
ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc) ATOM STDCALL
RegisterClassExA(const WNDCLASSEX* wc)
{ {
ATOM atom; ATOM atom;
CLASS *classPtr; CLASS *classPtr;
INT classExtra, winExtra; INT classExtra, winExtra;
int len; int len;
if (wc == NULL || wc->cbSize != sizeof(WNDCLASSEX))
if ( wc == NULL || wc->cbSize != sizeof(WNDCLASSEX)) { {
SetLastError(ERROR_INVALID_DATA); SetLastError(ERROR_INVALID_DATA);
return FALSE; return FALSE;
} }
atom = GlobalAddAtomA( wc->lpszClassName ); atom = GlobalAddAtomA(wc->lpszClassName);
if (!atom) if (!atom)
{ {
SetLastError(ERROR_CLASS_ALREADY_EXISTS); SetLastError(ERROR_CLASS_ALREADY_EXISTS);
return FALSE; return FALSE;
} }
classExtra = wc->cbClsExtra; classExtra = wc->cbClsExtra;
if (classExtra < 0) if (classExtra < 0)
classExtra = 0; classExtra = 0;
else if (classExtra > 40) else if (classExtra > 40)
classExtra = 40; classExtra = 40;
winExtra = wc->cbClsExtra; winExtra = wc->cbClsExtra;
if (winExtra < 0) if (winExtra < 0)
winExtra = 0; winExtra = 0;
else if (winExtra > 40) else if (winExtra > 40)
winExtra = 40; winExtra = 40;
classPtr = (CLASS *)HeapAlloc( GetProcessHeap(), 0, sizeof(CLASS) + classPtr = (CLASS *)HeapAlloc( GetProcessHeap(), 0, sizeof(CLASS) +
classExtra - sizeof(classPtr->wExtra) ); classExtra - sizeof(classPtr->wExtra) );
if (classExtra) if (classExtra)
HEAP_memset( classPtr->wExtra, 0, classExtra ); HEAP_memset( classPtr->wExtra, 0, classExtra );
if (!classPtr) { if (!classPtr) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
GlobalDeleteAtom( atom ); GlobalDeleteAtom( atom );
return FALSE; return FALSE;
} }
classPtr->magic = CLASS_MAGIC; classPtr->magic = CLASS_MAGIC;
classPtr->cWindows = 0; classPtr->cWindows = 0;
@ -109,23 +113,23 @@ ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc)
classPtr->hCursor = (HCURSOR)wc->hCursor; classPtr->hCursor = (HCURSOR)wc->hCursor;
classPtr->hbrBackground = (HBRUSH)wc->hbrBackground; classPtr->hbrBackground = (HBRUSH)wc->hbrBackground;
classPtr->bUnicode = FALSE; classPtr->bUnicode = FALSE;
if (wc->style & CS_CLASSDC) if (wc->style & CS_CLASSDC)
classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ; classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ;
else else
classPtr->dce = NULL; classPtr->dce = NULL;
if ( wc->lpszMenuName != NULL ) { if ( wc->lpszMenuName != NULL ) {
len = lstrlenA(wc->lpszMenuName); len = lstrlenA(wc->lpszMenuName);
classPtr->menuName = HeapAlloc(GetProcessHeap(),0,len+1); classPtr->menuName = HeapAlloc(GetProcessHeap(),0,len+1);
lstrcpyA(classPtr->menuName,wc->lpszMenuName); lstrcpyA(classPtr->menuName,wc->lpszMenuName);
} }
else else
classPtr->menuName = NULL; classPtr->menuName = NULL;
len = lstrlenA(wc->lpszClassName); len = lstrlenA(wc->lpszClassName);
classPtr->className = HeapAlloc(GetProcessHeap(),0,len+1); classPtr->className = HeapAlloc(GetProcessHeap(),0,len+1);
lstrcpyA(classPtr->className,wc->lpszClassName); lstrcpyA(classPtr->className,wc->lpszClassName);
@ -557,4 +561,4 @@ WINBOOL CLASS_FreeClass(CLASS *classPtr)
HeapFree(GetProcessHeap(),0,classPtr); HeapFree(GetProcessHeap(),0,classPtr);
return TRUE; return TRUE;
} }

View file

@ -196,7 +196,8 @@ HalInitFirstTask(PETHREAD thread)
KiTss.Esp0 = (ULONG)&init_stack_top; KiTss.Esp0 = (ULONG)&init_stack_top;
KiTss.Ss0 = KERNEL_DS; KiTss.Ss0 = KERNEL_DS;
KiTss.IoMapBase = FIELD_OFFSET(KTSS, IoBitmap); KiTss.IoMapBase = FIELD_OFFSET(KTSS, IoBitmap);
KiTss.IoBitmap[0] = 0xFF; //KiTss.IoMapBase = 0xFFFF;
KiTss.IoBitmap[0] = 0xFF;
KiTss.Ldt = LDT_SELECTOR; KiTss.Ldt = LDT_SELECTOR;
/* /*

View file

@ -16,7 +16,7 @@
* 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: main.c,v 1.83 2001/03/25 02:34:28 dwelch Exp $ /* $Id: main.c,v 1.84 2001/03/26 20:46:53 dwelch Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -377,65 +377,6 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
} }
} }
extern NTSTATUS STDCALL
Ke386CallBios(UCHAR Int, KV86M_REGISTERS* Regs);
struct __attribute__((packed)) vesa_info
{
UCHAR Signature[4];
USHORT Version;
ULONG OEMName;
ULONG Capabilities;
ULONG SupportedModes;
USHORT TotalVideoMemory;
USHORT OEMVersion;
ULONG VendorName;
ULONG ProductName;
ULONG ProductRevisionString;
UCHAR Reserved[478];
};
VOID
TestV86Mode(VOID)
{
ULONG i;
extern UCHAR OrigIVT[1024];
KV86M_REGISTERS regs;
NTSTATUS Status;
struct vesa_info* vi;
for (i = 0; i < (640 / 4); i++)
{
MmCreateVirtualMapping(NULL,
(PVOID)(i * 4096),
PAGE_EXECUTE_READWRITE,
(ULONG)MmAllocPage(0));
}
for (; i < (1024 / 4); i++)
{
MmCreateVirtualMapping(NULL,
(PVOID)(i * 4096),
PAGE_EXECUTE_READ,
i * 4096);
}
vi = (struct vesa_info*)0x20000;
vi->Signature[0] = 'V';
vi->Signature[1] = 'B';
vi->Signature[2] = 'E';
vi->Signature[3] = '2';
memset(&regs, 0, sizeof(regs));
regs.Eax = 0x4F00;
regs.Es = 0x2000;
regs.Edi = 0x0;
memcpy((PVOID)0x0, OrigIVT, 1024);
Status = Ke386CallBios(0x10, &regs);
DbgPrint("Finished (Status %x, CS:EIP %x:%x)\n", Status, regs.Cs,
regs.Eip);
DbgPrint("Eax %x\n", regs.Eax);
DbgPrint("Signature %.4s\n", vi->Signature);
DbgPrint("TotalVideoMemory %dKB\n", vi->TotalVideoMemory * 64);
}
VOID VOID
_main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
/* /*
@ -484,7 +425,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
KeLoaderModules[i].ModEnd += 0xc0000000; KeLoaderModules[i].ModEnd += 0xc0000000;
KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i]; KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i];
} }
/* /*
* Initialization phase 0 * Initialization phase 0
*/ */

View file

@ -45,6 +45,12 @@ static KSPIN_LOCK PageListLock;
static LIST_ENTRY FreePageListHead; static LIST_ENTRY FreePageListHead;
static LIST_ENTRY BiosPageListHead; static LIST_ENTRY BiosPageListHead;
NTSTATUS
MmCreateVirtualMappingUnsafe(struct _EPROCESS* Process,
PVOID Address,
ULONG flProtect,
ULONG PhysicalAddress);
/* FUNCTIONS *************************************************************/ /* FUNCTIONS *************************************************************/
PVOID PVOID
@ -163,12 +169,13 @@ PVOID MmInitializePageList(PVOID FirstPhysKernelAddress,
if (!MmIsPagePresent(NULL, if (!MmIsPagePresent(NULL,
(PVOID)((ULONG)MmPageArray + (i * PAGESIZE)))) (PVOID)((ULONG)MmPageArray + (i * PAGESIZE))))
{ {
Status = MmCreateVirtualMapping(NULL, Status =
(PVOID)((ULONG)MmPageArray + MmCreateVirtualMappingUnsafe(NULL,
(i * PAGESIZE)), (PVOID)((ULONG)MmPageArray +
PAGE_READWRITE, (i * PAGESIZE)),
(ULONG)(LastPhysKernelAddress PAGE_READWRITE,
- (i * PAGESIZE))); (ULONG)(LastPhysKernelAddress
- (i * PAGESIZE)));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint("Unable to create virtual mapping\n"); DbgPrint("Unable to create virtual mapping\n");

View file

@ -16,7 +16,7 @@
* 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: page.c,v 1.24 2001/03/25 02:34:29 dwelch Exp $ /* $Id: page.c,v 1.25 2001/03/26 20:46:53 dwelch Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/i386/page.c * FILE: ntoskrnl/mm/i386/page.c
@ -583,22 +583,17 @@ BOOLEAN MmIsPagePresent(PEPROCESS Process, PVOID Address)
return((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT); return((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT);
} }
NTSTATUS
NTSTATUS MmCreateVirtualMapping(PEPROCESS Process, MmCreateVirtualMappingUnsafe(PEPROCESS Process,
PVOID Address, PVOID Address,
ULONG flProtect, ULONG flProtect,
ULONG PhysicalAddress) ULONG PhysicalAddress)
{ {
PEPROCESS CurrentProcess = PsGetCurrentProcess(); PEPROCESS CurrentProcess = PsGetCurrentProcess();
ULONG Attributes = 0; ULONG Attributes = 0;
PULONG Pte; PULONG Pte;
NTSTATUS Status; NTSTATUS Status;
if (!MmIsUsablePage((PVOID)PhysicalAddress))
{
DPRINT1("Page not usable\n");
KeBugCheck(0);
}
if (Process == NULL && Address < (PVOID)KERNEL_BASE) if (Process == NULL && Address < (PVOID)KERNEL_BASE)
{ {
DPRINT1("No process\n"); DPRINT1("No process\n");
@ -651,6 +646,23 @@ NTSTATUS MmCreateVirtualMapping(PEPROCESS Process,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS
MmCreateVirtualMapping(PEPROCESS Process,
PVOID Address,
ULONG flProtect,
ULONG PhysicalAddress)
{
if (!MmIsUsablePage((PVOID)PhysicalAddress))
{
DPRINT1("Page not usable\n");
KeBugCheck(0);
}
return(MmCreateVirtualMappingUnsafe(Process,
Address,
flProtect,
PhysicalAddress));
}
ULONG ULONG
MmGetPageProtect(PEPROCESS Process, PVOID Address) MmGetPageProtect(PEPROCESS Process, PVOID Address)
{ {

View file

@ -1,4 +1,4 @@
/* $Id: mminit.c,v 1.15 2001/03/25 02:34:28 dwelch Exp $ /* $Id: mminit.c,v 1.16 2001/03/26 20:46:53 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top directory * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -232,7 +232,7 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr,
/* add 1MB for standard memory (not extended) */ /* add 1MB for standard memory (not extended) */
MmStats.NrTotalPages += 256; MmStats.NrTotalPages += 256;
} }
DbgPrint("Used memory %d\n", MmStats.NrTotalPages * PAGESIZE); DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGESIZE) / 1024);
LastKernelAddress = (ULONG)MmInitializePageList( LastKernelAddress = (ULONG)MmInitializePageList(
(PVOID)FirstKrnlPhysAddr, (PVOID)FirstKrnlPhysAddr,

View file

@ -1,4 +1,4 @@
/* $Id: services.c,v 1.2 2001/01/20 18:39:35 ekohl Exp $ /* $Id: services.c,v 1.3 2001/03/26 20:46:52 dwelch Exp $
* *
* service control manager * service control manager
* *
@ -93,6 +93,7 @@ WinMain(HINSTANCE hInstance,
int nShowCmd) int nShowCmd)
{ {
HANDLE hScmStartEvent; HANDLE hScmStartEvent;
HANDLE hEvent;
PrintString("Service Control Manager\n"); PrintString("Service Control Manager\n");
@ -137,11 +138,18 @@ WinMain(HINSTANCE hInstance,
PrintString("SERVICES: Running.\n"); PrintString("SERVICES: Running.\n");
hEvent = CreateEvent(NULL,
TRUE,
FALSE,
NULL);
WaitForSingleObject(hEvent, INFINITE);
#if 0
for (;;) for (;;)
{ {
NtYieldExecution(); NtYieldExecution();
} }
#endif
PrintString("SERVICES: Finished.\n"); PrintString("SERVICES: Finished.\n");