Move some common headers and code to an x86 directory.
Fix register mappings, they differ between illumos and FreeBSD.