mirror of
https://github.com/golang/go
synced 2024-11-24 22:57:57 -07:00
runtime: implement runtime.usleep for FreeBSD/386 and amd64.
R=golang-dev, jsing CC=golang-dev https://golang.org/cl/5528106
This commit is contained in:
parent
f53cc8e6ff
commit
c30ba7e65a
@ -199,8 +199,24 @@ TEXT runtime·sigaltstack(SB),7,$0
|
||||
CALL runtime·notok(SB)
|
||||
RET
|
||||
|
||||
// TODO: Implement usleep
|
||||
TEXT runtime·usleep(SB),7,$0
|
||||
TEXT runtime·usleep(SB),7,$20
|
||||
MOVL $0, DX
|
||||
MOVL usec+0(FP), AX
|
||||
MOVL $1000000, CX
|
||||
DIVL CX
|
||||
MOVL AX, 12(SP) // tv_sec
|
||||
MOVL $1000, AX
|
||||
MULL DX
|
||||
MOVL AX, 16(SP) // tv_nsec
|
||||
|
||||
MOVL $0, 0(SP)
|
||||
LEAL 12(SP), AX
|
||||
MOVL AX, 4(SP) // arg 1 - rqtp
|
||||
MOVL $0, 8(SP) // arg 2 - rmtp
|
||||
MOVL $240, AX // sys_nanosleep
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
CALL runtime·notok(SB)
|
||||
RET
|
||||
|
||||
/*
|
||||
|
@ -184,8 +184,22 @@ TEXT runtime·sigaltstack(SB),7,$-8
|
||||
CALL runtime·notok(SB)
|
||||
RET
|
||||
|
||||
// TODO: Implement usleep
|
||||
TEXT runtime·usleep(SB),7,$0
|
||||
TEXT runtime·usleep(SB),7,$16
|
||||
MOVL $0, DX
|
||||
MOVL usec+0(FP), AX
|
||||
MOVL $1000000, CX
|
||||
DIVL CX
|
||||
MOVQ AX, 0(SP) // tv_sec
|
||||
MOVL $1000, AX
|
||||
MULL DX
|
||||
MOVQ AX, 8(SP) // tv_nsec
|
||||
|
||||
MOVQ SP, DI // arg 1 - rqtp
|
||||
MOVQ $0, SI // arg 2 - rmtp
|
||||
MOVL $240, AX // sys_nanosleep
|
||||
SYSCALL
|
||||
JCC 2(PC)
|
||||
CALL runtime·notok(SB)
|
||||
RET
|
||||
|
||||
// set tls base to DI
|
||||
|
Loading…
Reference in New Issue
Block a user