Browse Source

[LibOS] Rename allocate_tls()/populate_tls() to init_fs_base()/update_fs_base()

Isaku Yamahata 4 years ago
parent
commit
e4f90b1eec

+ 2 - 2
LibOS/shim/include/shim_thread.h

@@ -144,8 +144,8 @@ 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 allocate_tls (unsigned long fs_base, struct shim_thread * thread);
-void populate_tls (unsigned long fs_base);
+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

@@ -727,7 +727,7 @@ static int resume_wrapper (void * param)
     assert(tcb->context.regs && tcb->context.regs->rsp);
 
     thread->in_vm = thread->is_alive = true;
-    allocate_tls(fs_base, thread);
+    init_fs_base(fs_base, thread);
     debug_setbuf(tcb, false);
     debug("set fs_base to 0x%lx\n", fs_base);
 
@@ -776,7 +776,7 @@ BEGIN_RS_FUNC(running_thread)
             shim_tcb_t * tcb = thread->shim_tcb;
             assert(tcb->context.regs && tcb->context.regs->rsp);
             tcb->debug_buf = shim_get_tls()->debug_buf;
-            allocate_tls(fs_base, thread);
+            init_fs_base(fs_base, thread);
             /* Temporarily disable preemption until the thread resumes. */
             __disable_preempt(tcb);
             debug_setprefix(tcb);

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

@@ -792,7 +792,7 @@ static void shim_ipc_helper_prepare(void* arg) {
         return;
 
     unsigned long fs_base = 0;
-    allocate_tls(fs_base, self);
+    init_fs_base(fs_base, self);
     debug_setbuf(shim_get_tls(), true);
 
     lock(&ipc_helper_lock);

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

@@ -145,7 +145,7 @@ static void shim_async_helper(void * arg) {
         return;
 
     unsigned long fs_base = 0;
-    allocate_tls(fs_base, self);
+    init_fs_base(fs_base, self);
     debug_setbuf(shim_get_tls(), true);
 
     lock(&async_helper_lock);

+ 3 - 3
LibOS/shim/src/shim_init.c

@@ -206,7 +206,7 @@ void init_tcb (shim_tcb_t * tcb)
 }
 
 /* This function is used to allocate tls before interpreter start running */
-void allocate_tls (unsigned long fs_base, struct shim_thread * thread)
+void init_fs_base (unsigned long fs_base, struct shim_thread * thread)
 {
     shim_tcb_t * shim_tcb = shim_get_tls();
     init_tcb(shim_tcb);
@@ -225,7 +225,7 @@ void allocate_tls (unsigned long fs_base, struct shim_thread * thread)
     assert(shim_tls_check_canary());
 }
 
-void populate_tls (unsigned long fs_base)
+void update_fs_base (unsigned long fs_base)
 {
     shim_tcb_t * shim_tcb = shim_get_tls();
 
@@ -676,7 +676,7 @@ noreturn void* shim_init (int argc, void * args)
 
     /* create the initial TCB, shim can not be run without a tcb */
     unsigned long fs_base = 0;
-    allocate_tls(fs_base, NULL);
+    init_fs_base(fs_base, NULL);
     __disable_preempt(shim_get_tls()); // Temporarily disable preemption for delaying any signal
                                        // that arrives during initialization
     debug_setbuf(shim_get_tls(), true);

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

@@ -591,7 +591,7 @@ void* shim_do_arch_prctl(int code, void* addr) {
             if (!addr)
                 return (void*)-EINVAL;
 
-            populate_tls((unsigned long)addr);
+            update_fs_base((unsigned long)addr);
             debug("set fs_base to 0x%lx\n", (unsigned long)addr);
             return NULL;
 

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

@@ -125,11 +125,11 @@ static int clone_implementation_wrapper(struct clone_args * arg)
     struct shim_thread* my_thread = arg->thread;
     assert(my_thread);
 
-    allocate_tls(my_thread->fs_base, my_thread); /* set up TCB */
+    init_fs_base(my_thread->fs_base, my_thread); /* set up TCB */
     shim_tcb_t * tcb = my_thread->shim_tcb;
 
     /* only now we can call LibOS/PAL functions because they require a set-up TCB;
-     * do not move the below functions before allocate_tls()! */
+     * do not move the below functions before init_fs_base()! */
     object_wait_with_retry(arg->create_event);
     DkObjectClose(arg->create_event);
 

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

@@ -88,7 +88,7 @@ noreturn static void __shim_do_execve_rtld (struct execve_rtld_arg * __arg)
     int ret = 0;
 
     unsigned long fs_base = 0;
-    populate_tls(fs_base);
+    update_fs_base(fs_base);
     debug("set fs_base to 0x%lx\n", fs_base);
 
     UPDATE_PROFILE_INTERVAL();