Author: tkreuzer
Date: Sat Feb 4 18:35:56 2012
New Revision: 55415
URL:
http://svn.reactos.org/svn/reactos?rev=55415&view=rev
Log:
[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.
Modified:
trunk/reactos/lib/rtl/amd64/debug_asm.S
trunk/reactos/lib/rtl/amd64/stubs.c
trunk/reactos/lib/rtl/heap.h
Modified: trunk/reactos/lib/rtl/amd64/debug_asm.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/amd64/debug_asm.S?…
==============================================================================
--- trunk/reactos/lib/rtl/amd64/debug_asm.S [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/amd64/debug_asm.S [iso-8859-1] Sat Feb 4 18:35:56 2012
@@ -22,20 +22,31 @@
.code64
-DbgBreakPointNoBugCheck:
+.PROC DbgBreakPointNoBugCheck
+ .endprolog
int 3
ret
+.ENDP
-DbgBreakPoint:
DbgUserBreakPoint:
+.PROC DbgBreakPoint
+ .endprolog
int 3
ret
+.ENDP
-DbgBreakPointWithStatus:
+.PROC DbgBreakPointWithStatus
+ .endprolog
mov eax, ecx
-RtlpBreakWithStatusInstruction:
int 3
ret
+.ENDP
+
+.PROC RtlpBreakWithStatusInstruction
+ .endprolog
+ int 3
+ ret
+.ENDP
DebugService2:
ret
Modified: trunk/reactos/lib/rtl/amd64/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/amd64/stubs.c?rev=…
==============================================================================
--- trunk/reactos/lib/rtl/amd64/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/amd64/stubs.c [iso-8859-1] Sat Feb 4 18:35:56 2012
@@ -11,6 +11,7 @@
#include <rtl.h>
#define NDEBUG
#include <debug.h>
+#include "amd64/ketypes.h"
/* PUBLIC FUNCTIONS **********************************************************/
@@ -23,9 +24,60 @@
OUT PCONTEXT ThreadContext,
IN PVOID ThreadStartParam OPTIONAL,
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;
}
Modified: trunk/reactos/lib/rtl/heap.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.h?rev=55415&a…
==============================================================================
--- trunk/reactos/lib/rtl/heap.h [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heap.h [iso-8859-1] Sat Feb 4 18:35:56 2012
@@ -78,6 +78,9 @@
/* Heap structures */
struct _HEAP_COMMON_ENTRY
{
+#ifdef _M_AMD64
+ PVOID PreviousBlockPrivateData;
+#endif
union
{
struct
@@ -88,7 +91,11 @@
};
struct
{
+#ifndef _M_AMD64
PVOID SubSegmentCode;
+#else
+ ULONG SubSegmentCodeDummy;
+#endif
USHORT PreviousSize;
union
{