]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use monotonic clock for timers on freebsd/amd64,386,arm
authorMikio Hara <mikioh.mikioh@gmail.com>
Wed, 26 Feb 2014 01:19:51 +0000 (10:19 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Wed, 26 Feb 2014 01:19:51 +0000 (10:19 +0900)
For now we don't use CLOCK_MONOTONIC_FAST instead because
it's not supported on prior to 9-STABLE.

Update #6007

LGTM=minux.ma
R=golang-codereviews, minux.ma, bradfitz
CC=golang-codereviews
https://golang.org/cl/68690043

src/pkg/runtime/sys_freebsd_386.s
src/pkg/runtime/sys_freebsd_amd64.s
src/pkg/runtime/sys_freebsd_arm.s

index 8b4d2317dc28b8c2964025c2477340fb6bc1eb56..71245a1562834ff806b47c4025d6272d29f975ea 100644 (file)
@@ -135,7 +135,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-4
 TEXT time·now(SB), NOSPLIT, $32
        MOVL    $232, AX
        LEAL    12(SP), BX
-       MOVL    $0, 4(SP)
+       MOVL    $0, 4(SP)       // CLOCK_REALTIME
        MOVL    BX, 8(SP)
        INT     $0x80
        MOVL    12(SP), AX      // sec
@@ -152,7 +152,9 @@ TEXT time·now(SB), NOSPLIT, $32
 TEXT runtime·nanotime(SB), NOSPLIT, $32
        MOVL    $232, AX
        LEAL    12(SP), BX
-       MOVL    $0, 4(SP)
+       // We can use CLOCK_MONOTONIC_FAST here when we drop
+       // support for FreeBSD 8-STABLE.
+       MOVL    $4, 4(SP)       // CLOCK_MONOTONIC
        MOVL    BX, 8(SP)
        INT     $0x80
        MOVL    12(SP), AX      // sec
index 63cd3ac074775ba89f7995fc7584f202386c6b75..4c5b325043bfcd0215b33dca65397fa7250182c9 100644 (file)
@@ -144,7 +144,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8
 // func now() (sec int64, nsec int32)
 TEXT time·now(SB), NOSPLIT, $32
        MOVL    $232, AX
-       MOVQ    $0, DI
+       MOVQ    $0, DI          // CLOCK_REALTIME
        LEAQ    8(SP), SI
        SYSCALL
        MOVQ    8(SP), AX       // sec
@@ -157,7 +157,9 @@ TEXT time·now(SB), NOSPLIT, $32
 
 TEXT runtime·nanotime(SB), NOSPLIT, $32
        MOVL    $232, AX
-       MOVQ    $0, DI
+       // We can use CLOCK_MONOTONIC_FAST here when we drop
+       // support for FreeBSD 8-STABLE.
+       MOVQ    $4, DI          // CLOCK_MONOTONIC
        LEAQ    8(SP), SI
        SYSCALL
        MOVQ    8(SP), AX       // sec
index 106d727990e1c9c38b342330db21812b9e8ebe93..31711de20674a6dbd6958457cac88de61ca6941a 100644 (file)
@@ -162,7 +162,9 @@ TEXT time·now(SB), NOSPLIT, $32
 // int64 nanotime(void) so really
 // void nanotime(int64 *nsec)
 TEXT runtime·nanotime(SB), NOSPLIT, $32
-       MOVW $0, R0 // CLOCK_REALTIME
+       // We can use CLOCK_MONOTONIC_FAST here when we drop
+       // support for FreeBSD 8-STABLE.
+       MOVW $4, R0 // CLOCK_MONOTONIC
        MOVW $8(R13), R1
        MOVW $SYS_clock_gettime, R7
        SWI $0