mirror of
https://github.com/reactos/reactos.git
synced 2024-08-28 14:18:41 +00:00
Move x86 specific part to i386/ directory.
Fix a few warnings svn path=/trunk/; revision=25415
This commit is contained in:
parent
de1bca6b2c
commit
35f20cc413
|
@ -57,8 +57,8 @@ typedef enum {
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
udict_balanced = 0,
|
udict_balanced = 0,
|
||||||
udict_leftheavy = -1,
|
udict_leftheavy = 1,
|
||||||
udict_rightheavy = 1
|
udict_rightheavy = 2
|
||||||
} udict_avl_balance_t;
|
} udict_avl_balance_t;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
|
|
80
reactos/lib/rtl/i386/thread.c
Normal file
80
reactos/lib/rtl/i386/thread.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* PURPOSE: Rtl user thread functions
|
||||||
|
* FILE: lib/rtl/thread.c
|
||||||
|
* PROGRAMERS:
|
||||||
|
* Alex Ionescu (alex@relsoft.net)
|
||||||
|
* Eric Kohl
|
||||||
|
* KJK::Hyperion
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <rtl.h>
|
||||||
|
#include "i386/ketypes.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS *******************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlInitializeContext(IN HANDLE ProcessHandle,
|
||||||
|
OUT PCONTEXT ThreadContext,
|
||||||
|
IN PVOID ThreadStartParam OPTIONAL,
|
||||||
|
IN PTHREAD_START_ROUTINE ThreadStartAddress,
|
||||||
|
IN PINITIAL_TEB InitialTeb)
|
||||||
|
{
|
||||||
|
DPRINT("RtlInitializeContext: (hProcess: %p, ThreadContext: %p, Teb: %p\n",
|
||||||
|
ProcessHandle, ThreadContext, InitialTeb);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the Initial Registers
|
||||||
|
* This is based on NT's default values -- crazy apps might expect this...
|
||||||
|
*/
|
||||||
|
ThreadContext->Ebp = 0;
|
||||||
|
ThreadContext->Eax = 0;
|
||||||
|
ThreadContext->Ebx = 1;
|
||||||
|
ThreadContext->Ecx = 2;
|
||||||
|
ThreadContext->Edx = 3;
|
||||||
|
ThreadContext->Esi = 4;
|
||||||
|
ThreadContext->Edi = 5;
|
||||||
|
|
||||||
|
/* Set the Selectors */
|
||||||
|
ThreadContext->SegGs = 0;
|
||||||
|
ThreadContext->SegFs = KGDT_R3_TEB;
|
||||||
|
ThreadContext->SegEs = KGDT_R3_DATA;
|
||||||
|
ThreadContext->SegDs = KGDT_R3_DATA;
|
||||||
|
ThreadContext->SegSs = KGDT_R3_DATA;
|
||||||
|
ThreadContext->SegCs = KGDT_R3_CODE;
|
||||||
|
|
||||||
|
/* Enable Interrupts */
|
||||||
|
ThreadContext->EFlags = EFLAGS_INTERRUPT_MASK;
|
||||||
|
|
||||||
|
/* Settings passed */
|
||||||
|
ThreadContext->Eip = (ULONG)ThreadStartAddress;
|
||||||
|
ThreadContext->Esp = (ULONG)InitialTeb;
|
||||||
|
|
||||||
|
/* Only the basic Context is initialized */
|
||||||
|
ThreadContext->ContextFlags = CONTEXT_CONTROL |
|
||||||
|
CONTEXT_INTEGER |
|
||||||
|
CONTEXT_SEGMENTS;
|
||||||
|
|
||||||
|
/* Set up ESP to the right value */
|
||||||
|
ThreadContext->Esp -= sizeof(PVOID);
|
||||||
|
ZwWriteVirtualMemory(ProcessHandle,
|
||||||
|
(PVOID)ThreadContext->Esp,
|
||||||
|
(PVOID)&ThreadStartParam,
|
||||||
|
sizeof(PVOID),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Push it down one more notch for RETEIP */
|
||||||
|
ThreadContext->Esp -= sizeof(PVOID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -359,7 +359,7 @@ RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
|
||||||
DPRINT("RtlResetRtlTranslations() called\n");
|
DPRINT("RtlResetRtlTranslations() called\n");
|
||||||
|
|
||||||
/* Set ANSI data */
|
/* Set ANSI data */
|
||||||
NlsAnsiToUnicodeTable = NlsTable->AnsiTableInfo.MultiByteTable;
|
NlsAnsiToUnicodeTable = (PWCHAR)NlsTable->AnsiTableInfo.MultiByteTable; /* Real type is PUSHORT */
|
||||||
NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
|
NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
|
||||||
NlsDbcsUnicodeToAnsiTable = (PWCHAR)NlsTable->AnsiTableInfo.WideCharTable;
|
NlsDbcsUnicodeToAnsiTable = (PWCHAR)NlsTable->AnsiTableInfo.WideCharTable;
|
||||||
NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
|
NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
|
||||||
|
@ -368,7 +368,7 @@ RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
|
||||||
DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
|
DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
|
||||||
|
|
||||||
/* Set OEM data */
|
/* Set OEM data */
|
||||||
NlsOemToUnicodeTable = NlsTable->OemTableInfo.MultiByteTable;
|
NlsOemToUnicodeTable = (PWCHAR)NlsTable->OemTableInfo.MultiByteTable; /* Real type is PUSHORT */
|
||||||
NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
|
NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
|
||||||
NlsDbcsUnicodeToOemTable = (PWCHAR)NlsTable->OemTableInfo.WideCharTable;
|
NlsDbcsUnicodeToOemTable = (PWCHAR)NlsTable->OemTableInfo.WideCharTable;
|
||||||
NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
|
NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<file>sin_asm.s</file>
|
<file>sin_asm.s</file>
|
||||||
<file>sqrt_asm.s</file>
|
<file>sqrt_asm.s</file>
|
||||||
<file>tan_asm.s</file>
|
<file>tan_asm.s</file>
|
||||||
|
<file>thread.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
</if>
|
</if>
|
||||||
<directory name="austin">
|
<directory name="austin">
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <rtl.h>
|
#include <rtl.h>
|
||||||
#include "i386/ketypes.h"
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -218,62 +217,6 @@ RtlCreateUserThread(IN HANDLE ProcessHandle,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: Should go in /i386
|
|
||||||
@implemented
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
RtlInitializeContext(IN HANDLE ProcessHandle,
|
|
||||||
OUT PCONTEXT ThreadContext,
|
|
||||||
IN PVOID ThreadStartParam OPTIONAL,
|
|
||||||
IN PTHREAD_START_ROUTINE ThreadStartAddress,
|
|
||||||
IN PINITIAL_TEB InitialTeb)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Set the Initial Registers
|
|
||||||
* This is based on NT's default values -- crazy apps might expect this...
|
|
||||||
*/
|
|
||||||
ThreadContext->Ebp = 0;
|
|
||||||
ThreadContext->Eax = 0;
|
|
||||||
ThreadContext->Ebx = 1;
|
|
||||||
ThreadContext->Ecx = 2;
|
|
||||||
ThreadContext->Edx = 3;
|
|
||||||
ThreadContext->Esi = 4;
|
|
||||||
ThreadContext->Edi = 5;
|
|
||||||
|
|
||||||
/* Set the Selectors */
|
|
||||||
ThreadContext->SegGs = 0;
|
|
||||||
ThreadContext->SegFs = KGDT_R3_TEB;
|
|
||||||
ThreadContext->SegEs = KGDT_R3_DATA;
|
|
||||||
ThreadContext->SegDs = KGDT_R3_DATA;
|
|
||||||
ThreadContext->SegSs = KGDT_R3_DATA;
|
|
||||||
ThreadContext->SegCs = KGDT_R3_CODE;
|
|
||||||
|
|
||||||
/* Enable Interrupts */
|
|
||||||
ThreadContext->EFlags = EFLAGS_INTERRUPT_MASK;
|
|
||||||
|
|
||||||
/* Settings passed */
|
|
||||||
ThreadContext->Eip = (ULONG)ThreadStartAddress;
|
|
||||||
ThreadContext->Esp = (ULONG)InitialTeb;
|
|
||||||
|
|
||||||
/* Only the basic Context is initialized */
|
|
||||||
ThreadContext->ContextFlags = CONTEXT_CONTROL |
|
|
||||||
CONTEXT_INTEGER |
|
|
||||||
CONTEXT_SEGMENTS;
|
|
||||||
|
|
||||||
/* Set up ESP to the right value */
|
|
||||||
ThreadContext->Esp -= sizeof(PVOID);
|
|
||||||
ZwWriteVirtualMemory(ProcessHandle,
|
|
||||||
(PVOID)ThreadContext->Esp,
|
|
||||||
(PVOID)&ThreadStartParam,
|
|
||||||
sizeof(PVOID),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Push it down one more notch for RETEIP */
|
|
||||||
ThreadContext->Esp -= sizeof(PVOID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue