1 #include "pthread_impl.h" 2 #include "atomic.h" 3 #include "syscall.h" 4 /* cheat and reuse CRTJMP macro from dynlink code */ 5 #include "dynlink.h" 6 7 static void *unmap_base; 8 static size_t unmap_size; 9 static char shared_stack[256]; 10 do_unmap()11static void do_unmap() 12 { 13 __syscall(SYS_munmap, unmap_base, unmap_size); 14 __syscall(SYS_exit); 15 } 16 __unmapself(void * base,size_t size)17void __unmapself(void *base, size_t size) 18 { 19 char *stack = shared_stack + sizeof shared_stack; 20 stack -= (uintptr_t)stack % 16; 21 unmap_base = base; 22 unmap_size = size; 23 CRTJMP(do_unmap, stack); 24 } 25