diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2016-08-01 21:54:40 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2016-10-23 03:47:25 +0000 |
commit | 524c67d0d6cd8d4b96d1272ff0a705ab80ff341a (patch) | |
tree | 58e69d0636559428f135d7485d88c57c20196ffa | |
parent | c26cf5cc1a3a128d1c7e20cf5ca79547263fce38 (diff) | |
download | go-524c67d0d6cd8d4b96d1272ff0a705ab80ff341a.tar.gz go-524c67d0d6cd8d4b96d1272ff0a705ab80ff341a.zip |
runtime: fix nanotime for macOS Sierra, again.
This is a cherry-pick of https://go-review.googlesource.com/25400
to the release-branch-go1.4
macOS Sierra beta4 changed the kernel interface for getting time.
DX now optionally points to an address for additional info.
Set it to zero to avoid corrupting memory.
Fixes #16570
Change-Id: I714325a7749a145d23cf03251db38196ac9c481a
Reviewed-on: https://go-review.googlesource.com/31750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/runtime/sys_darwin_386.s | 7 | ||||
-rw-r--r-- | src/runtime/sys_darwin_amd64.s | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s index 469cabc174..3ae60eb8cc 100644 --- a/src/runtime/sys_darwin_386.s +++ b/src/runtime/sys_darwin_386.s @@ -182,15 +182,16 @@ timeloop: systime: // Fall back to system call (usually first call in this thread) - LEAL 12(SP), AX // must be non-nil, unused + LEAL 16(SP), AX // must be non-nil, unused MOVL AX, 4(SP) MOVL $0, 8(SP) // time zone pointer + MOVL $0, 12(SP) // required as of Sierra; Issue 16570 MOVL $116, AX INT $0x80 CMPL AX, $0 JNE inreg - MOVL 12(SP), AX - MOVL 16(SP), DX + MOVL 16(SP), AX + MOVL 20(SP), DX inreg: // sec is in AX, usec in DX // convert to DX:AX nsec diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s index 8f845e5503..fe9f38490f 100644 --- a/src/runtime/sys_darwin_amd64.s +++ b/src/runtime/sys_darwin_amd64.s @@ -143,6 +143,7 @@ systime: // Fall back to system call (usually first call in this thread). MOVQ SP, DI MOVQ $0, SI + MOVQ $0, DX // required as of Sierra; Issue 16570 MOVL $(0x2000000+116), AX SYSCALL CMPQ AX, $0 |