summaryrefslogtreecommitdiff
path: root/viengoos
diff options
context:
space:
mode:
Diffstat (limited to 'viengoos')
-rw-r--r--viengoos/ChangeLog16
-rw-r--r--viengoos/cap.h1
-rw-r--r--viengoos/mutex.h21
-rw-r--r--viengoos/object.h17
-rw-r--r--viengoos/thread.h7
5 files changed, 53 insertions, 9 deletions
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog
index 4acd0a4..7113eb0 100644
--- a/viengoos/ChangeLog
+++ b/viengoos/ChangeLog
@@ -1,5 +1,21 @@
2009-01-16 Neal H. Walfield <neal@gnu.org>
+ * cap.h: Don't include <l4.h>.
+ * mutex.h [USE_L4]: Only include <l4/thread.h> in this case.
+ (ss_mutex_t) [! USE_L4]: Define to be an int.
+ (ss_mutex_lock) [! USE_L4]: Make a no-op.
+ (ss_mutex_unlock) [! USE_L4]: Likewise.
+ (ss_mutex_trylock) [! USE_L4]: Likewise.
+ * object.h [USE_L4]: Only include <l4.h> in this case.
+ (object_desc_unmap) [! USE_L4]: Make a no-op.
+ (object_desc_flush) [! USE_L4]: Likewise.
+ * thread.h: Don't include <l4.h>.
+ (struct thread): Make tid a vg_thread_id_t, not an l4_thread_id_t.
+ (thread_lookup): Make threadid a vg_thread_id_t, not an
+ l4_thread_id_t.
+
+2009-01-16 Neal H. Walfield <neal@gnu.org>
+
* Makefile.am (viengoos_LDADD): Link to
../libhurd-btree/libhurd-btree-kernel.a, not
../libhurd-btree/libhurd-btree.a.
diff --git a/viengoos/cap.h b/viengoos/cap.h
index 8ce0820..01285f6 100644
--- a/viengoos/cap.h
+++ b/viengoos/cap.h
@@ -21,7 +21,6 @@
#ifndef RM_CAP_H
#define RM_CAP_H
-#include <l4.h>
#include <viengoos/cap.h>
/* The number of slots in a capability object of the given type. */
diff --git a/viengoos/mutex.h b/viengoos/mutex.h
index f6ed2ff..245cb3a 100644
--- a/viengoos/mutex.h
+++ b/viengoos/mutex.h
@@ -21,12 +21,18 @@
#ifndef _MUTEX_H
#define _MUTEX_H
-#include <l4/thread.h>
+#ifdef USE_L4
+# include <l4/thread.h>
+#endif
#include <atomic.h>
#include <assert.h>
#include <hurd/lock.h>
+#ifdef USE_L4
typedef l4_thread_id_t ss_mutex_t;
+#else
+typedef int ss_mutex_t;
+#endif
/* Used by the atomic operations. */
extern void abort (void);
@@ -34,6 +40,7 @@ extern void abort (void);
static inline void
ss_mutex_lock (__const char *caller, int line, ss_mutex_t *lock)
{
+#ifdef USE_L4
l4_thread_id_t owner;
for (;;)
@@ -53,6 +60,9 @@ ss_mutex_lock (__const char *caller, int line, ss_mutex_t *lock)
__ss_lock_wait (l4_anylocalthread);
}
+#else
+# warning Unimplemened on this platform.
+#endif
}
#define ss_mutex_lock(__sml_lockp) \
@@ -66,6 +76,7 @@ ss_mutex_lock (__const char *caller, int line, ss_mutex_t *lock)
static inline void
ss_mutex_unlock (__const char *caller, int line, ss_mutex_t *lock)
{
+#ifdef USE_L4
l4_thread_id_t waiter;
waiter = atomic_exchange_acq (lock, l4_nilthread);
@@ -80,6 +91,9 @@ ss_mutex_unlock (__const char *caller, int line, ss_mutex_t *lock)
/* Signal the waiter. */
__ss_lock_wakeup (waiter);
+#else
+# warning Unimplemened on this platform.
+#endif
}
#define ss_mutex_unlock(__smu_lockp) \
@@ -93,6 +107,7 @@ ss_mutex_unlock (__const char *caller, int line, ss_mutex_t *lock)
static inline bool
ss_mutex_trylock (__const char *caller, int line, ss_mutex_t *lock)
{
+#ifdef USE_L4
l4_thread_id_t owner;
owner = atomic_compare_and_exchange_val_acq (lock, l4_myself (),
@@ -106,6 +121,10 @@ ss_mutex_trylock (__const char *caller, int line, ss_mutex_t *lock)
// ss_mutex_trace_add (SS_MUTEX_TRYLOCK_BLOCKED, caller, line, lock);
return false;
+#else
+# warning Unimplemened on this platform.
+ return true;
+#endif
}
#define ss_mutex_trylock(__sml_lockp) \
diff --git a/viengoos/object.h b/viengoos/object.h
index 789e35d..ea7e6ec 100644
--- a/viengoos/object.h
+++ b/viengoos/object.h
@@ -21,7 +21,10 @@
#ifndef RM_OBJECT_H
#define RM_OBJECT_H
-#include <l4.h>
+#ifdef USE_L4
+# include <l4.h>
+#endif
+
#include <hurd/error.h>
#include <string.h>
#include <assert.h>
@@ -377,7 +380,8 @@ object_desc_unmap (struct object_desc *desc)
if (desc->mapped)
{
-#ifndef _L4_TEST_ENVIRONMENT
+#ifdef USE_L4
+# ifndef _L4_TEST_ENVIRONMENT
struct vg_object *object = object_desc_to_object (desc);
l4_fpage_t fpage = l4_fpage ((l4_word_t) object, PAGESIZE);
@@ -389,6 +393,9 @@ object_desc_unmap (struct object_desc *desc)
desc->user_referenced |= !!l4_was_referenced (result);
desc->user_dirty |= !!l4_was_written (result);
+# endif
+#else
+# warning Unimplemened on this platform.
#endif
desc->mapped = false;
@@ -405,7 +412,8 @@ object_desc_flush (struct object_desc *desc, bool clear_kernel)
if (clear_kernel || ! desc->dirty || ! desc->user_referenced)
/* We only need to see if we dirtied or referenced it. */
{
-#ifndef _L4_TEST_ENVIRONMENT
+#ifdef USE_L4
+# ifndef _L4_TEST_ENVIRONMENT
struct vg_object *object = object_desc_to_object (desc);
l4_fpage_t fpage = l4_fpage ((l4_word_t) object, PAGESIZE);
@@ -415,6 +423,9 @@ object_desc_flush (struct object_desc *desc, bool clear_kernel)
desc->user_referenced |= !!l4_was_referenced (result);
desc->user_dirty |= !!l4_was_written (result);
+# endif
+#else
+# warning Unimplemened on this platform.
#endif
}
}
diff --git a/viengoos/thread.h b/viengoos/thread.h
index b8006e5..73b6c4f 100644
--- a/viengoos/thread.h
+++ b/viengoos/thread.h
@@ -21,7 +21,6 @@
#ifndef RM_THREAD_H
#define RM_THREAD_H
-#include <l4.h>
#include <errno.h>
#include <viengoos/cap.h>
#include <viengoos/thread.h>
@@ -50,7 +49,7 @@ struct thread
/* Non-user-accessible fields. */
/* Allocated thread id. */
- l4_thread_id_t tid;
+ vg_thread_id_t tid;
/* XXX: Register state, blah, blah, blah. */
l4_word_t sp;
@@ -122,7 +121,7 @@ extern void thread_raise_exception (struct activity *activity,
extern void thread_deliver_pending (struct activity *activity,
struct thread *thread);
-/* Given the L4 thread id THREADID, find the associated thread. */
-extern struct thread *thread_lookup (l4_thread_id_t threadid);
+/* Given the thread id THREADID, find the associated thread. */
+extern struct thread *thread_lookup (vg_thread_id_t threadid);
#endif