2009-11-18 00:58:51 -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, FreeBSD
|
|
|
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
|
|
|
//
|
|
|
|
|
2011-12-19 13:51:13 -07:00
|
|
|
#include "zasm_GOOS_GOARCH.h"
|
2009-11-18 00:58:51 -07:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·sys_umtx_op(SB),7,$-4
|
2009-12-08 19:19:30 -07:00
|
|
|
MOVL $454, AX
|
|
|
|
INT $0x80
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·thr_new(SB),7,$-4
|
2009-12-08 19:19:30 -07:00
|
|
|
MOVL $455, AX
|
|
|
|
INT $0x80
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·thr_start(SB),7,$0
|
2009-11-18 17:51:59 -07:00
|
|
|
MOVL mm+0(FP), AX
|
|
|
|
MOVL m_g0(AX), BX
|
2009-11-18 00:58:51 -07:00
|
|
|
LEAL m_tls(AX), BP
|
|
|
|
MOVL 0(BP), DI
|
|
|
|
ADDL $7, DI
|
|
|
|
PUSHAL
|
|
|
|
PUSHL $32
|
|
|
|
PUSHL BP
|
|
|
|
PUSHL DI
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·setldt(SB)
|
2009-11-18 00:58:51 -07:00
|
|
|
POPL AX
|
|
|
|
POPL AX
|
|
|
|
POPL AX
|
|
|
|
POPAL
|
2010-01-06 18:58:55 -07:00
|
|
|
get_tls(CX)
|
|
|
|
MOVL BX, g(CX)
|
|
|
|
|
|
|
|
MOVL AX, m(CX)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·stackcheck(SB) // smashes AX
|
2013-03-01 09:44:43 -07:00
|
|
|
CALL runtime·mstart(SB)
|
2013-03-01 06:30:11 -07:00
|
|
|
|
2009-12-08 19:19:30 -07:00
|
|
|
MOVL 0, AX // crash (not reached)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
|
|
|
// Exit the entire program (like C exit)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·exit(SB),7,$-4
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $1, AX
|
|
|
|
INT $0x80
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·exit1(SB),7,$-4
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $431, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
2013-03-12 11:47:44 -06:00
|
|
|
TEXT runtime·open(SB),7,$-4
|
|
|
|
MOVL $5, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT runtime·close(SB),7,$-4
|
|
|
|
MOVL $6, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT runtime·read(SB),7,$-4
|
|
|
|
MOVL $3, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·write(SB),7,$-4
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $4, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2012-02-24 13:28:51 -07:00
|
|
|
TEXT runtime·getrlimit(SB),7,$-4
|
|
|
|
MOVL $194, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-03-14 23:11:03 -06:00
|
|
|
TEXT runtime·raise(SB),7,$16
|
2011-04-25 14:58:00 -06:00
|
|
|
// thr_self(&8(SP))
|
|
|
|
LEAL 8(SP), AX
|
2013-03-14 23:11:03 -06:00
|
|
|
MOVL AX, 4(SP)
|
2011-04-25 14:58:00 -06:00
|
|
|
MOVL $432, AX
|
|
|
|
INT $0x80
|
|
|
|
// thr_kill(self, SIGPIPE)
|
|
|
|
MOVL 8(SP), AX
|
2013-03-14 23:11:03 -06:00
|
|
|
MOVL AX, 4(SP)
|
|
|
|
MOVL sig+0(FP), AX
|
|
|
|
MOVL AX, 8(SP)
|
2011-04-25 14:58:00 -06:00
|
|
|
MOVL $433, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·mmap(SB),7,$32
|
2010-08-24 11:04:02 -06:00
|
|
|
LEAL arg0+0(FP), SI
|
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL
|
|
|
|
MOVSL
|
|
|
|
MOVSL
|
|
|
|
MOVSL
|
|
|
|
MOVSL
|
|
|
|
MOVSL
|
2012-09-20 23:50:02 -06:00
|
|
|
MOVL $0, AX // top 32 bits of file offset
|
2010-08-24 11:04:02 -06:00
|
|
|
STOSL
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $477, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·munmap(SB),7,$-4
|
2010-09-07 07:57:22 -06:00
|
|
|
MOVL $73, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2010-09-07 07:57:22 -06:00
|
|
|
RET
|
|
|
|
|
2012-11-23 21:55:19 -07:00
|
|
|
TEXT runtime·madvise(SB),7,$-4
|
|
|
|
MOVL $75, AX // madvise
|
|
|
|
INT $0x80
|
2012-12-22 13:06:28 -07:00
|
|
|
// ignore failure - maybe pages are locked
|
2012-11-23 21:55:19 -07:00
|
|
|
RET
|
|
|
|
|
2011-03-23 09:31:42 -06:00
|
|
|
TEXT runtime·setitimer(SB), 7, $-4
|
|
|
|
MOVL $83, AX
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2011-11-30 09:59:44 -07:00
|
|
|
// func now() (sec int64, nsec int32)
|
|
|
|
TEXT time·now(SB), 7, $32
|
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 $232, AX
|
2011-11-30 09:59:44 -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)
|
|
|
|
MOVL BX, 8(SP)
|
2011-11-30 09:59:44 -07:00
|
|
|
INT $0x80
|
|
|
|
MOVL 12(SP), AX // sec
|
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 16(SP), BX // nsec
|
2011-11-30 09:59:44 -07:00
|
|
|
|
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
|
|
|
// sec is in AX, nsec in BX
|
2011-11-30 09:59:44 -07:00
|
|
|
MOVL AX, sec+0(FP)
|
|
|
|
MOVL $0, sec+4(FP)
|
|
|
|
MOVL BX, nsec+8(FP)
|
|
|
|
RET
|
|
|
|
|
2011-11-03 15:35:28 -06:00
|
|
|
// int64 nanotime(void) so really
|
|
|
|
// void nanotime(int64 *nsec)
|
|
|
|
TEXT runtime·nanotime(SB), 7, $32
|
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 $232, AX
|
2010-02-08 15:32:22 -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)
|
|
|
|
MOVL BX, 8(SP)
|
2010-02-08 15:32:22 -07:00
|
|
|
INT $0x80
|
2011-11-03 15:35:28 -06:00
|
|
|
MOVL 12(SP), AX // sec
|
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 16(SP), BX // nsec
|
2011-11-03 15:35:28 -06:00
|
|
|
|
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
|
|
|
// sec is in AX, nsec in BX
|
2011-11-03 15:35:28 -06:00
|
|
|
// convert to DX:AX nsec
|
|
|
|
MOVL $1000000000, CX
|
|
|
|
MULL CX
|
|
|
|
ADDL BX, AX
|
|
|
|
ADCL $0, DX
|
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
|
|
|
|
2011-11-03 15:35:28 -06:00
|
|
|
MOVL ret+0(FP), DI
|
|
|
|
MOVL AX, 0(DI)
|
|
|
|
MOVL DX, 4(DI)
|
2010-02-08 15:32:22 -07:00
|
|
|
RET
|
|
|
|
|
2011-11-03 15:35:28 -06:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·sigaction(SB),7,$-4
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $416, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
2011-02-23 12:47:42 -07:00
|
|
|
TEXT runtime·sigtramp(SB),7,$44
|
|
|
|
get_tls(CX)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
2012-03-12 13:55:18 -06:00
|
|
|
// check that m exists
|
|
|
|
MOVL m(CX), BX
|
|
|
|
CMPL BX, $0
|
2012-09-04 12:40:49 -06:00
|
|
|
JNE 5(PC)
|
|
|
|
MOVL signo+0(FP), BX
|
|
|
|
MOVL BX, 0(SP)
|
2012-03-12 13:55:18 -06:00
|
|
|
CALL runtime·badsignal(SB)
|
2012-09-04 12:40:49 -06:00
|
|
|
RET
|
2012-03-12 13:55:18 -06:00
|
|
|
|
2011-02-23 12:47:42 -07:00
|
|
|
// save g
|
|
|
|
MOVL g(CX), DI
|
|
|
|
MOVL DI, 20(SP)
|
|
|
|
|
|
|
|
// g = m->gsignal
|
|
|
|
MOVL m_gsignal(BX), BX
|
|
|
|
MOVL BX, g(CX)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
2011-02-23 12:47:42 -07:00
|
|
|
// copy arguments for call to sighandler
|
|
|
|
MOVL signo+0(FP), BX
|
|
|
|
MOVL BX, 0(SP)
|
|
|
|
MOVL info+4(FP), BX
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL BX, 4(SP)
|
2011-02-23 12:47:42 -07:00
|
|
|
MOVL context+8(FP), BX
|
|
|
|
MOVL BX, 8(SP)
|
|
|
|
MOVL DI, 12(SP)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
2011-02-23 12:47:42 -07:00
|
|
|
CALL runtime·sighandler(SB)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
2011-02-23 12:47:42 -07:00
|
|
|
// restore g
|
|
|
|
get_tls(CX)
|
|
|
|
MOVL 20(SP), BX
|
|
|
|
MOVL BX, g(CX)
|
|
|
|
|
|
|
|
// call sigreturn
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL context+8(FP), AX
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
|
|
|
MOVL AX, 4(SP)
|
|
|
|
MOVL $417, AX // sigreturn(ucontext)
|
|
|
|
INT $0x80
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·sigaltstack(SB),7,$0
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL $53, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2009-11-18 00:58:51 -07:00
|
|
|
RET
|
|
|
|
|
2012-01-16 09:22:34 -07:00
|
|
|
TEXT runtime·usleep(SB),7,$20
|
|
|
|
MOVL $0, DX
|
|
|
|
MOVL usec+0(FP), AX
|
|
|
|
MOVL $1000000, CX
|
|
|
|
DIVL CX
|
|
|
|
MOVL AX, 12(SP) // tv_sec
|
|
|
|
MOVL $1000, AX
|
|
|
|
MULL DX
|
|
|
|
MOVL AX, 16(SP) // tv_nsec
|
|
|
|
|
|
|
|
MOVL $0, 0(SP)
|
|
|
|
LEAL 12(SP), AX
|
|
|
|
MOVL AX, 4(SP) // arg 1 - rqtp
|
|
|
|
MOVL $0, 8(SP) // arg 2 - rmtp
|
|
|
|
MOVL $240, AX // sys_nanosleep
|
|
|
|
INT $0x80
|
2011-09-30 17:39:10 -06:00
|
|
|
RET
|
|
|
|
|
2009-11-18 00:58:51 -07:00
|
|
|
/*
|
|
|
|
descriptor entry format for system call
|
|
|
|
is the native machine format, ugly as it is:
|
|
|
|
|
|
|
|
2-byte limit
|
|
|
|
3-byte base
|
|
|
|
1-byte: 0x80=present, 0x60=dpl<<5, 0x1F=type
|
|
|
|
1-byte: 0x80=limit is *4k, 0x40=32-bit operand size,
|
|
|
|
0x0F=4 more bits of limit
|
|
|
|
1 byte: 8 more bits of base
|
|
|
|
|
|
|
|
int i386_get_ldt(int, union ldt_entry *, int);
|
|
|
|
int i386_set_ldt(int, const union ldt_entry *, int);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// setldt(int entry, int address, int limit)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·setldt(SB),7,$32
|
2009-11-18 00:58:51 -07:00
|
|
|
MOVL address+4(FP), BX // aka base
|
2012-01-22 11:34:17 -07:00
|
|
|
// see comment in sys_linux_386.s; freebsd is similar
|
2009-11-18 17:51:59 -07:00
|
|
|
ADDL $0x8, BX
|
2009-11-18 00:58:51 -07:00
|
|
|
|
|
|
|
// set up data_desc
|
|
|
|
LEAL 16(SP), AX // struct data_desc
|
|
|
|
MOVL $0, 0(AX)
|
|
|
|
MOVL $0, 4(AX)
|
|
|
|
|
|
|
|
MOVW BX, 2(AX)
|
|
|
|
SHRL $16, BX
|
|
|
|
MOVB BX, 4(AX)
|
|
|
|
SHRL $8, BX
|
|
|
|
MOVB BX, 7(AX)
|
|
|
|
|
2009-11-18 17:51:59 -07:00
|
|
|
MOVW $0xffff, 0(AX)
|
|
|
|
MOVB $0xCF, 6(AX) // 32-bit operand, 4k limit unit, 4 more bits of limit
|
2009-11-18 00:58:51 -07:00
|
|
|
|
|
|
|
MOVB $0xF2, 5(AX) // r/w data descriptor, dpl=3, present
|
|
|
|
|
|
|
|
// call i386_set_ldt(entry, desc, 1)
|
|
|
|
MOVL $0xffffffff, 0(SP) // auto-allocate entry and return in AX
|
|
|
|
MOVL AX, 4(SP)
|
|
|
|
MOVL $1, 8(SP)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·i386_set_ldt(SB)
|
2009-11-18 00:58:51 -07:00
|
|
|
|
|
|
|
// compute segment selector - (entry*8+7)
|
|
|
|
SHLL $3, AX
|
|
|
|
ADDL $7, AX
|
|
|
|
MOVW AX, GS
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·i386_set_ldt(SB),7,$16
|
2009-11-18 00:58:51 -07:00
|
|
|
LEAL args+0(FP), AX // 0(FP) == 4(SP) before SP got moved
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
|
|
|
MOVL $1, 4(SP)
|
|
|
|
MOVL AX, 8(SP)
|
|
|
|
MOVL $165, AX
|
|
|
|
INT $0x80
|
|
|
|
CMPL AX, $0xfffff001
|
|
|
|
JLS 2(PC)
|
|
|
|
INT $3
|
|
|
|
RET
|
|
|
|
|
2012-01-09 23:39:17 -07:00
|
|
|
TEXT runtime·sysctl(SB),7,$28
|
|
|
|
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
|
|
|
|
|
2012-02-20 15:32:20 -07:00
|
|
|
TEXT runtime·osyield(SB),7,$-4
|
|
|
|
MOVL $331, AX // sys_sched_yield
|
|
|
|
INT $0x80
|
|
|
|
RET
|
2012-01-09 23:39:17 -07:00
|
|
|
|
2012-02-21 21:44:09 -07:00
|
|
|
TEXT runtime·sigprocmask(SB),7,$16
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
|
|
|
MOVL $3, 4(SP) // arg 1 - how (SIG_SETMASK)
|
|
|
|
MOVL args+0(FP), AX
|
|
|
|
MOVL AX, 8(SP) // arg 2 - set
|
|
|
|
MOVL args+4(FP), AX
|
|
|
|
MOVL AX, 12(SP) // arg 3 - oset
|
|
|
|
MOVL $340, AX // sys_sigprocmask
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-03-08 12:03:56 -07:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2012-02-21 21:44:09 -07:00
|
|
|
RET
|
|
|
|
|
2013-05-20 04:25:32 -06:00
|
|
|
// int32 runtime·kqueue(void);
|
|
|
|
TEXT runtime·kqueue(SB),7,$0
|
|
|
|
MOVL $269, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout);
|
|
|
|
TEXT runtime·kevent(SB),7,$0
|
|
|
|
MOVL $270, AX
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
// int32 runtime·closeonexec(int32 fd);
|
|
|
|
TEXT runtime·closeonexec(SB),7,$32
|
|
|
|
MOVL $92, AX // fcntl
|
|
|
|
// 0(SP) is where the caller PC would be; kernel skips it
|
|
|
|
MOVL fd+0(FP), BX
|
|
|
|
MOVL BX, 4(SP) // fd
|
|
|
|
MOVL $2, 8(SP) // F_SETFD
|
|
|
|
MOVL $1, 12(SP) // FD_CLOEXEC
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
GLOBL runtime·tlsoffset(SB),$4
|