xf.li | bfc6e71 | 2025-02-07 01:54:34 -0800 | [diff] [blame^] | 1 | #include <stdint.h> |
| 2 | |
| 3 | #define STACK_CHK_GUARD \ |
| 4 | ({ uintptr_t x; __asm__ ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; }) |
| 5 | |
| 6 | /* On s390/s390x there is no unique pointer guard, instead we use the |
| 7 | same value as the stack guard. */ |
| 8 | #define POINTER_CHK_GUARD \ |
| 9 | ({ \ |
| 10 | uintptr_t x; \ |
| 11 | __asm__ ("ear %0,%%a0;" \ |
| 12 | "sllg %0,%0,32;" \ |
| 13 | "ear %0,%%a1;" \ |
| 14 | "lg %0,%1(%0)" \ |
| 15 | : "=a" (x) \ |
| 16 | : "i" (offsetof (tcbhead_t, stack_guard))); \ |
| 17 | x; \ |
| 18 | }) |