diff options
| author | Russ Cox <rsc@golang.org> | 2008-09-09 11:50:14 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2008-09-09 11:50:14 -0700 |
| commit | 376898ca8bd875a22ed7be15b9a9c1f05a272fc5 (patch) | |
| tree | 5f0bcd75b78709db665272c7e017fb947b4a251d /src/runtime/sys_amd64_linux.s | |
| parent | c59d2f13aa73468c43ec46040689e5219a9c140b (diff) | |
| download | go-376898ca8bd875a22ed7be15b9a9c1f05a272fc5.tar.xz | |
go threads for OS X
R=r
OCL=14944
CL=15013
Diffstat (limited to 'src/runtime/sys_amd64_linux.s')
| -rw-r--r-- | src/runtime/sys_amd64_linux.s | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/runtime/sys_amd64_linux.s b/src/runtime/sys_amd64_linux.s index 2cb6258320..01f6f6280d 100644 --- a/src/runtime/sys_amd64_linux.s +++ b/src/runtime/sys_amd64_linux.s @@ -162,10 +162,17 @@ TEXT clone(SB),7,$0 JEQ 2(PC) RET - // In child, call fn on new stack + // In child, set up new stack MOVQ SI, SP MOVQ R8, R14 // m MOVQ R9, R15 // g + + // Initialize m->procid to Linux tid + MOVL $186, AX // gettid + SYSCALL + MOVQ AX, 24(R14) + + // Call fn CALL R12 // It shouldn't return. If it does, exi @@ -174,7 +181,7 @@ TEXT clone(SB),7,$0 SYSCALL JMP -3(PC) // keep exiting -// int64 select(int32, void*, void*, void*, void*) +// int64 select(int32, void*, void*, void*, struct timeval*) TEXT select(SB),7,$0 MOVL 8(SP), DI MOVQ 16(SP), SI @@ -185,16 +192,3 @@ TEXT select(SB),7,$0 SYSCALL RET -// Linux allocates each thread its own pid, like Plan 9. -// But the getpid() system call returns the pid of the -// original thread (the one that exec started with), -// no matter which thread asks. This system call, -// which Linux calls gettid, returns the actual pid of -// the calling thread, not the fake one. -// -// int32 getprocid(void) -TEXT getprocid(SB),7,$0 - MOVL $186, AX - SYSCALL - RET - |
