Implemented setting the fs register to point to the TEB

svn path=/trunk/; revision=1062
This commit is contained in:
David Welch 2000-03-16 18:44:57 +00:00
parent 15c9809105
commit 337952bfb9
13 changed files with 308 additions and 280 deletions

View file

@ -17,8 +17,7 @@ include rules.mak
COMPONENTS = iface_native iface_additional ntoskrnl COMPONENTS = iface_native iface_additional ntoskrnl
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32 DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32
#DLLS = mingw32 #DLLS = mingw32
SUBSYS = smss win32k SUBSYS = smss win32k csrss
#SUBSYS = csrss
# #
# Select the server(s) you want to build # Select the server(s) you want to build

View file

@ -1,4 +1,4 @@
/* $Id: shell.c,v 1.33 2000/03/12 23:24:51 ekohl Exp $ /* $Id: shell.c,v 1.34 2000/03/16 18:44:55 dwelch Exp $
* *
* PROJECT : ReactOS Operating System * PROJECT : ReactOS Operating System
* DESCRIPTION: ReactOS' Native Shell * DESCRIPTION: ReactOS' Native Shell
@ -178,11 +178,11 @@ int ExecuteProcess(char* name, char* cmdline, BOOL detached)
{ {
if (ret) if (ret)
{ {
debug_printf("ProcessInformation.hThread %x\n", // debug_printf("ProcessInformation.hThread %x\n",
ProcessInformation.hThread); // ProcessInformation.hThread);
WaitForSingleObject(ProcessInformation.hProcess, INFINITE); WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
CloseHandle(ProcessInformation.hProcess); CloseHandle(ProcessInformation.hProcess);
debug_printf("Thandle %x\n", ProcessInformation.hThread); // debug_printf("Thandle %x\n", ProcessInformation.hThread);
CloseHandle(ProcessInformation.hThread); CloseHandle(ProcessInformation.hThread);
} }
} }

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.2 2000/02/21 22:34:26 ekohl Exp $ # $Id: makefile,v 1.3 2000/03/16 18:44:55 dwelch Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -32,7 +32,7 @@ BASE_CFLAGS = -I../../include
all: $(SVC_FILES) all: $(SVC_FILES)
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c $(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c
$(CC) \ $(NATIVE_CC) \
$(CFLAGS) \ $(CFLAGS) \
-o $(TARGETNAME) \ -o $(TARGETNAME) \
-O2 \ -O2 \

12
reactos/install-system.sh Normal file
View file

@ -0,0 +1,12 @@
mkdir -p $1/reactos
mkdir -p $1/reactos/system32
mkdir -p $1/reactos/system32/drivers
mkdir -p $1/reactos/bin
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 services/dd/keyboard/keyboard.sys $1/reactos/system32/drivers
cp services/dd/blue/blue.sys $1/reactos/system32/drivers
cp services/dd/vga/vgamp.sys $1/reactos/system32/drivers
cp services/dd/vidport/vidport.sys $1/reactos/system32/drivers

7
reactos/install.bochs Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh
mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw
./install-system.sh /mnt/floppy
umount /mnt/floppy
mount -t vfat /bochs/10M.vga /mnt/floppy -o loop,rw
./install.sh /mnt/floppy
umount /mnt/floppy

View file

@ -1,4 +1,4 @@
/* $Id: curdir.c,v 1.21 2000/03/14 23:09:23 ekohl Exp $ /* $Id: curdir.c,v 1.22 2000/03/16 18:44:55 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
@ -28,59 +28,51 @@ UNICODE_STRING WindowsDirectory;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
DWORD DWORD STDCALL GetCurrentDirectoryA (DWORD nBufferLength,
STDCALL LPSTR lpBuffer)
GetCurrentDirectoryA (
DWORD nBufferLength,
LPSTR lpBuffer
)
{ {
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
/* initialize ansi string */ /* initialize ansi string */
AnsiString.Length = 0; AnsiString.Length = 0;
AnsiString.MaximumLength = nBufferLength; AnsiString.MaximumLength = nBufferLength;
AnsiString.Buffer = lpBuffer; AnsiString.Buffer = lpBuffer;
/* allocate buffer for unicode string */
UnicodeString.Length = 0;
UnicodeString.MaximumLength = nBufferLength * sizeof(WCHAR);
UnicodeString.Buffer = RtlAllocateHeap (RtlGetProcessHeap (),
0,
UnicodeString.MaximumLength);
/* allocate buffer for unicode string */ /* get current directory */
UnicodeString.Length = 0; UnicodeString.Length = RtlGetCurrentDirectory_U (UnicodeString.MaximumLength,
UnicodeString.MaximumLength = nBufferLength * sizeof(WCHAR); UnicodeString.Buffer);
UnicodeString.Buffer = RtlAllocateHeap (RtlGetProcessHeap (), DPRINT("UnicodeString.Buffer %S\n", UnicodeString.Buffer);
0,
UnicodeString.MaximumLength); /* convert unicode string to ansi (or oem) */
if (bIsFileApiAnsi)
RtlUnicodeStringToAnsiString (&AnsiString,
&UnicodeString,
FALSE);
else
RtlUnicodeStringToOemString (&AnsiString,
&UnicodeString,
FALSE);
DPRINT("AnsiString.Buffer %s\n", AnsiString.Buffer);
/* get current directory */ /* free unicode string */
UnicodeString.Length = RtlGetCurrentDirectory_U (UnicodeString.MaximumLength, RtlFreeHeap (RtlGetProcessHeap (),
UnicodeString.Buffer); 0,
DPRINT("UnicodeString.Buffer %S\n", UnicodeString.Buffer); UnicodeString.Buffer);
/* convert unicode string to ansi (or oem) */ return AnsiString.Length;
if (bIsFileApiAnsi)
RtlUnicodeStringToAnsiString (&AnsiString,
&UnicodeString,
FALSE);
else
RtlUnicodeStringToOemString (&AnsiString,
&UnicodeString,
FALSE);
DPRINT("AnsiString.Buffer %s\n", AnsiString.Buffer);
/* free unicode string */
RtlFreeHeap (RtlGetProcessHeap (),
0,
UnicodeString.Buffer);
return AnsiString.Length;
} }
DWORD DWORD STDCALL GetCurrentDirectoryW (DWORD nBufferLength,
STDCALL LPWSTR lpBuffer)
GetCurrentDirectoryW (
DWORD nBufferLength,
LPWSTR lpBuffer
)
{ {
ULONG Length; ULONG Length;
@ -127,7 +119,6 @@ SetCurrentDirectoryA (
return TRUE; return TRUE;
} }
WINBOOL WINBOOL
STDCALL STDCALL
SetCurrentDirectoryW ( SetCurrentDirectoryW (
@ -233,13 +224,7 @@ GetTempPathW (
return Value.Length / sizeof(WCHAR); return Value.Length / sizeof(WCHAR);
} }
WINBOOL STDCALL SetCurrentDirectoryW (LPCWSTR lpPathName)
UINT
STDCALL
GetSystemDirectoryA (
LPSTR lpBuffer,
UINT uSize
)
{ {
ANSI_STRING String; ANSI_STRING String;
ULONG Length; ULONG Length;
@ -269,6 +254,7 @@ GetSystemDirectoryA (
} }
UINT UINT
STDCALL STDCALL
GetSystemDirectoryW ( GetSystemDirectoryW (

View file

@ -1,4 +1,4 @@
/* $Id: path.c,v 1.3 2000/03/13 17:54:23 ekohl Exp $ /* $Id: path.c,v 1.4 2000/03/16 18:44:55 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
@ -19,7 +19,6 @@
#define NDEBUG #define NDEBUG
#include <ntdll/ntdll.h> #include <ntdll/ntdll.h>
/* DEFINITONS and MACROS ******************************************************/ /* DEFINITONS and MACROS ******************************************************/
#define MAX_PFX_SIZE 16 #define MAX_PFX_SIZE 16
@ -30,95 +29,87 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static static ULONG RtlpGetDotSequence (PWSTR p)
ULONG
RtlpGetDotSequence (PWSTR p)
{ {
ULONG Count = 0; ULONG Count = 0;
for (;;) for (;;)
{ {
if (*p == '.') if (*p == '.')
Count++; Count++;
else if ((*p == '\\' || *p == '\0') && Count) else if ((*p == '\\' || *p == '\0') && Count)
return Count; return Count;
else else
return 0; return 0;
p++; p++;
} }
return 0; return 0;
} }
static static VOID RtlpEatPath (PWSTR Path)
VOID
RtlpEatPath (
PWSTR Path
)
{ {
PWSTR p, prev; PWSTR p, prev;
p = Path + 2; p = Path + 2;
prev = p; prev = p;
while ((*p) != 0 || ((*p) == L'\\' && (*(p+1)) == 0)) while ((*p) != 0 || ((*p) == L'\\' && (*(p+1)) == 0))
{ {
ULONG DotLen; ULONG DotLen;
DotLen = RtlpGetDotSequence (p+1); DotLen = RtlpGetDotSequence (p+1);
DPRINT("DotSequenceLength %u\n", DotLen); DPRINT("DotSequenceLength %u\n", DotLen);
DPRINT("prev %S p %S\n",prev,p); DPRINT("prev %S p %S\n",prev,p);
if (DotLen == 0) if (DotLen == 0)
{ {
prev = p; prev = p;
do do
{ {
p++; p++;
} }
while ((*p) != 0 && (*p) != L'\\'); while ((*p) != 0 && (*p) != L'\\');
} }
else if (DotLen == 1) else if (DotLen == 1)
{ {
wcscpy (p, p+2); wcscpy (p, p+2);
} }
else else
{ {
if (DotLen > 2) if (DotLen > 2)
{ {
int n = DotLen - 2; int n = DotLen - 2;
while (n > 0 && prev > (Path + 2)) while (n > 0 && prev > (Path + 2))
{ {
prev--; prev--;
if ((*prev) == L'\\') if ((*prev) == L'\\')
n--; n--;
} }
} }
if (*(p + DotLen + 1) == 0) if (*(p + DotLen + 1) == 0)
*(prev + 1) = 0; *(prev + 1) = 0;
else else
wcscpy (prev, p + DotLen + 1); wcscpy (prev, p + DotLen + 1);
p = prev; p = prev;
if (prev > (Path + 2)) if (prev > (Path + 2))
{ {
prev--; prev--;
while ((*prev) != L'\\') while ((*prev) != L'\\')
{ {
prev--; prev--;
} }
} }
} }
} }
} }
ULONG ULONG STDCALL RtlGetLongestNtPathLength (VOID)
STDCALL
RtlGetLongestNtPathLength (VOID)
{ {
return (MAX_PATH + 9); return (MAX_PATH + 9);
} }
@ -282,112 +273,108 @@ RtlGetCurrentDirectory_U (
} }
NTSTATUS NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
STDCALL
RtlSetCurrentDirectory_U (
PUNICODE_STRING name
)
{ {
UNICODE_STRING full; UNICODE_STRING full;
OBJECT_ATTRIBUTES Attr; OBJECT_ATTRIBUTES Attr;
IO_STATUS_BLOCK iosb; IO_STATUS_BLOCK iosb;
PCURDIR cd; PCURDIR cd;
NTSTATUS Status; NTSTATUS Status;
ULONG size; ULONG size;
HANDLE handle = NULL; HANDLE handle = NULL;
PWSTR wcs; PWSTR wcs;
PWSTR buf = 0; PWSTR buf = 0;
DPRINT ("RtlSetCurrentDirectory %wZ\n", name); DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
RtlAcquirePebLock ();
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
size = cd->DosPath.MaximumLength;
buf = RtlAllocateHeap (RtlGetProcessHeap(),
0,
size);
if (buf == NULL)
{
RtlReleasePebLock ();
return STATUS_NO_MEMORY;
}
size = RtlGetFullPathName_U (name->Buffer, size, buf, 0);
if (!size)
{
RtlFreeHeap (RtlGetProcessHeap (),
0,
buf);
RtlReleasePebLock ();
return STATUS_OBJECT_NAME_INVALID;
}
if (!RtlDosPathNameToNtPathName_U (buf, &full, 0, 0))
{
RtlFreeHeap (RtlGetProcessHeap (),
0,
buf);
RtlFreeHeap (RtlGetProcessHeap (),
0,
full.Buffer);
RtlReleasePebLock ();
return STATUS_OBJECT_NAME_INVALID;
}
InitializeObjectAttributes (&Attr,
&full,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL,
NULL);
Status = NtOpenFile (&handle,
SYNCHRONIZE | FILE_TRAVERSE,
&Attr,
&iosb,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status))
{
RtlFreeHeap (RtlGetProcessHeap (),
0,
buf);
RtlFreeHeap (RtlGetProcessHeap (),
0,
full.Buffer);
RtlReleasePebLock ();
return Status;
}
/* append backslash if missing */
wcs = buf + size / sizeof(WCHAR) - 1;
if (*wcs != L'\\')
{
*(++wcs) = L'\\';
*(++wcs) = 0;
size += sizeof(WCHAR);
}
memmove (cd->DosPath.Buffer,
buf,
size + sizeof(WCHAR));
cd->DosPath.Length = size;
if (cd->Handle)
NtClose (cd->Handle);
cd->Handle = handle;
RtlAcquirePebLock ();
cd = &NtCurrentPeb ()->ProcessParameters->CurrentDirectory;
size = cd->DosPath.MaximumLength;
buf = RtlAllocateHeap (RtlGetProcessHeap(),
0,
size);
if (buf == NULL)
{
RtlReleasePebLock ();
return STATUS_NO_MEMORY;
}
size = RtlGetFullPathName_U (name->Buffer, size, buf, 0);
if (!size)
{
RtlFreeHeap (RtlGetProcessHeap (), RtlFreeHeap (RtlGetProcessHeap (),
0, 0,
buf); buf);
RtlReleasePebLock ();
return STATUS_OBJECT_NAME_INVALID;
}
if (!RtlDosPathNameToNtPathName_U (buf, &full, 0, 0))
{
RtlFreeHeap (RtlGetProcessHeap (), RtlFreeHeap (RtlGetProcessHeap (),
0, 0,
full.Buffer); buf);
RtlFreeHeap (RtlGetProcessHeap (),
RtlReleasePebLock(); 0,
full.Buffer);
return STATUS_SUCCESS; RtlReleasePebLock ();
return STATUS_OBJECT_NAME_INVALID;
}
InitializeObjectAttributes (&Attr,
&full,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL,
NULL);
Status = NtOpenFile (&handle,
SYNCHRONIZE | FILE_TRAVERSE,
&Attr,
&iosb,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status))
{
RtlFreeHeap (RtlGetProcessHeap (),
0,
buf);
RtlFreeHeap (RtlGetProcessHeap (),
0,
full.Buffer);
RtlReleasePebLock ();
return Status;
}
/* append backslash if missing */
wcs = buf + size / sizeof(WCHAR) - 1;
if (*wcs != L'\\')
{
*(++wcs) = L'\\';
*(++wcs) = 0;
size += sizeof(WCHAR);
}
memmove (cd->DosPath.Buffer,
buf,
size + sizeof(WCHAR));
cd->DosPath.Length = size;
if (cd->Handle)
NtClose (cd->Handle);
cd->Handle = handle;
RtlFreeHeap (RtlGetProcessHeap (),
0,
buf);
RtlFreeHeap (RtlGetProcessHeap (),
0,
full.Buffer);
RtlReleasePebLock();
return STATUS_SUCCESS;
} }

View file

@ -26,7 +26,7 @@ USHORT KiGdt[(8 + NR_TASKS) * 4] = {0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xf200, 0xcc, 0x0, 0x0, 0xf200, 0xcc,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0}; 0x1000, 0x0, 0xf200, 0x0};
static KSPIN_LOCK GdtLock; static KSPIN_LOCK GdtLock;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -36,18 +36,29 @@ VOID KeSetBaseGdtSelector(ULONG Entry,
{ {
KIRQL oldIrql; KIRQL oldIrql;
DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
Entry, Base);
KeAcquireSpinLock(&GdtLock, &oldIrql); KeAcquireSpinLock(&GdtLock, &oldIrql);
KiGdt[Entry*4 + 1] = ((ULONG)Base) & 0xffff; Entry = (Entry & (~0x3)) / 2;
KiGdt[Entry*4 + 2] = KiGdt[Entry*4 + 2] & ~(0xff); KiGdt[Entry + 1] = ((ULONG)Base) & 0xffff;
KiGdt[Entry*4 + 2] = KiGdt[Entry*4 + 2] |
KiGdt[Entry + 2] = KiGdt[Entry + 2] & ~(0xff);
KiGdt[Entry + 2] = KiGdt[Entry + 2] |
((((ULONG)Base) & 0xff0000) >> 16); ((((ULONG)Base) & 0xff0000) >> 16);
KiGdt[Entry*4 + 3] = KiGdt[Entry*4 + 3] & ~(0xff00); KiGdt[Entry + 3] = KiGdt[Entry + 3] & ~(0xff00);
KiGdt[Entry*4 + 3] = KiGdt[Entry*4 + 3] | KiGdt[Entry + 3] = KiGdt[Entry + 3] |
((((ULONG)Base) & 0xff000000) >> 16); ((((ULONG)Base) & 0xff000000) >> 16);
DPRINT("%x %x %x %x\n",
KiGdt[Entry + 0],
KiGdt[Entry + 1],
KiGdt[Entry + 2],
KiGdt[Entry + 3]);
KeReleaseSpinLock(&GdtLock, oldIrql); KeReleaseSpinLock(&GdtLock, oldIrql);
} }

View file

@ -34,6 +34,8 @@ static char KiNullLdt[8] = {0,};
static unsigned int KiNullLdtSel = 0; static unsigned int KiNullLdtSel = 0;
static PETHREAD FirstThread = NULL; static PETHREAD FirstThread = NULL;
extern ULONG KeSetBaseGdtSelector(ULONG Entry, PVOID Base);
/* FUNCTIONS **************************************************************/ /* FUNCTIONS **************************************************************/
VOID HalTaskSwitch(PKTHREAD thread) VOID HalTaskSwitch(PKTHREAD thread)
@ -45,15 +47,14 @@ VOID HalTaskSwitch(PKTHREAD thread)
* again (possibly never) * again (possibly never)
*/ */
{ {
#if 0 // PETHREAD Thread;
PETHREAD Thread; // PVOID Teb;
Thread = CONTAINING_RECORD(thread, ETHREAD, Tcb);
if (Thread->Cid.UniqueThread != (HANDLE)1) /* Set the base of the TEB selector to the base of the TEB for the
{ * new thread
DPRINT1("Scheduling thread %x (id %d)\n",Thread, */
Thread->Cid.UniqueThread); KeSetBaseGdtSelector(TEB_SELECTOR, thread->Teb);
} /* Switch to the new thread's context and stack */
#endif
__asm__("pushfl\n\t" __asm__("pushfl\n\t"
"cli\n\t" "cli\n\t"
"ljmp %0\n\t" "ljmp %0\n\t"
@ -61,6 +62,31 @@ VOID HalTaskSwitch(PKTHREAD thread)
: /* No outputs */ : /* No outputs */
: "m" (*(((unsigned char *)(&(thread->Context.nr)))-4) ) : "m" (*(((unsigned char *)(&(thread->Context.nr)))-4) )
: "ax","dx"); : "ax","dx");
/* Reload the TEB selector */
__asm__("movw %0, %%ax\n\t"
"movw %%ax, %%fs\n\t"
: /* No outputs */
: "i" (TEB_SELECTOR)
: "ax");
#if 0
Thread = PsGetCurrentThread();
if (Thread->Cid.UniqueThread != (HANDLE)1)
{
// DbgPrint("Scheduling thread %x (id %d) teb %x\n",Thread,
// Thread->Cid.UniqueThread, Thread->Tcb.Teb);
}
if (Thread->Tcb.Teb != NULL)
{
// DbgPrint("cr3 %x\n", Thread->ThreadsProcess->Pcb.PageTableDirectory);
__asm__("movl %%fs:0x18, %0\n\t"
: "=g" (Teb)
: /* No inputs */
);
// DbgPrint("Teb %x\n", Teb);
}
#endif
} }
#define FLAG_NT (1<<14) #define FLAG_NT (1<<14)
@ -175,6 +201,7 @@ NTSTATUS HalInitTaskWithContext(PETHREAD Thread, PCONTEXT Context)
} }
stack_start = kernel_stack + 3*PAGESIZE - sizeof(CONTEXT); stack_start = kernel_stack + 3*PAGESIZE - sizeof(CONTEXT);
Context->SegFs = TEB_SELECTOR;
memcpy(stack_start, Context, sizeof(CONTEXT)); memcpy(stack_start, Context, sizeof(CONTEXT));
/* /*

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.39 2000/03/04 22:03:01 ekohl Exp $ /* $Id: main.c,v 1.40 2000/03/16 18:44:56 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -30,13 +30,10 @@
/* DATA *********************************************************************/ /* DATA *********************************************************************/
USHORT USHORT __declspec(dllexport) NtBuildNumber = KERNEL_VERSION_BUILD;
__declspec(dllexport) /* EXPORTED */
NtBuildNumber = KERNEL_VERSION_BUILD; /* EXPORTED */
ULONG ULONG __declspec(dllexport) NtGlobalFlag = 0; /* FIXME: EXPORTED */
__declspec(dllexport)
NtGlobalFlag = 0; /* FIXME: EXPORTED */
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/

View file

@ -243,13 +243,15 @@ ULONG MmPageFault(ULONG cs, ULONG eip, ULONG error_code)
MEMORY_AREA* MemoryArea; MEMORY_AREA* MemoryArea;
NTSTATUS Status; NTSTATUS Status;
unsigned int cr2; unsigned int cr2;
// unsigned int cr3;
/* /*
* Get the address for the page fault * Get the address for the page fault
*/ */
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2)); __asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
DPRINT("Page fault address %x eip %x process %x code %x\n",cr2,eip, // __asm__("movl %%cr3,%0\n\t" : "=d" (cr3));
PsGetCurrentProcess(), error_code); // DPRINT1("Page fault address %x eip %x process %x code %x cr3 %x\n",cr2,eip,
// PsGetCurrentProcess(), error_code, cr3);
MmSetPageProtect(PsGetCurrentProcess(), MmSetPageProtect(PsGetCurrentProcess(),
(PVOID)PAGE_ROUND_DOWN(PsGetCurrentProcess()), (PVOID)PAGE_ROUND_DOWN(PsGetCurrentProcess()),

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.10 2000/02/14 14:13:33 dwelch Exp $ /* $Id: create.c,v 1.11 2000/03/16 18:44:57 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -369,8 +369,8 @@ NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
Thread->Tcb.WaitBlockList = NULL; Thread->Tcb.WaitBlockList = NULL;
InsertTailList(&Thread->ThreadsProcess->Pcb.ThreadListHead, InsertTailList(&Thread->ThreadsProcess->Pcb.ThreadListHead,
&Thread->Tcb.ProcessThreadListEntry ); &Thread->Tcb.ProcessThreadListEntry );
DPRINT1("Inserting %x into process %x list\n", // DPRINT1("Inserting %x into process %x list\n",
Thread, Thread->ThreadsProcess); // Thread, Thread->ThreadsProcess);
KeInitializeDispatcherHeader(&Thread->Tcb.DispatcherHeader, KeInitializeDispatcherHeader(&Thread->Tcb.DispatcherHeader,
InternalThreadType, InternalThreadType,
sizeof(ETHREAD), sizeof(ETHREAD),
@ -422,7 +422,7 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
PAGE_READWRITE); PAGE_READWRITE);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DPRINT ("TEB allocated at %x\n", TebBase); DPRINT1 ("TEB allocated at %x\n", TebBase);
break; break;
} }
else else
@ -477,7 +477,7 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* free TEB */ /* free TEB */
DPRINT ("Writing TEB failed!\n"); DPRINT1 ("Writing TEB failed!\n");
RegionSize = 0; RegionSize = 0;
NtFreeVirtualMemory(ProcessHandle, NtFreeVirtualMemory(ProcessHandle,
@ -492,10 +492,10 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
if (TebPtr != NULL) if (TebPtr != NULL)
{ {
// *TebPtr = (PNT_TEB)TebBase; *TebPtr = (PNT_TEB)TebBase;
} }
DPRINT ("TEB allocated at %p\n", TebBase); DPRINT1 ("TEB allocated at %p\n", TebBase);
return Status; return Status;
} }
@ -540,7 +540,7 @@ NTSTATUS STDCALL NtCreateThread (PHANDLE ThreadHandle,
} }
/* Attention: TebBase is in user memory space */ /* Attention: TebBase is in user memory space */
// Thread->Tcb.Teb = TebBase; Thread->Tcb.Teb = TebBase;
Thread->StartAddress=NULL; Thread->StartAddress=NULL;

View file

@ -321,7 +321,7 @@ NTSTATUS STDCALL NtCreateProcess (OUT PHANDLE ProcessHandle,
InternalProcessType, InternalProcessType,
sizeof(EPROCESS), sizeof(EPROCESS),
FALSE); FALSE);
KProcess = &(Process->Pcb); KProcess = &Process->Pcb;
KProcess->BasePriority = PROCESS_PRIO_NORMAL; KProcess->BasePriority = PROCESS_PRIO_NORMAL;
InitializeListHead(&(KProcess->MemoryAreaList)); InitializeListHead(&(KProcess->MemoryAreaList));