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>
This commit is contained in:
Guoqi Chen 2023-03-29 05:08:28 +08:00 committed by Gopher Robot
parent 8af1067698
commit 93897960cb
1 changed files with 10 additions and 10 deletions

View File

@ -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