Commit 4af3c17f authored by Austin Clements's avatar Austin Clements

runtime: wrap nanotime, walltime, and write

In preparation for general faketime support, this renames the existing
nanotime, walltime, and write functions to nanotime1, walltime1, and
write1 and wraps them with trivial Go functions. This will let us
inject different implementations on all platforms when faketime is
enabled.

Updates #30439.

Change-Id: Ice5ccc513a32a6d89ea051638676d3ee05b00418
Reviewed-on: https://go-review.googlesource.com/c/go/+/192738
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 6719d889
...@@ -248,13 +248,13 @@ ...@@ -248,13 +248,13 @@
this.mem = new DataView(this._inst.exports.mem.buffer); this.mem = new DataView(this._inst.exports.mem.buffer);
}, },
// func nanotime() int64 // func nanotime1() int64
"runtime.nanotime": (sp) => { "runtime.nanotime1": (sp) => {
setInt64(sp + 8, (timeOrigin + performance.now()) * 1000000); setInt64(sp + 8, (timeOrigin + performance.now()) * 1000000);
}, },
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
"runtime.walltime": (sp) => { "runtime.walltime1": (sp) => {
const msec = (new Date).getTime(); const msec = (new Date).getTime();
setInt64(sp + 8, msec / 1000); setInt64(sp + 8, msec / 1000);
this.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true); this.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true);
......
...@@ -390,10 +390,10 @@ func exit(code int32) { ...@@ -390,10 +390,10 @@ func exit(code int32) {
exit1(code) exit1(code)
} }
func write1(fd, p uintptr, n int32) int32 func write2(fd, p uintptr, n int32) int32
//go:nosplit //go:nosplit
func write(fd uintptr, p unsafe.Pointer, n int32) int32 { func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
_g_ := getg() _g_ := getg()
// Check the validity of g because without a g during // Check the validity of g because without a g during
...@@ -402,7 +402,7 @@ func write(fd uintptr, p unsafe.Pointer, n int32) int32 { ...@@ -402,7 +402,7 @@ func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
r, _ := syscall3(&libc_write, uintptr(fd), uintptr(p), uintptr(n)) r, _ := syscall3(&libc_write, uintptr(fd), uintptr(p), uintptr(n))
return int32(r) return int32(r)
} }
return write1(fd, uintptr(p), n) return write2(fd, uintptr(p), n)
} }
......
...@@ -393,11 +393,11 @@ func munmap(addr unsafe.Pointer, n uintptr) { ...@@ -393,11 +393,11 @@ func munmap(addr unsafe.Pointer, n uintptr) {
sysvicall2(&libc_munmap, uintptr(addr), uintptr(n)) sysvicall2(&libc_munmap, uintptr(addr), uintptr(n))
} }
func nanotime1() func nanotime2()
//go:nosplit //go:nosplit
func nanotime() int64 { func nanotime1() int64 {
return int64(sysvicall0((*libcFunc)(unsafe.Pointer(funcPC(nanotime1))))) return int64(sysvicall0((*libcFunc)(unsafe.Pointer(funcPC(nanotime2)))))
} }
//go:nosplit //go:nosplit
...@@ -499,7 +499,7 @@ func usleep(µs uint32) { ...@@ -499,7 +499,7 @@ func usleep(µs uint32) {
} }
//go:nosplit //go:nosplit
func write(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 { func write1(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
return int32(sysvicall3(&libc_write, uintptr(fd), uintptr(buf), uintptr(nbyte))) return int32(sysvicall3(&libc_write, uintptr(fd), uintptr(buf), uintptr(nbyte)))
} }
......
...@@ -323,7 +323,7 @@ const ( ...@@ -323,7 +323,7 @@ const (
) )
//go:nosplit //go:nosplit
func nanotime() int64 { func nanotime1() int64 {
tp := &timespec{} tp := &timespec{}
if clock_gettime(_CLOCK_REALTIME, tp) != 0 { if clock_gettime(_CLOCK_REALTIME, tp) != 0 {
throw("syscall clock_gettime failed") throw("syscall clock_gettime failed")
...@@ -331,7 +331,7 @@ func nanotime() int64 { ...@@ -331,7 +331,7 @@ func nanotime() int64 {
return tp.tv_sec*1000000000 + tp.tv_nsec return tp.tv_sec*1000000000 + tp.tv_nsec
} }
func walltime() (sec int64, nsec int32) { func walltime1() (sec int64, nsec int32) {
ts := &timespec{} ts := &timespec{}
if clock_gettime(_CLOCK_REALTIME, ts) != 0 { if clock_gettime(_CLOCK_REALTIME, ts) != 0 {
throw("syscall clock_gettime failed") throw("syscall clock_gettime failed")
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
func exit(code int32) func exit(code int32)
func write(fd uintptr, p unsafe.Pointer, n int32) int32 { func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
if fd > 2 { if fd > 2 {
throw("runtime.write to fd > 2 is unsupported") throw("runtime.write to fd > 2 is unsupported")
} }
......
...@@ -300,6 +300,8 @@ var lastfaketime int64 ...@@ -300,6 +300,8 @@ var lastfaketime int64
// but the timestamp must increase if the fd changes. // but the timestamp must increase if the fd changes.
var lastfaketimefd int32 var lastfaketimefd int32
func walltime() (sec int64, nsec int32)
/* /*
An attempt at IRT. Doesn't work. See end of sys_nacl_amd64.s. An attempt at IRT. Doesn't work. See end of sys_nacl_amd64.s.
......
...@@ -328,7 +328,7 @@ func usleep(µs uint32) { ...@@ -328,7 +328,7 @@ func usleep(µs uint32) {
} }
//go:nosplit //go:nosplit
func nanotime() int64 { func nanotime1() int64 {
var scratch int64 var scratch int64
ns := nsec(&scratch) ns := nsec(&scratch)
// TODO(aram): remove hack after I fix _nsec in the pc64 kernel. // TODO(aram): remove hack after I fix _nsec in the pc64 kernel.
...@@ -373,7 +373,7 @@ func postnote(pid uint64, msg []byte) int { ...@@ -373,7 +373,7 @@ func postnote(pid uint64, msg []byte) int {
return -1 return -1
} }
len := findnull(&msg[0]) len := findnull(&msg[0])
if write(uintptr(fd), unsafe.Pointer(&msg[0]), int32(len)) != int64(len) { if write1(uintptr(fd), unsafe.Pointer(&msg[0]), int32(len)) != int32(len) {
closefd(fd) closefd(fd)
return -1 return -1
} }
...@@ -451,8 +451,8 @@ func read(fd int32, buf unsafe.Pointer, n int32) int32 { ...@@ -451,8 +451,8 @@ func read(fd int32, buf unsafe.Pointer, n int32) int32 {
} }
//go:nosplit //go:nosplit
func write(fd uintptr, buf unsafe.Pointer, n int32) int64 { func write1(fd uintptr, buf unsafe.Pointer, n int32) int32 {
return int64(pwrite(int32(fd), buf, n, -1)) return pwrite(int32(fd), buf, n, -1)
} }
var _badsignal = []byte("runtime: signal received on thread not created by Go.\n") var _badsignal = []byte("runtime: signal received on thread not created by Go.\n")
......
...@@ -416,8 +416,6 @@ func osinit() { ...@@ -416,8 +416,6 @@ func osinit() {
stdcall2(_SetProcessPriorityBoost, currentProcess, 1) stdcall2(_SetProcessPriorityBoost, currentProcess, 1)
} }
func nanotime() int64
// useQPCTime controls whether time.now and nanotime use QueryPerformanceCounter. // useQPCTime controls whether time.now and nanotime use QueryPerformanceCounter.
// This is only set to 1 when running under Wine. // This is only set to 1 when running under Wine.
var useQPCTime uint8 var useQPCTime uint8
...@@ -542,8 +540,12 @@ func exit(code int32) { ...@@ -542,8 +540,12 @@ func exit(code int32) {
stdcall1(_ExitProcess, uintptr(code)) stdcall1(_ExitProcess, uintptr(code))
} }
// write1 must be nosplit because it's used as a last resort in
// functions like badmorestackg0. In such cases, we'll always take the
// ASCII path.
//
//go:nosplit //go:nosplit
func write(fd uintptr, buf unsafe.Pointer, n int32) int32 { func write1(fd uintptr, buf unsafe.Pointer, n int32) int32 {
const ( const (
_STD_OUTPUT_HANDLE = ^uintptr(10) // -11 _STD_OUTPUT_HANDLE = ^uintptr(10) // -11
_STD_ERROR_HANDLE = ^uintptr(11) // -12 _STD_ERROR_HANDLE = ^uintptr(11) // -12
...@@ -640,6 +642,9 @@ func writeConsoleUTF16(handle uintptr, b []uint16) { ...@@ -640,6 +642,9 @@ func writeConsoleUTF16(handle uintptr, b []uint16) {
return return
} }
// walltime1 isn't implemented on Windows, but will never be called.
func walltime1() (sec int64, nsec int32)
//go:nosplit //go:nosplit
func semasleep(ns int64) int32 { func semasleep(ns int64) int32 {
const ( const (
......
...@@ -21,7 +21,7 @@ func exit(code int32) ...@@ -21,7 +21,7 @@ func exit(code int32)
func usleep(usec uint32) func usleep(usec uint32)
//go:noescape //go:noescape
func write(fd uintptr, p unsafe.Pointer, n int32) int32 func write1(fd uintptr, p unsafe.Pointer, n int32) int32
//go:noescape //go:noescape
func open(name *byte, mode, perm int32) int32 func open(name *byte, mode, perm int32) int32
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
// +build !plan9 // +build !plan9
// +build !solaris // +build !solaris
// +build !windows
// +build !nacl // +build !nacl
// +build !freebsd // +build !freebsd
// +build !darwin // +build !darwin
...@@ -12,4 +11,4 @@ ...@@ -12,4 +11,4 @@
package runtime package runtime
func nanotime() int64 func nanotime1() int64
...@@ -258,8 +258,8 @@ TEXT runtime·exit1(SB),NOSPLIT,$0-4 ...@@ -258,8 +258,8 @@ TEXT runtime·exit1(SB),NOSPLIT,$0-4
CSYSCALL() CSYSCALL()
RET RET
// Runs on OS stack, called from runtime·write. // Runs on OS stack, called from runtime·write1.
TEXT runtime·write1(SB),NOSPLIT,$0-28 TEXT runtime·write2(SB),NOSPLIT,$0-28
MOVD fd+0(FP), R3 MOVD fd+0(FP), R3
MOVD p+8(FP), R4 MOVD p+8(FP), R4
MOVW n+16(FP), R5 MOVW n+16(FP), R5
......
...@@ -230,7 +230,7 @@ func usleep_trampoline() ...@@ -230,7 +230,7 @@ func usleep_trampoline()
//go:nosplit //go:nosplit
//go:cgo_unsafe_args //go:cgo_unsafe_args
func write(fd uintptr, p unsafe.Pointer, n int32) int32 { func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
return libcCall(unsafe.Pointer(funcPC(write_trampoline)), unsafe.Pointer(&fd)) return libcCall(unsafe.Pointer(funcPC(write_trampoline)), unsafe.Pointer(&fd))
} }
func write_trampoline() func write_trampoline()
...@@ -244,7 +244,7 @@ func open_trampoline() ...@@ -244,7 +244,7 @@ func open_trampoline()
//go:nosplit //go:nosplit
//go:cgo_unsafe_args //go:cgo_unsafe_args
func nanotime() int64 { func nanotime1() int64 {
var r struct { var r struct {
t int64 // raw timer t int64 // raw timer
numer, denom uint32 // conversion factors. nanoseconds = t * numer / denom. numer, denom uint32 // conversion factors. nanoseconds = t * numer / denom.
...@@ -266,7 +266,7 @@ func nanotime_trampoline() ...@@ -266,7 +266,7 @@ func nanotime_trampoline()
//go:nosplit //go:nosplit
//go:cgo_unsafe_args //go:cgo_unsafe_args
func walltime() (int64, int32) { func walltime1() (int64, int32) {
var t timeval var t timeval
libcCall(unsafe.Pointer(funcPC(walltime_trampoline)), unsafe.Pointer(&t)) libcCall(unsafe.Pointer(funcPC(walltime_trampoline)), unsafe.Pointer(&t))
return int64(t.tv_sec), 1000 * t.tv_usec return int64(t.tv_sec), 1000 * t.tv_usec
......
...@@ -108,7 +108,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8 ...@@ -108,7 +108,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8
MOVL AX, ret+24(FP) MOVL AX, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-8 TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 fd MOVQ fd+0(FP), DI // arg 1 fd
MOVQ p+8(FP), SI // arg 2 buf MOVQ p+8(FP), SI // arg 2 buf
MOVL n+16(FP), DX // arg 3 count MOVL n+16(FP), DX // arg 3 count
...@@ -146,8 +146,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8 ...@@ -146,8 +146,8 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8
SYSCALL SYSCALL
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVL $232, AX // clock_gettime MOVL $232, AX // clock_gettime
MOVQ $0, DI // CLOCK_REALTIME MOVQ $0, DI // CLOCK_REALTIME
LEAQ 8(SP), SI LEAQ 8(SP), SI
...@@ -160,7 +160,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -160,7 +160,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVL DX, nsec+8(FP) MOVL DX, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB), NOSPLIT, $32 TEXT runtime·nanotime1(SB), NOSPLIT, $32
MOVL $232, AX MOVL $232, AX
MOVQ $4, DI // CLOCK_MONOTONIC MOVQ $4, DI // CLOCK_MONOTONIC
LEAQ 8(SP), SI LEAQ 8(SP), SI
......
...@@ -97,7 +97,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4 ...@@ -97,7 +97,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP) MOVL AX, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-4 TEXT runtime·write1(SB),NOSPLIT,$-4
MOVL $4, AX MOVL $4, AX
INT $0x80 INT $0x80
JAE 2(PC) JAE 2(PC)
......
...@@ -97,7 +97,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8 ...@@ -97,7 +97,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8
MOVL AX, ret+24(FP) MOVL AX, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-8 TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 fd MOVQ fd+0(FP), DI // arg 1 fd
MOVQ p+8(FP), SI // arg 2 buf MOVQ p+8(FP), SI // arg 2 buf
MOVL n+16(FP), DX // arg 3 count MOVL n+16(FP), DX // arg 3 count
......
...@@ -119,7 +119,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 ...@@ -119,7 +119,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
MOVW R0, ret+12(FP) MOVW R0, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 fd MOVW fd+0(FP), R0 // arg 1 fd
MOVW p+4(FP), R1 // arg 2 buf MOVW p+4(FP), R1 // arg 2 buf
MOVW n+8(FP), R2 // arg 3 count MOVW n+8(FP), R2 // arg 3 count
......
...@@ -107,7 +107,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0 ...@@ -107,7 +107,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL AX, ret+4(FP) MOVL AX, ret+4(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$0 TEXT runtime·write1(SB),NOSPLIT,$0
MOVL $SYS_write, AX MOVL $SYS_write, AX
MOVL fd+0(FP), BX MOVL fd+0(FP), BX
MOVL p+4(FP), CX MOVL p+4(FP), CX
...@@ -192,8 +192,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16 ...@@ -192,8 +192,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16
MOVL AX, ret+12(FP) MOVL AX, ret+12(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $0-12 TEXT runtime·walltime1(SB), NOSPLIT, $0-12
// We don't know how much stack space the VDSO code will need, // We don't know how much stack space the VDSO code will need,
// so switch to g0. // so switch to g0.
...@@ -257,7 +257,7 @@ finish: ...@@ -257,7 +257,7 @@ finish:
// int64 nanotime(void) so really // int64 nanotime(void) so really
// void nanotime(int64 *nsec) // void nanotime(int64 *nsec)
TEXT runtime·nanotime(SB), NOSPLIT, $0-8 TEXT runtime·nanotime1(SB), NOSPLIT, $0-8
// Switch to g0 stack. See comment above in runtime·walltime. // Switch to g0 stack. See comment above in runtime·walltime.
MOVL SP, BP // Save old SP; BP unchanged by C code. MOVL SP, BP // Save old SP; BP unchanged by C code.
......
...@@ -89,7 +89,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0-12 ...@@ -89,7 +89,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0-12
MOVL AX, ret+8(FP) MOVL AX, ret+8(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$0-28 TEXT runtime·write1(SB),NOSPLIT,$0-28
MOVQ fd+0(FP), DI MOVQ fd+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVL n+16(FP), DX MOVL n+16(FP), DX
...@@ -175,8 +175,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-28 ...@@ -175,8 +175,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-28
MOVL AX, ret+24(FP) MOVL AX, ret+24(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$0-12 TEXT runtime·walltime1(SB),NOSPLIT,$0-12
// We don't know how much stack space the VDSO code will need, // We don't know how much stack space the VDSO code will need,
// so switch to g0. // so switch to g0.
// In particular, a kernel configured with CONFIG_OPTIMIZE_INLINING=n // In particular, a kernel configured with CONFIG_OPTIMIZE_INLINING=n
...@@ -233,7 +233,7 @@ fallback: ...@@ -233,7 +233,7 @@ fallback:
MOVL DX, nsec+8(FP) MOVL DX, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$0-8 TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
// Switch to g0 stack. See comment above in runtime·walltime. // Switch to g0 stack. See comment above in runtime·walltime.
MOVQ SP, BP // Save old SP; BP unchanged by C code. MOVQ SP, BP // Save old SP; BP unchanged by C code.
......
...@@ -75,7 +75,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0 ...@@ -75,7 +75,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0
MOVW R0, ret+4(FP) MOVW R0, ret+4(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$0 TEXT runtime·write1(SB),NOSPLIT,$0
MOVW fd+0(FP), R0 MOVW fd+0(FP), R0
MOVW p+4(FP), R1 MOVW p+4(FP), R1
MOVW n+8(FP), R2 MOVW n+8(FP), R2
...@@ -215,7 +215,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0 ...@@ -215,7 +215,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0
MOVW R0, ret+12(FP) MOVW R0, ret+12(FP)
RET RET
TEXT runtime·walltime(SB),NOSPLIT,$0-12 TEXT runtime·walltime1(SB),NOSPLIT,$0-12
// We don't know how much stack space the VDSO code will need, // We don't know how much stack space the VDSO code will need,
// so switch to g0. // so switch to g0.
...@@ -266,8 +266,8 @@ finish: ...@@ -266,8 +266,8 @@ finish:
MOVW R2, nsec+8(FP) MOVW R2, nsec+8(FP)
RET RET
// int64 nanotime(void) // int64 nanotime1(void)
TEXT runtime·nanotime(SB),NOSPLIT,$0-8 TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
// Switch to g0 stack. See comment above in runtime·walltime. // Switch to g0 stack. See comment above in runtime·walltime.
// Save old SP. Use R13 instead of SP to avoid linker rewriting the offsets. // Save old SP. Use R13 instead of SP to avoid linker rewriting the offsets.
......
...@@ -91,7 +91,7 @@ done: ...@@ -91,7 +91,7 @@ done:
MOVW R0, ret+8(FP) MOVW R0, ret+8(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0-28 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-28
MOVD fd+0(FP), R0 MOVD fd+0(FP), R0
MOVD p+8(FP), R1 MOVD p+8(FP), R1
MOVW n+16(FP), R2 MOVW n+16(FP), R2
...@@ -181,8 +181,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 ...@@ -181,8 +181,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
MOVW R0, ret+24(FP) MOVW R0, ret+24(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$24-12 TEXT runtime·walltime1(SB),NOSPLIT,$24-12
MOVD RSP, R20 // R20 is unchanged by C code MOVD RSP, R20 // R20 is unchanged by C code
MOVD RSP, R1 MOVD RSP, R1
...@@ -225,7 +225,7 @@ finish: ...@@ -225,7 +225,7 @@ finish:
MOVW R5, nsec+8(FP) MOVW R5, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$24-8 TEXT runtime·nanotime1(SB),NOSPLIT,$24-8
MOVD RSP, R20 // R20 is unchanged by C code MOVD RSP, R20 // R20 is unchanged by C code
MOVD RSP, R1 MOVD RSP, R1
......
...@@ -88,7 +88,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12 ...@@ -88,7 +88,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12
MOVW R2, ret+8(FP) MOVW R2, ret+8(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0-28 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-28
MOVV fd+0(FP), R4 MOVV fd+0(FP), R4
MOVV p+8(FP), R5 MOVV p+8(FP), R5
MOVW n+16(FP), R6 MOVW n+16(FP), R6
...@@ -176,8 +176,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 ...@@ -176,8 +176,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
MOVW R2, ret+24(FP) MOVW R2, ret+24(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$16 TEXT runtime·walltime1(SB),NOSPLIT,$16
MOVW $0, R4 // CLOCK_REALTIME MOVW $0, R4 // CLOCK_REALTIME
MOVV $0(R29), R5 MOVV $0(R29), R5
MOVV $SYS_clock_gettime, R2 MOVV $SYS_clock_gettime, R2
...@@ -188,7 +188,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 ...@@ -188,7 +188,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16
MOVW R5, nsec+8(FP) MOVW R5, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$16 TEXT runtime·nanotime1(SB),NOSPLIT,$16
MOVW $1, R4 // CLOCK_MONOTONIC MOVW $1, R4 // CLOCK_MONOTONIC
MOVV $0(R29), R5 MOVV $0(R29), R5
MOVV $SYS_clock_gettime, R2 MOVV $SYS_clock_gettime, R2
......
...@@ -86,7 +86,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0-8 ...@@ -86,7 +86,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0-8
MOVW R2, ret+4(FP) MOVW R2, ret+4(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$0-16 TEXT runtime·write1(SB),NOSPLIT,$0-16
MOVW fd+0(FP), R4 MOVW fd+0(FP), R4
MOVW p+4(FP), R5 MOVW p+4(FP), R5
MOVW n+8(FP), R6 MOVW n+8(FP), R6
...@@ -174,8 +174,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16 ...@@ -174,8 +174,8 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16
MOVW R2, ret+12(FP) MOVW R2, ret+12(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$8-12 TEXT runtime·walltime1(SB),NOSPLIT,$8-12
MOVW $0, R4 // CLOCK_REALTIME MOVW $0, R4 // CLOCK_REALTIME
MOVW $4(R29), R5 MOVW $4(R29), R5
MOVW $SYS_clock_gettime, R2 MOVW $SYS_clock_gettime, R2
...@@ -193,7 +193,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12 ...@@ -193,7 +193,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12
MOVW R5, nsec+8(FP) MOVW R5, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$8-8 TEXT runtime·nanotime1(SB),NOSPLIT,$8-8
MOVW $1, R4 // CLOCK_MONOTONIC MOVW $1, R4 // CLOCK_MONOTONIC
MOVW $4(R29), R5 MOVW $4(R29), R5
MOVW $SYS_clock_gettime, R2 MOVW $SYS_clock_gettime, R2
......
...@@ -80,7 +80,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12 ...@@ -80,7 +80,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12
MOVW R3, ret+8(FP) MOVW R3, ret+8(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0-28 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-28
MOVD fd+0(FP), R3 MOVD fd+0(FP), R3
MOVD p+8(FP), R4 MOVD p+8(FP), R4
MOVW n+16(FP), R5 MOVW n+16(FP), R5
...@@ -155,8 +155,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 ...@@ -155,8 +155,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
MOVW R3, ret+24(FP) MOVW R3, ret+24(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$16 TEXT runtime·walltime1(SB),NOSPLIT,$16
MOVD R1, R15 // R15 is unchanged by C code MOVD R1, R15 // R15 is unchanged by C code
MOVD g_m(g), R21 // R21 = m MOVD g_m(g), R21 // R21 = m
...@@ -203,7 +203,7 @@ fallback: ...@@ -203,7 +203,7 @@ fallback:
MOVD 40(R1), R5 MOVD 40(R1), R5
JMP finish JMP finish
TEXT runtime·nanotime(SB),NOSPLIT,$16 TEXT runtime·nanotime1(SB),NOSPLIT,$16
MOVD $1, R3 // CLOCK_MONOTONIC MOVD $1, R3 // CLOCK_MONOTONIC
MOVD R1, R15 // R15 is unchanged by C code MOVD R1, R15 // R15 is unchanged by C code
......
...@@ -80,7 +80,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12 ...@@ -80,7 +80,7 @@ TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12
MOVW R2, ret+8(FP) MOVW R2, ret+8(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0-28 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-28
MOVD fd+0(FP), R2 MOVD fd+0(FP), R2
MOVD p+8(FP), R3 MOVD p+8(FP), R3
MOVW n+16(FP), R4 MOVW n+16(FP), R4
...@@ -167,8 +167,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28 ...@@ -167,8 +167,8 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
MOVW R2, ret+24(FP) MOVW R2, ret+24(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$16 TEXT runtime·walltime1(SB),NOSPLIT,$16
MOVW $0, R2 // CLOCK_REALTIME MOVW $0, R2 // CLOCK_REALTIME
MOVD $tp-16(SP), R3 MOVD $tp-16(SP), R3
MOVW $SYS_clock_gettime, R1 MOVW $SYS_clock_gettime, R1
...@@ -179,7 +179,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 ...@@ -179,7 +179,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16
MOVW R3, nsec+8(FP) MOVW R3, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$16 TEXT runtime·nanotime1(SB),NOSPLIT,$16
MOVW $1, R2 // CLOCK_MONOTONIC MOVW $1, R2 // CLOCK_MONOTONIC
MOVD $tp-16(SP), R3 MOVD $tp-16(SP), R3
MOVW $SYS_clock_gettime, R1 MOVW $SYS_clock_gettime, R1
......
...@@ -87,7 +87,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4 ...@@ -87,7 +87,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP) MOVL AX, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-4 TEXT runtime·write1(SB),NOSPLIT,$-4
MOVL $SYS_write, AX MOVL $SYS_write, AX
INT $0x80 INT $0x80
JAE 2(PC) JAE 2(PC)
...@@ -181,8 +181,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4 ...@@ -181,8 +181,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4
INT $0x80 INT $0x80
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
LEAL 12(SP), BX LEAL 12(SP), BX
MOVL $CLOCK_REALTIME, 4(SP) // arg 1 - clock_id MOVL $CLOCK_REALTIME, 4(SP) // arg 1 - clock_id
MOVL BX, 8(SP) // arg 2 - tp MOVL BX, 8(SP) // arg 2 - tp
...@@ -198,9 +198,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -198,9 +198,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVL BX, nsec+8(FP) MOVL BX, nsec+8(FP)
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB),NOSPLIT,$32 TEXT runtime·nanotime1(SB),NOSPLIT,$32
LEAL 12(SP), BX LEAL 12(SP), BX
MOVL $CLOCK_MONOTONIC, 4(SP) // arg 1 - clock_id MOVL $CLOCK_MONOTONIC, 4(SP) // arg 1 - clock_id
MOVL BX, 8(SP) // arg 2 - tp MOVL BX, 8(SP) // arg 2 - tp
......
...@@ -158,7 +158,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8 ...@@ -158,7 +158,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8
MOVL AX, ret+24(FP) MOVL AX, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-8 TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 - fd MOVQ fd+0(FP), DI // arg 1 - fd
MOVQ p+8(FP), SI // arg 2 - buf MOVQ p+8(FP), SI // arg 2 - buf
MOVL n+16(FP), DX // arg 3 - nbyte MOVL n+16(FP), DX // arg 3 - nbyte
...@@ -211,8 +211,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8 ...@@ -211,8 +211,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8
SYSCALL SYSCALL
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVQ $CLOCK_REALTIME, DI // arg 1 - clock_id MOVQ $CLOCK_REALTIME, DI // arg 1 - clock_id
LEAQ 8(SP), SI // arg 2 - tp LEAQ 8(SP), SI // arg 2 - tp
MOVL $SYS___clock_gettime50, AX MOVL $SYS___clock_gettime50, AX
...@@ -225,7 +225,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -225,7 +225,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVL DX, nsec+8(FP) MOVL DX, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$32 TEXT runtime·nanotime1(SB),NOSPLIT,$32
MOVQ $CLOCK_MONOTONIC, DI // arg 1 - clock_id MOVQ $CLOCK_MONOTONIC, DI // arg 1 - clock_id
LEAQ 8(SP), SI // arg 2 - tp LEAQ 8(SP), SI // arg 2 - tp
MOVL $SYS___clock_gettime50, AX MOVL $SYS___clock_gettime50, AX
......
...@@ -96,7 +96,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 ...@@ -96,7 +96,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
MOVW R0, ret+12(FP) MOVW R0, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 - fd MOVW fd+0(FP), R0 // arg 1 - fd
MOVW p+4(FP), R1 // arg 2 - buf MOVW p+4(FP), R1 // arg 2 - buf
MOVW n+8(FP), R2 // arg 3 - nbyte MOVW n+8(FP), R2 // arg 3 - nbyte
...@@ -188,8 +188,8 @@ TEXT runtime·setitimer(SB),NOSPLIT|NOFRAME,$0 ...@@ -188,8 +188,8 @@ TEXT runtime·setitimer(SB),NOSPLIT|NOFRAME,$0
SWI $SYS___setitimer50 SWI $SYS___setitimer50
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVW $0, R0 // CLOCK_REALTIME MOVW $0, R0 // CLOCK_REALTIME
MOVW $8(R13), R1 MOVW $8(R13), R1
SWI $SYS___clock_gettime50 SWI $SYS___clock_gettime50
...@@ -203,9 +203,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -203,9 +203,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVW R2, nsec+8(FP) MOVW R2, nsec+8(FP)
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB), NOSPLIT, $32 TEXT runtime·nanotime1(SB), NOSPLIT, $32
MOVW $3, R0 // CLOCK_MONOTONIC MOVW $3, R0 // CLOCK_MONOTONIC
MOVW $8(R13), R1 MOVW $8(R13), R1
SWI $SYS___clock_gettime50 SWI $SYS___clock_gettime50
......
...@@ -146,7 +146,7 @@ ok: ...@@ -146,7 +146,7 @@ ok:
MOVW R0, ret+24(FP) MOVW R0, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-8 TEXT runtime·write1(SB),NOSPLIT,$-8
MOVD fd+0(FP), R0 // arg 1 - fd MOVD fd+0(FP), R0 // arg 1 - fd
MOVD p+8(FP), R1 // arg 2 - buf MOVD p+8(FP), R1 // arg 2 - buf
MOVW n+16(FP), R2 // arg 3 - nbyte MOVW n+16(FP), R2 // arg 3 - nbyte
...@@ -195,8 +195,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8 ...@@ -195,8 +195,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8
SVC $SYS___setitimer50 SVC $SYS___setitimer50
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVW $CLOCK_REALTIME, R0 // arg 1 - clock_id MOVW $CLOCK_REALTIME, R0 // arg 1 - clock_id
MOVD $8(RSP), R1 // arg 2 - tp MOVD $8(RSP), R1 // arg 2 - tp
SVC $SYS___clock_gettime50 SVC $SYS___clock_gettime50
...@@ -209,9 +209,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -209,9 +209,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVW R1, nsec+8(FP) MOVW R1, nsec+8(FP)
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB), NOSPLIT, $32 TEXT runtime·nanotime1(SB), NOSPLIT, $32
MOVD $CLOCK_MONOTONIC, R0 // arg 1 - clock_id MOVD $CLOCK_MONOTONIC, R0 // arg 1 - clock_id
MOVD $8(RSP), R1 // arg 2 - tp MOVD $8(RSP), R1 // arg 2 - tp
SVC $SYS___clock_gettime50 SVC $SYS___clock_gettime50
......
...@@ -50,7 +50,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4 ...@@ -50,7 +50,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP) MOVL AX, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-4 TEXT runtime·write1(SB),NOSPLIT,$-4
MOVL $4, AX // sys_write MOVL $4, AX // sys_write
INT $0x80 INT $0x80
JAE 2(PC) JAE 2(PC)
...@@ -145,8 +145,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4 ...@@ -145,8 +145,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-4
INT $0x80 INT $0x80
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
LEAL 12(SP), BX LEAL 12(SP), BX
MOVL $0, 4(SP) // arg 1 - clock_id MOVL $0, 4(SP) // arg 1 - clock_id
MOVL BX, 8(SP) // arg 2 - tp MOVL BX, 8(SP) // arg 2 - tp
...@@ -162,9 +162,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -162,9 +162,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVL BX, nsec+8(FP) MOVL BX, nsec+8(FP)
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB),NOSPLIT,$32 TEXT runtime·nanotime1(SB),NOSPLIT,$32
LEAL 12(SP), BX LEAL 12(SP), BX
MOVL CLOCK_MONOTONIC, 4(SP) // arg 1 - clock_id MOVL CLOCK_MONOTONIC, 4(SP) // arg 1 - clock_id
MOVL BX, 8(SP) // arg 2 - tp MOVL BX, 8(SP) // arg 2 - tp
......
...@@ -127,7 +127,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8 ...@@ -127,7 +127,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8
MOVL AX, ret+24(FP) MOVL AX, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT,$-8 TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 - fd MOVQ fd+0(FP), DI // arg 1 - fd
MOVQ p+8(FP), SI // arg 2 - buf MOVQ p+8(FP), SI // arg 2 - buf
MOVL n+16(FP), DX // arg 3 - nbyte MOVL n+16(FP), DX // arg 3 - nbyte
...@@ -181,8 +181,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8 ...@@ -181,8 +181,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8
SYSCALL SYSCALL
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVQ $0, DI // arg 1 - clock_id MOVQ $0, DI // arg 1 - clock_id
LEAQ 8(SP), SI // arg 2 - tp LEAQ 8(SP), SI // arg 2 - tp
MOVL $87, AX // sys_clock_gettime MOVL $87, AX // sys_clock_gettime
...@@ -195,7 +195,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -195,7 +195,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
MOVL DX, nsec+8(FP) MOVL DX, nsec+8(FP)
RET RET
TEXT runtime·nanotime(SB),NOSPLIT,$24 TEXT runtime·nanotime1(SB),NOSPLIT,$24
MOVQ CLOCK_MONOTONIC, DI // arg 1 - clock_id MOVQ CLOCK_MONOTONIC, DI // arg 1 - clock_id
LEAQ 8(SP), SI // arg 2 - tp LEAQ 8(SP), SI // arg 2 - tp
MOVL $87, AX // sys_clock_gettime MOVL $87, AX // sys_clock_gettime
......
...@@ -59,7 +59,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 ...@@ -59,7 +59,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
MOVW R0, ret+12(FP) MOVW R0, ret+12(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 - fd MOVW fd+0(FP), R0 // arg 1 - fd
MOVW p+4(FP), R1 // arg 2 - buf MOVW p+4(FP), R1 // arg 2 - buf
MOVW n+8(FP), R2 // arg 3 - nbyte MOVW n+8(FP), R2 // arg 3 - nbyte
...@@ -155,8 +155,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0 ...@@ -155,8 +155,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0
SWI $0 SWI $0
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id
MOVW $8(R13), R1 // arg 2 - tp MOVW $8(R13), R1 // arg 2 - tp
MOVW $87, R12 // sys_clock_gettime MOVW $87, R12 // sys_clock_gettime
...@@ -172,9 +172,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -172,9 +172,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB),NOSPLIT,$32 TEXT runtime·nanotime1(SB),NOSPLIT,$32
MOVW CLOCK_MONOTONIC, R0 // arg 1 - clock_id MOVW CLOCK_MONOTONIC, R0 // arg 1 - clock_id
MOVW $8(R13), R1 // arg 2 - tp MOVW $8(R13), R1 // arg 2 - tp
MOVW $87, R12 // sys_clock_gettime MOVW $87, R12 // sys_clock_gettime
......
...@@ -63,7 +63,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 ...@@ -63,7 +63,7 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
MOVW R0, ret+24(FP) MOVW R0, ret+24(FP)
RET RET
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // arg 1 - fd MOVW fd+0(FP), R0 // arg 1 - fd
MOVD p+8(FP), R1 // arg 2 - buf MOVD p+8(FP), R1 // arg 2 - buf
MOVW n+16(FP), R2 // arg 3 - nbyte MOVW n+16(FP), R2 // arg 3 - nbyte
...@@ -158,8 +158,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0 ...@@ -158,8 +158,8 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0
SVC SVC
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB), NOSPLIT, $32 TEXT runtime·walltime1(SB), NOSPLIT, $32
MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id
MOVD $8(RSP), R1 // arg 2 - tp MOVD $8(RSP), R1 // arg 2 - tp
MOVD $87, R8 // sys_clock_gettime MOVD $87, R8 // sys_clock_gettime
...@@ -172,9 +172,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 ...@@ -172,9 +172,9 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
RET RET
// int64 nanotime(void) so really // int64 nanotime1(void) so really
// void nanotime(int64 *nsec) // void nanotime1(int64 *nsec)
TEXT runtime·nanotime(SB),NOSPLIT,$32 TEXT runtime·nanotime1(SB),NOSPLIT,$32
MOVW CLOCK_MONOTONIC, R0 // arg 1 - clock_id MOVW CLOCK_MONOTONIC, R0 // arg 1 - clock_id
MOVD $8(RSP), R1 // arg 2 - tp MOVD $8(RSP), R1 // arg 2 - tp
MOVD $87, R8 // sys_clock_gettime MOVD $87, R8 // sys_clock_gettime
......
...@@ -102,9 +102,9 @@ TEXT runtime·nsec(SB),NOSPLIT,$8 ...@@ -102,9 +102,9 @@ TEXT runtime·nsec(SB),NOSPLIT,$8
MOVL $-1, ret_hi+8(FP) MOVL $-1, ret_hi+8(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$8-12 TEXT runtime·walltime1(SB),NOSPLIT,$8-12
CALL runtime·nanotime(SB) CALL runtime·nanotime1(SB)
MOVL 0(SP), AX MOVL 0(SP), AX
MOVL 4(SP), DX MOVL 4(SP), DX
......
...@@ -88,9 +88,9 @@ TEXT runtime·nsec(SB),NOSPLIT,$0 ...@@ -88,9 +88,9 @@ TEXT runtime·nsec(SB),NOSPLIT,$0
MOVQ AX, ret+8(FP) MOVQ AX, ret+8(FP)
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$8-12 TEXT runtime·walltime1(SB),NOSPLIT,$8-12
CALL runtime·nanotime(SB) CALL runtime·nanotime1(SB)
MOVQ 0(SP), AX MOVQ 0(SP), AX
// generated code for // generated code for
......
...@@ -138,8 +138,8 @@ TEXT runtime·nsec(SB),NOSPLIT|NOFRAME,$0-12 ...@@ -138,8 +138,8 @@ TEXT runtime·nsec(SB),NOSPLIT|NOFRAME,$0-12
MOVW R0, ret_hi+8(FP) MOVW R0, ret_hi+8(FP)
RET RET
// time.now() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$12-12 TEXT runtime·walltime1(SB),NOSPLIT,$12-12
// use nsec system call to get current time in nanoseconds // use nsec system call to get current time in nanoseconds
MOVW $sysnsec_lo-8(SP), R0 // destination addr MOVW $sysnsec_lo-8(SP), R0 // destination addr
MOVW R0,res-12(SP) MOVW R0,res-12(SP)
......
...@@ -29,14 +29,14 @@ TEXT runtime·miniterrno(SB),NOSPLIT,$0 ...@@ -29,14 +29,14 @@ TEXT runtime·miniterrno(SB),NOSPLIT,$0
MOVQ AX, (m_mOS+mOS_perrno)(BX) MOVQ AX, (m_mOS+mOS_perrno)(BX)
RET RET
// int64 runtime·nanotime1(void); // int64 runtime·nanotime2(void);
// //
// clock_gettime(3c) wrapper because Timespec is too large for // clock_gettime(3c) wrapper because Timespec is too large for
// runtime·nanotime stack. // runtime·nanotime stack.
// //
// Called using runtime·sysvicall6 from os_solaris.c:/nanotime. // Called using runtime·sysvicall6 from os_solaris.c:/nanotime.
// NOT USING GO CALLING CONVENTION. // NOT USING GO CALLING CONVENTION.
TEXT runtime·nanotime1(SB),NOSPLIT,$0 TEXT runtime·nanotime2(SB),NOSPLIT,$0
// need space for the timespec argument. // need space for the timespec argument.
SUBQ $64, SP // 16 bytes will do, but who knows in the future? SUBQ $64, SP // 16 bytes will do, but who knows in the future?
MOVQ $3, DI // CLOCK_REALTIME from <sys/time_impl.h> MOVQ $3, DI // CLOCK_REALTIME from <sys/time_impl.h>
...@@ -339,9 +339,9 @@ TEXT runtime·osyield1(SB),NOSPLIT,$0 ...@@ -339,9 +339,9 @@ TEXT runtime·osyield1(SB),NOSPLIT,$0
CALL AX CALL AX
RET RET
// func walltime() (sec int64, nsec int32) // func walltime1() (sec int64, nsec int32)
TEXT runtime·walltime(SB),NOSPLIT,$8-12 TEXT runtime·walltime1(SB),NOSPLIT,$8-12
CALL runtime·nanotime(SB) CALL runtime·nanotime1(SB)
MOVQ 0(SP), AX MOVQ 0(SP), AX
// generated code for // generated code for
......
...@@ -183,11 +183,11 @@ TEXT ·wasmWrite(SB), NOSPLIT, $0 ...@@ -183,11 +183,11 @@ TEXT ·wasmWrite(SB), NOSPLIT, $0
CallImport CallImport
RET RET
TEXT ·nanotime(SB), NOSPLIT, $0 TEXT ·nanotime1(SB), NOSPLIT, $0
CallImport CallImport
RET RET
TEXT ·walltime(SB), NOSPLIT, $0 TEXT ·walltime1(SB), NOSPLIT, $0
CallImport CallImport
RET RET
......
...@@ -444,7 +444,7 @@ TEXT runtime·switchtothread(SB),NOSPLIT,$0 ...@@ -444,7 +444,7 @@ TEXT runtime·switchtothread(SB),NOSPLIT,$0
#define time_hi1 4 #define time_hi1 4
#define time_hi2 8 #define time_hi2 8
TEXT runtime·nanotime(SB),NOSPLIT,$0-8 TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
CMPB runtime·useQPCTime(SB), $0 CMPB runtime·useQPCTime(SB), $0
JNE useQPC JNE useQPC
loop: loop:
......
...@@ -473,7 +473,7 @@ TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 ...@@ -473,7 +473,7 @@ TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0
#define time_hi1 4 #define time_hi1 4
#define time_hi2 8 #define time_hi2 8
TEXT runtime·nanotime(SB),NOSPLIT,$0-8 TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
CMPB runtime·useQPCTime(SB), $0 CMPB runtime·useQPCTime(SB), $0
JNE useQPC JNE useQPC
MOVQ $_INTERRUPT_TIME, DI MOVQ $_INTERRUPT_TIME, DI
......
...@@ -495,7 +495,7 @@ TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 ...@@ -495,7 +495,7 @@ TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0
#define time_hi1 4 #define time_hi1 4
#define time_hi2 8 #define time_hi2 8
TEXT runtime·nanotime(SB),NOSPLIT,$0-8 TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
MOVW $0, R0 MOVW $0, R0
MOVB runtime·useQPCTime(SB), R0 MOVB runtime·useQPCTime(SB), R0
CMP $0, R0 CMP $0, R0
......
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !nacl
package runtime
import "unsafe"
//go:nosplit
func nanotime() int64 {
return nanotime1()
}
func walltime() (sec int64, nsec int32) {
return walltime1()
}
// write must be nosplit on Windows (see write1)
//
//go:nosplit
func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
return write1(fd, p, n)
}
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
package runtime package runtime
func walltime() (sec int64, nsec int32) func walltime1() (sec int64, nsec int32)
...@@ -97,7 +97,7 @@ func fallback_nanotime() int64 ...@@ -97,7 +97,7 @@ func fallback_nanotime() int64
func fallback_walltime() (sec int64, nsec int32) func fallback_walltime() (sec int64, nsec int32)
//go:nosplit //go:nosplit
func nanotime() int64 { func nanotime1() int64 {
bt := vdsoClockGettime(_CLOCK_MONOTONIC) bt := vdsoClockGettime(_CLOCK_MONOTONIC)
if bt == zeroBintime { if bt == zeroBintime {
return fallback_nanotime() return fallback_nanotime()
...@@ -105,7 +105,7 @@ func nanotime() int64 { ...@@ -105,7 +105,7 @@ func nanotime() int64 {
return int64((1e9 * uint64(bt.sec)) + ((1e9 * uint64(bt.frac>>32)) >> 32)) return int64((1e9 * uint64(bt.sec)) + ((1e9 * uint64(bt.frac>>32)) >> 32))
} }
func walltime() (sec int64, nsec int32) { func walltime1() (sec int64, nsec int32) {
bt := vdsoClockGettime(_CLOCK_REALTIME) bt := vdsoClockGettime(_CLOCK_REALTIME)
if bt == zeroBintime { if bt == zeroBintime {
return fallback_walltime() return fallback_walltime()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment