Last change
on this file since 445 was 444, checked in by coas-nagasima, 4 years ago |
muslのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
667 bytes
|
Line | |
---|
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 volatile int lock;
|
---|
8 | static void *unmap_base;
|
---|
9 | static size_t unmap_size;
|
---|
10 | static char shared_stack[256];
|
---|
11 |
|
---|
12 | static void do_unmap()
|
---|
13 | {
|
---|
14 | __syscall(SYS_munmap, unmap_base, unmap_size);
|
---|
15 | __syscall(SYS_exit);
|
---|
16 | }
|
---|
17 |
|
---|
18 | void __unmapself(void *base, size_t size)
|
---|
19 | {
|
---|
20 | int tid=__pthread_self()->tid;
|
---|
21 | char *stack = shared_stack + sizeof shared_stack;
|
---|
22 | stack -= (uintptr_t)stack % 16;
|
---|
23 | while (lock || a_cas(&lock, 0, tid))
|
---|
24 | a_spin();
|
---|
25 | __syscall(SYS_set_tid_address, &lock);
|
---|
26 | unmap_base = base;
|
---|
27 | unmap_size = size;
|
---|
28 | CRTJMP(do_unmap, stack);
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.