aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_darwin_arm64.s
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2016-08-04 21:34:06 -0400
committerMinux Ma <minux@golang.org>2016-08-05 20:47:34 +0000
commit9fde86b0124b8c75000eb5d05887eff922a24566 (patch)
treec59a36760e14ae00e3ffe8181c0aa03263d2d557 /src/runtime/sys_darwin_arm64.s
parent3a03e877cc03c1fd155055e60a3f1f9cb8bda8d0 (diff)
downloadgo-9fde86b0124b8c75000eb5d05887eff922a24566.tar.gz
go-9fde86b0124b8c75000eb5d05887eff922a24566.zip
runtime, syscall: fix kernel gettimeofday ABI change on iOS 10
Fixes #16570 on iOS. Thanks Daniel Burhans for reporting the bug and testing the fix. Change-Id: I43ae7b78c8f85a131ed3d93ea59da9f32a02cd8f Reviewed-on: https://go-review.googlesource.com/25481 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_darwin_arm64.s')
-rw-r--r--src/runtime/sys_darwin_arm64.s14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s
index a3b851d2fc..8e6b5b1ebf 100644
--- a/src/runtime/sys_darwin_arm64.s
+++ b/src/runtime/sys_darwin_arm64.s
@@ -155,9 +155,14 @@ TEXT time·now(SB),NOSPLIT,$40-12
MOVD RSP, R0 // timeval
MOVD R0, R9 // this is how dyld calls gettimeofday
MOVW $0, R1 // zone
+ MOVD $0, R2 // see issue 16570
MOVW $SYS_gettimeofday, R16
SVC $0x80 // Note: x0 is tv_sec, w1 is tv_usec
-
+ CMP $0, R0
+ BNE inreg
+ MOVD 0(RSP), R0
+ MOVW 8(RSP), R1
+inreg:
MOVD R0, sec+0(FP)
MOVW $1000, R3
MUL R3, R1
@@ -168,9 +173,14 @@ TEXT runtime·nanotime(SB),NOSPLIT,$40
MOVD RSP, R0 // timeval
MOVD R0, R9 // this is how dyld calls gettimeofday
MOVW $0, R1 // zone
+ MOVD $0, R2 // see issue 16570
MOVW $SYS_gettimeofday, R16
SVC $0x80 // Note: x0 is tv_sec, w1 is tv_usec
-
+ CMP $0, R0
+ BNE inreg
+ MOVD 0(RSP), R0
+ MOVW 8(RSP), R1
+inreg:
MOVW $1000000000, R3
MUL R3, R0
MOVW $1000, R3