From 8c86bcfe8943be2a2709df2bf1eedee57b21e805 Mon Sep 17 00:00:00 2001 From: David Welch Date: Mon, 26 Mar 2001 20:46:53 +0000 Subject: [PATCH] Fixes for page list initialization V86 mode fixes svn path=/trunk/; revision=1736 --- reactos/.gdbinit | 1 + reactos/include/ddk/i386/tss.h | 38 ++-- reactos/lib/kernel32/misc/atom.c | 242 +++++++++++----------- reactos/lib/user32/windows/class.c | 138 ++++++------ reactos/ntoskrnl/ke/i386/thread.c | 3 +- reactos/ntoskrnl/ke/main.c | 63 +----- reactos/ntoskrnl/mm/freelist.c | 19 +- reactos/ntoskrnl/mm/i386/page.c | 34 ++- reactos/ntoskrnl/mm/mminit.c | 4 +- reactos/subsys/system/services/services.c | 12 +- 10 files changed, 263 insertions(+), 291 deletions(-) diff --git a/reactos/.gdbinit b/reactos/.gdbinit index 7b39e4748c5..b5c8dcf88d2 100644 --- a/reactos/.gdbinit +++ b/reactos/.gdbinit @@ -1,5 +1,6 @@ file ntoskrnl/ntoskrnl.nostrip.exe #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 subsys/csrss/csrss.exe 0x401000 #add-symbol-file subsys/smss/smss.exe 0x401000 diff --git a/reactos/include/ddk/i386/tss.h b/reactos/include/ddk/i386/tss.h index 67571ef6b78..08daa2845cb 100644 --- a/reactos/include/ddk/i386/tss.h +++ b/reactos/include/ddk/i386/tss.h @@ -13,41 +13,43 @@ typedef struct _KTSS { USHORT PreviousTask; USHORT Reserved1; - ULONG Esp0; + ULONG Esp0; USHORT Ss0; USHORT Reserved2; - ULONG Esp1; + ULONG Esp1; USHORT Ss1; USHORT Reserved3; - ULONG Esp2; + ULONG Esp2; USHORT Ss2; USHORT Reserved4; - ULONG Cr3; - ULONG Eip; - ULONG Eflags; - ULONG Eax; - ULONG Ecx; - ULONG Edx; - ULONG Ebx; - ULONG Esp; - ULONG Ebp; - ULONG Esi; - ULONG Edi; + ULONG Cr3; + ULONG Eip; + ULONG Eflags; + ULONG Eax; + ULONG Ecx; + ULONG Edx; + ULONG Ebx; + ULONG Esp; + ULONG Ebp; + ULONG Esi; + ULONG Edi; USHORT Es; USHORT Reserved5; USHORT Cs; USHORT Reserved6; USHORT Ss; USHORT Reserved7; - USHORT Fs; + USHORT Ds; USHORT Reserved8; - USHORT Gs; + USHORT Fs; USHORT Reserved9; - USHORT Ldt; + USHORT Gs; USHORT Reserved10; + USHORT Ldt; + USHORT Reserved11; USHORT Trap; USHORT IoMapBase; - UCHAR IoBitmap[1]; + UCHAR IoBitmap[1]; } KTSS; #endif /* not __ASM__ */ diff --git a/reactos/lib/kernel32/misc/atom.c b/reactos/lib/kernel32/misc/atom.c index 7273118c2c2..3ddf3726528 100644 --- a/reactos/lib/kernel32/misc/atom.c +++ b/reactos/lib/kernel32/misc/atom.c @@ -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 * PROJECT: ReactOS system libraries @@ -97,25 +97,20 @@ DeleteAtom( -ATOM -STDCALL -GlobalAddAtomA( - LPCSTR lpString - ) +ATOM STDCALL +GlobalAddAtomA(LPCSTR lpString) { - - UINT BufLen = strlen(lpString); - WCHAR * lpBuffer = (WCHAR *) HeapAlloc( - GetProcessHeap(), - (HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY), - (BufLen * sizeof (WCHAR)) - ); - ATOM atom; - - ansi2unicode(lpBuffer, lpString,BufLen); - atom = AWGLAddAtom(&GlobalAtomTable,lpBuffer ); - HeapFree(GetProcessHeap(),0,lpBuffer); - return atom; + UINT BufLen = strlen(lpString); + WCHAR* lpBuffer; + ATOM atom; + + lpBuffer = (WCHAR *) HeapAlloc(GetProcessHeap(), + (HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY), + (BufLen * sizeof (WCHAR))); + ansi2unicode(lpBuffer, lpString, BufLen); + atom = AWGLAddAtom(&GlobalAtomTable, lpBuffer); + HeapFree(GetProcessHeap(), 0, lpBuffer); + return(atom); } @@ -300,91 +295,96 @@ GLDeleteAtom( ATOM -AWGLAddAtom( - ATOMTABLE *at, const WCHAR *lpString - ) +AWGLAddAtom(ATOMTABLE *at, const WCHAR *lpString) { - ATOM atom; - ATOMID q; - LPATOMENTRY lp,lpfree; - int index,freeindex; - int atomlen; - int newlen; - - - - /* if we already have it, bump refcnt */ - if((atom = AWGLFindAtom(at, lpString ))) { - lp = GetAtomPointer(at,atom - ATOMBASE); - if(lp->idsize) lp->refcnt++; - return atom; - } + ATOM atom; + ATOMID q; + LPATOMENTRY lp,lpfree; + int index,freeindex; + int atomlen; + int newlen; + + /* if we already have it, bump refcnt */ + if((atom = AWGLFindAtom(at, lpString ))) + { + lp = GetAtomPointer(at,atom - ATOMBASE); + if(lp->idsize) lp->refcnt++; + return atom; + } - /* add to a free slot */ - q = AtomHashString(lpString,&atomlen); - - lpfree = 0; - freeindex = 0; - - for(index = 0;(lp = GetAtomPointer(at,index));index++) { - if(lp->q == 0 && lp->refcnt == 0) { - if(lp->idsize > atomlen) { - if ((lpfree == 0) || - (lpfree->idsize > lp->idsize)) { - lpfree = lp; - freeindex = index; - } - } + /* add to a free slot */ + q = AtomHashString(lpString,&atomlen); + + lpfree = 0; + freeindex = 0; + + for(index = 0;(lp = GetAtomPointer(at,index));index++) + { + if(lp->q == 0 && lp->refcnt == 0) + { + if(lp->idsize > atomlen) + { + 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 */ - if(lpfree && atomlen) { - lpfree->q = q; - lpfree->refcnt = 1; - lstrcpynW(&at->AtomData[lpfree->idx],lpString,atomlen); - return freeindex + ATOMBASE; - } + } + /* intatoms do not take space in data, but do get new entries */ + /* an INTATOM will have length of 0 */ + if(lpfree && atomlen) + { + lpfree->q = q; + 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 */ - /* 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; - - /* 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; + /* 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 -AWGLFindAtom( - ATOMTABLE *at, const WCHAR *lpString - ) +AWGLFindAtom(ATOMTABLE *at, const WCHAR *lpString) { - ATOMID q; - LPATOMENTRY lp; - int index; - int atomlen; + ATOMID q; + LPATOMENTRY lp; + int index; + int 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*/ - for(index = 0;(lp = GetAtomPointer(at,index));index++) { - if(lp->q == q) { - if(HIWORD(lpString) == 0) - return ATOMBASE + index; - if(lstrcmpiW(&at->AtomData[lp->idx],lpString) == 0) - return ATOMBASE + index; - } - } - return 0; + + /* 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*/ + for(index = 0;(lp = GetAtomPointer(at,index));index++) { + if(lp->q == q) { + if(HIWORD(lpString) == 0) + return ATOMBASE + index; + if(lstrcmpiW(&at->AtomData[lp->idx],lpString) == 0) + return ATOMBASE + index; + } + } + return 0; } diff --git a/reactos/lib/user32/windows/class.c b/reactos/lib/user32/windows/class.c index a43a584a3bc..9a316561e81 100644 --- a/reactos/lib/user32/windows/class.c +++ b/reactos/lib/user32/windows/class.c @@ -13,88 +13,92 @@ #include #include - CLASS *rootClass; -ATOM STDCALL RegisterClassA(const WNDCLASS* wc) +ATOM STDCALL +RegisterClassA(const WNDCLASS* wc) { - WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.style = wc->style; - wcex.lpfnWndProc = wc->lpfnWndProc; - wcex.cbClsExtra = wc->cbClsExtra; - wcex.cbWndExtra = wc->cbWndExtra; - wcex.hInstance = wc->hInstance; - wcex.hIcon = wc->hIcon; - wcex.hCursor = wc->hCursor; - wcex.hbrBackground = wc->hbrBackground; - wcex.lpszMenuName = wc->lpszMenuName; - wcex.lpszClassName = wc->lpszClassName; - wcex.hIconSm = NULL; - return RegisterClassExA(&wcex); + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = wc->style; + wcex.lpfnWndProc = wc->lpfnWndProc; + wcex.cbClsExtra = wc->cbClsExtra; + wcex.cbWndExtra = wc->cbWndExtra; + wcex.hInstance = wc->hInstance; + wcex.hIcon = wc->hIcon; + wcex.hCursor = wc->hCursor; + wcex.hbrBackground = wc->hbrBackground; + wcex.lpszMenuName = wc->lpszMenuName; + wcex.lpszClassName = wc->lpszClassName; + wcex.hIconSm = NULL; + return RegisterClassExA(&wcex); } -ATOM STDCALL RegisterClassW(const WNDCLASS* wc) +ATOM STDCALL +RegisterClassW(const WNDCLASS* wc) { - WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.style = wc->style; - wcex.lpfnWndProc = wc->lpfnWndProc; - wcex.cbClsExtra = wc->cbClsExtra; - wcex.cbWndExtra = wc->cbWndExtra; - wcex.hInstance = wc->hInstance; - wcex.hIcon = wc->hIcon; - wcex.hCursor = wc->hCursor; - wcex.hbrBackground = wc->hbrBackground; - wcex.lpszMenuName = wc->lpszMenuName; - wcex.lpszClassName = wc->lpszClassName; - wcex.hIconSm = NULL; - return RegisterClassExW(&wcex); + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = wc->style; + wcex.lpfnWndProc = wc->lpfnWndProc; + wcex.cbClsExtra = wc->cbClsExtra; + wcex.cbWndExtra = wc->cbWndExtra; + wcex.hInstance = wc->hInstance; + wcex.hIcon = wc->hIcon; + wcex.hCursor = wc->hCursor; + wcex.hbrBackground = wc->hbrBackground; + wcex.lpszMenuName = wc->lpszMenuName; + wcex.lpszClassName = wc->lpszClassName; + wcex.hIconSm = NULL; + return RegisterClassExW(&wcex); } -ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc) +ATOM STDCALL +RegisterClassExA(const WNDCLASSEX* wc) { ATOM atom; CLASS *classPtr; INT classExtra, winExtra; int len; - - - if ( wc == NULL || wc->cbSize != sizeof(WNDCLASSEX)) { + + if (wc == NULL || wc->cbSize != sizeof(WNDCLASSEX)) + { SetLastError(ERROR_INVALID_DATA); return FALSE; - } - - atom = GlobalAddAtomA( wc->lpszClassName ); + } + + atom = GlobalAddAtomA(wc->lpszClassName); if (!atom) - { + { SetLastError(ERROR_CLASS_ALREADY_EXISTS); return FALSE; - } - + } + classExtra = wc->cbClsExtra; if (classExtra < 0) - classExtra = 0; + classExtra = 0; else if (classExtra > 40) - classExtra = 40; - + classExtra = 40; + winExtra = wc->cbClsExtra; if (winExtra < 0) - winExtra = 0; + winExtra = 0; else if (winExtra > 40) - winExtra = 40; - + winExtra = 40; + classPtr = (CLASS *)HeapAlloc( GetProcessHeap(), 0, sizeof(CLASS) + - classExtra - sizeof(classPtr->wExtra) ); - - + classExtra - sizeof(classPtr->wExtra) ); + + if (classExtra) - HEAP_memset( classPtr->wExtra, 0, classExtra ); - + HEAP_memset( classPtr->wExtra, 0, classExtra ); + if (!classPtr) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - GlobalDeleteAtom( atom ); - return FALSE; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + GlobalDeleteAtom( atom ); + return FALSE; } classPtr->magic = CLASS_MAGIC; classPtr->cWindows = 0; @@ -109,23 +113,23 @@ ATOM STDCALL RegisterClassExA(const WNDCLASSEX* wc) classPtr->hCursor = (HCURSOR)wc->hCursor; classPtr->hbrBackground = (HBRUSH)wc->hbrBackground; classPtr->bUnicode = FALSE; - + if (wc->style & CS_CLASSDC) - classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ; + classPtr->dce = DCE_AllocDCE( 0, DCE_CLASS_DC ) ; else - classPtr->dce = NULL; - - + classPtr->dce = NULL; + + if ( wc->lpszMenuName != NULL ) { - len = lstrlenA(wc->lpszMenuName); - classPtr->menuName = HeapAlloc(GetProcessHeap(),0,len+1); - lstrcpyA(classPtr->menuName,wc->lpszMenuName); + len = lstrlenA(wc->lpszMenuName); + classPtr->menuName = HeapAlloc(GetProcessHeap(),0,len+1); + lstrcpyA(classPtr->menuName,wc->lpszMenuName); } else - classPtr->menuName = NULL; - + classPtr->menuName = NULL; + + - len = lstrlenA(wc->lpszClassName); classPtr->className = HeapAlloc(GetProcessHeap(),0,len+1); lstrcpyA(classPtr->className,wc->lpszClassName); @@ -557,4 +561,4 @@ WINBOOL CLASS_FreeClass(CLASS *classPtr) HeapFree(GetProcessHeap(),0,classPtr); return TRUE; } - \ No newline at end of file + diff --git a/reactos/ntoskrnl/ke/i386/thread.c b/reactos/ntoskrnl/ke/i386/thread.c index a9c1608e038..a94522280d9 100644 --- a/reactos/ntoskrnl/ke/i386/thread.c +++ b/reactos/ntoskrnl/ke/i386/thread.c @@ -196,7 +196,8 @@ HalInitFirstTask(PETHREAD thread) KiTss.Esp0 = (ULONG)&init_stack_top; KiTss.Ss0 = KERNEL_DS; KiTss.IoMapBase = FIELD_OFFSET(KTSS, IoBitmap); - KiTss.IoBitmap[0] = 0xFF; + //KiTss.IoMapBase = 0xFFFF; + KiTss.IoBitmap[0] = 0xFF; KiTss.Ldt = LDT_SELECTOR; /* diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 1198903511f..9a6d03d7f17 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * 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(®s, 0, sizeof(regs)); - regs.Eax = 0x4F00; - regs.Es = 0x2000; - regs.Edi = 0x0; - memcpy((PVOID)0x0, OrigIVT, 1024); - Status = Ke386CallBios(0x10, ®s); - 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 _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) /* @@ -484,7 +425,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) KeLoaderModules[i].ModEnd += 0xc0000000; KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i]; } - + /* * Initialization phase 0 */ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index da1c65151de..f8b92cf8fea 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -45,6 +45,12 @@ static KSPIN_LOCK PageListLock; static LIST_ENTRY FreePageListHead; static LIST_ENTRY BiosPageListHead; +NTSTATUS +MmCreateVirtualMappingUnsafe(struct _EPROCESS* Process, + PVOID Address, + ULONG flProtect, + ULONG PhysicalAddress); + /* FUNCTIONS *************************************************************/ PVOID @@ -163,12 +169,13 @@ PVOID MmInitializePageList(PVOID FirstPhysKernelAddress, if (!MmIsPagePresent(NULL, (PVOID)((ULONG)MmPageArray + (i * PAGESIZE)))) { - Status = MmCreateVirtualMapping(NULL, - (PVOID)((ULONG)MmPageArray + - (i * PAGESIZE)), - PAGE_READWRITE, - (ULONG)(LastPhysKernelAddress - - (i * PAGESIZE))); + Status = + MmCreateVirtualMappingUnsafe(NULL, + (PVOID)((ULONG)MmPageArray + + (i * PAGESIZE)), + PAGE_READWRITE, + (ULONG)(LastPhysKernelAddress + - (i * PAGESIZE))); if (!NT_SUCCESS(Status)) { DbgPrint("Unable to create virtual mapping\n"); diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index cd5c3f9eb5b..9512bdeb056 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: ntoskrnl/mm/i386/page.c @@ -583,22 +583,17 @@ BOOLEAN MmIsPagePresent(PEPROCESS Process, PVOID Address) return((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT); } - -NTSTATUS MmCreateVirtualMapping(PEPROCESS Process, - PVOID Address, - ULONG flProtect, - ULONG PhysicalAddress) +NTSTATUS +MmCreateVirtualMappingUnsafe(PEPROCESS Process, + PVOID Address, + ULONG flProtect, + ULONG PhysicalAddress) { PEPROCESS CurrentProcess = PsGetCurrentProcess(); ULONG Attributes = 0; PULONG Pte; NTSTATUS Status; - if (!MmIsUsablePage((PVOID)PhysicalAddress)) - { - DPRINT1("Page not usable\n"); - KeBugCheck(0); - } if (Process == NULL && Address < (PVOID)KERNEL_BASE) { DPRINT1("No process\n"); @@ -651,6 +646,23 @@ NTSTATUS MmCreateVirtualMapping(PEPROCESS Process, 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 MmGetPageProtect(PEPROCESS Process, PVOID Address) { diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index 3d178a9c281..9c19b78cc4b 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -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 * PROJECT: ReactOS kernel @@ -232,7 +232,7 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr, /* add 1MB for standard memory (not extended) */ MmStats.NrTotalPages += 256; } - DbgPrint("Used memory %d\n", MmStats.NrTotalPages * PAGESIZE); + DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGESIZE) / 1024); LastKernelAddress = (ULONG)MmInitializePageList( (PVOID)FirstKrnlPhysAddr, diff --git a/reactos/subsys/system/services/services.c b/reactos/subsys/system/services/services.c index eea9cc6f19c..07eb294b2d9 100644 --- a/reactos/subsys/system/services/services.c +++ b/reactos/subsys/system/services/services.c @@ -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 * @@ -93,6 +93,7 @@ WinMain(HINSTANCE hInstance, int nShowCmd) { HANDLE hScmStartEvent; + HANDLE hEvent; PrintString("Service Control Manager\n"); @@ -137,11 +138,18 @@ WinMain(HINSTANCE hInstance, PrintString("SERVICES: Running.\n"); - + + hEvent = CreateEvent(NULL, + TRUE, + FALSE, + NULL); + WaitForSingleObject(hEvent, INFINITE); +#if 0 for (;;) { NtYieldExecution(); } +#endif PrintString("SERVICES: Finished.\n");