ia32: Make TLS settable from uspace
The TLS document[1] mandates that %gs[0] is the thread pointer on ia32.
That is good as it allows userspace-only TLS management for fibrils:
fibril_save/restore() simply manipulate the thread pointer in %gs:0 and
don't need to ask the kernel to modify %gs's base. The kernel treats
%gs:0 as another preserved register and preserves it across context
switches. GCC gets in the way a little bit because it by default assumes
that TLS is accessible from negative %gs offsets (which would
necessitate a kernel-assisted solution). Fortunately, there is a GCC
option to suppress this assumption.
- Introduce the concept of virtual registers, with VREG_TP (thread
pointer) being the first of them
- Preserve VREG_TP in context_save/restore()
- Stop using sys_tls_set() in favour of using %gs:0 as the thread
pointer
- Make GCC generate code that always goes through %gs:0 to access TLS
[1] Drepper, U.: ELF Handling For Thread-Local Storage