Closed kevinaboos closed 2 years ago
Commit 5e3ea09 does the first part of this, but doesn't fully implement user/application-defined TLS.
TLS as per the ELF spec and the #[thread_local]
attribute is partially supported, but isn't fully working yet when dynamically loading crate object files and assigning offsets to their TLS areas in the global TLS Initializer data image.
The #[thread_local]
attribute now fully works. Next up is to add a thread_local!()
macro.
The thread_local!()
macro for lazy dynamic initialization (and destruction) of TLS objects is finished as of #463.
Use the
FS
segment register on x86_64. First start with just storing the current task id there, and then move on towards storing the actual currentTaskRef
there. This allows us to instantly look up the current task without having to query theTASKLIST
, which becomes a bottleneck when there are thousands of Tasks.Then, after that's working, we can add true support for arbitrary thread-local storage. It could potentially be inside the
Task
struct, or elsewhere.Discussion here: https://wiki.osdev.org/Thread_Local_Storage
TaskLocalData
.#[thread_local]
attribute in statically-linked base kernel image#[thread_local]
attribute in dynamically-loaded/linked crate object filesthread_local!()
macro, à la the Rust std lib