1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:24:45 -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:
Shenghou Ma 2012-01-17 03:22:34 +11:00 committed by Joel Sing
parent f53cc8e6ff
commit c30ba7e65a
2 changed files with 34 additions and 4 deletions

View File

@ -199,8 +199,24 @@ TEXT runtime·sigaltstack(SB),7,$0
CALL runtime·notok(SB) CALL runtime·notok(SB)
RET RET
// TODO: Implement usleep TEXT runtime·usleep(SB),7,$20
TEXT runtime·usleep(SB),7,$0 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 RET
/* /*

View File

@ -184,8 +184,22 @@ TEXT runtime·sigaltstack(SB),7,$-8
CALL runtime·notok(SB) CALL runtime·notok(SB)
RET RET
// TODO: Implement usleep TEXT runtime·usleep(SB),7,$16
TEXT runtime·usleep(SB),7,$0 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 RET
// set tls base to DI // set tls base to DI