LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <sys/types.h> | 5 #include <sys/types.h> |
6 #include <dlfcn.h> | 6 #include <dlfcn.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <errno.h> | 10 #include <errno.h> |
11 #include "libcgo.h" | 11 #include "libcgo.h" |
12 | 12 |
13 static void* threadentry(void*); | 13 static void* threadentry(void*); |
14 | 14 |
15 #define TCB_SIZE 16 | 15 // TCB_SIZE is sizeof(struct thread_control_block),· |
| 16 // defined in /usr/src/lib/librthread/tcb.h |
| 17 #define TCB_SIZE (4 * sizeof(void *)) |
16 #define TLS_SIZE (2 * sizeof(void *)) | 18 #define TLS_SIZE (2 * sizeof(void *)) |
17 | 19 |
18 void *__get_tcb(void); | 20 void *__get_tcb(void); |
19 void __set_tcb(void *); | 21 void __set_tcb(void *); |
20 | 22 |
21 static void | 23 static void |
22 tcb_fixup(int mainthread) | 24 tcb_fixup(int mainthread) |
23 { | 25 { |
24 void *newtcb, *oldtcb; | 26 void *newtcb, *oldtcb; |
25 | 27 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 */ | 156 */ |
155 asm volatile ( | 157 asm volatile ( |
156 "movl %0, %%gs:-8\n" // MOVL g, -8(GS) | 158 "movl %0, %%gs:-8\n" // MOVL g, -8(GS) |
157 "movl %1, %%gs:-4\n" // MOVL m, -4(GS) | 159 "movl %1, %%gs:-4\n" // MOVL m, -4(GS) |
158 :: "r"(ts.g), "r"(ts.m) | 160 :: "r"(ts.g), "r"(ts.m) |
159 ); | 161 ); |
160 | 162 |
161 crosscall_386(ts.fn); | 163 crosscall_386(ts.fn); |
162 return nil; | 164 return nil; |
163 } | 165 } |
LEFT | RIGHT |