KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
tls_static.h File Reference

Compiler Thread-local storage. More...

#include <sys/cdefs.h>
#include <kos/thread.h>

Go to the source code of this file.

Functions

void arch_tls_init (void)
 Initialize tls.
 
bool arch_tls_setup_data (kthread_t *thd)
 Set up tls data for a new kthread.
 
void arch_tls_destroy_data (kthread_t *thd)
 Destroy tls data for an old kthread.
 

Detailed Description

Compiler Thread-local storage.

The functions in this file deal with managing static TLS for C99's __thread or C11's _Thread_local.

This should not be exported or accessed externally.

Author
Donald Haase

Function Documentation

◆ arch_tls_destroy_data()

void arch_tls_destroy_data ( kthread_t * thd)

Destroy tls data for an old kthread.

This function undoes arch_tls_setup_data.

It will be called by thd_destroy

Parameters
thdThe thread to destroy tls data for.

◆ arch_tls_init()

void arch_tls_init ( void )

Initialize tls.

This function takes the steps necessary to initialize tls after the creation of the k_thread for the main kernel thread.

For SH, this forces the setting of the GBR register to the TLS of the kernel thread. That isn't necessary afterwards as it is handled during context switching.

◆ arch_tls_setup_data()

bool arch_tls_setup_data ( kthread_t * thd)

Set up tls data for a new kthread.

This function allocates the memory for a kthread's TLS, copies static data from the executable, and sets the kthread's IRQ context to match.

It will be called by thd_create_ex

Parameters
thdThe thread to setup tls data for.