2012-05-17 18:51:36 +00:00
|
|
|
#include <bits/wordsize.h>
|
|
|
|
|
2012-05-11 20:11:04 +00:00
|
|
|
#ifdef __tilegx__
|
2012-05-17 18:51:36 +00:00
|
|
|
# if __WORDSIZE == 64
|
|
|
|
# define STACK_CHK_GUARD \
|
2012-05-11 20:11:04 +00:00
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -16; ld %0, %0" : "=r" (x)); x; })
|
2013-09-23 04:52:09 +00:00
|
|
|
# define POINTER_CHK_GUARD \
|
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -24; ld %0, %0" : "=r" (x)); x; })
|
2012-05-17 18:51:36 +00:00
|
|
|
# else
|
|
|
|
# define STACK_CHK_GUARD \
|
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -8; ld4s %0, %0" : "=r" (x)); x; })
|
2013-09-23 04:52:09 +00:00
|
|
|
# define POINTER_CHK_GUARD \
|
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -12; ld4s %0, %0" : "=r" (x)); x; })
|
2012-05-17 18:51:36 +00:00
|
|
|
# endif
|
2012-05-11 20:11:04 +00:00
|
|
|
#else
|
|
|
|
# define STACK_CHK_GUARD \
|
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -8; lw %0, %0" : "=r" (x)); x; })
|
2013-09-23 04:52:09 +00:00
|
|
|
# define POINTER_CHK_GUARD \
|
|
|
|
({ uintptr_t x; asm ("addi %0, tp, -12; lw %0, %0" : "=r" (x)); x; })
|
2012-05-11 20:11:04 +00:00
|
|
|
#endif
|