Skip to content

Commit 84a399f

Browse files
Merge pull request #282 from archanaravindar/sleep1.22
Backport fix to correct usleep asm implementation on s390x for Go1.22
2 parents 07e4c54 + a2676fb commit 84a399f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

patches/020-fix-usleep-s390x.patch

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 3784dc6c80f5fe5dd81874330659074b14546ab2 Mon Sep 17 00:00:00 2001
2+
From: Archana Ravindar <[email protected]>
3+
Date: Fri, 28 Mar 2025 14:44:39 +0530
4+
Subject: [PATCH 1/1] backport usleep fix
5+
6+
---
7+
src/runtime/sys_linux_s390x.s | 5 +++--
8+
1 file changed, 3 insertions(+), 2 deletions(-)
9+
10+
diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s
11+
index adf5612c3c..e1ae00ff83 100644
12+
--- a/src/runtime/sys_linux_s390x.s
13+
+++ b/src/runtime/sys_linux_s390x.s
14+
@@ -112,9 +112,10 @@ TEXT runtime·usleep(SB),NOSPLIT,$16-4
15+
MOVW $1000000, R3
16+
DIVD R3, R2
17+
MOVD R2, 8(R15)
18+
- MOVW $1000, R3
19+
- MULLD R2, R3
20+
+ MULLD R2, R3 // convert sec to usec and subtract
21+
SUB R3, R4
22+
+ MOVW $1000, R3
23+
+ MULLD R3, R4 // convert remaining usec into nsec
24+
MOVD R4, 16(R15)
25+
26+
// nanosleep(&ts, 0)
27+
--
28+
2.47.1
29+

0 commit comments

Comments
 (0)