Experimental TLS support.
[c11tester.git] / model.cc
index 45fa1b20ff11462c7999090a34e34f31212b049d..e4d6b75f95cb8178d34184d838999b3a9b62b08f 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -24,6 +24,9 @@ ModelChecker *model = NULL;
 /** Wrapper to run the user's main function, with appropriate arguments */
 void user_main_wrapper(void *)
 {
+#ifdef TLS
+       model->get_execution()->getTLSSize();
+#endif
        user_main(model->params.argc, model->params.argv);
 }
 
@@ -41,6 +44,9 @@ ModelChecker::ModelChecker() :
 {
        memset(&stats,0,sizeof(struct execution_stats));
        init_thread = new Thread(execution->get_next_id(), (thrd_t *) model_malloc(sizeof(thrd_t)), &user_main_wrapper, NULL, NULL);    // L: user_main_wrapper passes the user program
+#ifdef TLS
+       init_thread->setTLS((char *)get_tls_addr());
+#endif
        execution->add_thread(init_thread);
        scheduler->set_current_thread(init_thread);
        execution->setParams(&params);