Changes to TLS to migrate the guts into the kernel.
Fix problems with TLS refactoring.