From d573ad26719fa6100970dc291ae83ad8ea33bff1 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sat, 1 Oct 2011 11:58:36 -0700 Subject: [PATCH] runtime: implement runtime usleep for openbsd R=golang-dev, mikioh.mikioh, hectorchu CC=golang-dev https://golang.org/cl/5173043 --- src/pkg/runtime/openbsd/386/sys.s | 18 ++++++++++++++++++ src/pkg/runtime/openbsd/amd64/sys.s | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/pkg/runtime/openbsd/386/sys.s b/src/pkg/runtime/openbsd/386/sys.s index 3a78679bc43..3e7c01f8de8 100644 --- a/src/pkg/runtime/openbsd/386/sys.s +++ b/src/pkg/runtime/openbsd/386/sys.s @@ -27,6 +27,24 @@ TEXT runtime·write(SB),7,$-4 INT $0x80 RET +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 + RET + TEXT runtime·raisesigpipe(SB),7,$12 MOVL $299, AX // sys_getthrid INT $0x80 diff --git a/src/pkg/runtime/openbsd/amd64/sys.s b/src/pkg/runtime/openbsd/amd64/sys.s index 38b3dbc9c0d..f1442efcf4d 100644 --- a/src/pkg/runtime/openbsd/amd64/sys.s +++ b/src/pkg/runtime/openbsd/amd64/sys.s @@ -100,6 +100,22 @@ TEXT runtime·write(SB),7,$-8 SYSCALL RET +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 + RET + TEXT runtime·raisesigpipe(SB),7,$16 MOVL $299, AX // sys_getthrid SYSCALL