First half of the long-overdue support for segment override prefixes,
LDTs and __NR_modify_ldt.

- Each thread has its own LDT.  Usually NULL, but if we need to
  change an entry, it is allocated.  LDTs are inherited from parents
  as one would expect.

- We intercept __NR_modify_ldt and update the calling thread's LDT
  accordingly.  This is done in coregrind/vg_ldt.c.  The kernel
  never sees these syscalls.

- New architectural state for %cs, %ss, %ds, %es, %fs and %gs.
  Probably overkill including %cs and %ss.  These are saved and
  restored in the usual way, _except_ at syscalls -- there's no
  point, since we are hiding all LDT operations from the kernel now.
  This does assume that no syscall implicitly looks at the
  segment registers, but I think that's safe.

Still only halfway there.  JITter is still unaware of seg regs
and override prefixes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1133 a5019735-40e9-0310-863c-91ae7b9d1cf9
10 files changed