summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/freebsd
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
commit758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch)
tree6d6b34f8c678862fe9b56c945a7b63f68502c245 /src/pkg/runtime/freebsd
parent3e45412327a2654a77944249962b3652e6142299 (diff)
downloadgolang-upstream/2011-02-01.1.tar.gz
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'src/pkg/runtime/freebsd')
-rw-r--r--src/pkg/runtime/freebsd/386/signal.c1
-rw-r--r--src/pkg/runtime/freebsd/amd64/signal.c1
-rw-r--r--src/pkg/runtime/freebsd/mem.c19
-rw-r--r--src/pkg/runtime/freebsd/runtime_defs.go14
4 files changed, 16 insertions, 19 deletions
diff --git a/src/pkg/runtime/freebsd/386/signal.c b/src/pkg/runtime/freebsd/386/signal.c
index 52b820df1..ddb11fc3b 100644
--- a/src/pkg/runtime/freebsd/386/signal.c
+++ b/src/pkg/runtime/freebsd/386/signal.c
@@ -63,6 +63,7 @@ runtime·sighandler(int32 sig, Siginfo* info, void* context)
gp->sig = sig;
gp->sigcode0 = info->si_code;
gp->sigcode1 = (uintptr)info->si_addr;
+ gp->sigpc = r->mc_eip;
// Only push runtime·sigpanic if r->mc_eip != 0.
// If r->mc_eip == 0, probably panicked because of a
diff --git a/src/pkg/runtime/freebsd/amd64/signal.c b/src/pkg/runtime/freebsd/amd64/signal.c
index c74ddad0b..9f873d276 100644
--- a/src/pkg/runtime/freebsd/amd64/signal.c
+++ b/src/pkg/runtime/freebsd/amd64/signal.c
@@ -71,6 +71,7 @@ runtime·sighandler(int32 sig, Siginfo* info, void* context)
gp->sig = sig;
gp->sigcode0 = info->si_code;
gp->sigcode1 = (uintptr)info->si_addr;
+ gp->sigpc = r->mc_rip;
// Only push runtime·sigpanic if r->mc_rip != 0.
// If r->mc_rip == 0, probably panicked because of a
diff --git a/src/pkg/runtime/freebsd/mem.c b/src/pkg/runtime/freebsd/mem.c
index 7fb2c2807..cbae18718 100644
--- a/src/pkg/runtime/freebsd/mem.c
+++ b/src/pkg/runtime/freebsd/mem.c
@@ -10,10 +10,8 @@ runtime·SysAlloc(uintptr n)
mstats.sys += n;
v = runtime·mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
- if(v < (void*)4096) {
- runtime·printf("mmap: errno=%p\n", v);
- runtime·throw("mmap");
- }
+ if(v < (void*)4096)
+ return nil;
return v;
}
@@ -32,8 +30,19 @@ runtime·SysFree(void *v, uintptr n)
runtime·munmap(v, n);
}
+void*
+runtime·SysReserve(void *v, uintptr n)
+{
+ return runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
+}
void
-runtime·SysMemInit(void)
+runtime·SysMap(void *v, uintptr n)
{
+ void *p;
+
+ mstats.sys += n;
+ p = runtime·mmap(v, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0);
+ if(p != v)
+ runtime·throw("runtime: cannot map pages in arena address space");
}
diff --git a/src/pkg/runtime/freebsd/runtime_defs.go b/src/pkg/runtime/freebsd/runtime_defs.go
deleted file mode 100644
index 86de13316..000000000
--- a/src/pkg/runtime/freebsd/runtime_defs.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2010 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.
-
-// OS-Specific Go definitions of internal structures. Master is runtime.h
-
-package runtime
-
-type lock struct {
- key uint32
- sema uint32
-}
-
-type note lock