(PTR_MANGLE): Roll value before returning.
authordrepper <drepper>
Thu, 1 Feb 2007 16:13:17 +0000 (16:13 +0000)
committerdrepper <drepper>
Thu, 1 Feb 2007 16:13:17 +0000 (16:13 +0000)
(PTR_DEMANGLE): Real definition now that it's not the same as
PRT_MANGLE anymore.

sysdeps/unix/sysv/linux/i386/sysdep.h
sysdeps/unix/sysv/linux/x86_64/sysdep.h

index 5286676..89d5b12 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1993,1995-2000,2002-2005,2006
+/* Copyright (C) 1992,1993,1995-2000,2002-2006,2007
        Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
@@ -566,15 +566,23 @@ asm (".L__X'%ebx = 1\n\t"
    is too complicated here since we have no PC-relative addressing mode.  */
 #else
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)      xorl %gs:POINTER_GUARD, reg
-#  define PTR_DEMANGLE(reg)    PTR_MANGLE (reg)
+#  define PTR_MANGLE(reg)      xorl %gs:POINTER_GUARD, reg;                  \
+                               roll $9, reg
+#  define PTR_DEMANGLE(reg)    rorl $9, reg;                                 \
+                               xorl %gs:POINTER_GUARD, reg
 # else
-#  define PTR_MANGLE(var)      asm ("xorl %%gs:%c2, %0"                      \
+#  define PTR_MANGLE(var)      asm ("xorl %%gs:%c2, %0\n"                    \
+                                    "roll $9, %0"                            \
+                                    : "=r" (var)                             \
+                                    : "0" (var),                             \
+                                      "i" (offsetof (tcbhead_t,              \
+                                                     pointer_guard)))
+#  define PTR_DEMANGLE(var)    asm ("rorl $9, %0\n"                          \
+                                    "xorl %%gs:%c2, %0"                      \
                                     : "=r" (var)                             \
                                     : "0" (var),                             \
                                       "i" (offsetof (tcbhead_t,              \
                                                      pointer_guard)))
-#  define PTR_DEMANGLE(var)    PTR_MANGLE (var)
 # endif
 #endif
 
index 5dfffca..3a0a632 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 /* We cannot use the thread descriptor because in ld.so we use setjmp
    earlier than the descriptor is initialized.  */
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)      xorq __pointer_chk_guard_local(%rip), reg
-#  define PTR_DEMANGLE(reg)    PTR_MANGLE (reg)
+#  define PTR_MANGLE(reg)      xorq __pointer_chk_guard_local(%rip), reg;    \
+                               rolq $17, reg
+#  define PTR_DEMANGLE(reg)    rorq $17, reg;                                \
+                               xorq __pointer_chk_guard_local(%rip), reg
 # else
-#  define PTR_MANGLE(reg)      asm ("xorq __pointer_chk_guard_local(%%rip), %0"\
+#  define PTR_MANGLE(reg)      asm ("xorq __pointer_chk_guard_local(%%rip), %0\n" \
+                                    "rolq $17, %0"                           \
+                                    : "=r" (reg) : "0" (reg))
+#  define PTR_DEMANGLE(reg)    asm ("rorq $17, %0\n"                         \
+                                    "xorq __pointer_chk_guard_local(%%rip), %0" \
                                     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)    PTR_MANGLE (reg)
 # endif
 #else
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)      xorq %fs:POINTER_GUARD, reg
-#  define PTR_DEMANGLE(reg)    PTR_MANGLE (reg)
+#  define PTR_MANGLE(reg)      xorq %fs:POINTER_GUARD, reg;                  \
+                               rolq $17, reg
+#  define PTR_DEMANGLE(reg)    rorq $17, reg;                                \
+                               xorq %fs:POINTER_GUARD, reg
 # else
-#  define PTR_MANGLE(var)      asm ("xorq %%fs:%c2, %0"                      \
+#  define PTR_MANGLE(var)      asm ("xorq %%fs:%c2, %0\n"                    \
+                                    "rolq $17, %0"                           \
+                                    : "=r" (var)                             \
+                                    : "0" (var),                             \
+                                      "i" (offsetof (tcbhead_t,              \
+                                                     pointer_guard)))
+#  define PTR_DEMANGLE(var)    asm ("rorq $17, %0\n"                         \
+                                    "xorq %%fs:%c2, %0"                      \
                                     : "=r" (var)                             \
                                     : "0" (var),                             \
                                       "i" (offsetof (tcbhead_t,              \
                                                      pointer_guard)))
-#  define PTR_DEMANGLE(var)    PTR_MANGLE (var)
 # endif
 #endif