2 ms·
The FS and GS segment selectors are still used in x86-64, typically for `thread_local` storage, but they can be repurposed. `thread_local` is an example of a "
by sparkie 1mo ago
The FS and GS segment selectors are still used in x86-64, typically for `thread_local` storage, but they can be repurposed.
`thread_local` is an example of a "relative pointer" though. Instructions to access the thread local are prefixed with `fs:` or `gs:`, and point relative to the address in the respective segment register.
- pocksuppet 22d agoThat's the same as any other index or member access. It's myThreadLocalBlock->myVariable. thread_local is an example of something else unusual though - a struct linker as seen in https://yosefk.com/blog/i-want-a-struct-linker.html https://yosefk.com/blog/i-want-a-struct-linker.html and it even supports dynamic loading.