mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[RTL]
- Fix RtlLengthSecurityDescriptor - Implement amd64 version of Implement RtlInitializeContext - Add unwind info to amd64 debug asm functions - Fix 64 bit HEAP_COMMON_ENTRY structure The resulting version doesn't exactly match the original windows one, but its compatible, as every field, except the dummy fields - which are omitted - is at its correct position. svn path=/trunk/; revision=55415
This commit is contained in:
parent
cbee83498e
commit
9fa8f0915e
|
@ -22,20 +22,31 @@ PUBLIC RtlpBreakWithStatusInstruction
|
||||||
|
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
DbgBreakPointNoBugCheck:
|
.PROC DbgBreakPointNoBugCheck
|
||||||
|
.endprolog
|
||||||
int 3
|
int 3
|
||||||
ret
|
ret
|
||||||
|
.ENDP
|
||||||
|
|
||||||
DbgBreakPoint:
|
|
||||||
DbgUserBreakPoint:
|
DbgUserBreakPoint:
|
||||||
|
.PROC DbgBreakPoint
|
||||||
|
.endprolog
|
||||||
int 3
|
int 3
|
||||||
ret
|
ret
|
||||||
|
.ENDP
|
||||||
|
|
||||||
DbgBreakPointWithStatus:
|
.PROC DbgBreakPointWithStatus
|
||||||
|
.endprolog
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
RtlpBreakWithStatusInstruction:
|
|
||||||
int 3
|
int 3
|
||||||
ret
|
ret
|
||||||
|
.ENDP
|
||||||
|
|
||||||
|
.PROC RtlpBreakWithStatusInstruction
|
||||||
|
.endprolog
|
||||||
|
int 3
|
||||||
|
ret
|
||||||
|
.ENDP
|
||||||
|
|
||||||
DebugService2:
|
DebugService2:
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <rtl.h>
|
#include <rtl.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include "amd64/ketypes.h"
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS **********************************************************/
|
/* PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
@ -23,9 +24,60 @@ RtlInitializeContext(IN HANDLE ProcessHandle,
|
||||||
OUT PCONTEXT ThreadContext,
|
OUT PCONTEXT ThreadContext,
|
||||||
IN PVOID ThreadStartParam OPTIONAL,
|
IN PVOID ThreadStartParam OPTIONAL,
|
||||||
IN PTHREAD_START_ROUTINE ThreadStartAddress,
|
IN PTHREAD_START_ROUTINE ThreadStartAddress,
|
||||||
IN PINITIAL_TEB InitialTeb)
|
IN PINITIAL_TEB StackBase)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
|
||||||
|
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;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,9 @@ RtlpHeapIsSpecial(ULONG Flags)
|
||||||
/* Heap structures */
|
/* Heap structures */
|
||||||
struct _HEAP_COMMON_ENTRY
|
struct _HEAP_COMMON_ENTRY
|
||||||
{
|
{
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
PVOID PreviousBlockPrivateData;
|
||||||
|
#endif
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -88,7 +91,11 @@ struct _HEAP_COMMON_ENTRY
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
#ifndef _M_AMD64
|
||||||
PVOID SubSegmentCode;
|
PVOID SubSegmentCode;
|
||||||
|
#else
|
||||||
|
ULONG SubSegmentCodeDummy;
|
||||||
|
#endif
|
||||||
USHORT PreviousSize;
|
USHORT PreviousSize;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue