diff options
| author | Guoqi Chen <chenguoqi@loongson.cn> | 2023-03-29 05:08:28 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-05-09 14:42:43 +0000 |
| commit | 93897960cb8462f5eefeaffeaa938fb9de5155e7 (patch) | |
| tree | a097a9269421c7ce65316985b2b8ee5ebf2adfab | |
| parent | 8af1067698ada0a835a265b49f7913d4d33f32fb (diff) | |
| download | go-93897960cb8462f5eefeaffeaa938fb9de5155e7.tar.xz | |
runtime: calculate nanoseconds in usleep on linux/loong64
Change-Id: Ia4cfdea3df8834e6260527ce8e6e894a0547070f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425299
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: WANG Xuerui <git@xen0n.name>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
| -rw-r--r-- | src/runtime/sys_linux_loong64.s | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/runtime/sys_linux_loong64.s b/src/runtime/sys_linux_loong64.s index 006c4bf2d5..486a9b1570 100644 --- a/src/runtime/sys_linux_loong64.s +++ b/src/runtime/sys_linux_loong64.s @@ -120,19 +120,19 @@ TEXT runtimeĀ·pipe2(SB),NOSPLIT|NOFRAME,$0-20 // func usleep(usec uint32) TEXT runtimeĀ·usleep(SB),NOSPLIT,$16-4 - MOVWU usec+0(FP), R6 - MOVV R6, R5 - MOVW $1000000, R4 - DIVVU R4, R6, R6 - MOVV R6, 8(R3) - MOVW $1000, R4 - MULVU R6, R4, R4 - SUBVU R4, R5 - MOVV R5, 16(R3) + MOVWU usec+0(FP), R7 + MOVV $1000, R6 + MULVU R6, R7, R7 + MOVV $1000000000, R6 + + DIVVU R6, R7, R5 // ts->tv_sec + REMVU R6, R7, R4 // ts->tv_nsec + MOVV R5, 8(R3) + MOVV R4, 16(R3) // nanosleep(&ts, 0) ADDV $8, R3, R4 - MOVW $0, R5 + MOVV R0, R5 MOVV $SYS_nanosleep, R11 SYSCALL RET |
