]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/ux/context-ux.cpp
update
[l4.git] / kernel / fiasco / src / kern / ux / context-ux.cpp
index e73e3c1d6ba75d4657b8da91b59c026021a3b8e6..32df20038e13e186455136b600f18bbee3333088 100644 (file)
@@ -13,6 +13,8 @@ protected:
 // ---------------------------------------------------------------------
 IMPLEMENTATION[ux]:
 
+#include "utcb_init.h"
+
 IMPLEMENT inline
 void
 Context::switch_fpu (Context *)
@@ -23,6 +25,13 @@ bool
 Context::is_native()
 { return _is_native; }
 
+PROTECTED inline NEEDS["utcb_init.h"]
+void
+Context::arch_setup_utcb_ptr()
+{
+  _gs = _fs = Utcb_init::utcb_segment();
+}
+
 PROTECTED inline
 void
 Context::switch_gdt_user_entries(Context *to)
@@ -43,4 +52,8 @@ Context::switch_gdt_user_entries(Context *to)
         Trampoline::syscall(tos->pid(), 243,
                             Mem_layout::Trampoline_page + sizeof(Mword));
       }
+
+  // update the global UTCB pointer to make the thread find its UTCB
+  // using fs:[0]
+  Mem_layout::user_utcb_ptr(current_cpu()) = to->utcb().usr();
 }