summaryrefslogtreecommitdiff
path: root/libpthread/sysdeps/viengoos
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/sysdeps/viengoos')
-rw-r--r--libpthread/sysdeps/viengoos/pt-spin.c17
-rw-r--r--libpthread/sysdeps/viengoos/pt-stack-alloc.c3
-rw-r--r--libpthread/sysdeps/viengoos/pt-sysdep.c9
-rw-r--r--libpthread/sysdeps/viengoos/pt-sysdep.h9
-rw-r--r--libpthread/sysdeps/viengoos/pt-thread-alloc.c6
-rw-r--r--libpthread/sysdeps/viengoos/pt-thread-start.c8
-rw-r--r--libpthread/sysdeps/viengoos/sig-sysdep.h10
7 files changed, 50 insertions, 12 deletions
diff --git a/libpthread/sysdeps/viengoos/pt-spin.c b/libpthread/sysdeps/viengoos/pt-spin.c
index b6978b0..6d6df7e 100644
--- a/libpthread/sysdeps/viengoos/pt-spin.c
+++ b/libpthread/sysdeps/viengoos/pt-spin.c
@@ -1,5 +1,5 @@
-/* Spin locks. L4 version.
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Spin locks. Viengoos version.
+ Copyright (C) 2000, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <l4.h>
+#ifdef USE_L4
+# include <l4.h>
+#endif
#include <pthread.h>
#include <sched.h>
@@ -38,12 +40,16 @@ int __pthread_spin_count = __PTHREAD_SPIN_COUNT;
int
_pthread_spin_lock (__pthread_spinlock_t *lock)
{
- l4_time_t timeout;
int i;
+#ifdef USE_L4
/* Start with a small timeout of 2 microseconds, then back off
exponentially. */
+ l4_time_t timeout;
timeout = l4_time_period (2);
+#else
+# warning Don't know how to sleep on this platform.
+#endif
while (1)
{
@@ -52,11 +58,14 @@ _pthread_spin_lock (__pthread_spinlock_t *lock)
if (__pthread_spin_trylock (lock) == 0)
return 0;
}
+
+#ifdef USE_L4
l4_sleep (timeout);
timeout = l4_time_mul2 (timeout);
if (timeout == L4_NEVER)
timeout = L4_TIME_PERIOD_MAX;
+#endif
}
}
diff --git a/libpthread/sysdeps/viengoos/pt-stack-alloc.c b/libpthread/sysdeps/viengoos/pt-stack-alloc.c
index b7ec12b..7dfea2a 100644
--- a/libpthread/sysdeps/viengoos/pt-stack-alloc.c
+++ b/libpthread/sysdeps/viengoos/pt-stack-alloc.c
@@ -1,4 +1,4 @@
-/* Allocate a new stack. L4 Hurd version.
+/* Allocate a new stack. Viengoos version.
Copyright (C) 2000, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,7 +17,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <l4.h>
#include <errno.h>
#include <pt-internal.h>
diff --git a/libpthread/sysdeps/viengoos/pt-sysdep.c b/libpthread/sysdeps/viengoos/pt-sysdep.c
index c23364c..d4d6fed 100644
--- a/libpthread/sysdeps/viengoos/pt-sysdep.c
+++ b/libpthread/sysdeps/viengoos/pt-sysdep.c
@@ -26,7 +26,11 @@
int
sched_yield (void)
{
+#ifdef USE_L4
l4_yield ();
+#else
+# warning Not ported to this platform.
+#endif
return 0;
}
@@ -56,6 +60,11 @@ init_routine (void (*entry) (void *), void *arg)
assert_perror (err);
/* Switch stacks. */
+#ifdef USE_L4
l4_start_sp_ip (l4_myself (), thread->mcontext.sp,
thread->mcontext.pc);
+#else
+# warning Not ported to this platform.
+ assert (0);
+#endif
}
diff --git a/libpthread/sysdeps/viengoos/pt-sysdep.h b/libpthread/sysdeps/viengoos/pt-sysdep.h
index f7ababa..db89112 100644
--- a/libpthread/sysdeps/viengoos/pt-sysdep.h
+++ b/libpthread/sysdeps/viengoos/pt-sysdep.h
@@ -20,7 +20,10 @@
#ifndef _PT_SYSDEP_H
#define _PT_SYSDEP_H 1
-#include <l4.h>
+#ifdef USE_L4
+# include <l4.h>
+#endif
+
#include <hurd/storage.h>
#include <sys/mman.h>
@@ -46,7 +49,11 @@ extern inline struct __pthread *
__attribute__((__always_inline__))
_pthread_self (void)
{
+#if USE_L4
return (struct __pthread *) l4_user_defined_handle ();
+#else
+ assert (0);
+#endif
}
extern inline void
diff --git a/libpthread/sysdeps/viengoos/pt-thread-alloc.c b/libpthread/sysdeps/viengoos/pt-thread-alloc.c
index e47377c..266444f 100644
--- a/libpthread/sysdeps/viengoos/pt-thread-alloc.c
+++ b/libpthread/sysdeps/viengoos/pt-thread-alloc.c
@@ -45,9 +45,13 @@ __pthread_thread_alloc (struct __pthread *thread)
if (__pthread_num_threads == 1)
{
thread->object = __hurd_startup_data->thread;
- thread->threadid = l4_myself ();
+ thread->threadid = hurd_myself ();
+#ifdef USE_L4
l4_set_user_defined_handle ((l4_word_t) thread);
+#else
+ assert (0);
+#endif
/* Get the thread's UTCB and stash it. */
thread->utcb = hurd_utcb ();
diff --git a/libpthread/sysdeps/viengoos/pt-thread-start.c b/libpthread/sysdeps/viengoos/pt-thread-start.c
index 41d0fbf..5a3867d 100644
--- a/libpthread/sysdeps/viengoos/pt-thread-start.c
+++ b/libpthread/sysdeps/viengoos/pt-thread-start.c
@@ -33,7 +33,7 @@ __pthread_thread_start (struct __pthread *thread)
/* The main thread is already running of course. */
{
assert (__pthread_total == 1);
- assert (l4_is_thread_equal (l4_myself (), thread->threadid));
+ assert (hurd_myself () == thread->threadid);
}
else
{
@@ -46,10 +46,10 @@ __pthread_thread_start (struct __pthread *thread)
vg_addr_t activity = VG_ADDR_VOID;
- in.sp = (l4_word_t) thread->mcontext.sp;
- in.ip = (l4_word_t) thread->mcontext.pc;
+ in.sp = (uintptr_t) thread->mcontext.sp;
+ in.ip = (uintptr_t) thread->mcontext.pc;
- in.user_handle = (l4_word_t) thread;
+ in.user_handle = (uintptr_t) thread;
err = vg_thread_exregs (VG_ADDR_VOID, thread->object,
VG_EXREGS_SET_ASPACE
| VG_EXREGS_SET_ACTIVITY
diff --git a/libpthread/sysdeps/viengoos/sig-sysdep.h b/libpthread/sysdeps/viengoos/sig-sysdep.h
index 33e1385..c1cbe92 100644
--- a/libpthread/sysdeps/viengoos/sig-sysdep.h
+++ b/libpthread/sysdeps/viengoos/sig-sysdep.h
@@ -18,6 +18,8 @@
License along with this program. If not, see
<http://www.gnu.org/licenses/>. */
+
+#ifdef USE_L4
#include <l4.h>
#include <string.h>
@@ -67,3 +69,11 @@ utcb_state_restore (struct utcb *buffer)
#define SIGNAL_DISPATCH_EXIT \
utcb_state_restore (&buffer);
+
+#else
+
+#warning Signal dispatch entry and exit unimplemented for this platform.
+#define SIGNAL_DISPATCH_ENTRY assert (0)
+#define SIGNAL_DISPATCH_EXIT assert (0)
+
+#endif