mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
Implemented setting the fs register to point to the TEB
svn path=/trunk/; revision=1062
This commit is contained in:
parent
15c9809105
commit
337952bfb9
|
@ -17,8 +17,7 @@ include rules.mak
|
|||
COMPONENTS = iface_native iface_additional ntoskrnl
|
||||
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32
|
||||
#DLLS = mingw32
|
||||
SUBSYS = smss win32k
|
||||
#SUBSYS = csrss
|
||||
SUBSYS = smss win32k csrss
|
||||
|
||||
#
|
||||
# Select the server(s) you want to build
|
||||
|
|
|
@ -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
|
||||
* DESCRIPTION: ReactOS' Native Shell
|
||||
|
@ -178,11 +178,11 @@ int ExecuteProcess(char* name, char* cmdline, BOOL detached)
|
|||
{
|
||||
if (ret)
|
||||
{
|
||||
debug_printf("ProcessInformation.hThread %x\n",
|
||||
ProcessInformation.hThread);
|
||||
// debug_printf("ProcessInformation.hThread %x\n",
|
||||
// ProcessInformation.hThread);
|
||||
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
||||
CloseHandle(ProcessInformation.hProcess);
|
||||
debug_printf("Thandle %x\n", ProcessInformation.hThread);
|
||||
// debug_printf("Thandle %x\n", ProcessInformation.hThread);
|
||||
CloseHandle(ProcessInformation.hThread);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
@ -32,7 +32,7 @@ BASE_CFLAGS = -I../../include
|
|||
all: $(SVC_FILES)
|
||||
|
||||
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c
|
||||
$(CC) \
|
||||
$(NATIVE_CC) \
|
||||
$(CFLAGS) \
|
||||
-o $(TARGETNAME) \
|
||||
-O2 \
|
||||
|
|
12
reactos/install-system.sh
Normal file
12
reactos/install-system.sh
Normal 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
7
reactos/install.bochs
Normal 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
|
|
@ -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
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -28,59 +28,51 @@ UNICODE_STRING WindowsDirectory;
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetCurrentDirectoryA (
|
||||
DWORD nBufferLength,
|
||||
LPSTR lpBuffer
|
||||
)
|
||||
DWORD STDCALL GetCurrentDirectoryA (DWORD nBufferLength,
|
||||
LPSTR lpBuffer)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
UNICODE_STRING UnicodeString;
|
||||
ANSI_STRING AnsiString;
|
||||
UNICODE_STRING UnicodeString;
|
||||
|
||||
/* initialize ansi string */
|
||||
AnsiString.Length = 0;
|
||||
AnsiString.MaximumLength = nBufferLength;
|
||||
AnsiString.Buffer = lpBuffer;
|
||||
/* initialize ansi string */
|
||||
AnsiString.Length = 0;
|
||||
AnsiString.MaximumLength = nBufferLength;
|
||||
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 */
|
||||
UnicodeString.Length = 0;
|
||||
UnicodeString.MaximumLength = nBufferLength * sizeof(WCHAR);
|
||||
UnicodeString.Buffer = RtlAllocateHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
UnicodeString.MaximumLength);
|
||||
/* get current directory */
|
||||
UnicodeString.Length = RtlGetCurrentDirectory_U (UnicodeString.MaximumLength,
|
||||
UnicodeString.Buffer);
|
||||
DPRINT("UnicodeString.Buffer %S\n", UnicodeString.Buffer);
|
||||
|
||||
/* 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 */
|
||||
UnicodeString.Length = RtlGetCurrentDirectory_U (UnicodeString.MaximumLength,
|
||||
UnicodeString.Buffer);
|
||||
DPRINT("UnicodeString.Buffer %S\n", UnicodeString.Buffer);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* free unicode string */
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
UnicodeString.Buffer);
|
||||
|
||||
return AnsiString.Length;
|
||||
/* free unicode string */
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
UnicodeString.Buffer);
|
||||
|
||||
return AnsiString.Length;
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetCurrentDirectoryW (
|
||||
DWORD nBufferLength,
|
||||
LPWSTR lpBuffer
|
||||
)
|
||||
DWORD STDCALL GetCurrentDirectoryW (DWORD nBufferLength,
|
||||
LPWSTR lpBuffer)
|
||||
{
|
||||
ULONG Length;
|
||||
|
||||
|
@ -127,7 +119,6 @@ SetCurrentDirectoryA (
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetCurrentDirectoryW (
|
||||
|
@ -233,13 +224,7 @@ GetTempPathW (
|
|||
return Value.Length / sizeof(WCHAR);
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GetSystemDirectoryA (
|
||||
LPSTR lpBuffer,
|
||||
UINT uSize
|
||||
)
|
||||
WINBOOL STDCALL SetCurrentDirectoryW (LPCWSTR lpPathName)
|
||||
{
|
||||
ANSI_STRING String;
|
||||
ULONG Length;
|
||||
|
@ -269,6 +254,7 @@ GetSystemDirectoryA (
|
|||
}
|
||||
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GetSystemDirectoryW (
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -19,7 +19,6 @@
|
|||
#define NDEBUG
|
||||
#include <ntdll/ntdll.h>
|
||||
|
||||
|
||||
/* DEFINITONS and MACROS ******************************************************/
|
||||
|
||||
#define MAX_PFX_SIZE 16
|
||||
|
@ -30,95 +29,87 @@
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
static
|
||||
ULONG
|
||||
RtlpGetDotSequence (PWSTR p)
|
||||
static ULONG RtlpGetDotSequence (PWSTR p)
|
||||
{
|
||||
ULONG Count = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (*p == '.')
|
||||
Count++;
|
||||
else if ((*p == '\\' || *p == '\0') && Count)
|
||||
return Count;
|
||||
else
|
||||
return 0;
|
||||
p++;
|
||||
}
|
||||
return 0;
|
||||
ULONG Count = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (*p == '.')
|
||||
Count++;
|
||||
else if ((*p == '\\' || *p == '\0') && Count)
|
||||
return Count;
|
||||
else
|
||||
return 0;
|
||||
p++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
RtlpEatPath (
|
||||
PWSTR Path
|
||||
)
|
||||
static VOID RtlpEatPath (PWSTR Path)
|
||||
{
|
||||
PWSTR p, prev;
|
||||
|
||||
p = Path + 2;
|
||||
prev = p;
|
||||
|
||||
while ((*p) != 0 || ((*p) == L'\\' && (*(p+1)) == 0))
|
||||
{
|
||||
ULONG DotLen;
|
||||
|
||||
DotLen = RtlpGetDotSequence (p+1);
|
||||
DPRINT("DotSequenceLength %u\n", DotLen);
|
||||
DPRINT("prev %S p %S\n",prev,p);
|
||||
|
||||
if (DotLen == 0)
|
||||
{
|
||||
prev = p;
|
||||
do
|
||||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != L'\\');
|
||||
}
|
||||
else if (DotLen == 1)
|
||||
{
|
||||
wcscpy (p, p+2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DotLen > 2)
|
||||
{
|
||||
int n = DotLen - 2;
|
||||
|
||||
while (n > 0 && prev > (Path + 2))
|
||||
{
|
||||
prev--;
|
||||
if ((*prev) == L'\\')
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
if (*(p + DotLen + 1) == 0)
|
||||
*(prev + 1) = 0;
|
||||
PWSTR p, prev;
|
||||
|
||||
p = Path + 2;
|
||||
prev = p;
|
||||
|
||||
while ((*p) != 0 || ((*p) == L'\\' && (*(p+1)) == 0))
|
||||
{
|
||||
ULONG DotLen;
|
||||
|
||||
DotLen = RtlpGetDotSequence (p+1);
|
||||
DPRINT("DotSequenceLength %u\n", DotLen);
|
||||
DPRINT("prev %S p %S\n",prev,p);
|
||||
|
||||
if (DotLen == 0)
|
||||
{
|
||||
prev = p;
|
||||
do
|
||||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != L'\\');
|
||||
}
|
||||
else if (DotLen == 1)
|
||||
{
|
||||
wcscpy (p, p+2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DotLen > 2)
|
||||
{
|
||||
int n = DotLen - 2;
|
||||
|
||||
while (n > 0 && prev > (Path + 2))
|
||||
{
|
||||
prev--;
|
||||
if ((*prev) == L'\\')
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
if (*(p + DotLen + 1) == 0)
|
||||
*(prev + 1) = 0;
|
||||
else
|
||||
wcscpy (prev, p + DotLen + 1);
|
||||
p = prev;
|
||||
if (prev > (Path + 2))
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != L'\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wcscpy (prev, p + DotLen + 1);
|
||||
p = prev;
|
||||
if (prev > (Path + 2))
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != L'\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ULONG
|
||||
STDCALL
|
||||
RtlGetLongestNtPathLength (VOID)
|
||||
ULONG STDCALL RtlGetLongestNtPathLength (VOID)
|
||||
{
|
||||
return (MAX_PATH + 9);
|
||||
return (MAX_PATH + 9);
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,112 +273,108 @@ RtlGetCurrentDirectory_U (
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlSetCurrentDirectory_U (
|
||||
PUNICODE_STRING name
|
||||
)
|
||||
NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||
{
|
||||
UNICODE_STRING full;
|
||||
OBJECT_ATTRIBUTES Attr;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
PCURDIR cd;
|
||||
NTSTATUS Status;
|
||||
ULONG size;
|
||||
HANDLE handle = NULL;
|
||||
PWSTR wcs;
|
||||
PWSTR buf = 0;
|
||||
|
||||
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;
|
||||
UNICODE_STRING full;
|
||||
OBJECT_ATTRIBUTES Attr;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
PCURDIR cd;
|
||||
NTSTATUS Status;
|
||||
ULONG size;
|
||||
HANDLE handle = NULL;
|
||||
PWSTR wcs;
|
||||
PWSTR buf = 0;
|
||||
|
||||
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);
|
||||
|
||||
0,
|
||||
buf);
|
||||
RtlReleasePebLock ();
|
||||
return STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U (buf, &full, 0, 0))
|
||||
{
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
full.Buffer);
|
||||
|
||||
RtlReleasePebLock();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
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;
|
||||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
buf);
|
||||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
full.Buffer);
|
||||
|
||||
RtlReleasePebLock();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ USHORT KiGdt[(8 + NR_TASKS) * 4] = {0x0, 0x0, 0x0, 0x0,
|
|||
0x0, 0x0, 0xf200, 0xcc,
|
||||
0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0};
|
||||
0x1000, 0x0, 0xf200, 0x0};
|
||||
static KSPIN_LOCK GdtLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -36,18 +36,29 @@ VOID KeSetBaseGdtSelector(ULONG Entry,
|
|||
{
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
|
||||
Entry, Base);
|
||||
|
||||
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*4 + 2] = KiGdt[Entry*4 + 2] |
|
||||
KiGdt[Entry + 1] = ((ULONG)Base) & 0xffff;
|
||||
|
||||
KiGdt[Entry + 2] = KiGdt[Entry + 2] & ~(0xff);
|
||||
KiGdt[Entry + 2] = KiGdt[Entry + 2] |
|
||||
((((ULONG)Base) & 0xff0000) >> 16);
|
||||
|
||||
KiGdt[Entry*4 + 3] = KiGdt[Entry*4 + 3] & ~(0xff00);
|
||||
KiGdt[Entry*4 + 3] = KiGdt[Entry*4 + 3] |
|
||||
KiGdt[Entry + 3] = KiGdt[Entry + 3] & ~(0xff00);
|
||||
KiGdt[Entry + 3] = KiGdt[Entry + 3] |
|
||||
((((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);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ static char KiNullLdt[8] = {0,};
|
|||
static unsigned int KiNullLdtSel = 0;
|
||||
static PETHREAD FirstThread = NULL;
|
||||
|
||||
extern ULONG KeSetBaseGdtSelector(ULONG Entry, PVOID Base);
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
VOID HalTaskSwitch(PKTHREAD thread)
|
||||
|
@ -45,15 +47,14 @@ VOID HalTaskSwitch(PKTHREAD thread)
|
|||
* again (possibly never)
|
||||
*/
|
||||
{
|
||||
#if 0
|
||||
PETHREAD Thread;
|
||||
Thread = CONTAINING_RECORD(thread, ETHREAD, Tcb);
|
||||
if (Thread->Cid.UniqueThread != (HANDLE)1)
|
||||
{
|
||||
DPRINT1("Scheduling thread %x (id %d)\n",Thread,
|
||||
Thread->Cid.UniqueThread);
|
||||
}
|
||||
#endif
|
||||
// PETHREAD Thread;
|
||||
// PVOID Teb;
|
||||
|
||||
/* Set the base of the TEB selector to the base of the TEB for the
|
||||
* new thread
|
||||
*/
|
||||
KeSetBaseGdtSelector(TEB_SELECTOR, thread->Teb);
|
||||
/* Switch to the new thread's context and stack */
|
||||
__asm__("pushfl\n\t"
|
||||
"cli\n\t"
|
||||
"ljmp %0\n\t"
|
||||
|
@ -61,6 +62,31 @@ VOID HalTaskSwitch(PKTHREAD thread)
|
|||
: /* No outputs */
|
||||
: "m" (*(((unsigned char *)(&(thread->Context.nr)))-4) )
|
||||
: "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)
|
||||
|
@ -175,6 +201,7 @@ NTSTATUS HalInitTaskWithContext(PETHREAD Thread, PCONTEXT Context)
|
|||
}
|
||||
|
||||
stack_start = kernel_stack + 3*PAGESIZE - sizeof(CONTEXT);
|
||||
Context->SegFs = TEB_SELECTOR;
|
||||
memcpy(stack_start, Context, sizeof(CONTEXT));
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -30,13 +30,10 @@
|
|||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
USHORT
|
||||
__declspec(dllexport)
|
||||
NtBuildNumber = KERNEL_VERSION_BUILD; /* EXPORTED */
|
||||
USHORT __declspec(dllexport) NtBuildNumber = KERNEL_VERSION_BUILD;
|
||||
/* EXPORTED */
|
||||
|
||||
ULONG
|
||||
__declspec(dllexport)
|
||||
NtGlobalFlag = 0; /* FIXME: EXPORTED */
|
||||
ULONG __declspec(dllexport) NtGlobalFlag = 0; /* FIXME: EXPORTED */
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -243,13 +243,15 @@ ULONG MmPageFault(ULONG cs, ULONG eip, ULONG error_code)
|
|||
MEMORY_AREA* MemoryArea;
|
||||
NTSTATUS Status;
|
||||
unsigned int cr2;
|
||||
// unsigned int cr3;
|
||||
|
||||
/*
|
||||
* Get the address for the page fault
|
||||
*/
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||
DPRINT("Page fault address %x eip %x process %x code %x\n",cr2,eip,
|
||||
PsGetCurrentProcess(), error_code);
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||
// __asm__("movl %%cr3,%0\n\t" : "=d" (cr3));
|
||||
// DPRINT1("Page fault address %x eip %x process %x code %x cr3 %x\n",cr2,eip,
|
||||
// PsGetCurrentProcess(), error_code, cr3);
|
||||
|
||||
MmSetPageProtect(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(PsGetCurrentProcess()),
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -369,8 +369,8 @@ NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
|
|||
Thread->Tcb.WaitBlockList = NULL;
|
||||
InsertTailList(&Thread->ThreadsProcess->Pcb.ThreadListHead,
|
||||
&Thread->Tcb.ProcessThreadListEntry );
|
||||
DPRINT1("Inserting %x into process %x list\n",
|
||||
Thread, Thread->ThreadsProcess);
|
||||
// DPRINT1("Inserting %x into process %x list\n",
|
||||
// Thread, Thread->ThreadsProcess);
|
||||
KeInitializeDispatcherHeader(&Thread->Tcb.DispatcherHeader,
|
||||
InternalThreadType,
|
||||
sizeof(ETHREAD),
|
||||
|
@ -422,7 +422,7 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
|
|||
PAGE_READWRITE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT ("TEB allocated at %x\n", TebBase);
|
||||
DPRINT1 ("TEB allocated at %x\n", TebBase);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -477,7 +477,7 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* free TEB */
|
||||
DPRINT ("Writing TEB failed!\n");
|
||||
DPRINT1 ("Writing TEB failed!\n");
|
||||
|
||||
RegionSize = 0;
|
||||
NtFreeVirtualMemory(ProcessHandle,
|
||||
|
@ -492,10 +492,10 @@ static NTSTATUS PsCreateTeb (HANDLE ProcessHandle,
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ NTSTATUS STDCALL NtCreateThread (PHANDLE ThreadHandle,
|
|||
}
|
||||
|
||||
/* Attention: TebBase is in user memory space */
|
||||
// Thread->Tcb.Teb = TebBase;
|
||||
Thread->Tcb.Teb = TebBase;
|
||||
|
||||
Thread->StartAddress=NULL;
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ NTSTATUS STDCALL NtCreateProcess (OUT PHANDLE ProcessHandle,
|
|||
InternalProcessType,
|
||||
sizeof(EPROCESS),
|
||||
FALSE);
|
||||
KProcess = &(Process->Pcb);
|
||||
KProcess = &Process->Pcb;
|
||||
|
||||
KProcess->BasePriority = PROCESS_PRIO_NORMAL;
|
||||
InitializeListHead(&(KProcess->MemoryAreaList));
|
||||
|
|
Loading…
Reference in a new issue