summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/linux
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/linux')
-rw-r--r--src/pkg/runtime/linux/386/signal.c1
-rw-r--r--src/pkg/runtime/linux/amd64/signal.c1
-rw-r--r--src/pkg/runtime/linux/arm/signal.c1
-rw-r--r--src/pkg/runtime/linux/mem.c21
-rw-r--r--src/pkg/runtime/linux/runtime_defs.go14
-rw-r--r--src/pkg/runtime/linux/thread.c3
6 files changed, 20 insertions, 21 deletions
diff --git a/src/pkg/runtime/linux/386/signal.c b/src/pkg/runtime/linux/386/signal.c
index 0dbfcf9ff..9651a6f28 100644
--- a/src/pkg/runtime/linux/386/signal.c
+++ b/src/pkg/runtime/linux/386/signal.c
@@ -60,6 +60,7 @@ runtime·sighandler(int32 sig, Siginfo* info, void* context)
gp->sig = sig;
gp->sigcode0 = info->si_code;
gp->sigcode1 = ((uintptr*)info)[3];
+ gp->sigpc = r->eip;
// Only push runtime·sigpanic if r->eip != 0.
// If r->eip == 0, probably panicked because of a
diff --git a/src/pkg/runtime/linux/amd64/signal.c b/src/pkg/runtime/linux/amd64/signal.c
index e78bbda9d..9e501c96d 100644
--- a/src/pkg/runtime/linux/amd64/signal.c
+++ b/src/pkg/runtime/linux/amd64/signal.c
@@ -70,6 +70,7 @@ runtime·sighandler(int32 sig, Siginfo* info, void* context)
gp->sig = sig;
gp->sigcode0 = info->si_code;
gp->sigcode1 = ((uintptr*)info)[2];
+ gp->sigpc = r->rip;
// Only push runtime·sigpanic if r->rip != 0.
// If r->rip == 0, probably panicked because of a
diff --git a/src/pkg/runtime/linux/arm/signal.c b/src/pkg/runtime/linux/arm/signal.c
index c65aff913..481bd13c6 100644
--- a/src/pkg/runtime/linux/arm/signal.c
+++ b/src/pkg/runtime/linux/arm/signal.c
@@ -67,6 +67,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *context)
gp->sig = sig;
gp->sigcode0 = info->si_code;
gp->sigcode1 = r->fault_address;
+ gp->sigpc = r->arm_pc;
// If this is a leaf function, we do smash LR,
// but we're not going back there anyway.
diff --git a/src/pkg/runtime/linux/mem.c b/src/pkg/runtime/linux/mem.c
index e750f97ea..3a83e7394 100644
--- a/src/pkg/runtime/linux/mem.c
+++ b/src/pkg/runtime/linux/mem.c
@@ -12,12 +12,11 @@ runtime·SysAlloc(uintptr n)
p = runtime·mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
if(p < (void*)4096) {
if(p == (void*)EACCES) {
- runtime·printf("mmap: access denied\n");
- runtime·printf("If you're running SELinux, enable execmem for this process.\n");
+ runtime·printf("runtime: mmap: access denied\n");
+ runtime·printf("if you're running SELinux, enable execmem for this process.\n");
runtime·exit(2);
}
- runtime·printf("mmap: errno=%p\n", p);
- runtime·throw("mmap");
+ return nil;
}
return p;
}
@@ -37,7 +36,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/linux/runtime_defs.go b/src/pkg/runtime/linux/runtime_defs.go
deleted file mode 100644
index 86de13316..000000000
--- a/src/pkg/runtime/linux/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
diff --git a/src/pkg/runtime/linux/thread.c b/src/pkg/runtime/linux/thread.c
index 979260ba1..d5f9a8fb0 100644
--- a/src/pkg/runtime/linux/thread.c
+++ b/src/pkg/runtime/linux/thread.c
@@ -238,8 +238,7 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
/*
* note: strace gets confused if we use CLONE_PTRACE here.
*/
- flags = CLONE_PARENT /* getppid doesn't change in child */
- | CLONE_VM /* share memory */
+ flags = CLONE_VM /* share memory */
| CLONE_FS /* share cwd, etc */
| CLONE_FILES /* share fd table */
| CLONE_SIGHAND /* share sig handler table */