freebsd-dev/sys/amd64
Ed Schouten ab83575070 Make CloudABI's way of doing TLS more friendly to userspace emulators.
We're currently seeing how hard it would be to run CloudABI binaries on
operating systems cannot be modified easily (Windows, Mac OS X). The
idea is that we want to just run them without any sandboxing. Now
that CloudABI executables are PIE, this is already a bit easier, but TLS
is still problematic:

- CloudABI executables want to write to the %fs, which typically
  requires extra system calls by the emulator every time it needs to
  switch between CloudABI's and its own TLS.

- If CloudABI executables overwrite the %fs base unconditionally, it
  also becomes harder for the emulator to store a backup of the old
  value of %fs. To solve this, let's no longer overwrite %fs, but just
  %fs:0.

As CloudABI's C library does not use a TCB, this space can now be used
by an emulator to keep track of its internal state. The executable can
now safely overwrite %fs:0, as long as it makes sure that the TCB is
copied over to the new TLS area.

Ensure that there is an initial TLS area set up when the process starts,
only containing a bogus TCB. We don't really care about its contents on
FreeBSD.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D5836
2016-04-06 11:11:31 +00:00
..
acpica If x86 CPU implementation of the MWAIT instruction reasonably 2015-05-09 12:28:48 +00:00
amd64 Move i386/i386/autoconf.c to sys/x86/x86 and use it on both amd64 and i386. 2016-04-03 23:03:54 +00:00
cloudabi64 Make CloudABI's way of doing TLS more friendly to userspace emulators. 2016-04-06 11:11:31 +00:00
conf Polish wbwd(4) driver and add more supported chips. 2016-03-24 20:52:35 +00:00
ia32 Convert ss_sp in stack_t and sigstack to void *. 2016-01-27 17:55:01 +00:00
include Type of the interrupt handlers on x86 cannot be expressed in C. 2016-03-29 19:56:48 +00:00
linux Add kern.features flags for linux and linux64 modules 2016-04-05 22:36:48 +00:00
linux32 Add kern.features flags for linux and linux64 modules 2016-04-05 22:36:48 +00:00
pci Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
vmm Bump VM_MAX_MEMSEGS from 2 to 3 to match the number of VM segment 2016-02-26 16:18:47 +00:00
Makefile Bring the tags and links entries for amd64 up to date. 2015-10-27 22:59:24 +00:00