From 2de5176c84ff1166bd21fa255009187b8a795169 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 9 Feb 2012 11:54:59 +0000 Subject: [PATCH] {RTL] - Fix RtlLengthSecurityDescriptor - Fix pointer calculation in amd64 interlocked slist code - Assert that the slist entry pointer is 16 byte aligned [CRT] - Add amd64 stubs for acos and acosf svn path=/trunk/; revision=55512 --- reactos/lib/rtl/amd64/slist.S | 13 +++++++++++-- reactos/lib/rtl/sd.c | 7 ++++++- reactos/lib/sdk/crt/crt.cmake | 2 ++ reactos/lib/sdk/crt/math/amd64/acos.S | 21 +++++++++++++++++++++ reactos/lib/sdk/crt/math/amd64/acosf.S | 21 +++++++++++++++++++++ 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 reactos/lib/sdk/crt/math/amd64/acos.S create mode 100644 reactos/lib/sdk/crt/math/amd64/acosf.S diff --git a/reactos/lib/rtl/amd64/slist.S b/reactos/lib/rtl/amd64/slist.S index efdada51999..81ed2061396 100644 --- a/reactos/lib/rtl/amd64/slist.S +++ b/reactos/lib/rtl/amd64/slist.S @@ -18,7 +18,7 @@ #define SLIST8B_HEADERTYPE_MASK HEX(0000000000000001) #define SLIST8B_INIT_MASK HEX(0000000000000002) #define SLIST8B_REGION_MASK HEX(E000000000000000) -#define SLIST8_POINTER_MASK HEX(000007FFFFFFFFF0) +#define SLIST8_POINTER_MASK HEX(000007FFFFFFFFFF) #define SLIST16A_DEPTH_MASK HEX(000000000000FFFF) #define SLIST16A_DEPTH_INC HEX(0000000000000001) @@ -181,6 +181,15 @@ RtlInterlockedPopEntrySListEmpty16: RtlInterlockedPushEntrySList: ExpInterlockedPushEntrySList: +#if DBG + /* Make sure the ListEntry is 16 bytes aligned */ + test rdx, HEX(0F) + jz ExpInterlockedPushEntrySListChecked + /* Not aligned, raise an assertion */ + int HEX(2C) +ExpInterlockedPushEntrySListChecked: +#endif + /* Load ListHead->Alignment into rax */ mov rax, [rcx] @@ -301,7 +310,7 @@ ExpInterlockedFlushSList: RtlInterlockedFlushSListLoop: - /* Zero ListHead->Alignment */ + /* Zero ListHead->Alignment */ xor r8, r8 /* If [rcx] equals rax, exchange it with r8 */ diff --git a/reactos/lib/rtl/sd.c b/reactos/lib/rtl/sd.c index 7d26e568b19..7dc49a3aa6c 100644 --- a/reactos/lib/rtl/sd.c +++ b/reactos/lib/rtl/sd.c @@ -250,10 +250,15 @@ RtlLengthSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor) { PSID Owner, Group; PACL Sacl, Dacl; - ULONG Length = sizeof(SECURITY_DESCRIPTOR); + ULONG Length; PAGED_CODE_RTL(); + if (((PISECURITY_DESCRIPTOR)SecurityDescriptor)->Control & SE_SELF_RELATIVE) + Length = sizeof(SECURITY_DESCRIPTOR_RELATIVE); + else + Length = sizeof(SECURITY_DESCRIPTOR); + RtlpQuerySecurityDescriptorPointers((PISECURITY_DESCRIPTOR)SecurityDescriptor, &Owner, &Group, diff --git a/reactos/lib/sdk/crt/crt.cmake b/reactos/lib/sdk/crt/crt.cmake index 748eda9bed9..692841b8362 100644 --- a/reactos/lib/sdk/crt/crt.cmake +++ b/reactos/lib/sdk/crt/crt.cmake @@ -392,6 +392,8 @@ elseif(ARCH MATCHES amd64) float/amd64/fpreset.S float/amd64/logb.S float/i386/statfp.c + math/amd64/acos.S + math/amd64/acosf.S math/amd64/atan.S math/amd64/atan2.S math/amd64/ceil.S diff --git a/reactos/lib/sdk/crt/math/amd64/acos.S b/reactos/lib/sdk/crt/math/amd64/acos.S new file mode 100644 index 00000000000..23a90493d6d --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/acos.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of acos + * FILE: lib/sdk/crt/math/amd64/acos.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include + +/* CODE **********************************************************************/ +.code64 + +PUBLIC acos +acos: + UNIMPLEMENTED acos + ret + +END diff --git a/reactos/lib/sdk/crt/math/amd64/acosf.S b/reactos/lib/sdk/crt/math/amd64/acosf.S new file mode 100644 index 00000000000..fab952692bf --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/acosf.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of acosf + * FILE: lib/sdk/crt/math/amd64/acosf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include + +/* CODE **********************************************************************/ +.code64 + +PUBLIC acosf +acosf: + UNIMPLEMENTED acos + ret + +END