diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-12-08 15:24:02 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-12-08 15:24:02 +0100 |
commit | 7fc4533b321fbe7ef6ce0ef05e3b99cebe13a39e (patch) | |
tree | b862d841d85f51754110df948f0b471c5e4583de /extras/mini-os/include/semaphore.h | |
parent | bc70813814bf808d64f0331c2e450662058e07a7 (diff) | |
download | xen-7fc4533b321fbe7ef6ce0ef05e3b99cebe13a39e.tar.gz xen-7fc4533b321fbe7ef6ce0ef05e3b99cebe13a39e.tar.bz2 xen-7fc4533b321fbe7ef6ce0ef05e3b99cebe13a39e.zip |
Merge in the newer Xenbus implementation from Linux to the Mini-OS. The new
version compiles and starts up, but I'm not really sure how to test the new
xenbus implementation.
* Added unbind_evtchn
* Copied parts of the Linux spinlock implementation to make the changes to
xenbus compared to Linux smaller. Also added a dummy rwsem implementation.
* Updated the xenbus-files
Signed-off-by: Simon Kagstrom <simon.kagstrom@bth.se>
Diffstat (limited to 'extras/mini-os/include/semaphore.h')
-rw-r--r-- | extras/mini-os/include/semaphore.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/extras/mini-os/include/semaphore.h b/extras/mini-os/include/semaphore.h index d30c81e674..47365d25fd 100644 --- a/extras/mini-os/include/semaphore.h +++ b/extras/mini-os/include/semaphore.h @@ -2,6 +2,7 @@ #define _SEMAPHORE_H_ #include <wait.h> +#include <spinlock.h> /* * Implementation of semaphore in Mini-os is simple, because @@ -14,6 +15,15 @@ struct semaphore struct wait_queue_head wait; }; +/* + * the semaphore definition + */ +struct rw_semaphore { + signed long count; + spinlock_t wait_lock; + struct list_head wait_list; + int debug; +}; #define __SEMAPHORE_INITIALIZER(name, n) \ { \ @@ -31,6 +41,12 @@ struct semaphore #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) +static inline void init_MUTEX(struct semaphore *sem) +{ + sem->count = 1; + init_waitqueue_head(&sem->wait); +} + static void inline down(struct semaphore *sem) { wait_event(sem->wait, sem->count > 0); @@ -43,4 +59,27 @@ static void inline up(struct semaphore *sem) wake_up(&sem->wait); } +/* FIXME! Thre read/write semaphores are unimplemented! */ +static inline void init_rwsem(struct rw_semaphore *sem) +{ + sem->count = 1; +} + +static inline void down_read(struct rw_semaphore *sem) +{ +} + + +static inline void up_read(struct rw_semaphore *sem) +{ +} + +static inline void up_write(struct rw_semaphore *sem) +{ +} + +static inline void down_write(struct rw_semaphore *sem) +{ +} + #endif /* _SEMAPHORE_H */ |