Back to index

glibc  2.9
stackguard-macros.h
Go to the documentation of this file.
00001 #include <stdint.h>
00002 
00003 #ifdef __i386__
00004 # define STACK_CHK_GUARD \
00005   ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
00006 #elif defined __x86_64__
00007 # define STACK_CHK_GUARD \
00008   ({ uintptr_t x; asm ("movq %%fs:0x28, %0" : "=r" (x)); x; })
00009 #elif defined __powerpc64__
00010 # define STACK_CHK_GUARD \
00011   ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
00012 #elif defined __powerpc__
00013 # define STACK_CHK_GUARD \
00014   ({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
00015 #elif defined __sparc__ && defined __arch64__
00016 # define STACK_CHK_GUARD \
00017   ({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
00018 #elif defined __sparc__
00019 # define STACK_CHK_GUARD \
00020   ({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
00021 #elif defined __s390x__
00022 # define STACK_CHK_GUARD \
00023   ({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
00024 #elif defined __s390__
00025 # define STACK_CHK_GUARD \
00026   ({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
00027 #elif defined __ia64__
00028 # define STACK_CHK_GUARD \
00029   ({ uintptr_t x; asm ("adds %0 = -8, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
00030 #else
00031 extern uintptr_t __stack_chk_guard;
00032 # define STACK_CHK_GUARD __stack_chk_guard
00033 #endif