mirror of
https://github.com/golang/go
synced 2024-11-18 07:54:55 -07:00
runtime: use clock_gettime(CLOCK_REALTIME) for nanosecond-precision time.now on arm64, mips64x
Assembly copied from the clock_gettime(CLOCK_MONOTONIC) call in runtime.nanotime in these files and then modified to use CLOCK_REALTIME. Also comment system call numbers in a few other files. Fixes #11222. Change-Id: Ie132086de7386f865908183aac2713f90fc73e0d Reviewed-on: https://go-review.googlesource.com/32177 Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
aff37662d1
commit
5594074dcd
@ -200,7 +200,7 @@ systime:
|
|||||||
MOVL AX, 4(SP)
|
MOVL AX, 4(SP)
|
||||||
MOVL $0, 8(SP) // time zone pointer
|
MOVL $0, 8(SP) // time zone pointer
|
||||||
MOVL $0, 12(SP) // required as of Sierra; Issue 16570
|
MOVL $0, 12(SP) // required as of Sierra; Issue 16570
|
||||||
MOVL $116, AX
|
MOVL $116, AX // SYS_GETTIMEOFDAY
|
||||||
INT $0x80
|
INT $0x80
|
||||||
CMPL AX, $0
|
CMPL AX, $0
|
||||||
JNE inreg
|
JNE inreg
|
||||||
|
@ -158,7 +158,7 @@ systime:
|
|||||||
MOVQ SP, DI
|
MOVQ SP, DI
|
||||||
MOVQ $0, SI
|
MOVQ $0, SI
|
||||||
MOVQ $0, DX // required as of Sierra; Issue 16570
|
MOVQ $0, DX // required as of Sierra; Issue 16570
|
||||||
MOVL $(0x2000000+116), AX
|
MOVL $(0x2000000+116), AX // gettimeofday
|
||||||
SYSCALL
|
SYSCALL
|
||||||
CMPQ AX, $0
|
CMPQ AX, $0
|
||||||
JNE inreg
|
JNE inreg
|
||||||
|
@ -150,7 +150,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8
|
|||||||
|
|
||||||
// func now() (sec int64, nsec int32)
|
// func now() (sec int64, nsec int32)
|
||||||
TEXT time·now(SB), NOSPLIT, $32
|
TEXT time·now(SB), NOSPLIT, $32
|
||||||
MOVL $232, AX
|
MOVL $232, AX // clock_gettime
|
||||||
MOVQ $0, DI // CLOCK_REALTIME
|
MOVQ $0, DI // CLOCK_REALTIME
|
||||||
LEAQ 8(SP), SI
|
LEAQ 8(SP), SI
|
||||||
SYSCALL
|
SYSCALL
|
||||||
|
@ -161,7 +161,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-4
|
|||||||
|
|
||||||
// func now() (sec int64, nsec int32)
|
// func now() (sec int64, nsec int32)
|
||||||
TEXT time·now(SB), NOSPLIT, $32
|
TEXT time·now(SB), NOSPLIT, $32
|
||||||
MOVL $232, AX
|
MOVL $232, AX // clock_gettime
|
||||||
LEAL 12(SP), BX
|
LEAL 12(SP), BX
|
||||||
MOVL $0, 4(SP) // CLOCK_REALTIME
|
MOVL $0, 4(SP) // CLOCK_REALTIME
|
||||||
MOVL BX, 8(SP)
|
MOVL BX, 8(SP)
|
||||||
|
@ -144,7 +144,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8
|
|||||||
|
|
||||||
// func now() (sec int64, nsec int32)
|
// func now() (sec int64, nsec int32)
|
||||||
TEXT time·now(SB), NOSPLIT, $32
|
TEXT time·now(SB), NOSPLIT, $32
|
||||||
MOVL $232, AX
|
MOVL $232, AX // clock_gettime
|
||||||
MOVQ $0, DI // CLOCK_REALTIME
|
MOVQ $0, DI // CLOCK_REALTIME
|
||||||
LEAQ 8(SP), SI
|
LEAQ 8(SP), SI
|
||||||
SYSCALL
|
SYSCALL
|
||||||
|
@ -184,14 +184,12 @@ TEXT runtime·mincore(SB),NOSPLIT,$-8-28
|
|||||||
|
|
||||||
// func now() (sec int64, nsec int32)
|
// func now() (sec int64, nsec int32)
|
||||||
TEXT time·now(SB),NOSPLIT,$24-12
|
TEXT time·now(SB),NOSPLIT,$24-12
|
||||||
MOVD RSP, R0
|
MOVW $0, R0 // CLOCK_REALTIME
|
||||||
MOVD $0, R1
|
MOVD RSP, R1
|
||||||
MOVD $SYS_gettimeofday, R8
|
MOVD $SYS_clock_gettime, R8
|
||||||
SVC
|
SVC
|
||||||
MOVD 0(RSP), R3 // sec
|
MOVD 0(RSP), R3 // sec
|
||||||
MOVD 8(RSP), R5 // usec
|
MOVD 8(RSP), R5 // nsec
|
||||||
MOVD $1000, R4
|
|
||||||
MUL R4, R5
|
|
||||||
MOVD R3, sec+0(FP)
|
MOVD R3, sec+0(FP)
|
||||||
MOVW R5, nsec+8(FP)
|
MOVW R5, nsec+8(FP)
|
||||||
RET
|
RET
|
||||||
|
@ -174,15 +174,12 @@ TEXT runtime·mincore(SB),NOSPLIT,$-8-28
|
|||||||
|
|
||||||
// func now() (sec int64, nsec int32)
|
// func now() (sec int64, nsec int32)
|
||||||
TEXT time·now(SB),NOSPLIT,$16
|
TEXT time·now(SB),NOSPLIT,$16
|
||||||
MOVV $0(R29), R4
|
MOVW $0, R4 // CLOCK_REALTIME
|
||||||
MOVV $0, R5
|
MOVV $0(R29), R5
|
||||||
MOVV $SYS_gettimeofday, R2
|
MOVV $SYS_clock_gettime, R2
|
||||||
SYSCALL
|
SYSCALL
|
||||||
MOVV 0(R29), R3 // sec
|
MOVV 0(R29), R3 // sec
|
||||||
MOVV 8(R29), R5 // usec
|
MOVV 8(R29), R5 // nsec
|
||||||
MOVV $1000, R4
|
|
||||||
MULVU R4, R5
|
|
||||||
MOVV LO, R5
|
|
||||||
MOVV R3, sec+0(FP)
|
MOVV R3, sec+0(FP)
|
||||||
MOVW R5, nsec+8(FP)
|
MOVW R5, nsec+8(FP)
|
||||||
RET
|
RET
|
||||||
|
Loading…
Reference in New Issue
Block a user