2011-12-12 16:10:11 -07:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//
|
|
|
|
// System calls and other sys.stuff for 386, NetBSD
|
|
|
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
|
|
|
//
|
|
|
|
|
2011-12-19 13:51:13 -07:00
|
|
|
#include "zasm_GOOS_GOARCH.h"
|
2013-08-07 13:20:05 -06:00
|
|
|
#include "../../cmd/ld/textflag.h"
|
2011-12-12 16:10:11 -07:00
|
|
|
|
|
|
|
// Exit the entire program (like C exit)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit(SB),NOSPLIT,$-4
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL $1, AX
|
|
|
|
INT $0x80
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-12-12 16:10:11 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit1(SB),NOSPLIT,$-4
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $310, AX // sys__lwp_exit
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-12-12 16:10:11 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·open(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $5, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·close(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $6, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·read(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $3, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·write(SB),NOSPLIT,$-4
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL $4, AX // sys_write
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·usleep(SB),NOSPLIT,$24
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL $0, DX
|
|
|
|
MOVL usec+0(FP), AX
|
|
|
|
MOVL $1000000, CX
|
|
|
|
DIVL CX
|
2012-06-06 04:39:27 -06:00
|
|
|
MOVL AX, 12(SP) // tv_sec - l32
|
|
|
|
MOVL $0, 16(SP) // tv_sec - h32
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL $1000, AX
|
|
|
|
MULL DX
|
2012-06-06 04:39:27 -06:00
|
|
|
MOVL AX, 20(SP) // tv_nsec
|
2011-12-12 16:10:11 -07:00
|
|
|
|
|
|
|
MOVL $0, 0(SP)
|
|
|
|
LEAL 12(SP), AX
|
|
|
|
MOVL AX, 4(SP) // arg 1 - rqtp
|
|
|
|
MOVL $0, 8(SP) // arg 2 - rmtp
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $430, AX // sys_nanosleep
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·raise(SB),NOSPLIT,$12
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $311, AX // sys__lwp_self
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
MOVL $0, 0(SP)
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL AX, 4(SP) // arg 1 - target
|
2013-03-14 23:11:03 -06:00
|
|
|
MOVL sig+0(FP), AX
|
|
|
|
MOVL AX, 8(SP) // arg 2 - signo
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $318, AX // sys__lwp_kill
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·mmap(SB),NOSPLIT,$36
|
2011-12-12 16:10:11 -07:00
|
|
|
LEAL arg0+0(FP), SI
|
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL // arg 1 - addr
|
|
|
|
MOVSL // arg 2 - len
|
|
|
|
MOVSL // arg 3 - prot
|
|
|
|
MOVSL // arg 4 - flags
|
|
|
|
MOVSL // arg 5 - fd
|
|
|
|
MOVL $0, AX
|
|
|
|
STOSL // arg 6 - pad
|
|
|
|
MOVSL // arg 7 - offset
|
2012-09-20 23:50:02 -06:00
|
|
|
MOVL $0, AX // top 32 bits of file offset
|
2011-12-12 16:10:11 -07:00
|
|
|
STOSL
|
|
|
|
MOVL $197, AX // sys_mmap
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·munmap(SB),NOSPLIT,$-4
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL $73, AX // sys_munmap
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-12-12 16:10:11 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·madvise(SB),NOSPLIT,$-4
|
2012-11-26 04:34:01 -07:00
|
|
|
MOVL $75, AX // sys_madvise
|
|
|
|
INT $0x80
|
2012-12-22 13:06:28 -07:00
|
|
|
// ignore failure - maybe pages are locked
|
2012-11-26 04:34:01 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·setitimer(SB),NOSPLIT,$-4
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $425, AX // sys_setitimer
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
|
|
|
// func now() (sec int64, nsec int32)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT time·now(SB), NOSPLIT, $32
|
2011-12-12 16:10:11 -07:00
|
|
|
LEAL 12(SP), BX
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVL $0, 4(SP) // arg 1 - clock_id
|
|
|
|
MOVL BX, 8(SP) // arg 2 - tp
|
|
|
|
MOVL $427, AX // sys_clock_gettime
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
|
2012-06-06 04:39:27 -06:00
|
|
|
MOVL 12(SP), AX // sec - l32
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL AX, sec+0(FP)
|
2012-06-06 04:39:27 -06:00
|
|
|
MOVL 16(SP), AX // sec - h32
|
|
|
|
MOVL AX, sec+4(FP)
|
|
|
|
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVL 20(SP), BX // nsec
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL BX, nsec+8(FP)
|
|
|
|
RET
|
|
|
|
|
|
|
|
// int64 nanotime(void) so really
|
|
|
|
// void nanotime(int64 *nsec)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·nanotime(SB),NOSPLIT,$32
|
2011-12-12 16:10:11 -07:00
|
|
|
LEAL 12(SP), BX
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVL $0, 4(SP) // arg 1 - clock_id
|
|
|
|
MOVL BX, 8(SP) // arg 2 - tp
|
|
|
|
MOVL $427, AX // sys_clock_gettime
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
|
2012-06-06 04:39:27 -06:00
|
|
|
MOVL 16(SP), CX // sec - h32
|
|
|
|
IMULL $1000000000, CX
|
|
|
|
|
|
|
|
MOVL 12(SP), AX // sec - l32
|
|
|
|
MOVL $1000000000, BX
|
|
|
|
MULL BX // result in dx:ax
|
|
|
|
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVL 20(SP), BX // nsec
|
2011-12-12 16:10:11 -07:00
|
|
|
ADDL BX, AX
|
2012-06-06 04:39:27 -06:00
|
|
|
ADCL CX, DX // add high bits with carry
|
2012-05-15 12:32:49 -06:00
|
|
|
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL ret+0(FP), DI
|
|
|
|
MOVL AX, 0(DI)
|
|
|
|
MOVL DX, 4(DI)
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·getcontext(SB),NOSPLIT,$-4
|
2012-05-15 12:32:49 -06:00
|
|
|
MOVL $307, AX // sys_getcontext
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $0xf1, 0xf1 // crash
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
|
2012-05-15 12:32:49 -06:00
|
|
|
MOVL $293, AX // sys_sigprocmask
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $0xf1, 0xf1 // crash
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$0
|
2012-05-10 11:48:43 -06:00
|
|
|
LEAL 140(SP), AX // Load address of ucontext
|
|
|
|
MOVL AX, 4(SP)
|
|
|
|
MOVL $308, AX // sys_setcontext
|
|
|
|
INT $0x80
|
|
|
|
MOVL $-1, 4(SP) // Something failed...
|
|
|
|
MOVL $1, AX // sys_exit
|
|
|
|
INT $0x80
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaction(SB),NOSPLIT,$24
|
2012-05-10 11:48:43 -06:00
|
|
|
LEAL arg0+0(FP), SI
|
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL // arg 1 - sig
|
|
|
|
MOVSL // arg 2 - act
|
|
|
|
MOVSL // arg 3 - oact
|
|
|
|
LEAL runtime·sigreturn_tramp(SB), AX
|
|
|
|
STOSL // arg 4 - tramp
|
2012-08-26 04:57:47 -06:00
|
|
|
MOVL $2, AX
|
2012-05-10 11:48:43 -06:00
|
|
|
STOSL // arg 5 - vers
|
|
|
|
MOVL $340, AX // sys___sigaction_sigtramp
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-12-12 16:10:11 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigtramp(SB),NOSPLIT,$44
|
2011-12-12 16:10:11 -07:00
|
|
|
get_tls(CX)
|
|
|
|
|
2012-03-12 13:55:18 -06:00
|
|
|
// check that m exists
|
|
|
|
MOVL m(CX), BX
|
|
|
|
CMPL BX, $0
|
2013-07-11 14:39:39 -06:00
|
|
|
JNE 6(PC)
|
2012-09-04 12:40:49 -06:00
|
|
|
MOVL signo+0(FP), BX
|
2012-11-26 04:34:01 -07:00
|
|
|
MOVL BX, 0(SP)
|
2013-07-11 14:39:39 -06:00
|
|
|
MOVL $runtime·badsignal(SB), AX
|
|
|
|
CALL AX
|
2012-09-04 12:40:49 -06:00
|
|
|
RET
|
2012-03-12 13:55:18 -06:00
|
|
|
|
2011-12-12 16:10:11 -07:00
|
|
|
// save g
|
|
|
|
MOVL g(CX), DI
|
|
|
|
MOVL DI, 20(SP)
|
2012-05-15 12:32:49 -06:00
|
|
|
|
2011-12-12 16:10:11 -07:00
|
|
|
// g = m->gsignal
|
|
|
|
MOVL m_gsignal(BX), BX
|
|
|
|
MOVL BX, g(CX)
|
|
|
|
|
|
|
|
// copy arguments for call to sighandler
|
|
|
|
MOVL signo+0(FP), BX
|
|
|
|
MOVL BX, 0(SP)
|
|
|
|
MOVL info+4(FP), BX
|
|
|
|
MOVL BX, 4(SP)
|
|
|
|
MOVL context+8(FP), BX
|
|
|
|
MOVL BX, 8(SP)
|
|
|
|
MOVL DI, 12(SP)
|
|
|
|
|
|
|
|
CALL runtime·sighandler(SB)
|
|
|
|
|
|
|
|
// restore g
|
|
|
|
get_tls(CX)
|
|
|
|
MOVL 20(SP), BX
|
|
|
|
MOVL BX, g(CX)
|
|
|
|
RET
|
|
|
|
|
2012-05-29 10:52:50 -06:00
|
|
|
// int32 lwp_create(void *context, uintptr flags, void *lwpid);
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·lwp_create(SB),NOSPLIT,$16
|
2012-05-29 10:52:50 -06:00
|
|
|
MOVL $0, 0(SP)
|
|
|
|
MOVL context+0(FP), AX
|
|
|
|
MOVL AX, 4(SP) // arg 1 - context
|
|
|
|
MOVL flags+4(FP), AX
|
|
|
|
MOVL AX, 8(SP) // arg 2 - flags
|
|
|
|
MOVL lwpid+8(FP), AX
|
|
|
|
MOVL AX, 12(SP) // arg 3 - lwpid
|
|
|
|
MOVL $309, AX // sys__lwp_create
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
2012-05-29 10:52:50 -06:00
|
|
|
JCC 2(PC)
|
2011-12-12 16:10:11 -07:00
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·lwp_tramp(SB),NOSPLIT,$0
|
2011-12-12 16:10:11 -07:00
|
|
|
|
|
|
|
// Set FS to point at m->tls
|
|
|
|
LEAL m_tls(BX), BP
|
|
|
|
PUSHAL // save registers
|
|
|
|
PUSHL BP
|
|
|
|
CALL runtime·settls(SB)
|
|
|
|
POPL AX
|
|
|
|
POPAL
|
2012-05-15 12:32:49 -06:00
|
|
|
|
2011-12-12 16:10:11 -07:00
|
|
|
// Now segment is established. Initialize m, g.
|
|
|
|
get_tls(AX)
|
|
|
|
MOVL DX, g(AX)
|
|
|
|
MOVL BX, m(AX)
|
|
|
|
|
|
|
|
CALL runtime·stackcheck(SB) // smashes AX, CX
|
|
|
|
MOVL 0(DX), DX // paranoia; check they are not nil
|
|
|
|
MOVL 0(BX), BX
|
|
|
|
|
|
|
|
// more paranoia; check that stack splitting code works
|
|
|
|
PUSHAL
|
|
|
|
CALL runtime·emptyfunc(SB)
|
|
|
|
POPAL
|
|
|
|
|
|
|
|
// Call fn
|
|
|
|
CALL SI
|
|
|
|
|
|
|
|
CALL runtime·exit1(SB)
|
|
|
|
MOVL $0x1234, 0x1005
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
|
2012-05-10 11:48:43 -06:00
|
|
|
MOVL $281, AX // sys___sigaltstack14
|
2011-12-12 16:10:11 -07:00
|
|
|
MOVL new+4(SP), BX
|
|
|
|
MOVL old+8(SP), CX
|
|
|
|
INT $0x80
|
|
|
|
CMPL AX, $0xfffff001
|
|
|
|
JLS 2(PC)
|
|
|
|
INT $3
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·setldt(SB),NOSPLIT,$8
|
2011-12-12 16:10:11 -07:00
|
|
|
// Under NetBSD we set the GS base instead of messing with the LDT.
|
|
|
|
MOVL 16(SP), AX // tls0
|
|
|
|
MOVL AX, 0(SP)
|
|
|
|
CALL runtime·settls(SB)
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·settls(SB),NOSPLIT,$16
|
2011-12-12 16:10:11 -07:00
|
|
|
// adjust for ELF: wants to use -8(GS) and -4(GS) for g and m
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL base+0(FP), CX
|
2011-12-12 16:10:11 -07:00
|
|
|
ADDL $8, CX
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL CX, 4(SP) // arg 1 - ptr
|
|
|
|
MOVL $317, AX // sys__lwp_setprivate
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
JCC 2(PC)
|
2012-05-14 19:26:05 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-12-12 16:10:11 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·osyield(SB),NOSPLIT,$-4
|
2012-05-15 11:33:37 -06:00
|
|
|
MOVL $350, AX // sys_sched_yield
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·lwp_park(SB),NOSPLIT,$-4
|
2012-05-29 10:52:50 -06:00
|
|
|
MOVL $434, AX // sys__lwp_park
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·lwp_unpark(SB),NOSPLIT,$-4
|
2012-05-29 10:52:50 -06:00
|
|
|
MOVL $321, AX // sys__lwp_unpark
|
2011-12-12 16:10:11 -07:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·lwp_self(SB),NOSPLIT,$-4
|
2012-05-30 11:27:04 -06:00
|
|
|
MOVL $311, AX // sys__lwp_self
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sysctl(SB),NOSPLIT,$28
|
2011-12-12 16:10:11 -07:00
|
|
|
LEAL arg0+0(FP), SI
|
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL // arg 1 - name
|
|
|
|
MOVSL // arg 2 - namelen
|
|
|
|
MOVSL // arg 3 - oldp
|
|
|
|
MOVSL // arg 4 - oldlenp
|
|
|
|
MOVSL // arg 5 - newp
|
|
|
|
MOVSL // arg 6 - newlen
|
|
|
|
MOVL $202, AX // sys___sysctl
|
|
|
|
INT $0x80
|
|
|
|
JCC 3(PC)
|
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
MOVL $0, AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
GLOBL runtime·tlsoffset(SB),$4
|