Browse Source

[LibOS] Replace init_fs_base() with update_fs_base()

Now init_fs_base() is same to update_fs_base() except struct shim_thread
argument which is unused.
Isaku Yamahata 4 years ago
parent
commit
f8f6a0c42f

+ 0 - 1
LibOS/shim/include/shim_thread.h

@@ -143,7 +143,6 @@ void put_thread (struct shim_thread * thread);
 void get_simple_thread (struct shim_simple_thread * thread);
 void put_simple_thread (struct shim_simple_thread * thread);
 
-void init_fs_base (unsigned long fs_base, struct shim_thread * thread);
 void update_fs_base (unsigned long fs_base);
 
 void debug_setprefix (shim_tcb_t * tcb);

+ 2 - 2
LibOS/shim/src/bookkeep/shim_thread.c

@@ -761,7 +761,7 @@ static int resume_wrapper (void * param)
     set_cur_thread(thread);
     unsigned long fs_base = saved_tcb->context.fs_base;
     assert(fs_base);
-    init_fs_base(fs_base, thread);
+    update_fs_base(fs_base);
 
     thread->in_vm = thread->is_alive = true;
 
@@ -815,7 +815,7 @@ BEGIN_RS_FUNC(running_thread)
             set_cur_thread(thread);
 
             assert(tcb->context.regs && tcb->context.regs->rsp);
-            init_fs_base(tcb->context.fs_base, thread);
+            update_fs_base(tcb->context.fs_base);
             /* Temporarily disable preemption until the thread resumes. */
             __disable_preempt(tcb);
             debug_setbuf(tcb, false);

+ 1 - 1
LibOS/shim/src/ipc/shim_ipc_helper.c

@@ -794,7 +794,7 @@ static void shim_ipc_helper_prepare(void* arg) {
 
     shim_tcb_init();
     set_cur_thread(self);
-    init_fs_base(0, self);
+    update_fs_base(0);
     debug_setbuf(shim_get_tcb(), true);
 
     lock(&ipc_helper_lock);

+ 1 - 1
LibOS/shim/src/shim_async.c

@@ -146,7 +146,7 @@ static void shim_async_helper(void * arg) {
 
     shim_tcb_init();
     set_cur_thread(self);
-    init_fs_base(0, self);
+    update_fs_base(0);
     debug_setbuf(shim_get_tcb(), true);
 
     lock(&async_helper_lock);

+ 1 - 11
LibOS/shim/src/shim_init.c

@@ -199,16 +199,6 @@ char ** library_paths = NULL;
 struct shim_lock __master_lock;
 bool lock_enabled;
 
-/* This function is used to allocate tls before interpreter start running */
-void init_fs_base (unsigned long fs_base, struct shim_thread * thread)
-{
-    __UNUSED(thread);
-    shim_tcb_t * shim_tcb = shim_get_tcb();
-    shim_tcb->context.fs_base = fs_base;
-    DkSegmentRegister(PAL_SEGMENT_FS, (PAL_PTR)fs_base);
-    assert(shim_tcb_check_canary());
-}
-
 void update_fs_base (unsigned long fs_base)
 {
     shim_tcb_t * shim_tcb = shim_get_tcb();
@@ -654,7 +644,7 @@ noreturn void* shim_init (int argc, void * args)
 
     /* create the initial TCB, shim can not be run without a tcb */
     shim_tcb_init();
-    init_fs_base(0, NULL);
+    update_fs_base(0);
     __disable_preempt(shim_get_tcb()); // Temporarily disable preemption for delaying any signal
                                        // that arrives during initialization
     debug_setbuf(shim_get_tcb(), true);

+ 1 - 1
LibOS/shim/src/sys/shim_clone.c

@@ -120,7 +120,7 @@ static int clone_implementation_wrapper(struct shim_clone_args * arg)
 
     shim_tcb_init();
     set_cur_thread(my_thread);
-    init_fs_base(arg->fs_base, my_thread);
+    update_fs_base(arg->fs_base);
     shim_tcb_t * tcb = my_thread->shim_tcb;
 
     /* only now we can call LibOS/PAL functions because they require a set-up TCB;