Index: trunk/src/VBox/ValidationKit/bootsectors/Config.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/Config.kmk	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/Config.kmk	(revision 60585)
@@ -75,14 +75,14 @@
 
 ##
-# Macro for generating near-call aliases for zero or more 16-bit C functions.
+# Macro for generating near-call aliases for one 16-bit C function.
 # @param    1   The target name.
-# @param    2   List of functions.
-BS3KIT_FN_GEN_CMN_NEARSTUBS = $(foreach fn,$2,$(evalcall2 def_Bs3KitGenNearStubSource,$1,_$(fn)_c16,_$(fn)_f16))
+# @param    2   The common function.
+BS3KIT_FN_GEN_CMN_NEARSTUB = $(evalcall2 def_Bs3KitGenNearStubSource,$1,_$2_c16,_$2_f16)
 
 ##
-# Macro for generating near-call aliases for zero or more 16-bit C mode functions.
+# Macro for generating near-call aliases for one 16-bit C mode function.
 # @param    1   The target name.
-# @param    2   List of mode functions.
-BS3KIT_FN_GEN_MODE_NEARSTUBS = $(foreach fn,$2,$(foreach suff, \
+# @param    2   The mode function.
+BS3KIT_FN_GEN_MODE_NEARSTUB = $(foreach suff, \
 	_rm \
 	_pe16 \
@@ -99,5 +99,5 @@
 	_paev86 \
 	_lm16 \
-	,$(evalcall2 def_Bs3KitGenNearStubSource,$1,_$(fn)$(suff),_$(fn)$(suff)_far)))
+	,$(evalcall2 def_Bs3KitGenNearStubSource,$1,_$2$(suff),_$2$(suff)_far))
 
 # @param    1   The target name.
@@ -124,12 +124,14 @@
 # Macro for generating far-call aliases for zero or more 16-bit C or assembly functions.
 # @param    1   The target name.
-# @param    2   List of functions.
-BS3KIT_FN_GEN_CMN_FARSTUBS = $(foreach fn,$2,$(evalcall2 def_Bs3KitGenFarStubSource,$1,$(fn),_f16,_c16))
+# @param    2   The common function.
+# @param    3   The parameter size in bytes.
+BS3KIT_FN_GEN_CMN_FARSTUB = $(evalcall2 def_Bs3KitGenFarStubSource,$1,$2,_f16,_c16,$3)
 
 ##
 # Macro for generating far-call aliases for zero or more 16-bit C mode functions.
 # @param    1   The target name.
-# @param    2   List of mode functions.
-BS3KIT_FN_GEN_MODE_FARSTUBS = $(foreach fn,$2,$(foreach suff, \
+# @param    2   The mode function.
+# @param    3   The parameter size in bytes.
+BS3KIT_FN_GEN_MODE_FARSTUB = $(foreach suff, \
 	_rm \
 	_pe16 \
@@ -146,38 +148,36 @@
 	_paev86 \
 	_lm16 \
-	,$(evalcall2 def_Bs3KitGenFarStubSource,$1,$(fn),$(suff)_far,$(suff))
+	,$(evalcall2 def_Bs3KitGenFarStubSource,$1,$2,$(suff)_far,$(suff),$3))
 
 # @param    1   The target name.
-# @param    2   The function and amount of parameters.
+# @param    2   The function name.
 # @param    3   The far function suffix.
 # @param    4   The near function suffix.
+# @param    5   The parameter size in bytes.
 define def_Bs3KitGenFarStubSource
-$(eval local fn2 = $(firstword $(subst :, $(SP), $2)))
-$(eval local cbParam = $(lastword $(subst :, $(SP), $2)))
-
-$1_SOURCES += $$($1_0_OUTDIR)/stub_$(fn2)$3.asm
-$1_CLEAN   += $$($1_0_OUTDIR)/stub_$(fn2)$3.asm
-$$$$($1_0_OUTDIR)/stub_$(fn2)$3.asm: $$(VBOX_PATH_BOOTSECTORS_SRC)/Config.kmk | $$$$(dir $$$$@)
+$1_SOURCES += $$($1_0_OUTDIR)/stub_$2$3.asm
+$1_CLEAN   += $$($1_0_OUTDIR)/stub_$2$3.asm
+$$$$($1_0_OUTDIR)/stub_$2$3.asm: $$(VBOX_PATH_BOOTSECTORS_SRC)/Config.kmk | $$$$(dir $$$$@)
 	$(QUIET)$(APPEND) -tn $$@ \
 		'%include "bs3kit.mac"' \
        	'BS3_BEGIN_TEXT16' \
-               '      extern  _$(fn2)$4' \
+               '      extern  _$2$4' \
        	'BS3_BEGIN_TEXT16_FARSTUBS' \
-		'BS3_PROC_BEGIN _$(fn2)$3' \
+		'BS3_PROC_BEGIN _$2$3' \
                '      CPU 8086' \
                '      inc     bp' \
                '      push    bp' \
                '      mov     bp, sp' \
-               '%assign offParam $(cbParam)' \
-               '%rep $(cbParam) / 2' \
+               '%assign offParam $5' \
+               '%rep $5 / 2' \
                '      push    word [bp + 2 + 4 + offParam - 2]' \
                '%assign offParam offParam - 2' \
                '%endrep' \
-               '      call    _$(fn2)$4' \
-               '      add     sp, $(cbParam)' \
+               '      call    _$2$4' \
+               '      add     sp, $5' \
                '      pop     bp' \
                '      dec     bp' \
                '      retf' \
-		'BS3_PROC_END _$(fn2)$3' \
+		'BS3_PROC_END _$2$3' \
                ''
 endef
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c	(revision 60585)
@@ -1528,5 +1528,5 @@
      * Re-initialize the IDT.
      */
-    TMPL_FAR_NM(Bs3TrapInit)();
+    Bs3TrapInit();
     return bRet;
 }
@@ -1554,5 +1554,5 @@
      * Re-initialize the IDT.
      */
-    TMPL_FAR_NM(Bs3TrapInit)();
+    Bs3TrapInit();
     return 0;
 #elif TMPL_MODE == BS3_MODE_RM
@@ -1600,5 +1600,5 @@
      * Re-initialize the IDT.
      */
-    TMPL_FAR_NM(Bs3TrapInit)();
+    Bs3TrapInit();
     return 0;
 }
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk	(revision 60585)
@@ -157,19 +157,4 @@
        ../../../Runtime/common/asm/ASMSerializeInstruction-rdtscp.asm \
 
-#
-# We generate a list of files with 16-bit far functions for which we generate
-# near jump stubs.
-#
-#$(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk.ts \
-#+| $(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk: $(VBOX_PATH_BS3KIT_SRC)/bs3kit.h
-#       $(SED) \
-#       	-n -e '/no-near-stub/d' \
-#       	-e 's/^ *BS3_DECL(.*)  *\([a-zA-Z][a-zA-Z0-9_]*\)(.*[;,][^;]*$/\1/p' \
-#               --output $@ \
-#       	bs3kit.h
-#       .$(CP_CHANGED) --changed -f -- $@ $(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk
-#include $(PATH)
-
-
 # The 16-bit BS3Kit library.
 LIBRARIES += bs3kit-common-16
@@ -199,33 +184,13 @@
 	bs3-wc16-I4D.asm \
        bs3-c16-Trap16Generic.asm \
+       bs3-c16-TrapRmV86Generic.asm \
+       bs3-c16-Trap16RmV86Data.asm \
+       bs3-c16-TrapRmV86Data.c \
 	bs3-c16-CreateHybridFarRet.asm
 bs3kit-common-16_bs3-cmn-UInt64Div.c_CFLAGS = -oh -d0 # -d1+ vs -d0 saves 0x6a3-0x577 = 0x12C (300)!
-bs3kit-common-16_VBOX_NEAR_TO_FAR_CMN_FUNCTIONS := \
-	$(sort $(subst bs3-cmn-,Bs3,$(basename $(filter-out \
-		%Data.c \
-		bs3-rm-% \
-		bs3-cmn-hexdigits.c \
-	,$(filter %.c,$(bs3kit-common-16_SOURCES)))))) \
-       Bs3PrintfV \
-       Bs3StrPrintfV \
-       Bs3TestPrintfV \
-       Bs3TestFailedF \
-       Bs3TestFailedV \
-       Bs3TestSkippedF \
-       Bs3TestSkippedV \
-       Bs3TestSubF \
-       Bs3TestSubV \
-       Bs3Trap16InitEx \
-
-bs3kit-common-16_VBOX_NEAR_TO_FAR_MODE_FUNCTIONS := \
-	Bs3TrapInit \
-
-bs3kit-common-16_VBOX_FAR_TO_NEAR_CMN_FUNCTIONS := \
-	ASMMemFirstMismatchingU8:8 \
-	ASMMemFirstNonZero:6 \
-
-$(call BS3KIT_FN_GEN_CMN_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_CMN_FUNCTIONS))
-$(call BS3KIT_FN_GEN_MODE_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_MODE_FUNCTIONS))
-$(call BS3KIT_FN_GEN_CMN_FARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_FAR_TO_NEAR_CMN_FUNCTIONS))
+
+$(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,ASMMemFirstMismatchingU8,8)
+$(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,ASMMemFirstNonZero,6)
+-include $(PATH_SUB_CURRENT)/bs3kit-autostubs.kmk # manually generated from headers, see bottom of this file.
 
 # The 32-bit BS3Kit library.
@@ -488,9 +453,108 @@
 bs3kit-mangling-code-undef.h: $(PATH_SUB_CURRENT)/bs3kit-mangling-code-define.h
 	$(SED) \
-		-e 's/#define \([a-zA-Z_][a-zA-Z0-9_]*\) .*$(DOLLAR)/#undef \1/' \
-       	-e 's/Function needing mangling\./Undefining function mangling - automatically generated by the $@ makefile rule./' \
+		-e 's/#\( *\)define \([a-zA-Z_][a-zA-Z0-9_]*\) .*$(DOLLAR)/#\1undef \2/' \
+       	-e 's/Function needing mangling.*$(DOLLAR)/Undefining function mangling - automatically generated by the $@ makefile rule./' \
        	--output $(dir $<)bs3kit-mangling-code-undef.h \
 		$<
 
+#
+# Rule for regenerating bs3kit-mangling-functions-define.h.
+#
+bs3kit-mangling-code-define.h: \
+		$(PATH_SUB_CURRENT)/bs3kit.h \
+		$(PATH_SUB_CURRENT)/bs3-cmn-paging.h \
+		$(PATH_SUB_CURRENT)/bs3-cmn-test.h
+	$(APPEND) -tn "$(dir $<)$@" \
+		 '/* $(DOLLAR)Id: $(DOLLAR) */' \
+		 '/** @file' \
+		 ' * BS3Kit - Function needing mangling - generated by the $@ makefile rule.' \
+		 ' */' \
+		 '' \
+		 '/*' \
+		 ' * Copyright (C) 2007-2016 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.' \
+		 ' */' \
+		 ''
+	$(SED) -n \
+		-e 's/^ *BS3_CMN_PROTO_STUB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/#define \1 BS3_CMN_MANGLER(\1)/p' \
+		-e 's/^ *BS3_CMN_PROTO_NOSB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/#define \1 BS3_CMN_MANGLER(\1)/p' \
+		-e 's/^ *BS3_CMN_PROTO_FARSTUB([^,]*,[^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/#define \1 BS3_CMN_MANGLER(\1)/p' \
+		$< | sort >> "$(dir $<)bs3kit-mangling-code-define.h"
+	$(APPEND) -n "$(dir $<)$@" '#ifndef BS3_CMN_ONLY'
+	$(SED) -n \
+		-e 's/^ *BS3_MODE_PROTO_STUB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/# define \1 BS3_MODE_MANGLER(\1)/p' \
+		-e 's/^ *BS3_MODE_PROTO_NOSB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/# define \1 BS3_MODE_MANGLER(\1)/p' \
+		-e 's/^ *BS3_MODE_PROTO_FARSTUB([^,]*,[^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/# define \1 BS3_MODE_MANGLER(\1)/p' \
+		$< | sort >> "$(dir $<)bs3kit-mangling-code-define.h"
+	$(APPEND) -n "$(dir $<)$@" '#endif /* !BS3_CMN_ONLY */'
+
+#
+# Rule for regenerating bs3kit-autostubs.kmk.
+#
+bs3kit-autostubs.kmk: \
+		$(PATH_SUB_CURRENT)/bs3kit.h \
+		$(PATH_SUB_CURRENT)/bs3-cmn-memory.h \
+		$(PATH_SUB_CURRENT)/bs3-cmn-paging.h \
+		$(PATH_SUB_CURRENT)/bs3-cmn-test.h
+	$(APPEND) -tn "$(dir $<)$@" \
+		 '# $(DOLLAR)Id: $(DOLLAR)' \
+		 '## @file' \
+		 '# BS3Kit - Automatic near/far stubs - generated by the $@ makefile rule.' \
+		 '#' \
+		 '' \
+		 '#' \
+		 '# Copyright (C) 2007-2016 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.' \
+		 '#' \
+		 ''
+	$(SED) -n \
+		-e '/^ *BS3_CMN_PROTO_STUB/p' \
+		-e '/^ *BS3_CMD_PROTO_FARSTUB/p' \
+		-e '/^ *BS3_MODE_PROTO_STUB/p' \
+		-e '/^ *BS3_MODE_PROTO_FARSTUB/p' \
+		$< \
+	| sort \
+	| $(SED) -n \
+		-e 's/^ *BS3_CMN_PROTO_STUB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/\$(DOLLAR)(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,\1)/p' \
+		-e 's/^ *BS3_MODE_PROTO_STUB([^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/\$(DOLLAR)(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,\1)/p' \
+		-e 's/^ *BS3_CMN_PROTO_FARSTUB( *\([^,]*\),[^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/\$(DOLLAR)(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,\2,\1)/p' \
+		-e 's/^ *BS3_MODE_PROTO_FARSTUB( *\([^,]*\),[^,]*, *\([a-zA-Z_][a-zA-Z0-9_]*\) *,.*$(DOLLAR)/\$(DOLLAR)(call BS3KIT_FN_GEN_MODE_FARSTUB,bs3kit-common-16,\2,\1)/p' \
+		--append "$(dir $<)$@"
+
+bs3kit-update:: bs3kit-autostubs.kmk bs3kit-mangling-code-define.h bs3kit-mangling-code-undef.h
+.NOTPARALLEL:   bs3kit-autostubs.kmk bs3kit-mangling-code-define.h bs3kit-mangling-code-undef.h
+
 
 include $(FILE_KBUILD_SUB_FOOTER)
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16Generic.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16Generic.asm	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16Generic.asm	(revision 60585)
@@ -41,4 +41,5 @@
 BS3_EXTERN_DATA16 g_uBs3TrapEipHint
 BS3_EXTERN_DATA16 g_uBs3CpuDetected
+BS3_EXTERN_DATA16 g_apfnBs3TrapHandlers_c16
 BS3_EXTERN_SYSTEM16 Bs3Gdt
 TMPL_BEGIN_TEXT
@@ -47,15 +48,4 @@
 TMPL_BEGIN_TEXT
 
-
-;*********************************************************************************************************************************
-;*  Global Variables                                                                                                             *
-;*********************************************************************************************************************************
-BS3_BEGIN_DATA16
-;; Pointer C trap handlers (BS3TEXT16).
-BS3_GLOBAL_DATA g_apfnBs3TrapHandlers_c16, 512
-        resw 256
-
-
-TMPL_BEGIN_TEXT
 
 ;;
@@ -181,7 +171,7 @@
 
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], eax
-        mov     edx, [bp - 12h]
-        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], edx
-        mov     [ss:bx + BS3TRAPFRAME.uHandlerRsp], edx
+        mov     edx, [bp - 12h]         ; This isn't quite right for wrap arounds, but close enough for now
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], edx     ; high bits
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerRsp], edx             ; high bits
         mov     dx, [bp - 0eh]
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], dx
@@ -190,5 +180,5 @@
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rdx], edx
         mov     edx, [bp - 8]
-        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], edx ; high bits
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], edx  ; high bits
         mov     [ss:bx + BS3TRAPFRAME.fHandlerRfl], edx
         mov     edx, [bp - 4]
@@ -212,5 +202,5 @@
         int3
 %endif
-        jmp     .stack_load_bx_into_ss
+        jmp     .stack_esp_out_of_bounds
 BS3_PROC_END   bs3Trap16GenericTrapErrCode
 
@@ -310,11 +300,9 @@
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ds], ds
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.es], es
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerCs], cs
 
         ;
         ; Load 16-bit data selector for the DPL we're executing at into DS and ES.
-        ; Save the handler SS and CS values first.
-        ;
-        mov     ax, cs
-        mov     [ss:bx + BS3TRAPFRAME.uHandlerCs], ax
+        ;
         mov     ax, ss
         and     ax, 3
@@ -368,7 +356,5 @@
         jmp     .iret_frame_seed_high_eip_word
 
-.iret_frame_same_cpl:
-        mov     cx, ss
-        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], cx
+.iret_frame_same_cpl: ; (ss and high bits was saved by CPU specific part)
         lea     cx, [bp + 8]
         mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], cx
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16RmV86Data.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16RmV86Data.asm	(revision 60585)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16RmV86Data.asm	(revision 60585)
@@ -0,0 +1,42 @@
+; $Id$
+;; @file
+; BS3Kit - Trap, data shared between real, virtual 8086, and 16-bit protected mode.
+;
+
+;
+; Copyright (C) 2007-2016 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.mac"
+
+%ifndef TMPL_16BIT
+ %error "16-bit only template"
+%endif
+
+
+BS3_BEGIN_DATA16
+;; Pointer C trap handlers (CGROUP16).
+BS3_GLOBAL_DATA g_apfnBs3TrapHandlers_c16, 512
+        resw 256
+
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Data.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Data.c	(revision 60585)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Data.c	(revision 60585)
@@ -0,0 +1,42 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Real mode and V86 trap data.
+ */
+
+/*
+ * Copyright (C) 2007-2016 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"
+
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
+#if ARCH_BITS == 16
+/** Copy of the original real-mode interrupt vector table. */
+RTFAR16 g_aBs3RmIvtOriginal[256];
+/** Indicates whether we've copied the real-mode IVT or not. */
+bool    g_fBs3RmIvtCopied = false;
+#endif
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Generic.asm
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Generic.asm	(revision 60585)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-TrapRmV86Generic.asm	(revision 60585)
@@ -0,0 +1,371 @@
+; $Id$
+;; @file
+; BS3Kit - Trap, 16-bit assembly handlers for real mode and v8086.
+;
+
+;
+; Copyright (C) 2007-2016 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.mac"
+
+%ifndef TMPL_16BIT
+ %error "16-bit only template"
+%endif
+
+
+;*********************************************************************************************************************************
+;*  External Symbols                                                                                                             *
+;*********************************************************************************************************************************
+BS3_EXTERN_DATA16 g_bBs3CurrentMode
+BS3_EXTERN_DATA16 g_uBs3TrapEipHint
+BS3_EXTERN_DATA16 g_uBs3CpuDetected
+BS3_EXTERN_DATA16 g_apfnBs3TrapHandlers_c16
+TMPL_BEGIN_TEXT
+BS3_EXTERN_CMN Bs3TrapDefaultHandler
+BS3_EXTERN_CMN Bs3RegCtxRestore
+TMPL_BEGIN_TEXT
+
+
+;;
+; Generic entry points for IDT handlers, 8 byte spacing.
+;
+BS3_PROC_BEGIN _Bs3TrapRmV86GenericEntries
+BS3_PROC_BEGIN Bs3TrapRmV86GenericEntries
+%macro Bs3TrapRmV86GenericEntryNoErr 1
+        push    byte 0                  ; 2 byte: fake error code
+        db      06ah, i                 ; 2 byte: push imm8 - note that this is a signextended value.
+        jmp     %1                      ; 3 byte
+        ALIGNCODE(8)
+%assign i i+1
+%endmacro
+
+%macro Bs3TrapRmV86GenericEntryErrCd 1
+        db      06ah, i                 ; 2 byte: push imm8 - note that this is a signextended value.
+        jmp     %1                      ; 3 byte
+        ALIGNCODE(8)
+%assign i i+1
+%endmacro
+
+%assign i 0                             ; start counter.
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 0
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 2
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 3
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 4
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 5
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 6
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 7
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; 8
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 9
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; a
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; b
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; c
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; d
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; e
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; f  (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 10
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; 11
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 12
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 13
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 14
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 15 (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 16 (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 17 (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 18 (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 19 (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1a (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1b (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1c (reserved)
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1d (reserved)
+        Bs3TrapRmV86GenericEntryErrCd bs3TrapRmV86GenericTrapOrInt   ; 1e
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt   ; 1f (reserved)
+%rep 224
+        Bs3TrapRmV86GenericEntryNoErr bs3TrapRmV86GenericTrapOrInt
+%endrep
+BS3_PROC_END  Bs3TrapRmV86GenericEntries
+AssertCompile(Bs3TrapRmV86GenericEntries_EndProc - Bs3TrapRmV86GenericEntries == 8*256)
+
+
+;;
+; Trap or interrupt with error code, faked if necessary.
+;
+; Note! This code is going to "misbehave" if the high word of ESP is not cleared.
+;
+BS3_PROC_BEGIN _bs3TrapRmV86GenericTrapOrInt
+BS3_PROC_BEGIN bs3TrapRmV86GenericTrapOrInt
+CPU 386
+        jmp     near bs3TrapRmV86GenericTrapErrCode8086 ; Bs3TrapRmV86Init adjusts this on 80386+
+        push    ebp
+        movzx   ebp, sp
+        push    ebx                     ; BP - 04h
+        pushfd                          ; BP - 08h
+        cld
+        push    edx                     ; BP - 0ch
+        push    ss                      ; BP - 0eh
+        push    esp                     ; BP - 12h
+
+        ; Reserve space for the the register and trap frame.
+        mov     bx, (BS3TRAPFRAME_size + 7) / 8
+.more_zeroed_space:
+        push    0
+        push    0
+        push    0
+        push    0
+        dec     bx
+        jnz     .more_zeroed_space
+        movzx   ebx, sp
+
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], eax
+        mov     edx, [bp - 12h]         ; This isn't quite right for wrap arounds, but close enough for now
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], edx     ; high bits
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerRsp], edx             ; high bits
+        mov     dx, [bp - 0eh]
+        ;mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], dx - share this here
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerSs], dx
+        mov     edx, [bp - 0ch]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rdx], edx
+        mov     edx, [bp - 8]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], edx  ; high bits
+        mov     [ss:bx + BS3TRAPFRAME.fHandlerRfl], edx
+        mov     edx, [bp - 4]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rbx], edx
+        mov     edx, [bp]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp], edx
+
+        mov     dl, [bp + 4]
+        mov     [ss:bx + BS3TRAPFRAME.bXcpt], dl
+
+        mov     dx, [bp + 6]
+;; @todo Do voodoo checks for 'int xx' or misguided hardware interrupts.
+        mov     [ss:bx + BS3TRAPFRAME.uErrCd], dx
+
+        add     bp, 6                   ; adjust so it points to the word before the iret frame.
+        xor     dx, dx
+        jmp     bs3TrapRmV86GenericCommon
+BS3_PROC_END   bs3TrapRmV86GenericTrapErrCode
+
+;;
+; Trap with error code - 8086/V20/80186/80286 code variant.
+;
+BS3_PROC_BEGIN bs3TrapRmV86GenericTrapErrCode8086
+CPU 8086
+        push    bp
+        mov     bp, sp
+        push    bx
+        pushf
+        push    ax
+        cld
+
+        ; Reserve space for the the register and trap frame.
+        mov     bx, (BS3TRAPFRAME_size + 7) / 8
+        xor     ax, ax
+.more_zeroed_space:
+        push    ax
+        push    ax
+        push    ax
+        push    ax
+        dec     bx
+        jnz     .more_zeroed_space
+        mov     bx, sp
+
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], ax
+        ;mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], ss - share this here
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerSs], ss
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rdx], dx
+        mov     dx, [bp - 4]
+        mov     [ss:bx + BS3TRAPFRAME.fHandlerRfl], dx
+        mov     dx, [bp - 2]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rbx], dx
+        mov     dx, [bp]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp], dx
+
+        mov     dl, [bp + 2]
+        mov     [ss:bx + BS3TRAPFRAME.bXcpt], dl
+
+        mov     dx, [bp + 4]
+;; @todo Do voodoo checks for 'int xx' or misguided hardware interrupts.
+        mov     [ss:bx + BS3TRAPFRAME.uErrCd], dx
+
+        add     bp, 4                   ; adjust so it points to the word before the iret frame.
+        mov     dl, 1
+        jmp     bs3TrapRmV86GenericCommon
+BS3_PROC_END   bs3TrapRmV86GenericTrapErrCode8086
+
+
+;;
+; Common context saving code and dispatching.
+;
+; @param    bx      Pointer to the trap frame, zero filled.  The following members
+;                   have been filled in by the previous code:
+;                       - bXcpt
+;                       - uErrCd
+;                       - fHandlerRFL
+;                       - Ctx.eax
+;                       - Ctx.edx
+;                       - Ctx.ebx
+;                       - Ctx.ebp
+;                       - Ctx.rflags - high bits only.
+;                       - Ctx.esp    - high bits only.
+;                       - All other bytes are zeroed.
+;
+; @param    bp      Pointer to the word before the iret frame, i.e. where bp
+;                   would be saved if this was a normal near call.
+; @param    dx      One (1) if 286, zero (0) if 386+.
+;
+BS3_PROC_BEGIN bs3TrapRmV86GenericCommon
+CPU 8086
+        ;
+        ; Fake EBP frame.
+        ;
+        mov     ax, [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp]
+        mov     [bp], ax
+
+        ;
+        ; Save the remaining GPRs and segment registers.
+        ;
+        test    dx, dx
+        jnz     .save_word_grps
+CPU 386
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rcx], ecx
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rdi], edi
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsi], esi
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.fs], fs
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.gs], gs
+        jmp     .save_segment_registers
+.save_word_grps:
+CPU 8086
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rcx], cx
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rdi], di
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsi], si
+.save_segment_registers:
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ds], ds
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.es], es
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerCs], cs
+
+        ;
+        ; Load 16-bit BS3KIT_GRPNM_DATA16 into DS and ES so we can access globals.
+        ;
+        mov     ax, BS3KIT_GRPNM_DATA16
+        mov     ds, ax
+        mov     es, ax
+
+        ;
+        ; Copy the mode now that we've got a flat DS.  We don't need to update
+        ; it as it didn't change.
+        ;
+        mov     al, [BS3_DATA16_WRT(g_bBs3CurrentMode)]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.bMode], al
+
+        ;
+        ; Copy iret info.
+        ;
+        lea     cx, [bp + 2]
+        mov     [ss:bx + BS3TRAPFRAME.uHandlerRsp], cx
+        mov     cx, [bp + 2]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rip], cx
+        mov     cx, [bp + 6]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], cx
+        mov     cx, [bp + 4]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cs], cx
+        mov     cx, ss
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], cx
+        lea     cx, [bp + 8]
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], cx
+        mov     byte [ss:bx + BS3TRAPFRAME.cbIretFrame], 3*2
+
+        ;
+        ; Control registers.
+        ;
+        cmp     byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80286
+        jb      .skip_control_regsiters_because_80186_or_older
+
+        ; The 286 ones.
+CPU 286
+        str     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.tr]
+        sldt    [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr]
+        smsw    ax
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0], ax
+
+        test    dx, dx
+        jnz     .set_flags
+.save_386_control_registers:
+CPU 386
+        ; 386 control registers are not accessible from virtual 8086 mode.
+        test    al, X86_CR0_PE
+        jnz     .skip_crX_because_v8086
+        mov     eax, cr0
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0], eax
+        mov     eax, cr2
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr2], eax
+        mov     eax, cr3
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], eax
+
+        test    byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) ; CR4 first appeared in later 486es.
+        jz      .skip_cr4_because_not_there
+        mov     eax, cr4
+        mov     [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], eax
+        jmp     .set_flags
+
+.skip_cr4_because_not_there:
+        mov     byte [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4
+        jmp     .set_flags
+
+CPU 8086
+.skip_control_regsiters_because_80186_or_older:
+.skip_crX_because_v8086:
+        or      byte [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR
+.set_flags:                             ; The double fault code joins us here.
+        or      byte [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64
+
+        ;
+        ; Dispatch it to C code.
+        ;
+.dispatch_to_handler:
+        mov     di, bx
+        mov     bl, byte [ss:bx + BS3TRAPFRAME.bXcpt]
+        mov     bh, 0
+        shl     bx, 1
+        mov     bx, [bx + BS3_DATA16_WRT(_g_apfnBs3TrapHandlers_c16)]
+        or      bx, bx
+        jnz     .call_handler
+        mov     bx, Bs3TrapDefaultHandler
+.call_handler:
+        push    ss
+        push    di
+        call    bx
+
+        ;
+        ; Resume execution using trap frame.
+        ;
+        xor     ax, ax
+        push    ax
+        push    ss
+        add     di, BS3TRAPFRAME.Ctx
+        push    di
+        call    Bs3RegCtxRestore
+.panic:
+        hlt
+        jmp     .panic
+BS3_PROC_END   bs3TrapRmV86GenericCommon
+
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c	(revision 60584)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/* $Id$ */
-/** @file
- * BS3Kit - Real mode and V86 trap data.
- */
-
-/*
- * Copyright (C) 2007-2016 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"
-
-
-/*********************************************************************************************************************************
-*   Global Variables                                                                                                             *
-*********************************************************************************************************************************/
-#if ARCH_BITS == 16
-/** Copy of the original real-mode interrupt vector table. */
-RTFAR16 g_aBs3RmIvtOriginal[256];
-/** Indicates whether we've copied the real-mode IVT or not. */
-bool    g_fBs3RmIvtCopied = false;
-#endif
-
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c	(revision 60585)
@@ -37,8 +37,8 @@
    flat address matches.   Also, these symbols are defined both with
    and without underscore prefixes. */
-extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16GenericEntries(void);
+extern BS3_DECL(void) BS3_FAR_CODE Bs3TrapRmV86GenericEntries(void);
 
 /* These two are ugly.  Need data access for patching purposes. */
-extern uint8_t  BS3_FAR_DATA bs3Trap16GenericTrapOrInt[];
+extern uint8_t  BS3_FAR_DATA bs3TrapRmV86GenericTrapOrInt[];
 
 /* bs3-cmn-TrapRmV86Data.c: */
@@ -74,5 +74,5 @@
     if (f386Plus)
     {
-        uint8_t BS3_FAR_DATA *pbFunction = &bs3Trap16GenericTrapOrInt[0];
+        uint8_t BS3_FAR_DATA *pbFunction = &bs3TrapRmV86GenericTrapOrInt[0];
 #if ARCH_BITS == 16
         if (g_bBs3CurrentMode != BS3_MODE_RM)
@@ -93,5 +93,5 @@
         if (iIvt != 0x10 && iIvt != BS3_TRAP_SYSCALL)
         {
-            paIvt[iIvt].off = (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIvt * 8;
+            paIvt[iIvt].off = (uint16_t)(uintptr_t)Bs3TrapRmV86GenericEntries + iIvt * 8;
             paIvt[iIvt].sel = BS3_SEL_TEXT16;
         }
@@ -99,5 +99,5 @@
 
 
-#undef Bs3TrapRmV86InitEx
+#undef Bs3TrapRmV86Init
 BS3_CMN_DEF(void, Bs3TrapRmV86Init,(void))
 {
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModes.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModes.c	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModes.c	(revision 60585)
@@ -181,5 +181,5 @@
 }
 
-
+#undef Bs3TestDoModes
 BS3_MODE_DEF(void, Bs3TestDoModes,(PCBS3TESTMODEENTRY paEntries, size_t cEntries))
 {
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapInit.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapInit.c	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapInit.c	(revision 60585)
@@ -32,9 +32,14 @@
 
 
+#undef Bs3TrapInit
 BS3_MODE_DEF(void, Bs3TrapInit,(void))
 {
-#if BS3_MODE_IS_16BIT_SYS(TMPL_MODE)
+#if BS3_MODE_IS_RM_SYS(TMPL_MODE)
+    Bs3TrapRmV86Init();
+#elif BS3_MODE_IS_16BIT_SYS(TMPL_MODE)
+    Bs3TrapRmV86Init();
     Bs3Trap16Init();
 #elif BS3_MODE_IS_32BIT_SYS(TMPL_MODE)
+    Bs3TrapRmV86Init();
     Bs3Trap32Init();
 #elif BS3_MODE_IS_64BIT_SYS(TMPL_MODE)
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c	(revision 60585)
@@ -50,4 +50,5 @@
     if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80286)
         Bs3Trap16Init();
+    Bs3TrapRmV86Init();
 }
 
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk	(revision 60585)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk	(revision 60585)
@@ -0,0 +1,94 @@
+# $Id$
+## @file
+# BS3Kit - Automatic near/far stubs - generated by the bs3kit-autostubs.kmk makefile rule.
+#
+
+#
+# Copyright (C) 2007-2016 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.
+#
+
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestCheckRegCtxEx)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrCpy)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingInitRootForLM)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingInitRootForPAE)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingInitRootForPP)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingProtect)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingProtectPtr)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetHandler)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Printf)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PrintfV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrFormatV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrLen)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrNLen)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrPrintf)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrPrintfV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabFree)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubErrorCount)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelFar32ToFlat32)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelProtFar32ToFlat32)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemAlloc)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemAllocZ)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemCpy)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemMove)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemPCpy)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabAlloc)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabAllocEx)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListAlloc)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListAllocEx)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemFree)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PicMaskAll)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PrintStr)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxConvertToRingX)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxPrint)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabInit)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListAdd)
+$(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,Bs3TestFailed)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestFailedF)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestFailedV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestInit)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestPrintf)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestPrintfV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSkipped)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSkippedF)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSkippedV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSub)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubDone)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubF)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubV)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestTerm)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap16Init)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap16InitEx)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap16SetGate)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap32Init)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap32SetGate)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap64Init)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Trap64SetGate)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapDefaultHandler)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapPrintFrame)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapRmV86Init)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapRmV86InitEx)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapRmV86SetGate)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestore)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapUnsetJmp)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3UInt32Div)
+$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3UInt64Div)
+$(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3TrapInit)
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h	(revision 60585)
@@ -1,5 +1,5 @@
 /* $Id$ */
 /** @file
- * BS3Kit - Function needing mangling.
+ * BS3Kit - Function needing mangling - generated by the bs3kit-mangling-code-define.h makefile rule.
  */
 
@@ -25,90 +25,97 @@
  */
 
-
-#define Bs3A20Disable                           BS3_CMN_MANGLER(Bs3A20Disable)
-#define Bs3A20DisableViaKbd                     BS3_CMN_MANGLER(Bs3A20DisableViaKbd)
-#define Bs3A20DisableViaPortA                   BS3_CMN_MANGLER(Bs3A20DisableViaPortA)
-#define Bs3A20Enable                            BS3_CMN_MANGLER(Bs3A20Enable)
-#define Bs3A20EnableViaKbd                      BS3_CMN_MANGLER(Bs3A20EnableViaKbd)
-#define Bs3A20EnableViaPortA                    BS3_CMN_MANGLER(Bs3A20EnableViaPortA)
-#define Bs3KbdRead                              BS3_CMN_MANGLER(Bs3KbdRead)
-#define Bs3KbdWait                              BS3_CMN_MANGLER(Bs3KbdWait)
-#define Bs3KbdWrite                             BS3_CMN_MANGLER(Bs3KbdWrite)
-#define Bs3MemAlloc                             BS3_CMN_MANGLER(Bs3MemAlloc)
-#define Bs3MemAllocZ                            BS3_CMN_MANGLER(Bs3MemAllocZ)
-#define Bs3MemCpy                               BS3_CMN_MANGLER(Bs3MemCpy)
-#define Bs3MemFree                              BS3_CMN_MANGLER(Bs3MemFree)
-#define Bs3MemMove                              BS3_CMN_MANGLER(Bs3MemMove)
-#define Bs3MemPCpy                              BS3_CMN_MANGLER(Bs3MemPCpy)
-#define Bs3MemZero                              BS3_CMN_MANGLER(Bs3MemZero)
-#define Bs3PagingInitRootForLM                  BS3_CMN_MANGLER(Bs3PagingInitRootForLM)
-#define Bs3PagingInitRootForPAE                 BS3_CMN_MANGLER(Bs3PagingInitRootForPAE)
-#define Bs3PagingInitRootForPP                  BS3_CMN_MANGLER(Bs3PagingInitRootForPP)
-#define Bs3PagingProtect                        BS3_CMN_MANGLER(Bs3PagingProtect)
-#define Bs3PagingProtectPtr                     BS3_CMN_MANGLER(Bs3PagingProtectPtr)
-#define Bs3Panic                                BS3_CMN_MANGLER(Bs3Panic)
-#define Bs3PicMaskAll                           BS3_CMN_MANGLER(Bs3PicMaskAll)
-#define Bs3PrintChr                             BS3_CMN_MANGLER(Bs3PrintChr)
-#define Bs3Printf                               BS3_CMN_MANGLER(Bs3Printf)
-#define Bs3PrintfV                              BS3_CMN_MANGLER(Bs3PrintfV)
-#define Bs3PrintStr                             BS3_CMN_MANGLER(Bs3PrintStr)
-#define Bs3PrintStrN                            BS3_CMN_MANGLER(Bs3PrintStrN)
-#define Bs3PrintU32                             BS3_CMN_MANGLER(Bs3PrintU32)
-#define Bs3PrintX32                             BS3_CMN_MANGLER(Bs3PrintX32)
-#define Bs3RegCtxConvertToRingX                 BS3_CMN_MANGLER(Bs3RegCtxConvertToRingX)
-#define Bs3RegCtxPrint                          BS3_CMN_MANGLER(Bs3RegCtxPrint)
-#define Bs3RegCtxRestore                        BS3_CMN_MANGLER(Bs3RegCtxRestore)
-#define Bs3RegCtxSave                           BS3_CMN_MANGLER(Bs3RegCtxSave)
-#define Bs3SelFlatCodeToRealMode                BS3_CMN_MANGLER(Bs3SelFlatCodeToRealMode)
-#define Bs3SelFlatCodeToProtFar16               BS3_CMN_MANGLER(Bs3SelFlatCodeToProtFar16)
-#define Bs3SelFar32ToFlat32                     BS3_CMN_MANGLER(Bs3SelFar32ToFlat32)
-#define Bs3SelProtFar32ToFlat32                 BS3_CMN_MANGLER(Bs3SelProtFar32ToFlat32)
-#define Bs3SelProtModeCodeToRealMode            BS3_CMN_MANGLER(Bs3SelProtModeCodeToRealMode)
-#define Bs3SelRealModeCodeToProtMode            BS3_CMN_MANGLER(Bs3SelRealModeCodeToProtMode)
-#define Bs3Shutdown                             BS3_CMN_MANGLER(Bs3Shutdown)
-#define Bs3SlabAlloc                            BS3_CMN_MANGLER(Bs3SlabAlloc)
-#define Bs3SlabAllocEx                          BS3_CMN_MANGLER(Bs3SlabAllocEx)
-#define Bs3SlabFree                             BS3_CMN_MANGLER(Bs3SlabFree)
-#define Bs3SlabInit                             BS3_CMN_MANGLER(Bs3SlabInit)
-#define Bs3SlabListAdd                          BS3_CMN_MANGLER(Bs3SlabListAdd)
-#define Bs3SlabListAlloc                        BS3_CMN_MANGLER(Bs3SlabListAlloc)
-#define Bs3SlabListAllocEx                      BS3_CMN_MANGLER(Bs3SlabListAllocEx)
-#define Bs3SlabListFree                         BS3_CMN_MANGLER(Bs3SlabListFree)
-#define Bs3SlabListInit                         BS3_CMN_MANGLER(Bs3SlabListInit)
-#define Bs3StrCpy                               BS3_CMN_MANGLER(Bs3StrCpy)
-#define Bs3StrFormatV                           BS3_CMN_MANGLER(Bs3StrFormatV)
-#define Bs3StrLen                               BS3_CMN_MANGLER(Bs3StrLen)
-#define Bs3StrNLen                              BS3_CMN_MANGLER(Bs3StrNLen)
-#define Bs3StrPrintf                            BS3_CMN_MANGLER(Bs3StrPrintf)
-#define Bs3StrPrintfV                           BS3_CMN_MANGLER(Bs3StrPrintfV)
-#define Bs3TestCheckRegCtxEx                    BS3_CMN_MANGLER(Bs3TestCheckRegCtxEx)
-#define Bs3TestFailed                           BS3_CMN_MANGLER(Bs3TestFailed)
-#define Bs3TestFailedF                          BS3_CMN_MANGLER(Bs3TestFailedF)
-#define Bs3TestFailedV                          BS3_CMN_MANGLER(Bs3TestFailedV)
-#define Bs3TestInit                             BS3_CMN_MANGLER(Bs3TestInit)
-#define Bs3TestPrintf                           BS3_CMN_MANGLER(Bs3TestPrintf)
-#define Bs3TestPrintfV                          BS3_CMN_MANGLER(Bs3TestPrintfV)
-#define Bs3TestSkipped                          BS3_CMN_MANGLER(Bs3TestSkipped)
-#define Bs3TestSkippedF                         BS3_CMN_MANGLER(Bs3TestSkippedF)
-#define Bs3TestSkippedV                         BS3_CMN_MANGLER(Bs3TestSkippedV)
-#define Bs3TestSub                              BS3_CMN_MANGLER(Bs3TestSub)
-#define Bs3TestSubDone                          BS3_CMN_MANGLER(Bs3TestSubDone)
-#define Bs3TestSubErrorCount                    BS3_CMN_MANGLER(Bs3TestSubErrorCount)
-#define Bs3TestSubF                             BS3_CMN_MANGLER(Bs3TestSubF)
-#define Bs3TestSubV                             BS3_CMN_MANGLER(Bs3TestSubV)
-#define Bs3TestTerm                             BS3_CMN_MANGLER(Bs3TestTerm)
-#define Bs3Trap16Init                           BS3_CMN_MANGLER(Bs3Trap16Init)
-#define Bs3Trap16InitEx                         BS3_CMN_MANGLER(Bs3Trap16InitEx)
-#define Bs3Trap16SetGate                        BS3_CMN_MANGLER(Bs3Trap16SetGate)
-#define Bs3Trap32Init                           BS3_CMN_MANGLER(Bs3Trap32Init)
-#define Bs3Trap32SetGate                        BS3_CMN_MANGLER(Bs3Trap32SetGate)
-#define Bs3Trap64Init                           BS3_CMN_MANGLER(Bs3Trap64Init)
-#define Bs3Trap64SetGate                        BS3_CMN_MANGLER(Bs3Trap64SetGate)
-#define Bs3TrapDefaultHandler                   BS3_CMN_MANGLER(Bs3TrapDefaultHandler)
-#define Bs3TrapPrintFrame                       BS3_CMN_MANGLER(Bs3TrapPrintFrame)
-#define Bs3TrapRmV86SetGate                     BS3_CMN_MANGLER(Bs3TrapRmV86SetGate)
-#define Bs3TrapSetHandler                       BS3_CMN_MANGLER(Bs3TrapSetHandler)
-#define Bs3TrapSetJmp                           BS3_CMN_MANGLER(Bs3TrapSetJmp)
-#define Bs3TrapSetJmpAndRestore                 BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestore)
-#define Bs3TrapUnsetJmp                         BS3_CMN_MANGLER(Bs3TrapUnsetJmp)
-
+#define Bs3A20Disable BS3_CMN_MANGLER(Bs3A20Disable)
+#define Bs3A20DisableViaKbd BS3_CMN_MANGLER(Bs3A20DisableViaKbd)
+#define Bs3A20DisableViaPortA BS3_CMN_MANGLER(Bs3A20DisableViaPortA)
+#define Bs3A20Enable BS3_CMN_MANGLER(Bs3A20Enable)
+#define Bs3A20EnableViaKbd BS3_CMN_MANGLER(Bs3A20EnableViaKbd)
+#define Bs3A20EnableViaPortA BS3_CMN_MANGLER(Bs3A20EnableViaPortA)
+#define Bs3KbdRead BS3_CMN_MANGLER(Bs3KbdRead)
+#define Bs3KbdWait BS3_CMN_MANGLER(Bs3KbdWait)
+#define Bs3KbdWrite BS3_CMN_MANGLER(Bs3KbdWrite)
+#define Bs3MemAlloc BS3_CMN_MANGLER(Bs3MemAlloc)
+#define Bs3MemAllocZ BS3_CMN_MANGLER(Bs3MemAllocZ)
+#define Bs3MemCpy BS3_CMN_MANGLER(Bs3MemCpy)
+#define Bs3MemFree BS3_CMN_MANGLER(Bs3MemFree)
+#define Bs3MemMove BS3_CMN_MANGLER(Bs3MemMove)
+#define Bs3MemPCpy BS3_CMN_MANGLER(Bs3MemPCpy)
+#define Bs3MemZero BS3_CMN_MANGLER(Bs3MemZero)
+#define Bs3PagingInitRootForLM BS3_CMN_MANGLER(Bs3PagingInitRootForLM)
+#define Bs3PagingInitRootForPAE BS3_CMN_MANGLER(Bs3PagingInitRootForPAE)
+#define Bs3PagingInitRootForPP BS3_CMN_MANGLER(Bs3PagingInitRootForPP)
+#define Bs3PagingProtect BS3_CMN_MANGLER(Bs3PagingProtect)
+#define Bs3PagingProtectPtr BS3_CMN_MANGLER(Bs3PagingProtectPtr)
+#define Bs3Panic BS3_CMN_MANGLER(Bs3Panic)
+#define Bs3PicMaskAll BS3_CMN_MANGLER(Bs3PicMaskAll)
+#define Bs3PrintChr BS3_CMN_MANGLER(Bs3PrintChr)
+#define Bs3Printf BS3_CMN_MANGLER(Bs3Printf)
+#define Bs3PrintfV BS3_CMN_MANGLER(Bs3PrintfV)
+#define Bs3PrintStr BS3_CMN_MANGLER(Bs3PrintStr)
+#define Bs3PrintStrN BS3_CMN_MANGLER(Bs3PrintStrN)
+#define Bs3PrintU32 BS3_CMN_MANGLER(Bs3PrintU32)
+#define Bs3PrintX32 BS3_CMN_MANGLER(Bs3PrintX32)
+#define Bs3RegCtxConvertToRingX BS3_CMN_MANGLER(Bs3RegCtxConvertToRingX)
+#define Bs3RegCtxPrint BS3_CMN_MANGLER(Bs3RegCtxPrint)
+#define Bs3RegCtxRestore BS3_CMN_MANGLER(Bs3RegCtxRestore)
+#define Bs3RegCtxSave BS3_CMN_MANGLER(Bs3RegCtxSave)
+#define Bs3SelFar32ToFlat32 BS3_CMN_MANGLER(Bs3SelFar32ToFlat32)
+#define Bs3SelFlatCodeToProtFar16 BS3_CMN_MANGLER(Bs3SelFlatCodeToProtFar16)
+#define Bs3SelFlatCodeToRealMode BS3_CMN_MANGLER(Bs3SelFlatCodeToRealMode)
+#define Bs3SelProtFar32ToFlat32 BS3_CMN_MANGLER(Bs3SelProtFar32ToFlat32)
+#define Bs3SelProtModeCodeToRealMode BS3_CMN_MANGLER(Bs3SelProtModeCodeToRealMode)
+#define Bs3SelRealModeCodeToProtMode BS3_CMN_MANGLER(Bs3SelRealModeCodeToProtMode)
+#define Bs3Shutdown BS3_CMN_MANGLER(Bs3Shutdown)
+#define Bs3SlabAlloc BS3_CMN_MANGLER(Bs3SlabAlloc)
+#define Bs3SlabAllocEx BS3_CMN_MANGLER(Bs3SlabAllocEx)
+#define Bs3SlabFree BS3_CMN_MANGLER(Bs3SlabFree)
+#define Bs3SlabInit BS3_CMN_MANGLER(Bs3SlabInit)
+#define Bs3SlabListAdd BS3_CMN_MANGLER(Bs3SlabListAdd)
+#define Bs3SlabListAlloc BS3_CMN_MANGLER(Bs3SlabListAlloc)
+#define Bs3SlabListAllocEx BS3_CMN_MANGLER(Bs3SlabListAllocEx)
+#define Bs3SlabListFree BS3_CMN_MANGLER(Bs3SlabListFree)
+#define Bs3SlabListInit BS3_CMN_MANGLER(Bs3SlabListInit)
+#define Bs3StrCpy BS3_CMN_MANGLER(Bs3StrCpy)
+#define Bs3StrFormatV BS3_CMN_MANGLER(Bs3StrFormatV)
+#define Bs3StrLen BS3_CMN_MANGLER(Bs3StrLen)
+#define Bs3StrNLen BS3_CMN_MANGLER(Bs3StrNLen)
+#define Bs3StrPrintf BS3_CMN_MANGLER(Bs3StrPrintf)
+#define Bs3StrPrintfV BS3_CMN_MANGLER(Bs3StrPrintfV)
+#define Bs3TestCheckRegCtxEx BS3_CMN_MANGLER(Bs3TestCheckRegCtxEx)
+#define Bs3TestFailed BS3_CMN_MANGLER(Bs3TestFailed)
+#define Bs3TestFailedF BS3_CMN_MANGLER(Bs3TestFailedF)
+#define Bs3TestFailedV BS3_CMN_MANGLER(Bs3TestFailedV)
+#define Bs3TestInit BS3_CMN_MANGLER(Bs3TestInit)
+#define Bs3TestPrintf BS3_CMN_MANGLER(Bs3TestPrintf)
+#define Bs3TestPrintfV BS3_CMN_MANGLER(Bs3TestPrintfV)
+#define Bs3TestSkipped BS3_CMN_MANGLER(Bs3TestSkipped)
+#define Bs3TestSkippedF BS3_CMN_MANGLER(Bs3TestSkippedF)
+#define Bs3TestSkippedV BS3_CMN_MANGLER(Bs3TestSkippedV)
+#define Bs3TestSub BS3_CMN_MANGLER(Bs3TestSub)
+#define Bs3TestSubDone BS3_CMN_MANGLER(Bs3TestSubDone)
+#define Bs3TestSubErrorCount BS3_CMN_MANGLER(Bs3TestSubErrorCount)
+#define Bs3TestSubF BS3_CMN_MANGLER(Bs3TestSubF)
+#define Bs3TestSubV BS3_CMN_MANGLER(Bs3TestSubV)
+#define Bs3TestTerm BS3_CMN_MANGLER(Bs3TestTerm)
+#define Bs3Trap16Init BS3_CMN_MANGLER(Bs3Trap16Init)
+#define Bs3Trap16InitEx BS3_CMN_MANGLER(Bs3Trap16InitEx)
+#define Bs3Trap16SetGate BS3_CMN_MANGLER(Bs3Trap16SetGate)
+#define Bs3Trap32Init BS3_CMN_MANGLER(Bs3Trap32Init)
+#define Bs3Trap32SetGate BS3_CMN_MANGLER(Bs3Trap32SetGate)
+#define Bs3Trap64Init BS3_CMN_MANGLER(Bs3Trap64Init)
+#define Bs3Trap64SetGate BS3_CMN_MANGLER(Bs3Trap64SetGate)
+#define Bs3TrapDefaultHandler BS3_CMN_MANGLER(Bs3TrapDefaultHandler)
+#define Bs3TrapPrintFrame BS3_CMN_MANGLER(Bs3TrapPrintFrame)
+#define Bs3TrapRmV86Init BS3_CMN_MANGLER(Bs3TrapRmV86Init)
+#define Bs3TrapRmV86InitEx BS3_CMN_MANGLER(Bs3TrapRmV86InitEx)
+#define Bs3TrapRmV86SetGate BS3_CMN_MANGLER(Bs3TrapRmV86SetGate)
+#define Bs3TrapSetHandler BS3_CMN_MANGLER(Bs3TrapSetHandler)
+#define Bs3TrapSetJmp BS3_CMN_MANGLER(Bs3TrapSetJmp)
+#define Bs3TrapSetJmpAndRestore BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestore)
+#define Bs3TrapUnsetJmp BS3_CMN_MANGLER(Bs3TrapUnsetJmp)
+#define Bs3UInt32Div BS3_CMN_MANGLER(Bs3UInt32Div)
+#define Bs3UInt64Div BS3_CMN_MANGLER(Bs3UInt64Div)
+#ifndef BS3_CMN_ONLY
+# define Bs3CpuDetect BS3_MODE_MANGLER(Bs3CpuDetect)
+# define Bs3TestDoModes BS3_MODE_MANGLER(Bs3TestDoModes)
+# define Bs3TrapInit BS3_MODE_MANGLER(Bs3TrapInit)
+#endif /* !BS3_CMN_ONLY */
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h	(revision 60585)
@@ -24,5 +24,4 @@
  * terms and conditions of either the GPL or the CDDL or both.
  */
-
 
 #undef Bs3A20Disable
@@ -60,7 +59,7 @@
 #undef Bs3RegCtxRestore
 #undef Bs3RegCtxSave
+#undef Bs3SelFar32ToFlat32
+#undef Bs3SelFlatCodeToProtFar16
 #undef Bs3SelFlatCodeToRealMode
-#undef Bs3SelFlatCodeToProtFar16
-#undef Bs3SelFar32ToFlat32
 #undef Bs3SelProtFar32ToFlat32
 #undef Bs3SelProtModeCodeToRealMode
@@ -107,4 +106,6 @@
 #undef Bs3TrapDefaultHandler
 #undef Bs3TrapPrintFrame
+#undef Bs3TrapRmV86Init
+#undef Bs3TrapRmV86InitEx
 #undef Bs3TrapRmV86SetGate
 #undef Bs3TrapSetHandler
@@ -112,3 +113,9 @@
 #undef Bs3TrapSetJmpAndRestore
 #undef Bs3TrapUnsetJmp
-
+#undef Bs3UInt32Div
+#undef Bs3UInt64Div
+#ifndef BS3_CMN_ONLY
+# undef Bs3CpuDetect
+# undef Bs3TestDoModes
+# undef Bs3TrapInit
+#endif /* !BS3_CMN_ONLY */
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h	(revision 60585)
@@ -30,8 +30,11 @@
  */
 #undef BS3_CMN_MANGLER
+#undef BS3_MODE_MANGLER
 #if ARCH_BITS != 16 || !defined(BS3_USE_ALT_16BIT_TEXT_SEG)
 # define BS3_CMN_MANGLER(a_Function)            BS3_CMN_NM(a_Function)
+# define BS3_MODE_MANGLER(a_Function)           TMPL_NM(a_Function)
 #else
 # define BS3_CMN_MANGLER(a_Function)            BS3_CMN_FAR_NM(a_Function)
+# define BS3_MODE_MANGLER(a_Function)           TMPL_FAR_NM(a_Function)
 #endif
 #include "bs3kit-mangling-code-undef.h"
Index: trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
===================================================================
--- trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 60584)
+++ trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h	(revision 60585)
@@ -1269,20 +1269,54 @@
  */
 
-/** @def BS3_CMN_PROTO
- * Macro for prototyping all the variations of a common function.
+/** @def BS3_CMN_PROTO_INT
+ * Internal macro for prototyping all the variations of a common function.
  * @param   a_RetType   The return type.
  * @param   a_Name      The function basename.
  * @param   a_Params    The parameter list (in parentheses).
- * @param   a_fAutoStub Whether to autogenerate a 16-bit near -> 16-bit far stub
- *                      function. Either 'true' for stub or 'false' for no stub.
+ * @sa      BS3_CMN_PROTO_STUB, BS3_CMN_PROTO_NOSB
  */
 #if ARCH_BITS == 16
-# define BS3_CMN_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
+# define BS3_CMN_PROTO_INT(a_RetType, a_Name, a_Params) \
     BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params;  \
     BS3_DECL_FAR(a_RetType)  BS3_CMN_FAR_NM(a_Name) a_Params
 #else
-# define BS3_CMN_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
+# define BS3_CMN_PROTO_INT(a_RetType, a_Name, a_Params) \
     BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params
 #endif
+
+/** @BS3_CMN_PROTO_STUB
+ * Macro for prototyping all the variations of a common function with automatic
+ * near -> far stub.
+ *
+ * @param   a_RetType   The return type.
+ * @param   a_Name      The function basename.
+ * @param   a_Params    The parameter list (in parentheses).
+ * @sa      BS3_CMN_PROTO_NOSB
+ */
+#define BS3_CMN_PROTO_STUB(a_RetType, a_Name, a_Params) BS3_CMN_PROTO_INT(a_RetType, a_Name, a_Params)
+
+/** @BS3_CMN_PROTO_NOSB
+ * Macro for prototyping all the variations of a common function without any
+ * near > far stub.
+ *
+ * @param   a_RetType   The return type.
+ * @param   a_Name      The function basename.
+ * @param   a_Params    The parameter list (in parentheses).
+ * @sa      BS3_CMN_PROTO_STUB
+ */
+#define BS3_CMN_PROTO_NOSB(a_RetType, a_Name, a_Params) BS3_CMN_PROTO_INT(a_RetType, a_Name, a_Params)
+
+/** @BS3_CMN_PROTO_FRST
+ * Macro for prototyping all the variations of a common function with automatic
+ * far -> near stub.
+ *
+ * @param   a_cbParam16 The size of the 16-bit parameter list in bytes.
+ * @param   a_RetType   The return type.
+ * @param   a_Name      The function basename.
+ * @param   a_Params    The parameter list (in parentheses).
+ * @sa      BS3_CMN_PROTO_STUB
+ */
+#define BS3_CMN_PROTO_FARSTUB(a_cbParam16, a_RetType, a_Name, a_Params) BS3_CMN_PROTO_INT(a_RetType, a_Name, a_Params)
+
 
 /** @def BS3_CMN_DEF
@@ -1319,5 +1353,5 @@
  * The current implementation will only halt the CPU.
  */
-BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3Panic,(void), false);
+BS3_CMN_PROTO_NOSB(DECL_NO_RETURN(void), Bs3Panic,(void));
 #if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
 # pragma aux Bs3Panic_c16 __aborts
@@ -1332,5 +1366,5 @@
  * just halt the CPU.
  */
-BS3_CMN_PROTO(void, Bs3Shutdown,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3Shutdown,(void));
 
 /**
@@ -1339,5 +1373,5 @@
  * @param   uValue      The 32-bit value.
  */
-BS3_CMN_PROTO(void, Bs3PrintU32,(uint32_t uValue), false);
+BS3_CMN_PROTO_NOSB(void, Bs3PrintU32,(uint32_t uValue));
 
 /**
@@ -1346,5 +1380,5 @@
  * @param   uValue      The 32-bit value.
  */
-BS3_CMN_PROTO(void, Bs3PrintX32,(uint32_t uValue), false);
+BS3_CMN_PROTO_NOSB(void, Bs3PrintX32,(uint32_t uValue));
 
 /**
@@ -1356,5 +1390,5 @@
  * @param   ...             Format arguments.
  */
-BS3_CMN_PROTO(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...));
 
 /**
@@ -1366,5 +1400,5 @@
  * @param   va              Format arguments.
  */
-BS3_CMN_PROTO(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va));
 
 /**
@@ -1373,5 +1407,5 @@
  * @param   pszString       The string to print.
  */
-BS3_CMN_PROTO(void, Bs3PrintStr,(const char BS3_FAR *pszString), true);
+BS3_CMN_PROTO_STUB(void, Bs3PrintStr,(const char BS3_FAR *pszString));
 
 /**
@@ -1381,5 +1415,5 @@
  * @param   cchString       The exact number of characters to print.
  */
-BS3_CMN_PROTO(void, Bs3PrintStrN,(const char BS3_FAR *pszString, size_t cchString), false);
+BS3_CMN_PROTO_NOSB(void, Bs3PrintStrN,(const char BS3_FAR *pszString, size_t cchString));
 
 /**
@@ -1388,5 +1422,5 @@
  * @param   ch              The character to print.
  */
-BS3_CMN_PROTO(void, Bs3PrintChr,(char ch), false);
+BS3_CMN_PROTO_NOSB(void, Bs3PrintChr,(char ch));
 
 
@@ -1422,6 +1456,6 @@
  * @param   pvUser      The user argument for the output function.
  */
-BS3_CMN_PROTO(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
-                                     PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
+                                          PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser));
 
 /**
@@ -1437,5 +1471,5 @@
  * @param   va          Format arguments.
  */
-BS3_CMN_PROTO(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va));
 
 /**
@@ -1451,5 +1485,5 @@
  * @param   ...         Format arguments.
  */
-BS3_CMN_PROTO(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...));
 
 
@@ -1460,5 +1494,5 @@
  * @param   pszString       The string to examine.
  */
-BS3_CMN_PROTO(size_t, Bs3StrLen,(const char BS3_FAR *pszString), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3StrLen,(const char BS3_FAR *pszString));
 
 /**
@@ -1470,5 +1504,5 @@
  * @param   cchMax          The max length to examine.
  */
-BS3_CMN_PROTO(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax), true);
+BS3_CMN_PROTO_STUB(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax));
 
 /**
@@ -1480,5 +1514,5 @@
  * @param   pszSrc          The source string.
  */
-BS3_CMN_PROTO(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc), true);
+BS3_CMN_PROTO_STUB(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc));
 
 /**
@@ -1490,5 +1524,5 @@
  * @param   cbCopy          The number of bytes to copy.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy));
 
 /**
@@ -1500,5 +1534,5 @@
  * @param   cbCopy          The number of bytes to copy.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy));
 
 /**
@@ -1510,5 +1544,5 @@
  * @param   cbCopy          The number of bytes to copy.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy));
 
 /**
@@ -1518,5 +1552,9 @@
  * @param   cbDst           The number of bytes to zero.
  */
-BS3_CMN_PROTO(void, Bs3MemZero,(void BS3_FAR *pvDst, size_t cbDst), false);
+BS3_CMN_PROTO_NOSB(void, Bs3MemZero,(void BS3_FAR *pvDst, size_t cbDst));
+
+
+BS3_CMN_PROTO_STUB(void, Bs3UInt64Div,(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder));
+BS3_CMN_PROTO_STUB(void, Bs3UInt32Div,(RTUINT32U uDividend, RTUINT32U uDivisor, RTUINT32U BS3_FAR *paQuotientReminder));
 
 
@@ -1528,5 +1566,5 @@
  * @param   uSel            The protected mode segment selector.
  */
-BS3_CMN_PROTO(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
+BS3_CMN_PROTO_STUB(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel));
 
 /**
@@ -1537,5 +1575,5 @@
  * @param   uSel            The current mode segment selector.
  */
-BS3_CMN_PROTO(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
+BS3_CMN_PROTO_STUB(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel));
 
 /**
@@ -1545,5 +1583,5 @@
  * @param   uRealSeg        Real mode code segment.
  */
-BS3_CMN_PROTO(uint16_t, Bs3SelRealModeCodeToProtMode,(uint16_t uRealSeg), false);
+BS3_CMN_PROTO_NOSB(uint16_t, Bs3SelRealModeCodeToProtMode,(uint16_t uRealSeg));
 
 /**
@@ -1553,5 +1591,5 @@
  * @param   uProtSel        Real mode code segment.
  */
-BS3_CMN_PROTO(uint16_t, Bs3SelProtModeCodeToRealMode,(uint16_t uProtSel), false);
+BS3_CMN_PROTO_NOSB(uint16_t, Bs3SelProtModeCodeToRealMode,(uint16_t uProtSel));
 
 /**
@@ -1561,5 +1599,5 @@
  * @param   uFlatAddr       Flat code address.
  */
-BS3_CMN_PROTO(uint32_t, Bs3SelFlatCodeToRealMode,(uint32_t uFlatAddr), false);
+BS3_CMN_PROTO_NOSB(uint32_t, Bs3SelFlatCodeToRealMode,(uint32_t uFlatAddr));
 
 /**
@@ -1570,5 +1608,5 @@
  * @param   uFlatAddr       Flat code address.
  */
-BS3_CMN_PROTO(uint32_t, Bs3SelFlatCodeToProtFar16,(uint32_t uFlatAddr), false);
+BS3_CMN_PROTO_NOSB(uint32_t, Bs3SelFlatCodeToProtFar16,(uint32_t uFlatAddr));
 
 /**
@@ -1651,6 +1689,6 @@
  * @param   cbChunk         The chunk size.
  */
-BS3_CMN_PROTO(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr,
-                                 uint32_t cbSlab, uint16_t cbChunk), true);
+BS3_CMN_PROTO_STUB(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr,
+                                      uint32_t cbSlab, uint16_t cbChunk));
 
 /**
@@ -1660,5 +1698,5 @@
  * @param   pSlabCtl        The slab constrol structure to allocate from.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl));
 
 /**
@@ -1671,5 +1709,5 @@
  * @param   fFlags          Flags, see BS3_SLAB_ALLOC_F_XXX
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags));
 
 /**
@@ -1682,5 +1720,5 @@
  * @param   cChunks         The number of contiguous chunks to free.
  */
-BS3_CMN_PROTO(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks), true);
+BS3_CMN_PROTO_STUB(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks));
 
 
@@ -1691,5 +1729,5 @@
  * @param   cbChunk     The chunk size.
  */
-BS3_CMN_PROTO(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk), true);
+BS3_CMN_PROTO_STUB(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk));
 
 /**
@@ -1699,5 +1737,5 @@
  * @param   pSlabCtl        The slab control structure to add.
  */
-BS3_CMN_PROTO(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl), true);
+BS3_CMN_PROTO_STUB(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl));
 
 /**
@@ -1707,5 +1745,5 @@
  * @param   pHead           The slab list to allocate from.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead));
 
 /**
@@ -1718,5 +1756,5 @@
  * @param   fFlags          Flags, see BS3_SLAB_ALLOC_F_XXX
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags));
 
 /**
@@ -1727,5 +1765,5 @@
  * @param   cChunks         The number of contiguous chunks to free.
  */
-BS3_CMN_PROTO(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks), true);
+BS3_CMN_PROTO_STUB(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks));
 
 /**
@@ -1756,5 +1794,5 @@
  * @param   cb          How much to allocate.  Must be 4KB or less.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb));
 
 /**
@@ -1765,5 +1803,5 @@
  * @param   cb          How much to allocate.  Must be 4KB or less.
  */
-BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb), true);
+BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb));
 
 /**
@@ -1774,5 +1812,5 @@
  * @param   cb          The size of the allocation.
  */
-BS3_CMN_PROTO(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb), true);
+BS3_CMN_PROTO_STUB(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb));
 
 
@@ -1780,30 +1818,30 @@
  * Enables the A20 gate.
  */
-BS3_CMN_PROTO(void, Bs3A20Enable,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20Enable,(void));
 
 /**
  * Enables the A20 gate via the keyboard controller
  */
-BS3_CMN_PROTO(void, Bs3A20EnableViaKbd,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20EnableViaKbd,(void));
 
 /**
  * Enables the A20 gate via the PS/2 control port A.
  */
-BS3_CMN_PROTO(void, Bs3A20EnableViaPortA,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20EnableViaPortA,(void));
 
 /**
  * Disables the A20 gate.
  */
-BS3_CMN_PROTO(void, Bs3A20Disable,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20Disable,(void));
 
 /**
  * Disables the A20 gate via the keyboard controller
  */
-BS3_CMN_PROTO(void, Bs3A20DisableViaKbd,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20DisableViaKbd,(void));
 
 /**
  * Disables the A20 gate via the PS/2 control port A.
  */
-BS3_CMN_PROTO(void, Bs3A20DisableViaPortA,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3A20DisableViaPortA,(void));
 
 
@@ -1814,5 +1852,5 @@
  * @remarks Must not be called in real-mode!
  */
-BS3_CMN_PROTO(int, Bs3PagingInitRootForPP,(void), true);
+BS3_CMN_PROTO_STUB(int, Bs3PagingInitRootForPP,(void));
 
 /**
@@ -1823,5 +1861,5 @@
  * @remarks Must not be called in real-mode!
  */
-BS3_CMN_PROTO(int, Bs3PagingInitRootForPAE,(void), true);
+BS3_CMN_PROTO_STUB(int, Bs3PagingInitRootForPAE,(void));
 
 /**
@@ -1832,5 +1870,5 @@
  * @remarks Must not be called in real-mode!
  */
-BS3_CMN_PROTO(int, Bs3PagingInitRootForLM,(void), true);
+BS3_CMN_PROTO_STUB(int, Bs3PagingInitRootForLM,(void));
 
 /**
@@ -1850,5 +1888,5 @@
  * @param   fClear      Mask of zero or more X86_PTE_XXX values to clear for the range.
  */
-BS3_CMN_PROTO(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear), true);
+BS3_CMN_PROTO_STUB(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear));
 
 /**
@@ -1868,10 +1906,10 @@
  * @param   fClear      Mask of zero or more X86_PTE_XXX values to clear for the range.
  */
-BS3_CMN_PROTO(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear), true);
+BS3_CMN_PROTO_STUB(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear));
 
 /**
  * Waits for the keyboard controller to become ready.
  */
-BS3_CMN_PROTO(void, Bs3KbdWait,(void), false);
+BS3_CMN_PROTO_NOSB(void, Bs3KbdWait,(void));
 
 /**
@@ -1884,5 +1922,5 @@
  * @param        bCmd            The read command.
  */
-BS3_CMN_PROTO(uint8_t, Bs3KbdRead,(uint8_t bCmd), false);
+BS3_CMN_PROTO_NOSB(uint8_t, Bs3KbdRead,(uint8_t bCmd));
 
 /**
@@ -1895,5 +1933,5 @@
  * @param        bData          The data to write.
  */
-BS3_CMN_PROTO(void, Bs3KbdWrite,(uint8_t bCmd, uint8_t bData), false);
+BS3_CMN_PROTO_NOSB(void, Bs3KbdWrite,(uint8_t bCmd, uint8_t bData));
 
 
@@ -1901,5 +1939,5 @@
  * Disables all IRQs on the PIC.
  */
-BS3_CMN_PROTO(void, Bs3PicMaskAll,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3PicMaskAll,(void));
 
 
@@ -2001,5 +2039,5 @@
  * @param   pRegCtx     Where to store the register context.
  */
-BS3_CMN_PROTO(void, Bs3RegCtxSave,(PCBS3REGCTX pRegCtx), false);
+BS3_CMN_PROTO_NOSB(void, Bs3RegCtxSave,(PCBS3REGCTX pRegCtx));
 
 /**
@@ -2009,5 +2047,5 @@
  * @param   bRing       The target ring (0..3).
  */
-BS3_CMN_PROTO(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing), true);
+BS3_CMN_PROTO_STUB(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing));
 
 /**
@@ -2020,5 +2058,5 @@
  * @remarks Does not return.
  */
-BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3RegCtxRestore,(PCBS3REGCTX pRegCtx, uint16_t fFlags), false);
+BS3_CMN_PROTO_NOSB(DECL_NO_RETURN(void), Bs3RegCtxRestore,(PCBS3REGCTX pRegCtx, uint16_t fFlags));
 #if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
 # pragma aux Bs3RegCtxRestore_c16 "_Bs3RegCtxRestore_aborts_c16" __aborts
@@ -2035,5 +2073,5 @@
  * @param   pRegCtx     The register context to be printed.
  */
-BS3_CMN_PROTO(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx), true);
+BS3_CMN_PROTO_STUB(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx));
 
 
@@ -2069,15 +2107,14 @@
 
 
-
-/**
- * Initializes 16-bit (protected mode) trap handling.
- *
- * @remarks Does not install 16-bit trap handling, just initializes the
+/**
+ * Initializes real mode and v8086 trap handling.
+ *
+ * @remarks Does not install RM/V86 trap handling, just initializes the
  *          structures.
  */
-BS3_CMN_PROTO(void, Bs3Trap16Init,(void), true);
-
-/**
- * Initializes 16-bit (protected mode) trap handling, extended version.
+BS3_CMN_PROTO_STUB(void, Bs3TrapRmV86Init,(void));
+
+/**
+ * Initializes real mode and v8086 trap handling, extended version.
  *
  * @param   f386Plus    Set if the CPU is 80386 or later and
@@ -2086,8 +2123,29 @@
  *                      reversed.
  *
+ * @remarks Does not install RM/V86 trap handling, just initializes the
+ *          structures.
+ */
+BS3_CMN_PROTO_STUB(void, Bs3TrapRmV86InitEx,(bool f386Plus));
+
+/**
+ * Initializes 16-bit (protected mode) trap handling.
+ *
  * @remarks Does not install 16-bit trap handling, just initializes the
  *          structures.
  */
-BS3_CMN_PROTO(void, Bs3Trap16InitEx,(bool f386Plus), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap16Init,(void));
+
+/**
+ * Initializes 16-bit (protected mode) trap handling, extended version.
+ *
+ * @param   f386Plus    Set if the CPU is 80386 or later and
+ *                      extended registers should be saved.  Once initialized
+ *                      with this parameter set to @a true, the effect cannot be
+ *                      reversed.
+ *
+ * @remarks Does not install 16-bit trap handling, just initializes the
+ *          structures.
+ */
+BS3_CMN_PROTO_STUB(void, Bs3Trap16InitEx,(bool f386Plus));
 
 /**
@@ -2097,5 +2155,5 @@
  *          structures.
  */
-BS3_CMN_PROTO(void, Bs3Trap32Init,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap32Init,(void));
 
 /**
@@ -2105,5 +2163,5 @@
  *          structures.
  */
-BS3_CMN_PROTO(void, Bs3Trap64Init,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap64Init,(void));
 
 /**
@@ -2114,5 +2172,5 @@
  * @param   off         The handler offset.
  */
-BS3_CMN_PROTO(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off), true);
+BS3_CMN_PROTO_STUB(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off));
 
 /**
@@ -2126,6 +2184,6 @@
  * @param   cParams     The parameter count (for call gates).
  */
-BS3_CMN_PROTO(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
-                                      uint16_t uSel, uint16_t off, uint8_t cParams), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
+                                           uint16_t uSel, uint16_t off, uint8_t cParams));
 
 /** The address of Bs3Trap16GenericEntries.
@@ -2145,6 +2203,6 @@
  * @param   cParams     The parameter count (for call gates).
  */
-BS3_CMN_PROTO(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
-                                      uint16_t uSel, uint32_t off, uint8_t cParams), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
+                                           uint16_t uSel, uint32_t off, uint8_t cParams));
 
 /** The address of Bs3Trap32GenericEntries.
@@ -2164,6 +2222,5 @@
  * @param   bIst        The interrupt stack to use.
  */
-BS3_CMN_PROTO(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
-                                      uint16_t uSel, uint64_t off, uint8_t bIst), true);
+BS3_CMN_PROTO_STUB(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst));
 
 /** The address of Bs3Trap64GenericEntries.
@@ -2202,5 +2259,5 @@
  * @param   pfnHandler  Pointer to the handler.
  */
-BS3_CMN_PROTO(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler), true);
+BS3_CMN_PROTO_STUB(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler));
 
 /**
@@ -2211,5 +2268,5 @@
  * @param   pTrapFrame      Trap frame of the trap to handle.
  */
-BS3_CMN_PROTO(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame), true);
+BS3_CMN_PROTO_STUB(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame));
 
 /**
@@ -2217,5 +2274,5 @@
  * @param   pTrapFrame      Trap frame to print.
  */
-BS3_CMN_PROTO(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame), true);
+BS3_CMN_PROTO_STUB(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame));
 
 /**
@@ -2231,5 +2288,5 @@
  * @sa      #Bs3TrapUnsetJmp
  */
-BS3_CMN_PROTO(DECL_RETURNS_TWICE(bool),Bs3TrapSetJmp,(PBS3TRAPFRAME pTrapFrame), false);
+BS3_CMN_PROTO_NOSB(DECL_RETURNS_TWICE(bool),Bs3TrapSetJmp,(PBS3TRAPFRAME pTrapFrame));
 
 /**
@@ -2239,10 +2296,10 @@
  * @param   pTrapFrame      Where to store the trap information.
  */
-BS3_CMN_PROTO(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame), true);
+BS3_CMN_PROTO_STUB(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame));
 
 /**
  * Disables a previous #Bs3TrapSetJmp call.
  */
-BS3_CMN_PROTO(void, Bs3TrapUnsetJmp,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3TrapUnsetJmp,(void));
 
 
@@ -2257,5 +2314,5 @@
  * @param   pszTest         The test name.
  */
-BS3_CMN_PROTO(void, Bs3TestInit,(const char BS3_FAR *pszTest), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestInit,(const char BS3_FAR *pszTest));
 
 
@@ -2263,30 +2320,30 @@
  * Equivalent to RTTestSummaryAndDestroy.
  */
-BS3_CMN_PROTO(void, Bs3TestTerm,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestTerm,(void));
 
 /**
  * Equivalent to RTTestISub.
  */
-BS3_CMN_PROTO(void, Bs3TestSub,(const char BS3_FAR *pszSubTest), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSub,(const char BS3_FAR *pszSubTest));
 
 /**
  * Equivalent to RTTestIFailedF.
  */
-BS3_CMN_PROTO(void, Bs3TestSubF,(const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSubF,(const char BS3_FAR *pszFormat, ...));
 
 /**
  * Equivalent to RTTestISubV.
  */
-BS3_CMN_PROTO(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list va));
 
 /**
  * Equivalent to RTTestISubDone.
  */
-BS3_CMN_PROTO(void, Bs3TestSubDone,(void), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSubDone,(void));
 
 /**
  * Equivalent to RTTestSubErrorCount.
  */
-BS3_CMN_PROTO(uint16_t, Bs3TestSubErrorCount,(void), true);
+BS3_CMN_PROTO_STUB(uint16_t, Bs3TestSubErrorCount,(void));
 
 /**
@@ -2296,5 +2353,5 @@
  * @param   ...         String format arguments.
  */
-BS3_CMN_PROTO(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...));
 
 /**
@@ -2304,20 +2361,20 @@
  * @param   va          String format arguments.
  */
-BS3_CMN_PROTO(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va));
 
 /**
  * Equivalent to RTTestIFailed.
  */
-BS3_CMN_PROTO(void, Bs3TestFailed,(const char BS3_FAR *pszMessage), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestFailed,(const char BS3_FAR *pszMessage));
 
 /**
  * Equivalent to RTTestIFailedF.
  */
-BS3_CMN_PROTO(void, Bs3TestFailedF,(const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestFailedF,(const char BS3_FAR *pszFormat, ...));
 
 /**
  * Equivalent to RTTestIFailedV.
  */
-BS3_CMN_PROTO(void, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list va));
 
 /**
@@ -2326,5 +2383,5 @@
  * @param   pszWhy          Optional reason why it's being skipped.
  */
-BS3_CMN_PROTO(void, Bs3TestSkipped,(const char BS3_FAR *pszWhy), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSkipped,(const char BS3_FAR *pszWhy));
 
 /**
@@ -2334,5 +2391,5 @@
  * @param   ...             Format arguments.
  */
-BS3_CMN_PROTO(void, Bs3TestSkippedF,(const char BS3_FAR *pszFormat, ...), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSkippedF,(const char BS3_FAR *pszFormat, ...));
 
 /**
@@ -2342,5 +2399,5 @@
  * @param   va              Format arguments.
  */
-BS3_CMN_PROTO(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list va), true);
+BS3_CMN_PROTO_STUB(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list va));
 
 /**
@@ -2358,6 +2415,6 @@
  * @param   idTestStep      Test step identifier.
  */
-BS3_CMN_PROTO(bool, Bs3TestCheckRegCtxEx,(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust,
-                                          int16_t cbSpAdjust, uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep), true);
+BS3_CMN_PROTO_STUB(bool, Bs3TestCheckRegCtxEx,(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust,
+                                               int16_t cbSpAdjust, uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep));
 
 /**
@@ -2545,16 +2602,13 @@
 
 
-/** @def BS3_MODE_PROTO
- * Macro for reducing typing.
- *
- * Doxygen knows how to expand this, well, kind of.
+/** @def BS3_MODE_PROTO_INT
+ * Internal macro for emitting prototypes for mode functions.
  *
  * @param   a_RetType   The return type.
  * @param   a_Name      The function basename.
  * @param   a_Params    The parameter list (in parentheses).
- * @param   a_fAutoStub Whether to autogenerate a 16-bit near -> 16-bit far stub
- *                      function. Either 'true' for stub or 'false' for no stub.
- */
-#define BS3_MODE_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
+ * @sa      BS3_MODE_PROTO_STUB, BS3_MODE_PROTO_NOSB
+ */
+#define BS3_MODE_PROTO_INT(a_RetType, a_Name, a_Params) \
     BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_Name,_rm)           a_Params; \
     BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_Name,_pe16)         a_Params; \
@@ -2594,4 +2648,27 @@
     BS3_DECL_FAR(a_RetType)  RT_CONCAT(a_Name,_lm16_far)     a_Params
 
+/** @def BS3_MODE_PROTO_STUB
+ * Macro for prototyping all the variations of a mod function with automatic
+ * near -> far stub.
+ *
+ * @param   a_RetType   The return type.
+ * @param   a_Name      The function basename.
+ * @param   a_Params    The parameter list (in parentheses).
+ * @sa      BS3_MODE_PROTO_STUB, BS3_MODE_PROTO_NOSB
+ */
+#define BS3_MODE_PROTO_STUB(a_RetType, a_Name, a_Params) BS3_MODE_PROTO_INT(a_RetType, a_Name, a_Params)
+
+/** @def BS3_MODE_PROTO_STUB
+ * Macro for prototyping all the variations of a mod function without any
+ * near -> far stub.
+ *
+ * @param   a_RetType   The return type.
+ * @param   a_Name      The function basename.
+ * @param   a_Params    The parameter list (in parentheses).
+ * @sa      BS3_MODE_PROTO_STUB, BS3_MODE_PROTO_NOSB
+ */
+#define BS3_MODE_PROTO_NOSB(a_RetType, a_Name, a_Params) BS3_MODE_PROTO_INT(a_RetType, a_Name, a_Params)
+
+
 /**
  * Macro for reducing typing.
@@ -2641,5 +2718,5 @@
  *          capabilities.
  */
-BS3_MODE_PROTO(uint8_t, Bs3CpuDetect,(void), false);
+BS3_MODE_PROTO_NOSB(uint8_t, Bs3CpuDetect,(void));
 
 /** @name BS3CPU_XXX - CPU detected by BS3CpuDetect_c16() and friends.
@@ -2677,5 +2754,5 @@
  * Calls the appropriate Bs3Trap16Init, Bs3Trap32Init or Bs3Trap64Init function.
  */
-BS3_MODE_PROTO(void, Bs3TrapInit,(void), true);
+BS3_MODE_PROTO_STUB(void, Bs3TrapInit,(void));
 
 /**
@@ -2685,5 +2762,5 @@
  * @param   cEntries        The number of sub-test entries.
  */
-BS3_MODE_PROTO(void, Bs3TestDoModes,(PCBS3TESTMODEENTRY paEntries, size_t cEntries), true);
+BS3_MODE_PROTO_NOSB(void, Bs3TestDoModes,(PCBS3TESTMODEENTRY paEntries, size_t cEntries));
 
 
