summaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-caller.c14
-rw-r--r--libgo/runtime/go-libmain.c3
-rw-r--r--libgo/runtime/go-main.c3
-rw-r--r--libgo/runtime/go-signal.c10
-rw-r--r--libgo/runtime/proc.c1
-rw-r--r--libgo/runtime/runtime.h2
-rw-r--r--libgo/runtime/runtime_c.c6
-rw-r--r--libgo/runtime/thread-linux.c20
-rw-r--r--libgo/runtime/thread-sema.c20
9 files changed, 31 insertions, 48 deletions
diff --git a/libgo/runtime/go-caller.c b/libgo/runtime/go-caller.c
index a35d8d73f44..360bae69594 100644
--- a/libgo/runtime/go-caller.c
+++ b/libgo/runtime/go-caller.c
@@ -74,7 +74,7 @@ static void *back_state;
/* A lock to control creating back_state. */
-static Lock back_state_lock;
+static uint32 back_state_lock;
/* The program arguments. */
@@ -85,7 +85,15 @@ extern Slice runtime_get_args(void);
struct backtrace_state *
__go_get_backtrace_state ()
{
- runtime_lock (&back_state_lock);
+ uint32 set;
+
+ /* We may not have a g here, so we can't use runtime_lock. */
+ set = 0;
+ while (!__atomic_compare_exchange_n (&back_state_lock, &set, 1, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ {
+ runtime_osyield ();
+ set = 0;
+ }
if (back_state == NULL)
{
Slice args;
@@ -113,7 +121,7 @@ __go_get_backtrace_state ()
back_state = backtrace_create_state (filename, 1, error_callback, NULL);
}
- runtime_unlock (&back_state_lock);
+ __atomic_store_n (&back_state_lock, 0, __ATOMIC_RELEASE);
return back_state;
}
diff --git a/libgo/runtime/go-libmain.c b/libgo/runtime/go-libmain.c
index 06f6bd32f35..5e3b8d9e48a 100644
--- a/libgo/runtime/go-libmain.c
+++ b/libgo/runtime/go-libmain.c
@@ -105,7 +105,8 @@ gostart (void *arg)
runtime_check ();
runtime_args (a->argc, (byte **) a->argv);
- runtime_osinit ();
+ setncpu (getproccount ());
+ setpagesize (getpagesize ());
runtime_sched = runtime_getsched();
runtime_schedinit ();
__go_go (runtime_main, NULL);
diff --git a/libgo/runtime/go-main.c b/libgo/runtime/go-main.c
index 26354ce69b0..1048161786c 100644
--- a/libgo/runtime/go-main.c
+++ b/libgo/runtime/go-main.c
@@ -51,7 +51,8 @@ main (int argc, char **argv)
runtime_cpuinit ();
runtime_check ();
runtime_args (argc, (byte **) argv);
- runtime_osinit ();
+ setncpu (getproccount ());
+ setpagesize (getpagesize ());
runtime_sched = runtime_getsched();
runtime_schedinit ();
__go_go (runtime_main, NULL);
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index ad29662d0fd..8c7ecbae3b5 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -215,6 +215,16 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP];
#endif
#endif
+#ifdef __alpha__
+ #ifdef __linux__
+ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
+ #endif
+#endif
+#ifdef __PPC__
+ #ifdef __linux__
+ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
+ #endif
+#endif
if (ret.sigpc == 0) {
// Skip getSiginfo/sighandler/sigtrampgo/sigtramp/handler.
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 1272669a8bd..3e3437e6a47 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -370,7 +370,6 @@ extern G* allocg(void)
__asm__ (GOSYM_PREFIX "runtime.allocg");
Sched* runtime_sched;
-int32 runtime_ncpu;
bool runtime_isarchive;
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 9f84f523f5e..3324038a57d 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -217,7 +217,6 @@ extern M* runtime_getallm(void)
extern Sched* runtime_sched;
extern uint32 runtime_panicking(void)
__asm__ (GOSYM_PREFIX "runtime.getPanicking");
-extern int32 runtime_ncpu;
extern struct debugVars runtime_debug;
extern bool runtime_isstarted;
@@ -237,7 +236,6 @@ void runtime_gogo(G*)
struct __go_func_type;
void runtime_args(int32, byte**)
__asm__ (GOSYM_PREFIX "runtime.args");
-void runtime_osinit();
void runtime_alginit(void)
__asm__ (GOSYM_PREFIX "runtime.alginit");
void runtime_goargs(void)
diff --git a/libgo/runtime/runtime_c.c b/libgo/runtime/runtime_c.c
index 336b2611324..6da35210440 100644
--- a/libgo/runtime/runtime_c.c
+++ b/libgo/runtime/runtime_c.c
@@ -139,6 +139,10 @@ uintptr getEnd(void)
uintptr
getEnd()
{
+#ifdef _AIX
+ // mmap adresses range start at 0x30000000 on AIX for 32 bits processes
+ uintptr end = 0x30000000U;
+#else
uintptr end = 0;
uintptr *pend;
@@ -146,6 +150,8 @@ getEnd()
if (pend != nil) {
end = *pend;
}
+#endif
+
return end;
}
diff --git a/libgo/runtime/thread-linux.c b/libgo/runtime/thread-linux.c
deleted file mode 100644
index f6d8be90caa..00000000000
--- a/libgo/runtime/thread-linux.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 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.
-
-#include "runtime.h"
-#include "defs.h"
-
-// Linux futex.
-
-#include <unistd.h>
-#include <syscall.h>
-#include <linux/futex.h>
-
-void
-runtime_osinit(void)
-{
- runtime_ncpu = getproccount();
- setncpu(runtime_ncpu);
- setpagesize(getpagesize());
-}
diff --git a/libgo/runtime/thread-sema.c b/libgo/runtime/thread-sema.c
deleted file mode 100644
index 77d53c41684..00000000000
--- a/libgo/runtime/thread-sema.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 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.
-
-#include "config.h"
-#include "runtime.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-#include <semaphore.h>
-
-void
-runtime_osinit (void)
-{
- runtime_ncpu = getproccount();
- setncpu(runtime_ncpu);
- setpagesize(getpagesize());
-}