summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/os_netbsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/os_netbsd.c')
-rw-r--r--src/pkg/runtime/os_netbsd.c48
1 files changed, 6 insertions, 42 deletions
diff --git a/src/pkg/runtime/os_netbsd.c b/src/pkg/runtime/os_netbsd.c
index 7679ec255..a49dca295 100644
--- a/src/pkg/runtime/os_netbsd.c
+++ b/src/pkg/runtime/os_netbsd.c
@@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
+#include "../../cmd/ld/textflag.h"
enum
{
@@ -62,6 +63,7 @@ runtime·semacreate(void)
return 1;
}
+#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{
@@ -93,9 +95,10 @@ runtime·semasleep(int64 ns)
runtime·atomicstore(&m->waitsemalock, 0);
runtime·lwp_park(nil, 0, &m->waitsemacount, nil);
} else {
- ns += runtime·nanotime();
- ts.tv_sec = ns/1000000000LL;
- ts.tv_nsec = ns%1000000000LL;
+ ns = ns + runtime·nanotime();
+ // NOTE: tv_nsec is int64 on amd64, so this assumes a little-endian system.
+ ts.tv_nsec = 0;
+ ts.tv_sec = runtime·timediv(ns, 1000000000, (int32*)&ts.tv_nsec);
// TODO(jsing) - potential deadlock!
// See above for details.
runtime·atomicstore(&m->waitsemalock, 0);
@@ -269,45 +272,6 @@ runtime·memlimit(void)
return 0;
}
-void
-runtime·setprof(bool on)
-{
- USED(on);
-}
-
-static int8 badcallback[] = "runtime: cgo callback on thread not created by Go.\n";
-
-// This runs on a foreign stack, without an m or a g. No stack split.
-#pragma textflag 7
-void
-runtime·badcallback(void)
-{
- runtime·write(2, badcallback, sizeof badcallback - 1);
-}
-
-static int8 badsignal[] = "runtime: signal received on thread not created by Go: ";
-
-// This runs on a foreign stack, without an m or a g. No stack split.
-#pragma textflag 7
-void
-runtime·badsignal(int32 sig)
-{
- int32 len;
-
- if (sig == SIGPROF) {
- return; // Ignore SIGPROFs intended for a non-Go thread.
- }
- runtime·write(2, badsignal, sizeof badsignal - 1);
- if (0 <= sig && sig < NSIG) {
- // Can't call findnull() because it will split stack.
- for(len = 0; runtime·sigtab[sig].name[len]; len++)
- ;
- runtime·write(2, runtime·sigtab[sig].name, len);
- }
- runtime·write(2, "\n", 1);
- runtime·exit(1);
-}
-
extern void runtime·sigtramp(void);
typedef struct sigaction {