mklinux.c 760 B

1234567891011121314151617181920212223242526272829
  1. #include <glue/mklinux.h>
  2. #include <linux/sched.h>
  3. #include <linux/printk.h>
  4. #define NCPUS 1
  5. #include <kern/thread.h>
  6. #define current get_current()
  7. void gnumach_thread_update(void)
  8. {
  9. if(current->gnumach_thread==NULL)
  10. {
  11. /* task create */
  12. current->gnumach_thread = gnumach_thread_create(gnumach_task_create());
  13. struct thread* t = (struct thread*) current->gnumach_thread;
  14. t->linux_task = current;
  15. }
  16. else
  17. {
  18. struct thread* t = (struct thread*) current->gnumach_thread;
  19. if(current != t->linux_task)
  20. {
  21. current->gnumach_thread = gnumach_thread_create(t->task);
  22. struct thread* t2 = (struct thread*) current->gnumach_thread;
  23. t2->linux_task = current;
  24. }
  25. }
  26. }