Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 72133)
@@ -110,4 +110,26 @@
        bs3-cmn-RegCtxSetRipCsFromFlat.c \
        bs3-cmn-RegCtxSetRipCsFromLnkPtr.c \
+       bs3-cmn-RegGetCr0.asm \
+       bs3-cmn-RegGetCr2.asm \
+       bs3-cmn-RegGetCr3.asm \
+       bs3-cmn-RegGetCr4.asm \
+       bs3-cmn-RegSetCr0.asm \
+       bs3-cmn-RegSetCr2.asm \
+       bs3-cmn-RegSetCr3.asm \
+       bs3-cmn-RegSetCr4.asm \
+       bs3-cmn-RegGetDr0.asm \
+       bs3-cmn-RegGetDr1.asm \
+       bs3-cmn-RegGetDr2.asm \
+       bs3-cmn-RegGetDr3.asm \
+       bs3-cmn-RegGetDr6.asm \
+       bs3-cmn-RegGetDr7.asm \
+       bs3-cmn-RegGetDrX.asm \
+       bs3-cmn-RegSetDr0.asm \
+       bs3-cmn-RegSetDr1.asm \
+       bs3-cmn-RegSetDr2.asm \
+       bs3-cmn-RegSetDr3.asm \
+       bs3-cmn-RegSetDr6.asm \
+       bs3-cmn-RegSetDr7.asm \
+       bs3-cmn-RegSetDrX.asm \
        bs3-cmn-ExtCtxInit.c \
        bs3-cmn-ExtCtxSave.asm \
@@ -165,4 +187,5 @@
 	bs3-cmn-TestIsVmmDevTestingPresent.asm \
 	bs3-cmn-TestCheckRegCtxEx.c \
+	bs3-cmn-TestHostPrintf.c \
 	bs3-cmn-TestPrintf.c \
 	bs3-cmn-TrapReInit.c \
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PerCpuData.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PerCpuData.c	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PerCpuData.c	(revision 72133)
@@ -53,4 +53,8 @@
 uint8_t  g_bStupidUnalignedCompiler1 = 0xfe;
 
+/** Set to disable special V8086 \#GP and \#UD handling in Bs3TrapDefaultHandler.
+ * This is useful for getting   */
+bool volatile g_fBs3TrapNoV86Assist = false;
+
 /** The context of the last Bs3TrapSetJmp call.
  * This will have eax set to 1 and need only be restored when it triggers. */
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm	(revision 72133)
@@ -30,4 +30,5 @@
 BS3_EXTERN_SYSTEM16 Bs3Gdt
 BS3_EXTERN_DATA16 g_bBs3CurrentMode
+BS3_EXTERN_DATA16 g_fBs3TrapNoV86Assist
 %if TMPL_BITS != 64
 BS3_EXTERN_DATA16 g_uBs3CpuDetected
@@ -148,4 +149,12 @@
         mov     [BS3_ONLY_16BIT(es:) BS3_DATA16_WRT(g_bBs3CurrentMode)], al
 
+        ;
+        ; Set g_fBs3TrapNoV86Assist if BS3REGCTXRESTORE_F_NO_V86_ASSIST specified.
+        ;
+        test    cl, BS3REGCTXRESTORE_F_NO_V86_ASSIST
+        jz      .no_f_no_v86_assist
+        mov     byte [BS3_ONLY_16BIT(es:) BS3_DATA16_WRT(g_fBs3TrapNoV86Assist)], 1
+.no_f_no_v86_assist:
+
 %if TMPL_BITS == 16
         ;
@@ -262,5 +271,5 @@
 
         ; Restore control registers if they've changed.
-        test    cl, BS3TRAPRESUME_F_SKIP_CRX
+        test    cl, BS3REGCTXRESTORE_F_SKIP_CRX
         jnz     .skip_control_regs
         test    byte [xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR0_IS_MSW | BS3REG_CTX_F_NO_CR2_CR3
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr0.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr0.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr0.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetCr0
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetCr0,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetCr0, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_CRX
+        mov     dl, 0
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, cr0
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetCr0
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr2.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr2.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr2.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetCr2
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetCr2,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetCr2, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_CRX
+        mov     dl, 2
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, cr2
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetCr2
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr3.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr3.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr3.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetCr3
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetCr3,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetCr3, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_CRX
+        mov     dl, 3
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, cr3
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetCr3
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr4.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr4.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetCr4.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetCr4
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetCr4,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetCr4, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_CRX
+        mov     dl, 4
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, cr4
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetCr4
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr0.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr0.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr0.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr0
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr0,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr0, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 0
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr0
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr0
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr1.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr1.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr1.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr1
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr1,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr1, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 1
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr1
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr1
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr2.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr2.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr2.asm	(revision 72133)
@@ -0,0 +1,73 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr2
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr2,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr2, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 2
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr2
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr2
+
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr3.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr3.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr3.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr3
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr3,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr3, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 3
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr3
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr3
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr6.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr6.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr6.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr6
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr7,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr6, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 6
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr6
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr6
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr7.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr7.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDr7.asm	(revision 72133)
@@ -0,0 +1,72 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDr7
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDr7,(void));
+;
+; @returns  Register value.
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDr7, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, 7
+        call    Bs3Syscall
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     sAX, dr7
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+
+.return:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDr7
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDrX.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDrX.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetDrX.asm	(revision 72133)
@@ -0,0 +1,115 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegGetDrX
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+;TONLY16 CPU 386
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(RTCCUINTXREG, Bs3RegGetDrX,(uint8_t iReg));
+;
+; @returns  Register value.
+; @param    iRegister   The source register
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs (only return full register(s)).
+;
+BS3_PROC_BEGIN_CMN Bs3RegGetDrX, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        mov     xAX, BS3_SYSCALL_GET_DRX
+        mov     dl, [xBP + xCB + cbCurRetAddr]
+        call    Bs3Syscall
+        jmp     .return_syscall
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     al, [xBP + xCB + cbCurRetAddr]
+        cmp     al, 6
+        jz      .get_dr6
+        cmp     al, 7
+        jz      .get_dr7
+        cmp     al, 0
+        jz      .get_dr0
+        cmp     al, 1
+        jz      .get_dr1
+        cmp     al, 2
+        jz      .get_dr2
+        cmp     al, 3
+        jz      .get_dr3
+        cmp     al, 4
+        jz      .get_dr4
+        cmp     al, 5
+        jz      .get_dr5
+        call    Bs3Panic
+
+.get_dr0:
+        mov     sAX, dr0
+        jmp     .return
+.get_dr1:
+        mov     sAX, dr1
+        jmp     .return
+.get_dr2:
+        mov     sAX, dr2
+        jmp     .return
+.get_dr3:
+        mov     sAX, dr3
+        jmp     .return
+.get_dr4:
+        mov     sAX, dr4
+        jmp     .return
+.get_dr5:
+        mov     sAX, dr5
+        jmp     .return
+.get_dr7:
+        mov     sAX, dr7
+        jmp     .return
+.get_dr6:
+        mov     sAX, dr6
+.return:
+TONLY16 mov     edx, eax
+TONLY16 shr     edx, 16
+.return_syscall:
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegGetDrX
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr0.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr0.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr0.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetCr0
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetCr0,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetCr0, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_CRX
+        mov     dl, 0
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     cr0, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetCr0
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr2.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr2.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr2.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetCr1
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetCr1,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetCr1, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_CRX
+        mov     dl, 1
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     cr1, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetCr1
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr3.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr3.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr3.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetCr3
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetCr3,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetCr3, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_CRX
+        mov     dl, 3
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     cr3, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetCr3
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr4.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr4.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetCr4.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetCr4
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetCr4,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetCr4, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_CRX
+        mov     dl, 4
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     cr4, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetCr4
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr0.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr0.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr0.asm	(revision 72133)
@@ -0,0 +1,82 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr0
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr0, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 0
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr0, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr0
+
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr1.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr1.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr1.asm	(revision 72133)
@@ -0,0 +1,83 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr1
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr1, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 1
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr1, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr1
+
+
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr2.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr2.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr2.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr2
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr2, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 2
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr2, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr2
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr3.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr3.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr3.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr3
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr3, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 3
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr3, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr3
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr6.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr6.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr6.asm	(revision 72133)
@@ -0,0 +1,83 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr6
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr6, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 6
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr6, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr6
+
+
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr7.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr7.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDr7.asm	(revision 72133)
@@ -0,0 +1,81 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDr7
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(RTCCUINTXREG uValue));
+;
+; @param    uValue      The value to set.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDr7, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+
+        mov     sSI, [xBP + xCB + cbCurRetAddr]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+        push    dx
+
+        mov     ax, BS3_SYSCALL_SET_DRX
+        mov     dl, 7
+        call    Bs3Syscall
+
+        pop     dx
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        mov     dr7, sSI
+
+.return:
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDr7
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDrX.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDrX.asm	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDrX.asm	(revision 72133)
@@ -0,0 +1,125 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3RegSetDrX
+;
+
+;
+; Copyright (C) 2007-2018 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bs3kit-template-header.mac"
+
+
+BS3_EXTERN_CMN Bs3Panic
+%if TMPL_BITS == 16
+BS3_EXTERN_CMN Bs3Syscall
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+%endif
+TMPL_BEGIN_TEXT
+
+;TONLY16 CPU 386
+
+;;
+; @cproto   BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(uint8_t iReg, RTCCUINTXREG uValue));
+;
+; @returns  Register value.
+; @param    iRegister   The source register
+; @param    uValue      The new Value.
+
+; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
+;
+; @uses     No GPRs.
+;
+BS3_PROC_BEGIN_CMN Bs3RegSetDrX, BS3_PBC_HYBRID_SAFE
+        BS3_CALL_CONV_PROLOG 1
+        push    xBP
+        mov     xBP, xSP
+        push    sSI
+        push    xDX
+
+        mov     dl, [xBP + xCB + cbCurRetAddr]
+        mov     sSI, [xBP + xCB + cbCurRetAddr + xCB]
+
+%if TMPL_BITS == 16
+        ; If V8086 mode we have to go thru a syscall.
+        test    byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
+        jz      .direct_access
+        push    ax
+
+        mov     xAX, BS3_SYSCALL_SET_DRX
+        call    Bs3Syscall
+
+        pop     ax
+        jmp     .return
+
+.direct_access:
+%endif
+        ; Switch (iRegister)
+        cmp     dl, 6
+        jz      .set_dr6
+        cmp     dl, 7
+        jz      .set_dr7
+        cmp     dl, 0
+        jz      .set_dr0
+        cmp     dl, 1
+        jz      .set_dr1
+        cmp     dl, 2
+        jz      .set_dr2
+        cmp     dl, 3
+        jz      .set_dr3
+        cmp     dl, 4
+        jz      .set_dr4
+        cmp     dl, 5
+        jz      .set_dr5
+
+        call    Bs3Panic
+
+.set_dr0:
+        mov     dr0, sSI
+        jmp     .return
+.set_dr1:
+        mov     dr1, sSI
+        jmp     .return
+.set_dr2:
+        mov     dr2, sSI
+        jmp     .return
+.set_dr3:
+        mov     dr3, sSI
+        jmp     .return
+.set_dr4:
+        mov     dr4, sSI
+        jmp     .return
+.set_dr5:
+        mov     dr5, sSI
+        jmp     .return
+.set_dr7:
+        mov     dr7, sSI
+        jmp     .return
+.set_dr6:
+        mov     dr6, sSI
+
+.return:
+        pop     xDX
+        pop     sSI
+        pop     xBP
+        BS3_CALL_CONV_EPILOG 1
+        BS3_HYBRID_RET
+BS3_PROC_END_CMN   Bs3RegSetDrX
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestHostPrintf.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestHostPrintf.c	(revision 72133)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestHostPrintf.c	(revision 72133)
@@ -0,0 +1,104 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - BS3TestPrintf, BS3TestPrintfV
+ */
+
+/*
+ * Copyright (C) 2007-2017 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
+#include "bs3kit-template-header.h"
+#include "bs3-cmn-test.h"
+
+#include <iprt/asm-amd64-x86.h>
+
+
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
+/** Output state for Bs3TestHostPrintfV. */
+typedef struct BS3TESTHOSTPRINTF
+{
+    bool     fNewCmd;
+} BS3TESTHOSTPRINTF;
+
+
+/**
+ * @callback_method_impl{FNBS3STRFORMATOUTPUT, Prints to screen and VMMDev}
+ */
+static BS3_DECL_CALLBACK(size_t) bs3TestPrintfStrOutput(char ch, void BS3_FAR *pvUser)
+{
+    BS3TESTHOSTPRINTF BS3_FAR *pState = (BS3TESTHOSTPRINTF BS3_FAR *)pvUser;
+
+    /*
+     * VMMDev first.  We do line by line processing to avoid running out of
+     * string buffer on the host side.
+     */
+    if (g_fbBs3VMMDevTesting)
+    {
+        if (ch != '\n' && !pState->fNewCmd)
+            ASMOutU8(VMMDEV_TESTING_IOPORT_DATA, ch);
+        else if (ch != '\0')
+        {
+            if (pState->fNewCmd)
+            {
+#if ARCH_BITS == 16
+                ASMOutU16(VMMDEV_TESTING_IOPORT_CMD, (uint16_t)VMMDEV_TESTING_CMD_PRINT);
+#else
+                ASMOutU32(VMMDEV_TESTING_IOPORT_CMD, VMMDEV_TESTING_CMD_PRINT);
+#endif
+                pState->fNewCmd = false;
+            }
+            ASMOutU8(VMMDEV_TESTING_IOPORT_DATA, ch);
+            if (ch == '\n')
+            {
+                ASMOutU8(VMMDEV_TESTING_IOPORT_DATA, '\0');
+                pState->fNewCmd = true;
+            }
+        }
+    }
+
+    return ch != '\0';
+}
+
+
+#undef Bs3TestHostPrintfV
+BS3_CMN_DEF(void, Bs3TestHostPrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va))
+{
+    BS3TESTHOSTPRINTF State;
+    State.fNewCmd = true;
+    Bs3StrFormatV(pszFormat, va, bs3TestPrintfStrOutput, &State);
+}
+
+
+
+#undef Bs3TestHostPrintf
+BS3_CMN_DEF(void, Bs3TestHostPrintf,(const char BS3_FAR *pszFormat, ...))
+{
+    va_list va;
+    va_start(va, pszFormat);
+    BS3_CMN_NM(Bs3TestHostPrintfV)(pszFormat, va);
+    va_end(va);
+}
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c	(revision 72133)
@@ -47,21 +47,81 @@
 
 #if TMPL_BITS != 64
+/**
+ * V86 syscall handler.
+ */
 static void bs3TrapDefaultHandlerV8086Syscall(PBS3TRAPFRAME pTrapFrame)
 {
     /* Minimal syscall. */
-    if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_PRINT_CHR)
+    uint16_t uSyscallNo = pTrapFrame->Ctx.rax.u16;
+    if (uSyscallNo == BS3_SYSCALL_PRINT_CHR)
         Bs3PrintChr(pTrapFrame->Ctx.rcx.u8);
-    else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_PRINT_STR)
+    else if (uSyscallNo == BS3_SYSCALL_PRINT_STR)
         Bs3PrintStrN(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
                      pTrapFrame->Ctx.rdx.u16);
-    else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_RESTORE_CTX)
+    else if (uSyscallNo == BS3_SYSCALL_RESTORE_CTX)
         Bs3RegCtxRestore(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
                          pTrapFrame->Ctx.rdx.u16);
-    else if (   pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING0
-             || pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING1
-             || pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING2
-             || pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING3)
+    else if (   uSyscallNo == BS3_SYSCALL_TO_RING0
+             || uSyscallNo == BS3_SYSCALL_TO_RING1
+             || uSyscallNo == BS3_SYSCALL_TO_RING2
+             || uSyscallNo == BS3_SYSCALL_TO_RING3)
     {
         Bs3RegCtxConvertToRingX(&pTrapFrame->Ctx, pTrapFrame->Ctx.rax.u16 - BS3_SYSCALL_TO_RING0);
+    }
+    else if (uSyscallNo == BS3_SYSCALL_SET_DRX)
+    {
+        uint32_t uValue = pTrapFrame->Ctx.rsi.u32;
+        switch (pTrapFrame->Ctx.rdx.u8)
+        {
+            case 0: ASMSetDR0(uValue); break;
+            case 1: ASMSetDR1(uValue); break;
+            case 2: ASMSetDR2(uValue); break;
+            case 3: ASMSetDR3(uValue); break;
+            case 6: ASMSetDR6(uValue); break;
+            case 7: ASMSetDR7(uValue); break;
+            default: Bs3Panic();
+        }
+    }
+    else if (uSyscallNo == BS3_SYSCALL_GET_DRX)
+    {
+        uint32_t uValue;
+        switch (pTrapFrame->Ctx.rdx.u8)
+        {
+            case 0: uValue = ASMGetDR0(); break;
+            case 1: uValue = ASMGetDR1(); break;
+            case 2: uValue = ASMGetDR2(); break;
+            case 3: uValue = ASMGetDR3(); break;
+            case 6: uValue = ASMGetDR6(); break;
+            case 7: uValue = ASMGetDR7(); break;
+            default: uValue = 0; Bs3Panic();
+        }
+        pTrapFrame->Ctx.rax.u32 = uValue;
+        pTrapFrame->Ctx.rdx.u32 = uValue >> 16;
+    }
+    else if (uSyscallNo == BS3_SYSCALL_SET_CRX)
+    {
+        uint32_t uValue = pTrapFrame->Ctx.rsi.u32;
+        switch (pTrapFrame->Ctx.rdx.u8)
+        {
+            case 0: ASMSetCR0(uValue); break;
+            case 2: ASMSetCR2(uValue); break;
+            case 3: ASMSetCR3(uValue); break;
+            case 4: ASMSetCR4(uValue); break;
+            default: Bs3Panic();
+        }
+    }
+    else if (uSyscallNo == BS3_SYSCALL_GET_CRX)
+    {
+        uint32_t uValue;
+        switch (pTrapFrame->Ctx.rdx.u8)
+        {
+            case 0: uValue = ASMGetDR0(); break;
+            case 2: uValue = ASMGetCR2(); break;
+            case 3: uValue = ASMGetCR3(); break;
+            case 4: uValue = ASMGetCR4(); break;
+            default: uValue = 0; Bs3Panic();
+        }
+        pTrapFrame->Ctx.rax.u32 = uValue;
+        pTrapFrame->Ctx.rdx.u32 = uValue >> 16;
     }
     else
@@ -77,5 +137,8 @@
      * v8086 VMM tasks.
      */
-    if (pTrapFrame->Ctx.rflags.u32 & X86_EFL_VM)
+//Bs3TestHostPrintf("Bs3____DefaultHandler: %02xh %04RX16:%08RX32 %08RX32 %04RX16:%08RX32 %d %d\n", pTrapFrame->bXcpt,
+//                  pTrapFrame->Ctx.cs, pTrapFrame->Ctx.rip.u32, pTrapFrame->Ctx.rflags.u32, pTrapFrame->Ctx.ss, pTrapFrame->Ctx.rsp.u32, g_fBs3TrapNoV86Assist, 42);
+    if (   (pTrapFrame->Ctx.rflags.u32 & X86_EFL_VM)
+        && !g_fBs3TrapNoV86Assist)
     {
         bool                    fHandled    = true;
@@ -89,4 +152,5 @@
         pbCode      = (uint8_t const BS3_FAR *)BS3_MAKE_PROT_R0PTR_FROM_REAL(pTrapFrame->Ctx.cs, pTrapFrame->Ctx.rip.u16);
         pbCodeStart = pbCode;
+//Bs3TestHostPrintf("Bs3TrapDefaultHandler: V86 assist...\n");
 
         /*
@@ -95,4 +159,5 @@
         if (pTrapFrame->bXcpt == X86_XCPT_GP)
         {
+//Bs3TestHostPrintf("Bs3TrapDefaultHandler: #GP %04RX16:%08RX32 %08RX32\n", pTrapFrame->Ctx.cs, pTrapFrame->Ctx.rip.u32, pTrapFrame->Ctx.rflags.u32);
             bOpCode = *pbCode++;
             if (bOpCode == 0x66)
@@ -196,5 +261,8 @@
         }
         else
+        {
+//Bs3TestHostPrintf("Bs3TrapDefaultHandler: %02x %04RX16:%08RX32 %08RX32\n", pTrapFrame->bXcpt, pTrapFrame->Ctx.cs, pTrapFrame->Ctx.rip.u32, pTrapFrame->Ctx.rflags.u32);
             fHandled = false;
+        }
         if (fHandled)
         {
@@ -205,4 +273,5 @@
 # endif
             Bs3RegCtxRestore(&pTrapFrame->Ctx, 0 /*fFlags*/); /* does not return. */
+Bs3TestHostPrintf("Bs3TrapDefaultHandler: => Handled\n");
             return;
         }
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c	(revision 72133)
@@ -36,12 +36,17 @@
 {
 #if 1
-    Bs3TestPrintf("Trap %#04x errcd=%#06RX64 at %04x:%016RX64 (by %04x/%04x) - test step %d (%#x)\n",
+    Bs3TestPrintf("Trap %#04x errcd=%#06RX64 at %04x:%016RX64 - test step %d (%#x)\n"
+                  "Handler: ss:rsp=%04x:%08RX64 cs=%04x cbIret=%#x rflags=%#06RX64\n"
+                  ,
                   pTrapFrame->bXcpt,
                   pTrapFrame->uErrCd,
                   pTrapFrame->Ctx.cs,
                   pTrapFrame->Ctx.rip.u64,
+                  g_usBs3TestStep, g_usBs3TestStep,
+                  pTrapFrame->uHandlerSs,
+                  pTrapFrame->uHandlerRsp,
                   pTrapFrame->uHandlerCs,
-                  pTrapFrame->uHandlerSs,
-                  g_usBs3TestStep, g_usBs3TestStep);
+                  pTrapFrame->cbIretFrame,
+                  pTrapFrame->fHandlerRfl);
     Bs3RegCtxPrint(&pTrapFrame->Ctx);
 #else
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c	(revision 72133)
@@ -40,6 +40,7 @@
         g_uBs3TrapEipHint = pCtxRestore->rip.u32;
 #endif
-        Bs3RegCtxRestore(pCtxRestore, 0);
+        Bs3RegCtxRestore(pCtxRestore, BS3REGCTXRESTORE_F_NO_V86_ASSIST);
     }
+    g_fBs3TrapNoV86Assist = false;
 }
 
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk	(revision 72133)
@@ -107,4 +107,6 @@
 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListFree)
 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListInit)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestHostPrintf)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestHostPrintfV)
 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestInit)
 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestPrintf)
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h	(revision 72133)
@@ -94,4 +94,26 @@
 #define Bs3RegCtxSetRipCsFromFlat BS3_CMN_MANGLER(Bs3RegCtxSetRipCsFromFlat)
 #define Bs3RegCtxSetRipCsFromLnkPtr BS3_CMN_MANGLER(Bs3RegCtxSetRipCsFromLnkPtr)
+#define Bs3RegGetCr0 BS3_CMN_MANGLER(Bs3RegGetCr0)
+#define Bs3RegGetCr2 BS3_CMN_MANGLER(Bs3RegGetCr2)
+#define Bs3RegGetCr3 BS3_CMN_MANGLER(Bs3RegGetCr3)
+#define Bs3RegGetCr4 BS3_CMN_MANGLER(Bs3RegGetCr4)
+#define Bs3RegGetDr0 BS3_CMN_MANGLER(Bs3RegGetDr0)
+#define Bs3RegGetDr1 BS3_CMN_MANGLER(Bs3RegGetDr1)
+#define Bs3RegGetDr2 BS3_CMN_MANGLER(Bs3RegGetDr2)
+#define Bs3RegGetDr3 BS3_CMN_MANGLER(Bs3RegGetDr3)
+#define Bs3RegGetDr6 BS3_CMN_MANGLER(Bs3RegGetDr6)
+#define Bs3RegGetDr7 BS3_CMN_MANGLER(Bs3RegGetDr7)
+#define Bs3RegGetDrX BS3_CMN_MANGLER(Bs3RegGetDrX)
+#define Bs3RegSetCr0 BS3_CMN_MANGLER(Bs3RegSetCr0)
+#define Bs3RegSetCr2 BS3_CMN_MANGLER(Bs3RegSetCr2)
+#define Bs3RegSetCr3 BS3_CMN_MANGLER(Bs3RegSetCr3)
+#define Bs3RegSetCr4 BS3_CMN_MANGLER(Bs3RegSetCr4)
+#define Bs3RegSetDr0 BS3_CMN_MANGLER(Bs3RegSetDr0)
+#define Bs3RegSetDr1 BS3_CMN_MANGLER(Bs3RegSetDr1)
+#define Bs3RegSetDr2 BS3_CMN_MANGLER(Bs3RegSetDr2)
+#define Bs3RegSetDr3 BS3_CMN_MANGLER(Bs3RegSetDr3)
+#define Bs3RegSetDr6 BS3_CMN_MANGLER(Bs3RegSetDr6)
+#define Bs3RegSetDr7 BS3_CMN_MANGLER(Bs3RegSetDr7)
+#define Bs3RegSetDrX BS3_CMN_MANGLER(Bs3RegSetDrX)
 #define Bs3SelFar32ToFlat32 BS3_CMN_MANGLER(Bs3SelFar32ToFlat32)
 #define Bs3SelFar32ToFlat32NoClobber BS3_CMN_MANGLER(Bs3SelFar32ToFlat32NoClobber)
@@ -131,4 +153,6 @@
 #define Bs3TestFailedF BS3_CMN_MANGLER(Bs3TestFailedF)
 #define Bs3TestFailedV BS3_CMN_MANGLER(Bs3TestFailedV)
+#define Bs3TestHostPrintf BS3_CMN_MANGLER(Bs3TestHostPrintf)
+#define Bs3TestHostPrintfV BS3_CMN_MANGLER(Bs3TestHostPrintfV)
 #define Bs3TestInit BS3_CMN_MANGLER(Bs3TestInit)
 #define Bs3TestPrintf BS3_CMN_MANGLER(Bs3TestPrintf)
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h	(revision 72133)
@@ -94,4 +94,26 @@
 #undef Bs3RegCtxSetRipCsFromFlat
 #undef Bs3RegCtxSetRipCsFromLnkPtr
+#undef Bs3RegGetCr0
+#undef Bs3RegGetCr2
+#undef Bs3RegGetCr3
+#undef Bs3RegGetCr4
+#undef Bs3RegGetDr0
+#undef Bs3RegGetDr1
+#undef Bs3RegGetDr2
+#undef Bs3RegGetDr3
+#undef Bs3RegGetDr6
+#undef Bs3RegGetDr7
+#undef Bs3RegGetDrX
+#undef Bs3RegSetCr0
+#undef Bs3RegSetCr2
+#undef Bs3RegSetCr3
+#undef Bs3RegSetCr4
+#undef Bs3RegSetDr0
+#undef Bs3RegSetDr1
+#undef Bs3RegSetDr2
+#undef Bs3RegSetDr3
+#undef Bs3RegSetDr6
+#undef Bs3RegSetDr7
+#undef Bs3RegSetDrX
 #undef Bs3SelFar32ToFlat32
 #undef Bs3SelFar32ToFlat32NoClobber
@@ -131,4 +153,6 @@
 #undef Bs3TestFailedF
 #undef Bs3TestFailedV
+#undef Bs3TestHostPrintf
+#undef Bs3TestHostPrintfV
 #undef Bs3TestInit
 #undef Bs3TestPrintf
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 72133)
@@ -828,4 +828,12 @@
 /** Restore context (pointer in cx:xSI, flags in dx). */
 #define BS3_SYSCALL_RESTORE_CTX UINT16_C(0x0007)
+/** Set DRx register (value in ESI, register number in dl). */
+#define BS3_SYSCALL_SET_DRX     UINT16_C(0x0008)
+/** Get DRx register (register number in dl, value returned in ax:dx). */
+#define BS3_SYSCALL_GET_DRX     UINT16_C(0x0009)
+/** Set CRx register (value in ESI, register number in dl). */
+#define BS3_SYSCALL_SET_CRX     UINT16_C(0x000a)
+/** Get CRx register (register number in dl, value returned in ax:dx). */
+#define BS3_SYSCALL_GET_CRX     UINT16_C(0x000b)
 /** @} */
 
@@ -1143,4 +1151,8 @@
 extern uint32_t   g_uBs3TrapEipHint;
 
+/** Set to disable special V8086 \#GP and \#UD handling in Bs3TrapDefaultHandler.
+ * This is useful for getting   */
+extern bool volatile g_fBs3TrapNoV86Assist;
+
 /** Copy of the original real-mode interrupt vector table. */
 extern RTFAR16 g_aBs3RmIvtOriginal[256];
@@ -2605,6 +2617,11 @@
 #endif
 
+/** @name Flags for Bs3RegCtxRestore
+ * @{ */
 /** Skip restoring the CRx registers. */
-#define BS3REGCTXRESTORE_F_SKIP_CRX     UINT16_C(0x0001)
+#define BS3REGCTXRESTORE_F_SKIP_CRX         UINT16_C(0x0001)
+/** Sets g_fBs3TrapNoV86Assist. */
+#define BS3REGCTXRESTORE_F_NO_V86_ASSIST    UINT16_C(0x0002)
+/** @} */
 
 /**
@@ -2798,4 +2815,38 @@
 BS3_CMN_PROTO_STUB(PBS3EXTCTX, Bs3ExtCtxCopy,(PBS3EXTCTX pDst, PCBS3EXTCTX pSrc));
 
+
+/** @name Debug register accessors for V8086 mode (works everwhere).
+ * @{  */
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr0,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr1,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr2,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr3,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr6,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDr7,(void));
+
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr0,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr1,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr2,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr3,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr6,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDr7,(RTCCUINTXREG uValue));
+
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetDrX,(uint8_t iReg));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetDrX,(uint8_t iReg, RTCCUINTXREG uValue));
+/** @} */
+
+
+/** @name Control register accessors for V8086 mode (works everwhere).
+ * @{  */
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetCr0,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetCr2,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetCr3,(void));
+BS3_CMN_PROTO_NOSB(RTCCUINTXREG, Bs3RegGetCr4,(void));
+
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetCr0,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetCr2,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetCr3,(RTCCUINTXREG uValue));
+BS3_CMN_PROTO_NOSB(void, Bs3RegSetCr4,(RTCCUINTXREG uValue));
+/** @} */
 
 
@@ -3149,4 +3200,20 @@
  */
 BS3_CMN_PROTO_STUB(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
+
+/**
+ * Same as Bs3TestPrintf, except no guest screen echo.
+ *
+ * @param   pszFormat   What to print, format string.  Explicit newline char.
+ * @param   ...         String format arguments.
+ */
+BS3_CMN_PROTO_STUB(void, Bs3TestHostPrintf,(const char BS3_FAR *pszFormat, ...));
+
+/**
+ * Same as Bs3TestPrintfV, except no guest screen echo.
+ *
+ * @param   pszFormat   What to print, format string.  Explicit newline char.
+ * @param   va          String format arguments.
+ */
+BS3_CMN_PROTO_STUB(void, Bs3TestHostPrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
 
 /**
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac	(revision 72132)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac	(revision 72133)
@@ -1418,4 +1418,13 @@
 
 
+;; @name Flags for Bs3RegCtxRestore
+; @{
+;; Skip restoring the CRx registers.
+%define BS3REGCTXRESTORE_F_SKIP_CRX         1
+;; Sets g_fBs3TrapNoV86Assist.
+%define BS3REGCTXRESTORE_F_NO_V86_ASSIST    2
+;; @}
+
+
 ;;
 ; BS3 extended register context (FPU, SSE, AVX, ++)
@@ -1450,8 +1459,4 @@
 endstruc
 AssertCompileSize(BS3TRAPFRAME, 0x20 + 0xd0)
-
-;; Flag for Bs3TrapXxResumeFrame methods.
-%define BS3TRAPRESUME_F_SKIP_CRX 1
-
 
 ;;
@@ -1494,6 +1499,14 @@
 ;; Restore context (pointer in cx:xDI, flags in dx).
 %define BS3_SYSCALL_RESTORE_CTX     0007h
+;; Set DRx register (value in ESI, register number in dl).
+%define BS3_SYSCALL_SET_DRX         0008h
+;; GET DRx register (register number in dl, value returned in ax:dx).
+%define BS3_SYSCALL_GET_DRX         0009h
+;; Set CRx register (value in ESI, register number in dl).
+%define BS3_SYSCALL_SET_CRX         000ah
+;; Get CRx register (register number in dl, value returned in ax:dx).
+%define BS3_SYSCALL_GET_CRX         000bh
 ;; The last system call value.
-%define BS3_SYSCALL_LAST            BS3_SYSCALL_RESTORE_CTX
+%define BS3_SYSCALL_LAST            BS3_SYSCALL_GET_CRX
 ;; @}
 
