summaryrefslogtreecommitdiff
path: root/rt/start-netbsd.s
AgeCommit message (Collapse)Author
2019-02-26Add support for `__fini__` functions.Ori Bernstein
2018-10-18Add thread-local storage for POSIX-y platforms.iriri
This patch implements thread-local storage by using a segment register to store pointers to regions of memory unique to each thread. In spawned threads, this region starts above the top of the stack, while in the main thread, this region is initially statically allocated so it can be used in `__init__` functions and dynamically reallocated if it needs to grow beyond 8 slots. The api consists of 3 functions: `tlsalloc()`, which must be called from the main thread, allocates a slot and returns a key to be used with `settls(k, v)` and `gettls(k)`. Each thread inherits its tls slots from the thread that spawned it and any slot added after a given thread is spawned is not available in that thread. Adding tls regions gives threads an easy way to get their own tids, allowing us to add some basic correctness checks to the mutex code. A pointer to the base of the stack and the size of the mapping are also stored in the tls region, making it easy to support user-specified stack sizes in the future. Changes from previous version: - Fixed size of main tls static allocation. - More comments, less magic. - Fixed typo in start+osx-x64.s exit+{freebsd,linux,openbsd}-x64.s - `gettlskey` renamed to `tlsalloc`. - `key` is now `tlskey(@a#)`, improving safety. - Test is slightly less bad.
2017-12-05Align the stack in _start.snocl
2017-07-04Simplify _start routinesMichael Forney
sys$__environment was unused since 94ee9832f5861c4d09afa12338720eb3a479c342. Delete it and count, which is no longer needed. Simplify _start routines since they no longer need to allocate space for the environment slice and populate it.
2017-07-04rt: Remove duplicate stack allocationMichael Forney
2017-02-15Add assembly start code for netbsd.Ori Bernstein
Seems to work so far.