Currently the minios headers do this:
#define current get_current()
Obviously when porting general code to this environment, this can
cause problems !
The attached patch arranges for this only to be done if
#define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.
Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.
(This is a revised version of my earlier patch, and supersedes it.)
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
diff -r 324b9b1dd71d extras/mini-os/Makefile
--- a/extras/mini-os/Makefile Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/Makefile Mon Oct 27 15:58:06 2008 +0000
@@ -17,6 +17,9 @@ include minios.mk
# Set tester flags
# CFLAGS += -DBLKTEST_WRITE
+
+# Make the headers define our internal stuff
+CFLAGS += -D__MINIOS__
# Define some default flags for linking.
LDLIBS :=
diff -r 324b9b1dd71d extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/include/sched.h Mon Oct 27 15:59:02 2008 +0000
@@ -48,8 +48,9 @@ void exit_thread(void) __attribute__((no
void exit_thread(void) __attribute__((noreturn));
void schedule(void);
+#ifdef __MINIOS__
#define current get_current()
-
+#endif
void wake(struct thread *thread);
void block(struct thread *thread);
diff -r 324b9b1dd71d extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h Mon Oct 27 14:59:01 2008 +0000
+++ b/extras/mini-os/include/wait.h Mon Oct 27 15:56:36 2008 +0000
@@ -7,7 +7,7 @@
#define DEFINE_WAIT(name) \
struct wait_queue name = { \
- .thread = current, \
+ .thread = get_current(), \
.thread_list = MINIOS_LIST_HEAD_INIT((name).thread_list), \
}
@@ -53,7 +53,7 @@ static inline void wake_up(struct wait_q
unsigned long flags; \
local_irq_save(flags); \
add_wait_queue(&wq, &w); \
- block(current); \
+ block(get_current()); \
local_irq_restore(flags); \
} while (0)
@@ -74,8 +74,8 @@ static inline void wake_up(struct wait_q
/* protect the list */ \
local_irq_save(flags); \
add_wait_queue(&wq, &__wait); \
- current->wakeup_time = deadline; \
- clear_runnable(current); \
+ get_current()->wakeup_time = deadline; \
+ clear_runnable(get_current()); \
local_irq_restore(flags); \
if((condition) || (deadline && NOW() >= deadline)) \
break; \
@@ -83,7 +83,7 @@ static inline void wake_up(struct wait_q
} \
local_irq_save(flags); \
/* need to wake up */ \
- wake(current); \
+ wake(get_current()); \
remove_wait_queue(&__wait); \
local_irq_restore(flags); \
} while(0)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|