From bb0e5c2045babea251436b32848dc904a59b3657 Mon Sep 17 00:00:00 2001 From: Paul Murphy Date: Wed, 12 Feb 2025 08:45:34 -0600 Subject: [PATCH] [release-branch.go1.24] runtime: fix usleep on s390x/linux The timespec argument takes the remainder in nanoseconds, not microseconds. Convert the remaining time to nsec. Fixes #71728 Change-Id: I36cbbe3a088830c5e3afcc9516ef42e96ee21268 Reviewed-on: https://go-review.googlesource.com/c/go/+/648915 TryBot-Result: Gopher Robot Reviewed-by: Mauri de Souza Meneguzzo Reviewed-by: Axel Busch Run-TryBot: Paul Murphy Reviewed-by: Cherry Mui Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Vishwanatha HD Reviewed-on: https://go-review.googlesource.com/c/go/+/649375 Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov --- src/runtime/sys_linux_s390x.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 7da4a52729..2f9d4beda8 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -112,9 +112,10 @@ TEXT runtime·usleep(SB),NOSPLIT,$16-4 MOVW $1000000, R3 DIVD R3, R2 MOVD R2, 8(R15) - MOVW $1000, R3 - MULLD R2, R3 + MULLD R2, R3 // Convert sec to usec and subtract SUB R3, R4 + MOVW $1000, R3 + MULLD R3, R4 // Convert remaining usec into nsec. MOVD R4, 16(R15) // nanosleep(&ts, 0) -- 2.48.1