MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / save_sp

Function save_sp

src/threadlist.cpp:126–146  ·  view source on GitHub ↗

* * 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. * *****************************************************************************/

Source from the content-addressed store, hash-verified

124 *
125 *****************************************************************************/
126static void
127save_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 *

Callers 2

checkpointhreadFunction · 0.85
stopthisthreadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected