aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_mips64x.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-04-20 15:30:52 -0700
committerIan Lance Taylor <iant@golang.org>2018-04-24 05:01:13 +0000
commit665b9b3476ad0a6dc4e578e42e6c63012e23aaa0 (patch)
tree4848606a8cb62e0a46e8f70983a2d32c75836ef3 /src/runtime/sys_linux_mips64x.s
parenta3c75d9b313cc9f06969125ff28501c081dac3b8 (diff)
downloadgo-665b9b3476ad0a6dc4e578e42e6c63012e23aaa0.tar.xz
runtime: change GNU/Linux usleep to use nanosleep
Ever since we added sleep to the runtime back in 2008, we've implemented it on GNU/Linux with the select (or pselect or pselect6) system call. But the Linux kernel has a nanosleep system call, which should be a tiny bit more efficient since it doesn't have to check to see whether there are any file descriptors. So use it. Change-Id: Icc3430baca46b082a4d33f97c6c47e25fa91cb9a Reviewed-on: https://go-review.googlesource.com/108538 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_mips64x.s')
-rw-r--r--src/runtime/sys_linux_mips64x.s12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s
index 25d13367ad..7632e06fbd 100644
--- a/src/runtime/sys_linux_mips64x.s
+++ b/src/runtime/sys_linux_mips64x.s
@@ -26,7 +26,7 @@
#define SYS_munmap 5011
#define SYS_setitimer 5036
#define SYS_clone 5055
-#define SYS_newselect 5022
+#define SYS_nanosleep 5034
#define SYS_sched_yield 5023
#define SYS_rt_sigreturn 5211
#define SYS_rt_sigaction 5013
@@ -117,18 +117,16 @@ TEXT runtimeĀ·usleep(SB),NOSPLIT,$16-4
DIVVU R4, R3
MOVV LO, R3
MOVV R3, 8(R29)
+ MOVW $1000, R4
MULVU R3, R4
MOVV LO, R4
SUBVU R4, R5
MOVV R5, 16(R29)
- // select(0, 0, 0, 0, &tv)
- MOVW $0, R4
+ // nanosleep(&ts, 0)
+ ADDV $8, R29, R4
MOVW $0, R5
- MOVW $0, R6
- MOVW $0, R7
- ADDV $8, R29, R8
- MOVV $SYS_newselect, R2
+ MOVV $SYS_nanosleep, R2
SYSCALL
RET