mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 13:31:24 +00:00
Fixes for page list initialization
V86 mode fixes svn path=/trunk/; revision=1736
This commit is contained in:
parent
51a205bc71
commit
8c86bcfe89
10 changed files with 263 additions and 291 deletions
|
@ -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
|
||||
|
|
|
@ -39,12 +39,14 @@ typedef struct _KTSS
|
|||
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];
|
||||
|
|
|
@ -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))
|
||||
);
|
||||
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;
|
||||
return(atom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,9 +295,7 @@ GLDeleteAtom(
|
|||
|
||||
|
||||
ATOM
|
||||
AWGLAddAtom(
|
||||
ATOMTABLE *at, const WCHAR *lpString
|
||||
)
|
||||
AWGLAddAtom(ATOMTABLE *at, const WCHAR *lpString)
|
||||
{
|
||||
ATOM atom;
|
||||
ATOMID q;
|
||||
|
@ -311,10 +304,9 @@ AWGLAddAtom(
|
|||
int atomlen;
|
||||
int newlen;
|
||||
|
||||
|
||||
|
||||
/* if we already have it, bump refcnt */
|
||||
if((atom = AWGLFindAtom(at, lpString ))) {
|
||||
if((atom = AWGLFindAtom(at, lpString )))
|
||||
{
|
||||
lp = GetAtomPointer(at,atom - ATOMBASE);
|
||||
if(lp->idsize) lp->refcnt++;
|
||||
return atom;
|
||||
|
@ -326,11 +318,15 @@ AWGLAddAtom(
|
|||
lpfree = 0;
|
||||
freeindex = 0;
|
||||
|
||||
for(index = 0;(lp = GetAtomPointer(at,index));index++) {
|
||||
if(lp->q == 0 && lp->refcnt == 0) {
|
||||
if(lp->idsize > atomlen) {
|
||||
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->idsize > lp->idsize))
|
||||
{
|
||||
lpfree = lp;
|
||||
freeindex = index;
|
||||
}
|
||||
|
@ -339,7 +335,8 @@ AWGLAddAtom(
|
|||
}
|
||||
/* intatoms do not take space in data, but do get new entries */
|
||||
/* an INTATOM will have length of 0 */
|
||||
if(lpfree && atomlen) {
|
||||
if(lpfree && atomlen)
|
||||
{
|
||||
lpfree->q = q;
|
||||
lpfree->refcnt = 1;
|
||||
lstrcpynW(&at->AtomData[lpfree->idx],lpString,atomlen);
|
||||
|
@ -348,12 +345,15 @@ AWGLAddAtom(
|
|||
|
||||
/* no space was available, or we have an INTATOM */
|
||||
/* so expand or create the table */
|
||||
if(at->AtomTable == 0) {
|
||||
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 {
|
||||
}
|
||||
else
|
||||
{
|
||||
at->TableSize++;
|
||||
at->AtomTable = (ATOMENTRY *) HeapReAlloc(GetProcessHeap(),0,
|
||||
(LPVOID) at->AtomTable,
|
||||
|
@ -397,9 +397,7 @@ AWGLAddAtom(
|
|||
|
||||
|
||||
ATOM
|
||||
AWGLFindAtom(
|
||||
ATOMTABLE *at, const WCHAR *lpString
|
||||
)
|
||||
AWGLFindAtom(ATOMTABLE *at, const WCHAR *lpString)
|
||||
{
|
||||
|
||||
ATOMID q;
|
||||
|
@ -408,8 +406,6 @@ AWGLFindAtom(
|
|||
int atomlen;
|
||||
|
||||
|
||||
|
||||
|
||||
/* convert string to 'q', and get length */
|
||||
q = AtomHashString(lpString,&atomlen);
|
||||
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
#include <user32/dce.h>
|
||||
#include <user32/heapdup.h>
|
||||
|
||||
|
||||
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;
|
||||
|
@ -34,9 +35,11 @@ ATOM STDCALL RegisterClassA(const WNDCLASS* wc)
|
|||
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;
|
||||
|
@ -52,15 +55,16 @@ ATOM STDCALL RegisterClassW(const WNDCLASS* wc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -196,6 +196,7 @@ HalInitFirstTask(PETHREAD thread)
|
|||
KiTss.Esp0 = (ULONG)&init_stack_top;
|
||||
KiTss.Ss0 = KERNEL_DS;
|
||||
KiTss.IoMapBase = FIELD_OFFSET(KTSS, IoBitmap);
|
||||
//KiTss.IoMapBase = 0xFFFF;
|
||||
KiTss.IoBitmap[0] = 0xFF;
|
||||
KiTss.Ldt = LDT_SELECTOR;
|
||||
|
||||
|
|
|
@ -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)
|
||||
/*
|
||||
|
|
|
@ -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,7 +169,8 @@ PVOID MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
if (!MmIsPagePresent(NULL,
|
||||
(PVOID)((ULONG)MmPageArray + (i * PAGESIZE))))
|
||||
{
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
Status =
|
||||
MmCreateVirtualMappingUnsafe(NULL,
|
||||
(PVOID)((ULONG)MmPageArray +
|
||||
(i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
|
|
|
@ -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,8 +583,8 @@ BOOLEAN MmIsPagePresent(PEPROCESS Process, PVOID Address)
|
|||
return((MmGetPageEntryForProcess1(Process, Address)) & PA_PRESENT);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS MmCreateVirtualMapping(PEPROCESS Process,
|
||||
NTSTATUS
|
||||
MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress)
|
||||
|
@ -594,11 +594,6 @@ NTSTATUS MmCreateVirtualMapping(PEPROCESS Process,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
@ -138,10 +139,17 @@ 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");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue