[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Run-Time Library
|
|
|
|
* PURPOSE: AMD64 stubs
|
|
|
|
* FILE: lib/rtl/amd64/stubs.c
|
|
|
|
* PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
|
|
|
#include <rtl.h>
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
2012-02-04 18:35:56 +00:00
|
|
|
#include "amd64/ketypes.h"
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|
|
|
|
/* PUBLIC FUNCTIONS **********************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
RtlInitializeContext(IN HANDLE ProcessHandle,
|
|
|
|
OUT PCONTEXT ThreadContext,
|
|
|
|
IN PVOID ThreadStartParam OPTIONAL,
|
|
|
|
IN PTHREAD_START_ROUTINE ThreadStartAddress,
|
2012-02-04 18:35:56 +00:00
|
|
|
IN PINITIAL_TEB StackBase)
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
{
|
2012-02-04 18:35:56 +00:00
|
|
|
|
|
|
|
ThreadContext->Rax = 0;
|
|
|
|
ThreadContext->Rbx = 0;
|
|
|
|
ThreadContext->Rcx = (ULONG64)ThreadStartParam;
|
|
|
|
ThreadContext->Rdx = 0;
|
|
|
|
ThreadContext->Rsi = 0;
|
|
|
|
ThreadContext->Rdi = 0;
|
|
|
|
ThreadContext->Rbp = 0;
|
|
|
|
ThreadContext->R8 = 0;
|
|
|
|
ThreadContext->R9 = 0;
|
|
|
|
ThreadContext->R10 = 0;
|
|
|
|
ThreadContext->R11 = 0;
|
|
|
|
ThreadContext->R12 = 0;
|
|
|
|
|
|
|
|
/* Set the Selectors */
|
|
|
|
if ((LONG64)ThreadStartAddress < 0)
|
|
|
|
{
|
|
|
|
/* Initialize kernel mode segments */
|
|
|
|
ThreadContext->SegCs = KGDT64_R0_CODE;
|
|
|
|
ThreadContext->SegDs = KGDT64_R3_DATA;
|
|
|
|
ThreadContext->SegEs = KGDT64_R3_DATA;
|
|
|
|
ThreadContext->SegFs = KGDT64_R3_CMTEB;
|
|
|
|
ThreadContext->SegGs = KGDT64_R3_DATA;
|
|
|
|
ThreadContext->SegSs = KGDT64_R0_DATA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Initialize user mode segments */
|
|
|
|
ThreadContext->SegCs = KGDT64_R3_CODE | RPL_MASK;
|
|
|
|
ThreadContext->SegDs = KGDT64_R3_DATA | RPL_MASK;
|
|
|
|
ThreadContext->SegEs = KGDT64_R3_DATA | RPL_MASK;
|
|
|
|
ThreadContext->SegFs = KGDT64_R3_CMTEB | RPL_MASK;
|
|
|
|
ThreadContext->SegGs = KGDT64_R3_DATA | RPL_MASK;
|
|
|
|
ThreadContext->SegSs = KGDT64_R3_DATA | RPL_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable Interrupts */
|
|
|
|
ThreadContext->EFlags = EFLAGS_INTERRUPT_MASK;
|
|
|
|
|
|
|
|
/* Settings passed */
|
|
|
|
ThreadContext->Rip = (ULONG64)ThreadStartAddress;
|
|
|
|
ThreadContext->Rsp = (ULONG64)StackBase - 6 * sizeof(PVOID);
|
|
|
|
|
|
|
|
/* Align stack by 16 and substract 8 (unaligned on function entry) */
|
|
|
|
ThreadContext->Rsp &= ~15;
|
|
|
|
ThreadContext->Rsp -= 8;
|
|
|
|
|
|
|
|
/* Only the basic Context is initialized */
|
|
|
|
ThreadContext->ContextFlags = CONTEXT_CONTROL |
|
|
|
|
CONTEXT_INTEGER |
|
|
|
|
CONTEXT_SEGMENTS;
|
|
|
|
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
RtlpGetExceptionAddress(VOID)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
RtlDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
|
|
|
|
IN PCONTEXT Context)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-20 19:04:55 +00:00
|
|
|
|
|
|
|
NTSYSAPI
|
|
|
|
VOID
|
|
|
|
RtlRestoreContext(
|
|
|
|
PCONTEXT ContextRecord,
|
|
|
|
PEXCEPTION_RECORD ExceptionRecord)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|