Updated to fedora-glibc-20070801T1703
[glibc.git] / elf / stackguard-macros.h
blob97db8bc22a3416c1ec550634a5c2daaa9593e761
1 #include <stdint.h>
3 #ifdef __i386__
4 # define STACK_CHK_GUARD \
5 ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
6 #elif defined __x86_64__
7 # define STACK_CHK_GUARD \
8 ({ uintptr_t x; asm ("movq %%fs:0x28, %0" : "=r" (x)); x; })
9 #elif defined __powerpc64__
10 # define STACK_CHK_GUARD \
11 ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
12 #elif defined __powerpc__
13 # define STACK_CHK_GUARD \
14 ({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
15 #elif defined __sparc__ && defined __arch64__
16 # define STACK_CHK_GUARD \
17 ({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
18 #elif defined __sparc__
19 # define STACK_CHK_GUARD \
20 ({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
21 #elif defined __s390x__
22 # define STACK_CHK_GUARD \
23 ({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
24 #elif defined __s390__
25 # define STACK_CHK_GUARD \
26 ({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
27 #elif defined __ia64__
28 # define STACK_CHK_GUARD \
29 ({ uintptr_t x; asm ("adds %0 = -8, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
30 #else
31 extern uintptr_t __stack_chk_guard;
32 # define STACK_CHK_GUARD __stack_chk_guard
33 #endif