Index: x86/conf/files.x86
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/conf/files.x86,v
retrieving revision 1.79
diff -u -p -r1.79 files.x86
--- x86/conf/files.x86  29 Aug 2012 17:13:21 -0000      1.79
+++ x86/conf/files.x86  12 Sep 2012 22:23:15 -0000
@@ -16,6 +16,9 @@ defflag opt_pcifixup.h        PCI_ADDR_FIXUP PC
# To be able to test for NetBSD/xen in shared files
defflag        opt_xen.h               DO_NOT_DEFINE

+# XXX: uwe: move TSS to its own page
+defflag        opt_vbox_tss_kludge.h   VBOX_TSS_KLUDGE
+
define  cpubus { [apid = -1] }
define cpufeaturebus {}
define  ioapicbus { [apid = -1] }
Index: x86/include/cpu.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/cpu.h,v
retrieving revision 1.52
diff -u -p -r1.52 cpu.h
--- x86/include/cpu.h   15 Jul 2012 15:17:56 -0000      1.52
+++ x86/include/cpu.h   12 Sep 2012 22:23:15 -0000
@@ -46,6 +46,9 @@
#if defined(_KERNEL) || defined(_KMEMUSER)
#if defined(_KERNEL_OPT)
#include "opt_xen.h"
+#if !defined(XEN)
+#include "opt_vbox_tss_kludge.h"
+#endif
#ifdef i386
#include "opt_user_ldt.h"
#include "opt_vm86.h"
@@ -209,8 +212,10 @@ struct cpu_info {
       device_t        ci_temperature; /* Intel coretemp(4) or equivalent */
       device_t        ci_vm;          /* Virtual machine guest driver */

+#if !defined(VBOX_TSS_KLUDGE) /* XXX: uwe: moved to the end onto a page of its own */
       struct i386tss  ci_tss;         /* Per-cpu TSS; shared among LWPs */
       char            ci_iomap[IOMAPSIZE]; /* I/O Bitmap */
+#endif
       int ci_tss_sel;                 /* TSS selector of this cpu */

       /*
@@ -238,6 +243,11 @@ struct cpu_info {
       /* The following must be in a single cache line. */
       int             ci_want_resched __aligned(64);
       int             ci_padout __aligned(64);
+
+#if defined(VBOX_TSS_KLUDGE) /* XXX: uwe: moved to the end onto a page of its own */
+       struct i386tss  ci_tss __aligned(4096); /* Per-cpu TSS; shared among LWPs */
+       char            ci_iomap[IOMAPSIZE]; /* I/O Bitmap */
+#endif
};

/*
Index: x86/x86/patch.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/patch.c,v
retrieving revision 1.21
diff -u -p -r1.21 patch.c
--- x86/x86/patch.c     18 Apr 2010 23:47:51 -0000      1.21
+++ x86/x86/patch.c     12 Sep 2012 22:23:16 -0000
@@ -146,6 +146,12 @@ x86_patch(bool early)
       u_long cr0;
       int i;

+#if 1  /* XXX: uwe: vbox seems to be very confused by this */
+       volatile int punt = 1;
+       if (punt)
+               return;
+#endif
+
       if (early) {
               if (first)
                       return;
Index: i386/i386/spl.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/spl.S,v
retrieving revision 1.37
diff -u -p -r1.37 spl.S
--- i386/i386/spl.S     15 Jun 2012 14:09:26 -0000      1.37
+++ i386/i386/spl.S     12 Sep 2012 22:23:16 -0000
@@ -180,6 +180,10 @@ IDTVEC(spllower)
#ifndef XEN
       CLI(%eax)
#endif
+#if 1 /* XXX: uwe: workaround vbox problem */
+       ## provide padding before the following label for vbox to stomp over
+       .byte   0x0f , 0x1f, 0x40, 0x00 # 4 byte NOP insn
+#endif
.Lspllower_resume:
#ifdef XEN
       CLI(%eax)