summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/dl-osinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/dl-osinfo.h')
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index e374023841..fb885330f9 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -18,12 +18,15 @@
02111-1307 USA. */
#include <string.h>
+#include <errno.h>
#include <fcntl.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
#include "kernel-features.h"
#include <dl-sysdep.h>
#include <stdint.h>
+#include <hp-timing.h>
+#include <endian.h>
#ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
@@ -177,5 +180,31 @@ _dl_setup_stack_chk_guard (void)
unsigned char *p = (unsigned char *) &ret;
p[sizeof (ret) - 1] = 255;
p[sizeof (ret) - 2] = '\n';
+#ifdef HP_TIMING_NOW
+ hp_timing_t hpt;
+ HP_TIMING_NOW (hpt);
+ hpt = (hpt & 0xffff) << 8;
+ ret ^= hpt;
+#endif
+ uintptr_t stk;
+ /* Avoid GCC being too smart. */
+ asm ("" : "=r" (stk) : "r" (p));
+ stk &= 0x7ffff0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ stk <<= (__WORDSIZE - 23);
+#elif __WORDSIZE == 64
+ stk <<= 31;
+#endif
+ ret ^= stk;
+ /* Avoid GCC being too smart. */
+ p = (unsigned char *) &errno;
+ asm ("" : "=r" (stk) : "r" (p));
+ stk &= 0x7fff00;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ stk <<= (__WORDSIZE - 29);
+#else
+ stk <<= (__WORDSIZE == 64 ? 24 : 5);
+#endif
+ ret ^= stk;
return ret;
}