* * We will use the region beyond the end of stack for our temporary stack. * glibc sigsetjmp will mangle pointers; We need the unmangled pointer. * So, we can't rely on parsing the jmpbuf for the saved sp. * *****************************************************************************/
| 124 | * |
| 125 | *****************************************************************************/ |
| 126 | static void |
| 127 | save_sp(void **sp) |
| 128 | { |
| 129 | #if defined(__i386__) || defined(__x86_64__) |
| 130 | asm volatile (CLEAN_FOR_64_BIT(mov %%esp, %0) |
| 131 | : "=g" (*sp) |
| 132 | : : "memory"); |
| 133 | #elif defined(__arm__) || defined(__aarch64__) |
| 134 | asm volatile ("mov %0,sp" |
| 135 | : "=r" (*sp) |
| 136 | : : "memory"); |
| 137 | |
| 138 | #elif defined(__riscv) |
| 139 | asm volatile ("addi %0, sp, 0" |
| 140 | : "=r" (*sp) |
| 141 | : : "memory"); |
| 142 | |
| 143 | #else // if defined(__i386__) || defined(__x86_64__) |
| 144 | # error "assembly instruction not translated" |
| 145 | #endif // if defined(__i386__) || defined(__x86_64__) |
| 146 | } |
| 147 | |
| 148 | /***************************************************************************** |
| 149 | * |
no outgoing calls
no test coverage detected