about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/stackguard-macros.h4
-rw-r--r--sysdeps/i386/stackguard-macros.h4
-rw-r--r--sysdeps/powerpc/powerpc32/stackguard-macros.h4
-rw-r--r--sysdeps/powerpc/powerpc64/stackguard-macros.h4
-rw-r--r--sysdeps/s390/s390-32/stackguard-macros.h4
-rw-r--r--sysdeps/s390/s390-64/stackguard-macros.h4
-rw-r--r--sysdeps/sparc/sparc32/stackguard-macros.h4
-rw-r--r--sysdeps/sparc/sparc64/stackguard-macros.h4
-rw-r--r--sysdeps/x86_64/stackguard-macros.h6
9 files changed, 38 insertions, 0 deletions
diff --git a/sysdeps/generic/stackguard-macros.h b/sysdeps/generic/stackguard-macros.h
new file mode 100644
index 0000000000..ababf65d37
--- /dev/null
+++ b/sysdeps/generic/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+extern uintptr_t __stack_chk_guard;
+#define STACK_CHK_GUARD __stack_chk_guard
diff --git a/sysdeps/i386/stackguard-macros.h b/sysdeps/i386/stackguard-macros.h
new file mode 100644
index 0000000000..8c31e197e1
--- /dev/null
+++ b/sysdeps/i386/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
diff --git a/sysdeps/powerpc/powerpc32/stackguard-macros.h b/sysdeps/powerpc/powerpc32/stackguard-macros.h
new file mode 100644
index 0000000000..839f6a4b9b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
diff --git a/sysdeps/powerpc/powerpc64/stackguard-macros.h b/sysdeps/powerpc/powerpc64/stackguard-macros.h
new file mode 100644
index 0000000000..9da879c611
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
diff --git a/sysdeps/s390/s390-32/stackguard-macros.h b/sysdeps/s390/s390-32/stackguard-macros.h
new file mode 100644
index 0000000000..b74c5799b3
--- /dev/null
+++ b/sysdeps/s390/s390-32/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
diff --git a/sysdeps/s390/s390-64/stackguard-macros.h b/sysdeps/s390/s390-64/stackguard-macros.h
new file mode 100644
index 0000000000..0cebb5f022
--- /dev/null
+++ b/sysdeps/s390/s390-64/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
diff --git a/sysdeps/sparc/sparc32/stackguard-macros.h b/sysdeps/sparc/sparc32/stackguard-macros.h
new file mode 100644
index 0000000000..c0b02b0bbd
--- /dev/null
+++ b/sysdeps/sparc/sparc32/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
diff --git a/sysdeps/sparc/sparc64/stackguard-macros.h b/sysdeps/sparc/sparc64/stackguard-macros.h
new file mode 100644
index 0000000000..80f063558a
--- /dev/null
+++ b/sysdeps/sparc/sparc64/stackguard-macros.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
diff --git a/sysdeps/x86_64/stackguard-macros.h b/sysdeps/x86_64/stackguard-macros.h
new file mode 100644
index 0000000000..d7fedb3737
--- /dev/null
+++ b/sysdeps/x86_64/stackguard-macros.h
@@ -0,0 +1,6 @@
+#include <stdint.h>
+
+#define STACK_CHK_GUARD \
+  ({ uintptr_t x;						\
+     asm ("mov %%fs:%c1, %0" : "=r" (x)				\
+	  : "i" (offsetof (tcbhead_t, stack_guard))); x; })