]>
Commit | Line | Data |
---|---|---|
320054e8 DG |
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 | ||
320054e8 DG |
7 | static void *unmap_base; |
8 | static size_t unmap_size; | |
9 | static char shared_stack[256]; | |
10 | ||
11 | static void do_unmap() | |
12 | { | |
13 | __syscall(SYS_munmap, unmap_base, unmap_size); | |
14 | __syscall(SYS_exit); | |
15 | } | |
16 | ||
17 | void __unmapself(void *base, size_t size) | |
18 | { | |
320054e8 DG |
19 | char *stack = shared_stack + sizeof shared_stack; |
20 | stack -= (uintptr_t)stack % 16; | |
320054e8 DG |
21 | unmap_base = base; |
22 | unmap_size = size; | |
23 | CRTJMP(do_unmap, stack); | |
24 | } |