summaryrefslogtreecommitdiff
path: root/src/VBox/ValidationKit
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-04-18 09:11:04 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-04-18 09:11:04 +0000
commit703b1dd779372d3ca801536994f2077355455def (patch)
treebc1a9dcd05c1b0ff5caa7cd827375c519223de56 /src/VBox/ValidationKit
parent349d55edded21f8b8ba2e0d5a66e6da5404cedcb (diff)
downloadVirtualBox-svn-703b1dd779372d3ca801536994f2077355455def.tar.gz
bs3kit: Far updates.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@60527 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/ValidationKit')
-rw-r--r--src/VBox/ValidationKit/bootsectors/Config.kmk51
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk51
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp315
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac10
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-CreateHybridFarRet.asm53
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm16
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm18
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm12
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm12
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm20
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c20
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm12
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrColonSpaces.asm77
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm28
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrSpacesColonSpace.c16
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c8
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm24
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm30
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c5
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c2
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c8
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm6
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm7
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm7
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm7
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm7
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm10
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c5
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c13
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c8
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm14
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm12
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c13
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c13
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c18
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c5
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c9
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c42
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c106
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86SetGate.c40
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm19
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c3
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h40
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac36
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm4
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c5
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c7
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h110
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h109
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h39
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-data.h253
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h16
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h879
-rw-r--r--src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac316
106 files changed, 2027 insertions, 1110 deletions
diff --git a/src/VBox/ValidationKit/bootsectors/Config.kmk b/src/VBox/ValidationKit/bootsectors/Config.kmk
index 5b054f7c3b8..49f58f94ff9 100644
--- a/src/VBox/ValidationKit/bootsectors/Config.kmk
+++ b/src/VBox/ValidationKit/bootsectors/Config.kmk
@@ -70,6 +70,35 @@ BS3KIT_CLASS_BSS16 = ???
endif
+##
+# Macro for generating near-call aliases for zero or more 16-bit C functions.
+# @param 1 The target name.
+# @param 2 List of functions.
+BS3KIT_FN_GEN_NEARSTUBS = $(foreach fn,$2,$(evalcall2 def_Bs3KitGenNearStubSource,$1,$(fn)))
+define def_Bs3KitGenNearStubSource
+$1_SOURCES += $$($1_0_OUTDIR)/near-call-to-$2_f16.asm
+$1_CLEAN += $$($1_0_OUTDIR)/near-call-to-$2_f16.asm
+$$$$($1_0_OUTDIR)/near-call-to-$2_f16.asm: | $$$$(dir $$$$@)
+ $(QUIET)$(APPEND) -tn $$@ \
+ '%include "bs3kit.mac"' \
+ 'BS3_BEGIN_TEXT16' \
+ ' extern _$2_f16' \
+ 'BS3_BEGIN_TEXT16_NEARSTUBS' \
+ 'GROUP CGROUP16 BS3TEXT16 BS3TEXT16_NEARSTUBS' \
+ 'BS3_GLOBAL_NAME_EX _$2_c16, function, 6' \
+ ' pop ax' \
+ ' push cs' \
+ ' push ax' \
+ ' jmp _$2_f16 wrt CGROUP16'
+endef
+
+
+#
+# Tools Tools Tools
+# Tools Tools Tools
+# Tools Tools Tools
+#
+
# Dummy CP "linker" tool.
TOOL_VBoxBsCpLd = Dummy copy linker.
TOOL_VBoxBsCpLd_LINK_MISCBIN_OUTPUT =
@@ -529,6 +558,8 @@ TEMPLATE_VBoxBS3KitImg_LDFLAGS = system dos \
segment BS3FLAT segaddr=0x0000 \
clname $(BS3KIT_CLASS_CODE16) segaddr=0x1000 \
segment BS3TEXT16 \
+ segment BS3TEXT16_NEARSTUBS \
+ segment BS3TEXT16_FARSTUBS \
segment BS3TEXT16_END \
clname BS3SYSTEM16 segaddr=0x2000 \
segment BS3SYSTEM16 \
@@ -570,10 +601,18 @@ $(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
segment BS3DATA64CONST \
segment BS3DATA64_BSS \
segment BS3DATA64_END \
+ clname BS3CLASS16RMCODE \
+ segment BS3RMCODE16_START \
+ segment BS3RMCODE16 \
+ segment BS3RMCODE16_END \
clname BS3CLASS32CODE \
+ segment BS3TEXT32_START \
segment BS3TEXT32 \
+ segment BS3TEXT32_END \
clname BS3CLASS64CODE \
- segment BS3TEXT64
+ segment BS3TEXT64_START \
+ segment BS3TEXT64 \
+ segment BS3TEXT64_END
TEMPLATE_VBoxBS3KitImg_LNK_DEPS = \
$(bs3-bootsector_1_TARGET) \
@@ -704,6 +743,8 @@ TEMPLATE_VBoxBS3KitUtil_LDFLAGS = system dos \
segment BEGTEXT \
segment BS3TEXT16 \
segment _TEXT \
+ segment BS3TEXT16_NEARSTUBS \
+ segment BS3TEXT16_FARSTUBS \
segment BS3TEXT16_END \
clname BS3SYSTEM16 \
segment BS3SYSTEM16 \
@@ -763,10 +804,16 @@ $(if-expr "$(BS3KIT_SEGNM_DATA16)" != "", \
segment BS3DATA64CONST \
segment BS3DATA64_BSS \
segment BS3DATA64_END \
+ clname BS3CLASS16RMCODE \
+ segment BS3RMCODE16_START \
+ segment BS3RMCODE16 \
+ segment BS3RMCODE16_END \
clname BS3CLASS32CODE \
segment BS3TEXT32 \
+ segment BS3TEXT32_END \
clname BS3CLASS64CODE \
- segment BS3TEXT64
+ segment BS3TEXT64 \
+ segment BS3TEXT64_END
# clname BS3FLAT segaddr=0x0000 \
# segment BS3FLAT segaddr=0x0000
diff --git a/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c b/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c
index deb0ac4b838..1cd0162a67b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c
@@ -48,10 +48,10 @@ BS3TESTMODE_PROTOTYPES_MODE(bs3CpuBasic2_sidt);
static const BS3TESTMODEENTRY g_aModeTest[] =
{
//BS3TESTMODEENTRY_MODE("tss / gate / esp", bs3CpuBasic2_TssGateEsp),
- //BS3TESTMODEENTRY_MODE("raise xcpt #1", bs3CpuBasic2_RaiseXcpt1),
+ BS3TESTMODEENTRY_MODE("raise xcpt #1", bs3CpuBasic2_RaiseXcpt1),
//BS3TESTMODEENTRY_CMN("iret", bs3CpuBasic2_iret),
- //BS3TESTMODEENTRY_MODE("iret", bs3CpuBasic2_iret),
- BS3TESTMODEENTRY_MODE("sidt", bs3CpuBasic2_sidt),
+// BS3TESTMODEENTRY_MODE("iret", bs3CpuBasic2_iret),
+// BS3TESTMODEENTRY_MODE("sidt", bs3CpuBasic2_sidt),
};
diff --git a/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c b/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
index 53cf67099dc..39df85b4971 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
@@ -350,7 +350,7 @@ static void bs3CpuBasic2_RaiseXcpt1Common(bool const g_f16BitSys,
bool const f486Plus = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80486;
# if TMPL_BITS == 16
bool const f386Plus = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386;
- bool const f286 = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80286;
+ bool const f286 = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) == BS3CPU_80286;
# else
bool const f286 = false;
bool const f386Plus = true;
@@ -1570,6 +1570,10 @@ BS3_DECL(uint8_t) TMPL_NM(bs3CpuBasic2_iret)(uint8_t bMode)
g_bTestMode = bMode;
g_f16BitSys = BS3_MODE_IS_16BIT_SYS(TMPL_MODE);
+ Bs3PrintStrN(RT_STR_TUPLE("Hello world!\n"));
+#if !BS3_MODE_IS_V86(TMPL_MODE)
+ Bs3TestPrintf(RT_STR_TUPLE("Hi there!\n"));
+#endif
return BS3TESTDOMODE_SKIPPED;
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk b/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
index 722af94c127..6171cbd548b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
@@ -65,8 +65,6 @@ VBOX_BS3KIT_COMMON_SOURCES = \
bs3-cmn-PrintX32.asm \
bs3-cmn-PrintStr.c \
bs3-cmn-PrintStrN.asm \
- bs3-cmn-PrintStrColonSpaces.asm \
- bs3-cmn-PrintStrSpacesColonSpace.c \
bs3-cmn-StrFormatV.c \
bs3-cmn-StrPrintf.c \
bs3-cmn-StrLen.c \
@@ -123,6 +121,8 @@ VBOX_BS3KIT_COMMON_SOURCES = \
bs3-cmn-TestIsVmmDevTestingPresent.asm \
bs3-cmn-TestCheckRegCtxEx.c \
bs3-cmn-TestPrintf.c \
+ bs3-cmn-TrapRmV86Init.c \
+ bs3-cmn-TrapRmV86SetGate.c \
bs3-cmn-Trap16Init.c \
bs3-cmn-Trap16SetGate.c \
bs3-cmn-Trap32Init.c \
@@ -150,6 +150,21 @@ VBOX_BS3KIT_COMMON_SOURCES = \
../../../Runtime/common/asm/ASMSerializeInstruction-iret.asm \
../../../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
bs3kit-common-16_TEMPLATE = VBoxBS3KitImg
@@ -175,8 +190,26 @@ bs3kit-common-16_SOURCES = $(VBOX_BS3KIT_COMMON_SOURCES) \
bs3-wc16-U8LS.asm \
bs3-wc16-U4D.asm \
bs3-wc16-I4D.asm \
- bs3-c16-Trap16Generic.asm
+ bs3-c16-Trap16Generic.asm \
+ 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_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
+$(call BS3KIT_FN_GEN_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_FUNCTIONS))
# The 32-bit BS3Kit library.
LIBRARIES += bs3kit-common-32
@@ -430,6 +463,16 @@ bs3cpudt_SOURCES = \
bs3cpudt.c
+#
+# Rule for regenerating bs3kit-mangling-functions-undef.h.
+#
+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./' \
+ --output $(dir $<)bs3kit-mangling-code-undef.h \
+ $<
+
+
include $(FILE_KBUILD_SUB_FOOTER)
-.PRECIOUS: $(PATH_OBJ)/bs3-shutdown/bs3-shutdown.map
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp b/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
index 28e8daadd33..ea3056a7313 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
@@ -56,6 +56,14 @@
# define ELF_FMT_D64 "lld"
#endif
+/** Compares an OMF string with a constant string. */
+#define IS_OMF_STR_EQUAL_EX(a_cch1, a_pch1, a_szConst2) \
+ ( (a_cch1) == sizeof(a_szConst2) - 1 && memcmp(a_pch1, a_szConst2, sizeof(a_szConst2) - 1) == 0 )
+
+/** Compares an OMF string with a constant string. */
+#define IS_OMF_STR_EQUAL(a_pchZeroPrefixed, a_szConst2) \
+ IS_OMF_STR_EQUAL_EX((uint8_t)((a_pchZeroPrefixed)[0]), &((a_pchZeroPrefixed)[1]), a_szConst2)
+
/*********************************************************************************************************************************
* Global Variables *
@@ -3593,6 +3601,39 @@ static const char * const g_apszExtDefRenames[] =
};
/**
+ * Segment definition.
+ */
+typedef struct OMFSEGDEF
+{
+ uint32_t cbSeg;
+ uint8_t bSegAttr;
+ uint16_t idxName;
+ uint16_t idxClass;
+ uint16_t idxOverlay;
+ uint8_t cchName;
+ uint8_t cchClass;
+ uint8_t cchOverlay;
+ const char *pchName;
+ const char *pchClass;
+ const char *pchOverlay;
+ bool fUse32;
+} OMFSEGDEF;
+typedef OMFSEGDEF *POMFSEGDEF;
+
+/**
+ * Group definition.
+ */
+typedef struct OMFGRPDEF
+{
+ const char *pchName;
+ uint16_t idxName;
+ uint8_t cchName;
+ uint16_t cSegDefs;
+ uint16_t *pidxSegDefs;
+} OMFGRPDEF;
+typedef OMFGRPDEF *POMFGRPDEF;
+
+/**
* Records line number information for a file in a segment (for CV8 debug info).
*/
typedef struct OMFFILELINES
@@ -3619,6 +3660,9 @@ typedef struct OMFSEGLINES
uint32_t cb;
/** The segment index. */
uint16_t idxSeg;
+ /** The group index for this segment. This is zero if not yet determined and
+ * UINT16_MAX if no group applicable to this segment. */
+ uint16_t idxGrp;
/** File table. */
POMFFILEINES paFiles;
} OMFSEGLINES;
@@ -3637,14 +3681,32 @@ typedef struct OMFDETAILS
bool fProbably32bit;
/** Set if this module may need mangling. */
bool fMayNeedMangling;
- /** Number of SEGDEFs records. */
- uint32_t cSegDefs;
+ /** Set if this module needs CGROUP16 for line number fixupes. */
+ bool fNeedsCGroup16;
/** The LNAME index of '$$SYMBOLS' or UINT16_MAX it not found. */
uint16_t iSymbolsNm;
/** The LNAME index of 'DEBSYM' or UINT16_MAX it not found. */
uint16_t iDebSymNm;
/** The '$$SYMBOLS' segment index. */
uint16_t iSymbolsSeg;
+ /** The LNAME index of 'CGROUP16' or UINT16_MAX it not found. */
+ uint16_t iCGroup16Nm;
+ /** The 'CGROUP16' group definition index or UINT16_MAX it not found. */
+ uint16_t iCGroup16Grp;
+
+ /** Number of SEGDEFs records. */
+ uint16_t cSegDefs;
+ /** Number of GRPDEFs records. */
+ uint16_t cGrpDefs;
+ /** Number of listed names. */
+ uint16_t cLNames;
+
+ /** Segment defintions. */
+ POMFSEGDEF paSegDefs;
+ /** Group defintions. */
+ POMFGRPDEF paGrpDefs;
+ /** Name list. Points to the size repfix. */
+ char **papchLNames;
/** CV8: Filename string table size. */
uint32_t cbStrTab;
@@ -3666,6 +3728,37 @@ typedef struct OMFDETAILS
typedef OMFDETAILS *POMFDETAILS;
typedef OMFDETAILS const *PCOMFDETAILS;
+/** Grows a table to a given size (a_cNewEntries). */
+#define OMF_GROW_TABLE_EX_RET_ERR(a_EntryType, a_paTable, a_cEntries, a_cNewEntries) \
+ do\
+ { \
+ size_t cbOld = (a_cEntries) * sizeof(a_EntryType); \
+ size_t cbNew = (a_cNewEntries) * sizeof(a_EntryType); \
+ void *pvNew = realloc(a_paTable, cbNew); \
+ if (pvNew) \
+ { \
+ memset((uint8_t *)pvNew + cbOld, 0, cbNew - cbOld); \
+ (a_paTable) = (a_EntryType *)pvNew; \
+ } \
+ else return error("???", "Out of memory!\n"); \
+ } while (0)
+
+/** Grows a table. */
+#define OMF_GROW_TABLE_RET_ERR(a_EntryType, a_paTable, a_cEntries, a_cEvery) \
+ if ((a_cEntries) % (a_cEvery) != 0) { /* likely */ } \
+ else do\
+ { \
+ size_t cbOld = (a_cEntries) * sizeof(a_EntryType); \
+ size_t cbNew = cbOld + (a_cEvery) * sizeof(a_EntryType); \
+ void *pvNew = realloc(a_paTable, cbNew); \
+ if (pvNew) \
+ { \
+ memset((uint8_t *)pvNew + cbOld, 0, (a_cEvery) * sizeof(a_EntryType)); \
+ (a_paTable) = (a_EntryType *)pvNew; \
+ } \
+ else return error("???", "Out of memory!\n"); \
+ } while (0)
+
/**
* Adds a line number to the CV8 debug info.
@@ -3755,16 +3848,11 @@ static bool collectOmfAddLine(POMFDETAILS pOmfStuff, uint16_t idxSeg, uint32_t o
*/
if (idxSeg >= pOmfStuff->cSegLines)
{
- void *pvNew = realloc(pOmfStuff->paSegLines, (idxSeg + 1) * sizeof(pOmfStuff->paSegLines[0]));
- if (!pvNew)
- return error("???", "out of memory");
- pOmfStuff->paSegLines = (POMFSEGLINES)pvNew;
-
- memset(&pOmfStuff->paSegLines[pOmfStuff->cSegLines], 0,
- (idxSeg + 1 - pOmfStuff->cSegLines) * sizeof(pOmfStuff->paSegLines[0]));
+ OMF_GROW_TABLE_EX_RET_ERR(OMFSEGLINES, pOmfStuff->paSegLines, pOmfStuff->cSegLines, idxSeg + 1);
for (uint32_t i = pOmfStuff->cSegLines; i <= idxSeg; i++)
{
pOmfStuff->paSegLines[i].idxSeg = i;
+ pOmfStuff->paSegLines[i].idxGrp = UINT16_MAX;
pOmfStuff->paSegLines[i].cb = sizeof(RTCV8LINESHDR);
}
pOmfStuff->cSegLines = idxSeg + 1;
@@ -3785,14 +3873,7 @@ static bool collectOmfAddLine(POMFDETAILS pOmfStuff, uint16_t idxSeg, uint32_t o
if (!pFileLines)
{
i = pSegLines->cFiles;
- if ((i % 4) == 0)
- {
- void *pvNew = realloc(pSegLines->paFiles, (i + 4) * sizeof(pSegLines->paFiles[0]));
- if (!pvNew)
- return error("???", "out of memory");
- pSegLines->paFiles = (POMFFILEINES)pvNew;
- }
-
+ OMF_GROW_TABLE_RET_ERR(OMFFILEINES, pSegLines->paFiles, pSegLines->cFiles, 4);
pSegLines->cFiles = i + 1;
pSegLines->cb += sizeof(RTCV8LINESSRCMAP);
@@ -3801,6 +3882,22 @@ static bool collectOmfAddLine(POMFDETAILS pOmfStuff, uint16_t idxSeg, uint32_t o
pFileLines->cPairs = 0;
pFileLines->cPairsAlloc = 0;
pFileLines->paPairs = NULL;
+
+ /*
+ * Check for segment group requirements the first time a segment is used.
+ */
+ if (i == 0)
+ {
+ if (idxSeg >= pOmfStuff->cSegDefs)
+ return error("???", "collectOmfAddLine: idxSeg=%#x is out of bounds (%#x)!\n", idxSeg, pOmfStuff->cSegDefs);
+ POMFSEGDEF pSegDef = &pOmfStuff->paSegDefs[idxSeg];
+ if ( IS_OMF_STR_EQUAL_EX(pSegDef->cchClass, pSegDef->pchClass, "BS3CLASS16CODE")
+ || IS_OMF_STR_EQUAL_EX(pSegDef->cchClass, pSegDef->pchClass, "CODE"))
+ {
+ pOmfStuff->fNeedsCGroup16 = true;
+ pSegLines->idxGrp = 0; /* We'll replace zeros by the actual CGROUP16 index later. */
+ }
+ }
}
/*
@@ -3851,7 +3948,6 @@ static bool collectOmfAddLine(POMFDETAILS pOmfStuff, uint16_t idxSeg, uint32_t o
*/
static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t cbFile, POMFDETAILS pOmfStuff)
{
- uint32_t cLNames = 0;
uint32_t cExtDefs = 0;
uint32_t cPubDefs = 0;
uint32_t off = 0;
@@ -3860,10 +3956,26 @@ static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t
uint32_t offSrcInfo = UINT32_MAX;
memset(pOmfStuff, 0, sizeof(*pOmfStuff));
- pOmfStuff->iDebSymNm = UINT16_MAX;
- pOmfStuff->iSymbolsNm = UINT16_MAX;
- pOmfStuff->iSymbolsSeg = UINT16_MAX;
+ pOmfStuff->iDebSymNm = UINT16_MAX;
+ pOmfStuff->iSymbolsNm = UINT16_MAX;
+ pOmfStuff->iSymbolsSeg = UINT16_MAX;
+ pOmfStuff->iCGroup16Nm = UINT16_MAX;
+ pOmfStuff->iCGroup16Grp = UINT16_MAX;
+
+ /* Dummy entries. */
+ OMF_GROW_TABLE_RET_ERR(char *, pOmfStuff->papchLNames, pOmfStuff->cLNames, 16);
+ pOmfStuff->papchLNames[0] = (char *)"";
+ pOmfStuff->cLNames = 1;
+
+ OMF_GROW_TABLE_RET_ERR(OMFSEGDEF, pOmfStuff->paSegDefs, pOmfStuff->cSegDefs, 16);
+ pOmfStuff->cSegDefs = 1;
+
+ OMF_GROW_TABLE_RET_ERR(OMFGRPDEF, pOmfStuff->paGrpDefs, pOmfStuff->cGrpDefs, 16);
+ pOmfStuff->cGrpDefs = 1;
+ /*
+ * Process the OMF records.
+ */
while (off + 3 < cbFile)
{
uint8_t bRecType = pbFile[off];
@@ -3887,6 +3999,28 @@ static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t
a_idx = (((a_idx) & 0x7f) << 8) | pbRec[offRec++]; \
} while (0)
+#define OMF_READ_U16(a_u16, a_Name) \
+ do { \
+ OMF_CHECK_RET(4, a_Name); \
+ a_u16 = RT_MAKE_U16(pbRec[offRec], pbRec[offRec + 1]); \
+ offRec += 2; \
+ } while (0)
+#define OMF_READ_U32(a_u32, a_Name) \
+ do { \
+ OMF_CHECK_RET(4, a_Name); \
+ a_u32 = RT_MAKE_U32_FROM_U8(pbRec[offRec], pbRec[offRec + 1], pbRec[offRec + 2], pbRec[offRec + 3]); \
+ offRec += 4; \
+ } while (0)
+#define OMF_EXPLODE_LNAME(a_idxName, a_pchName, a_cchName, a_Name) \
+ do { \
+ if ((a_idxName) < pOmfStuff->cLNames) \
+ { \
+ a_cchName = (uint8_t)*pOmfStuff->papchLNames[(a_idxName)]; \
+ a_pchName = pOmfStuff->papchLNames[(a_idxName)] + 1; \
+ } \
+ else return error(pszFile, "Invalid LNAME reference %#x in " #a_Name "!\n", a_idxName); \
+ } while (0)
+
switch (bRecType)
{
/*
@@ -3900,28 +4034,29 @@ static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t
return error(pszFile, "Invalid LNAME string length at %#x+3+%#x: %#x (cbFile=%#lx)\n",
off, offRec, cch, (unsigned long)cbFile);
- cLNames++;
if (g_cVerbose > 2)
- printf(" LNAME[%u]: %-*.*s\n", cLNames, cch, cch, &pbRec[offRec + 1]);
+ printf(" LNAME[%u]: %-*.*s\n", pOmfStuff->cLNames, cch, cch, &pbRec[offRec + 1]);
+
+ OMF_GROW_TABLE_RET_ERR(char *, pOmfStuff->papchLNames, pOmfStuff->cLNames, 16);
+ pOmfStuff->papchLNames[pOmfStuff->cLNames] = (char *)&pbRec[offRec];
- if (cch == 4 && memcmp(&pbRec[offRec + 1], "FLAT", 4) == 0)
+ if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "FLAT"))
pOmfStuff->fProbably32bit = true;
- if ( cch == 6
- && pOmfStuff->iDebSymNm == UINT16_MAX
- && memcmp(&pbRec[offRec + 1], "DEBSYM", 6) == 0)
- pOmfStuff->iDebSymNm = cLNames;
- if ( cch == 9
- && pOmfStuff->iSymbolsNm == UINT16_MAX
- && memcmp(&pbRec[offRec + 1], "$$SYMBOLS", 9) == 0)
- pOmfStuff->iSymbolsNm = cLNames;
+ if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "DEBSYM"))
+ pOmfStuff->iDebSymNm = pOmfStuff->cLNames;
+ if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "$$SYMBOLS"))
+ pOmfStuff->iSymbolsNm = pOmfStuff->cLNames;
+ if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "CGROUP16"))
+ pOmfStuff->iCGroup16Nm = pOmfStuff->cLNames;
+ pOmfStuff->cLNames++;
offRec += cch + 1;
}
break;
/*
- * Display external defitions if -v is specified, also check if anything needs mangling.
+ * Display external definitions if -v is specified, also check if anything needs mangling.
*/
case OMF_EXTDEF:
while (offRec + 1 < cbRec)
@@ -4023,12 +4158,63 @@ static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t
break;
/*
- * Must count segment defitions to figure the index of our segment.
+ * Must count segment definitions to figure the index of our segment.
*/
case OMF_SEGDEF16:
case OMF_SEGDEF32:
- pOmfStuff->cSegDefs++;
+ {
+ OMF_GROW_TABLE_RET_ERR(OMFSEGDEF, pOmfStuff->paSegDefs, pOmfStuff->cSegDefs, 16);
+ POMFSEGDEF pSegDef = &pOmfStuff->paSegDefs[pOmfStuff->cSegDefs++];
+
+ OMF_CHECK_RET(1 + (bRecType == OMF_SEGDEF16 ? 2 : 4) + 1 + 1 + 1, SEGDEF);
+ pSegDef->bSegAttr = pbRec[offRec++];
+ pSegDef->fUse32 = pSegDef->bSegAttr & 1;
+ if ((pSegDef->bSegAttr >> 5) == 0)
+ {
+ /* A=0: skip frame number of offset. */
+ OMF_CHECK_RET(3, SEGDEF);
+ offRec += 3;
+ }
+ if (bRecType == OMF_SEGDEF16)
+ OMF_READ_U16(pSegDef->cbSeg, SEGDEF16);
+ else
+ OMF_READ_U32(pSegDef->cbSeg, SEGDEF32);
+ OMF_READ_IDX(pSegDef->idxName, SEGDEF);
+ OMF_READ_IDX(pSegDef->idxClass, SEGDEF);
+ OMF_READ_IDX(pSegDef->idxOverlay, SEGDEF);
+ OMF_EXPLODE_LNAME(pSegDef->idxName, pSegDef->pchName, pSegDef->cchName, SEGDEF);
+ OMF_EXPLODE_LNAME(pSegDef->idxClass, pSegDef->pchClass, pSegDef->cchClass, SEGDEF);
+ OMF_EXPLODE_LNAME(pSegDef->idxOverlay, pSegDef->pchOverlay, pSegDef->cchOverlay, SEGDEF);
+ break;
+ }
+
+ /*
+ * Must count segment definitions to figure the index of our segment.
+ */
+ case OMF_GRPDEF:
+ {
+ OMF_GROW_TABLE_RET_ERR(OMFGRPDEF, pOmfStuff->paGrpDefs, pOmfStuff->cGrpDefs, 8);
+ POMFGRPDEF pGrpDef = &pOmfStuff->paGrpDefs[pOmfStuff->cGrpDefs];
+
+ OMF_READ_IDX(pGrpDef->idxName, GRPDEF);
+ OMF_EXPLODE_LNAME(pGrpDef->idxName, pGrpDef->pchName, pGrpDef->cchName, GRPDEF);
+ if (pGrpDef->idxName == pOmfStuff->iCGroup16Grp)
+ pOmfStuff->iCGroup16Grp = pOmfStuff->cGrpDefs;
+
+ pGrpDef->cSegDefs = 0;
+ pGrpDef->pidxSegDefs = NULL;
+ while (offRec + 2 + 1 < cbRec)
+ {
+ if (pbRec[offRec] != 0xff)
+ return error(pszFile, "Unsupported GRPDEF member type: %#x\n", pbRec[offRec]);
+ offRec++;
+ OMF_GROW_TABLE_RET_ERR(uint16_t, pGrpDef->pidxSegDefs, pGrpDef->cSegDefs, 16);
+ OMF_READ_IDX(pGrpDef->pidxSegDefs[pGrpDef->cSegDefs], GRPDEF);
+ pGrpDef->cSegDefs++;
+ }
+ pOmfStuff->cGrpDefs++;
break;
+ }
/*
* Gather file names.
@@ -4148,9 +4334,9 @@ static bool convertOmfWriteDebugSegDefs(POMFWRITER pThis, POMFDETAILS pOmfStuff)
#endif
/*
- * Emit the segment defitions.
+ * Emit the segment definitions.
*/
- pOmfStuff->iSymbolsSeg = ++pOmfStuff->cSegDefs;
+ pOmfStuff->iSymbolsSeg = pOmfStuff->cSegDefs++;
uint8_t bSegAttr = 0;
bSegAttr |= 5 << 5; /* A: dword alignment */
@@ -4171,6 +4357,40 @@ static bool convertOmfWriteDebugSegDefs(POMFWRITER pThis, POMFDETAILS pOmfStuff)
/**
+ * Writes additional segment group definitions.
+ *
+ * @returns success indicator.
+ * @param pThis The OMF writer.
+ * @param pOmfStuff The OMF stuff with CV8 line number info.
+ */
+static bool convertOmfWriteDebugGrpDefs(POMFWRITER pThis, POMFDETAILS pOmfStuff)
+{
+ if ( pOmfStuff->cSegLines == 0
+ || !pOmfStuff->fNeedsCGroup16)
+ return true;
+
+ if (pOmfStuff->iCGroup16Grp == UINT16_MAX)
+ {
+ if (pOmfStuff->iCGroup16Nm == UINT16_MAX)
+ if ( !omfWriter_LNamesBegin(pThis, true)
+ || !omfWriter_LNamesAdd(pThis, "CGROUP16", &pOmfStuff->iCGroup16Nm)
+ || !omfWriter_LNamesEnd(pThis))
+ return false;
+
+ if ( !omfWriter_GrpDefBegin(pThis, pOmfStuff->iCGroup16Nm)
+ || !omfWriter_GrpDefEnd(pThis))
+ return false;
+ pOmfStuff->iCGroup16Grp = pOmfStuff->cGrpDefs;
+ }
+
+ for (unsigned i = 0; i < pOmfStuff->cSegLines; i++)
+ if (pOmfStuff->paSegLines[i].idxGrp == 0)
+ pOmfStuff->paSegLines[i].idxGrp = pOmfStuff->iCGroup16Grp;
+ return true;
+}
+
+
+/**
* Writes the debug segment data.
*
* @returns success indicator.
@@ -4236,17 +4456,26 @@ static bool convertOmfWriteDebugData(POMFWRITER pThis, POMFDETAILS pOmfStuff)
|| !omfWriter_LEDataAddU32(pThis, cbSectionCovered) /*RTCV8LINESHDR::cbSectionCovered*/ )
return false;
+ /* Default to the segment (BS3TEXT32, BS3TEXT64) or the group (CGROUP16,
+ RMGROUP16, etc). The important thing is that we're framing the fixups
+ using a segment or group which ends up in the codeview segment map. */
+ uint16_t idxFrame = pSegLines->idxSeg;
+ uint8_t bFrame = OMF_FIX_F_SEGDEF;
+ if (pSegLines->idxGrp != UINT16_MAX)
+ {
+ idxFrame = pSegLines->idxGrp;
+ bFrame = OMF_FIX_F_GRPDEF;
+ }
+
/* Fixup #1: segment offset - IMAGE_REL_AMD64_SECREL. */
if (!omfWriter_LEDataAddFixupNoDisp(pThis, 4 + 4 + RT_OFFSETOF(RTCV8LINESHDR, offSection), OMF_FIX_LOC_32BIT_OFFSET,
- OMF_FIX_F_SEGDEF, pSegLines->idxSeg,
- OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
+ bFrame, idxFrame, OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
return false;
/* Fixup #2: segment number - IMAGE_REL_AMD64_SECTION. */
if (!omfWriter_LEDataAddFixupNoDisp(pThis, 4 + 4 + RT_OFFSETOF(RTCV8LINESHDR, iSection), OMF_FIX_LOC_16BIT_SEGMENT,
- OMF_FIX_F_SEGDEF, pSegLines->idxSeg,
- OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
+ bFrame, idxFrame, OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
return false;
/* Emit data for each source file. */
@@ -4386,7 +4615,8 @@ static bool convertOmfPassthru(POMFWRITER pThis, uint8_t const *pbFile, size_t c
{
fSkip = pbRec[1] == OMF_CCLS_BORLAND_SRC_FILE;
if (pbRec[1] == OMF_CCLS_LINK_PASS_SEP)
- if (!convertOmfWriteDebugSegDefs(pThis, pOmfStuff))
+ if ( !convertOmfWriteDebugSegDefs(pThis, pOmfStuff)
+ || !convertOmfWriteDebugGrpDefs(pThis, pOmfStuff))
return false;
}
break;
@@ -4419,6 +4649,7 @@ static bool convertOmfPassthru(POMFWRITER pThis, uint8_t const *pbFile, size_t c
if (fConvertLineNumbers)
{
if ( convertOmfWriteDebugSegDefs(pThis, pOmfStuff)
+ && convertOmfWriteDebugGrpDefs(pThis, pOmfStuff)
&& convertOmfWriteDebugData(pThis, pOmfStuff))
{ /* likely */ }
else return false;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac b/src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac
index 1e55f2ee203..344dc7649c4 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac
@@ -33,12 +33,20 @@
%include "bs3kit-template-header.mac"
+;
; Redefine some macros to suite us.
+;
+; We do near 16-bit code and produce far stubs separately as needed.
+;
%define BEGINCODE TMPL_BEGIN_TEXT
-%define BEGINPROC_EXPORTED BS3_PROC_BEGIN_CMN
+%define BEGINPROC_EXPORTED BS3_BEGINPROC_EXPORTED_WRAPPER
%define ENDPROC BS3_PROC_END_CMN
%undef NAME
%define NAME(a) BS3_CMN_NM(a)
+%macro BS3_BEGINPROC_EXPORTED_WRAPPER 1
+BS3_PROC_BEGIN_CMN %1, BS3_PBC_NEAR
+%endmacro
+
%endif
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-CreateHybridFarRet.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-CreateHybridFarRet.asm
new file mode 100644
index 00000000000..35f1e193b88
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-CreateHybridFarRet.asm
@@ -0,0 +1,53 @@
+; $Id$
+;; @file
+; BS3Kit - Bs3A20Disable.
+;
+
+;
+; Copyright (C) 2007-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bs3kit.mac"
+
+
+;;
+; Worker for BS3_PROC_BEGIN_CMN
+; @uses nothing
+BS3_PROC_BEGIN Bs3CreateHybridFarRet_c16
+ push ax ; reserve space
+ push bp
+ mov bp, sp
+ push ax ; save it
+
+ ; Move the return address up a word.
+ mov ax, [bp + 4]
+ mov [bp + 2], ax
+ ; Move the caller's return address up a word.
+ mov ax, [bp + 6]
+ mov [bp + 4], ax
+ ; Add CS to the caller's far return address.
+ mov [bp + 6], cs
+
+ pop ax
+ pop bp
+ ret
+BS3_PROC_END Bs3CreateHybridFarRet_c16
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm
index fccb406fc7e..1f5ae0ea1f6 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm
@@ -4,7 +4,7 @@
;
;
-; Copyright (C) 2007-2015 Oracle Corporation
+; 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;
@@ -37,13 +37,13 @@ BS3_EXTERN_CMN Bs3KbdWrite
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20Disable
+BS3_PROC_BEGIN_CMN Bs3A20Disable, BS3_PBC_HYBRID_0_ARGS
; Must call both because they may be ORed together on real HW.
BS3_ONLY_64BIT_STMT sub rsp, 20h
call BS3_CMN_NM(Bs3A20DisableViaKbd)
call BS3_CMN_NM(Bs3A20DisableViaPortA)
BS3_ONLY_64BIT_STMT add rsp, 20h
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20Disable
@@ -52,7 +52,7 @@ BS3_PROC_END_CMN Bs3A20Disable
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20DisableViaPortA
+BS3_PROC_BEGIN_CMN Bs3A20DisableViaPortA, BS3_PBC_HYBRID_0_ARGS
push xAX
; Use Control port A, assuming a PS/2 style system.
@@ -64,7 +64,7 @@ BS3_PROC_BEGIN_CMN Bs3A20DisableViaPortA
.done:
pop xAX
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20DisableViaPortA
@@ -73,7 +73,7 @@ BS3_PROC_END_CMN Bs3A20DisableViaPortA
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20DisableViaKbd
+BS3_PROC_BEGIN_CMN Bs3A20DisableViaKbd, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
push xAX
@@ -99,7 +99,7 @@ BS3_PROC_BEGIN_CMN Bs3A20DisableViaKbd
BS3_ONLY_64BIT_STMT add rsp, 20h
popf
pop xAX
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20DisableViaKbd
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm
index e7d951b4fd1..90a4522b4c4 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm
@@ -37,7 +37,7 @@ BS3_EXTERN_CMN Bs3KbdWrite
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20Enable
+BS3_PROC_BEGIN_CMN Bs3A20Enable, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
BS3_ONLY_64BIT_STMT sub rsp, 20h
@@ -46,8 +46,8 @@ BS3_PROC_BEGIN_CMN Bs3A20Enable
;; @todo real 286 support
; call TMPL_NM_CMN(Bs3A20EnableViaKbd)
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20Enable
@@ -56,7 +56,7 @@ BS3_PROC_END_CMN Bs3A20Enable
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20EnableViaKbd
+BS3_PROC_BEGIN_CMN Bs3A20EnableViaKbd, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
push xAX
@@ -82,8 +82,8 @@ BS3_PROC_BEGIN_CMN Bs3A20EnableViaKbd
BS3_ONLY_64BIT_STMT add rsp, 20h
popf
pop xAX
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20EnableViaKbd
@@ -92,7 +92,7 @@ BS3_PROC_END_CMN Bs3A20EnableViaKbd
;
; @uses Nothing.
;
-BS3_PROC_BEGIN_CMN Bs3A20EnableViaPortA
+BS3_PROC_BEGIN_CMN Bs3A20EnableViaPortA, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
push xAX
@@ -106,7 +106,7 @@ BS3_PROC_BEGIN_CMN Bs3A20EnableViaPortA
.done:
pop xAX
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3A20EnableViaPortA
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm
index ba0a29394dc..379d77d393f 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm
@@ -42,7 +42,7 @@
;
; @uses cx, ss, esp
;
-BS3_PROC_BEGIN_CMN Bs3ConvertRMStackToP16UsingCxReturnToAx
+BS3_PROC_BEGIN_CMN Bs3ConvertRMStackToP16UsingCxReturnToAx, BS3_PBC_NEAR
;
; Check if it looks like the normal stack, if use BS3_SEL_R0_SS16.
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm
index a6ce6937094..9eec0d3d913 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm
@@ -39,7 +39,7 @@
;
; @cproto BS3_DECL(uint8_t) Bs3KbdRead_c16(uint8_t bCmd);
;
-BS3_PROC_BEGIN_CMN Bs3KbdRead
+BS3_PROC_BEGIN_CMN Bs3KbdRead, BS3_PBC_NEAR
push xBP
mov xBP, xSP
@@ -53,7 +53,13 @@ BS3_PROC_BEGIN_CMN Bs3KbdRead
in al, 60h ; Read the data.
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3KbdRead
+;
+; We may be using the near code in some critical code paths, so don't
+; penalize it.
+;
+BS3_CMN_FAR_STUB Bs3KbdRead, 2
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm
index cb0044b6a71..cb310ccd1dc 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm
@@ -31,7 +31,7 @@
;
; @cproto BS3_DECL(void) Bs3KbdWait_c16(void);
;
-BS3_PROC_BEGIN_CMN Bs3KbdWait
+BS3_PROC_BEGIN_CMN Bs3KbdWait, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
push xAX
@@ -44,8 +44,8 @@ BS3_PROC_BEGIN_CMN Bs3KbdWait
jnz .check_status
pop xAX
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
.read_data_and_status:
in al, 60h
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm
index bb4b7bb3f2b..7539b52c171 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm
@@ -44,7 +44,7 @@ BS3_EXTERN_CMN Bs3KbdWait
;
; @cproto BS3_DECL(void) Bs3KbdWait_c16(uint8_t bCmd, uint8_t bData);
;
-BS3_PROC_BEGIN_CMN Bs3KbdWrite
+BS3_PROC_BEGIN_CMN Bs3KbdWrite, BS3_PBC_NEAR
push xBP
mov xBP, xSP
push xAX
@@ -60,7 +60,13 @@ BS3_PROC_BEGIN_CMN Bs3KbdWrite
BS3_ONLY_64BIT_STMT add rsp, 20h
pop xAX
- leave
- ret
+ pop xBP
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3KbdWrite
+;
+; We may be using the near code in some critical code paths, so don't
+; penalize it.
+;
+BS3_CMN_FAR_STUB Bs3KbdWrite, 4
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c
index 292ff39b72e..a4706c9e9ad 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c
@@ -32,7 +32,8 @@
#include <iprt/asm.h>
-BS3_DECL(void BS3_FAR *) Bs3MemAlloc(BS3MEMKIND enmKind, size_t cb)
+#undef Bs3MemAlloc
+BS3_CMN_DEF(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb))
{
void BS3_FAR *pvRet;
uint8_t idxSlabList = bs3MemSizeToSlabListIndex(cb);
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c
index fbb9d4111d8..c3e9cda45f0 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c
@@ -31,7 +31,8 @@
#include "bs3-cmn-memory.h"
-BS3_DECL(void BS3_FAR *) Bs3MemAllocZ(BS3MEMKIND enmKind, size_t cb)
+#undef Bs3MemAllocZ
+BS3_CMN_DEF(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb))
{
void BS3_FAR *pvRet = Bs3MemAlloc(enmKind, cb);
if (pvRet)
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c
index c6a9a5895b8..106fe8b8760 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3MemCpy
-BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemCpy)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
+BS3_CMN_DEF(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
{
#if 1
const size_t BS3_FAR *pBigSrc = (const size_t BS3_FAR *)pvSrc;
@@ -73,4 +73,3 @@ BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemCpy)(void BS3_FAR *pvDst, const void B
return pvDst;
}
-
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c
index d94bda77fb9..f8a70157514 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c
@@ -31,7 +31,8 @@
#include "bs3-cmn-memory.h"
-BS3_DECL(void) Bs3MemFree(void BS3_FAR *pv, size_t cb)
+#undef Bs3MemFree
+BS3_CMN_DEF(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb))
{
if (pv != NULL)
{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c
index 9aff282e79f..a73c936258b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3MemMove
-BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemMove)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
+BS3_CMN_DEF(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
{
size_t cLargeRounds;
BS3CVPTRUNION uSrc;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c
index b8f2ac7f129..debcd73a271 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3MemPCpy
-BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemPCpy)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
+BS3_CMN_DEF(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
{
size_t cLargeRounds;
BS3CPTRUNION uSrc;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm
index aaac85f5c45..51c978c5533 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm
@@ -29,7 +29,7 @@
;;
; @cproto BS3_DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);
;
-BS3_PROC_BEGIN_CMN Bs3MemZero
+BS3_PROC_BEGIN_CMN Bs3MemZero, BS3_PBC_HYBRID
%ifdef RT_ARCH_AMD64
push rdi
@@ -45,7 +45,7 @@ BS3_PROC_BEGIN_CMN Bs3MemZero
rep stosb
pop rdi
- ret
+ BS3_HYBRID_RET
%elif ARCH_BITS == 16
push bp
@@ -53,22 +53,22 @@ BS3_PROC_BEGIN_CMN Bs3MemZero
push di
push es
- mov di, [bp + 4] ; pvDst.off
- mov dx, [bp + 4 + 2] ; pvDst.sel
+ mov di, [bp + 2 + cbCurRetAddr] ; pvDst.off
+ mov dx, [bp + 2 + cbCurRetAddr + 2] ; pvDst.sel
mov es, dx
- mov cx, [bp + 4 + 4] ; cbDst
- shr cx, 1 ; calc dword count.
+ mov cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst
+ shr cx, 1 ; calc dword count.
xor ax, ax
rep stosw
- mov cx, [bp + 4 + 4] ; cbDst
- and cx, 1 ; calc tailing byte count.
+ mov cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst
+ and cx, 1 ; calc tailing byte count.
rep stosb
pop es
pop di
pop bp
- ret
+ BS3_HYBRID_RET
%elif ARCH_BITS == 32
push edi
@@ -84,7 +84,7 @@ BS3_PROC_BEGIN_CMN Bs3MemZero
rep stosb
pop edi
- ret
+ BS3_HYBRID_RET
%else
%error "Unknown bitness."
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c
index c02e3e942f2..5fd102333c8 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c
@@ -31,7 +31,8 @@
#include "bs3-cmn-paging.h"
-BS3_DECL(int) Bs3PagingInitRootForLM(void)
+#undef Bs3PagingInitRootForLM
+BS3_CMN_DEF(int, Bs3PagingInitRootForLM,(void))
{
X86PML4 BS3_FAR *pPml4;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c
index 13c6c68a466..28d4ed0695b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c
@@ -31,7 +31,8 @@
#include "bs3-cmn-paging.h"
-BS3_DECL(int) Bs3PagingInitRootForPAE(void)
+#undef Bs3PagingInitRootForPAE
+BS3_CMN_DEF(int, Bs3PagingInitRootForPAE,(void))
{
X86PDPT BS3_FAR *pPdPtr;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c
index 3e3a76d0a0f..da4f846d64d 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c
@@ -67,7 +67,8 @@ static int Bs3PagingInitPageTablesForPgDir(X86PD BS3_FAR *pPgDir, unsigned iFirs
}
-BS3_DECL(int) Bs3PagingInitRootForPP(void)
+#undef Bs3PagingInitRootForPP
+BS3_CMN_DEF(int, Bs3PagingInitRootForPP,(void))
{
X86PD BS3_FAR *pPgDir;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c
index 20f6a6fb418..bbeb44a767e 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c
@@ -58,7 +58,8 @@ static void *bs3PagingBuildPaeTable(uint64_t uTmpl, uint64_t cbIncrement, BS3MEM
}
-BS3_DECL(X86PTE BS3_FAR *) bs3PagingGetLegacyPte(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc)
+#undef bs3PagingGetLegacyPte
+BS3_CMN_DEF(X86PTE BS3_FAR *, bs3PagingGetLegacyPte,(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc))
{
X86PTE BS3_FAR *pPTE = NULL;
#if TMPL_BITS == 16
@@ -119,7 +120,8 @@ BS3_DECL(X86PTE BS3_FAR *) bs3PagingGetLegacyPte(RTCCUINTXREG cr3, uint32_t uFla
}
-BS3_DECL(X86PTEPAE BS3_FAR *) bs3PagingGetPte(RTCCUINTXREG cr3, uint64_t uFlat, bool fUseInvlPg, int *prc)
+#undef bs3PagingGetPte
+BS3_CMN_DEF(X86PTEPAE BS3_FAR *, bs3PagingGetPte,(RTCCUINTXREG cr3, uint64_t uFlat, bool fUseInvlPg, int *prc))
{
X86PTEPAE BS3_FAR *pPTE = NULL;
#if TMPL_BITS == 16
@@ -211,7 +213,8 @@ BS3_DECL(X86PTEPAE BS3_FAR *) bs3PagingGetPte(RTCCUINTXREG cr3, uint64_t uFlat,
}
-BS3_DECL(int) Bs3PagingProtect(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear)
+#undef Bs3PagingProtect
+BS3_CMN_DEF(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear))
{
RTCCUINTXREG const cr3 = ASMGetCR3();
RTCCUINTXREG const cr4 = g_uBs3CpuDetected & BS3CPU_F_CPUID ? ASMGetCR4() : 0;
@@ -241,7 +244,7 @@ BS3_DECL(int) Bs3PagingProtect(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint6
*/
while ((uint32_t)cb > 0)
{
- PX86PTE pPte = bs3PagingGetLegacyPte(cr3, (uint32_t)uFlat, fUseInvlPg, &rc);
+ PX86PTE pPte = BS3_CMN_NM(bs3PagingGetLegacyPte)(cr3, (uint32_t)uFlat, fUseInvlPg, &rc);
if (!pPte)
return rc;
@@ -266,7 +269,7 @@ BS3_DECL(int) Bs3PagingProtect(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint6
*/
while (cb > 0)
{
- PX86PTEPAE pPte = bs3PagingGetPte(cr3, uFlat, fUseInvlPg, &rc);
+ PX86PTEPAE pPte = BS3_CMN_NM(bs3PagingGetPte)(cr3, uFlat, fUseInvlPg, &rc);
if (!pPte)
return rc;
@@ -297,12 +300,13 @@ BS3_DECL(int) Bs3PagingProtect(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint6
}
-BS3_DECL(int) Bs3PagingProtectPtr(void *pv, size_t cb, uint64_t fSet, uint64_t fClear)
+#undef Bs3PagingProtectPtr
+BS3_CMN_DEF(int, Bs3PagingProtectPtr,(void *pv, size_t cb, uint64_t fSet, uint64_t fClear))
{
#if ARCH_BITS == 16
- return Bs3PagingProtect(Bs3SelPtrToFlat(pv), cb, fSet, fClear);
+ return BS3_CMN_NM(Bs3PagingProtect)(Bs3SelPtrToFlat(pv), cb, fSet, fClear);
#else
- return Bs3PagingProtect((uintptr_t)pv, cb, fSet, fClear);
+ return BS3_CMN_NM(Bs3PagingProtect)((uintptr_t)pv, cb, fSet, fClear);
#endif
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm
index 9496c123414..50e3f4291eb 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm
@@ -27,7 +27,7 @@
%include "bs3kit-template-header.mac"
-BS3_PROC_BEGIN_CMN Bs3Panic
+BS3_PROC_BEGIN_CMN Bs3Panic, BS3_PBC_HYBRID_0_ARGS
push xBP
mov xBP, xSP
cli
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c
index 4adc11bf35d..311e2e2c042 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c
@@ -32,7 +32,8 @@
#include <iprt/asm-amd64-x86.h>
-BS3_DECL(void) Bs3PicMaskAll(void)
+#undef Bs3PicMaskAll
+BS3_CMN_DEF(void, Bs3PicMaskAll,(void))
{
ASMOutU8(0xa1, 0xff);
ASMOutU8(0x21, 0xff);
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm
index c98ef6db52f..aa0a8202bc3 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm
@@ -45,7 +45,7 @@ TMPL_BEGIN_TEXT
;;
; @cproto BS3_DECL(void) Bs3PrintChr_c16(char ch);
;
-BS3_PROC_BEGIN_CMN Bs3PrintChr
+BS3_PROC_BEGIN_CMN Bs3PrintChr, BS3_PBC_NEAR
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
@@ -86,14 +86,20 @@ BS3_PROC_BEGIN_CMN Bs3PrintChr
.do_system_call:
mov cl, [xBP + xCB*2] ; Load the char
mov ax, BS3_SYSCALL_PRINT_CHR
- call Bs3Syscall ; (no BS3_CALL!)
+ call Bs3Syscall ; near! no BS3_CALL!
.return:
pop xBX
pop xCX
pop xAX
- leave
+ pop xBP
BS3_CALL_CONV_EPILOG 1
ret
BS3_PROC_END_CMN Bs3PrintChr
+;
+; Generate 16-bit far stub.
+; Peformance critical, so don't penalize near calls.
+;
+BS3_CMN_FAR_STUB Bs3PrintChr, 2
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c
index 457b6a0f0fd..6bc0a3fe917 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c
@@ -26,7 +26,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3PrintStr(const char BS3_FAR *pszString)
+#undef Bs3PrintStr
+BS3_CMN_DEF(void, Bs3PrintStr,(const char BS3_FAR *pszString))
{
Bs3PrintStrN(pszString, Bs3StrLen(pszString));
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrColonSpaces.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrColonSpaces.asm
deleted file mode 100644
index 680382c67f5..00000000000
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrColonSpaces.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-; $Id$
-;; @file
-; BS3Kit - Bs3PrintStrColonSpaces, Common.
-;
-
-;
-; Copyright (C) 2007-2015 Oracle Corporation
-;
-; This file is part of VirtualBox Open Source Edition (OSE), as
-; available from http://www.virtualbox.org. This file is free software;
-; you can redistribute it and/or modify it under the terms of the GNU
-; General Public License (GPL) as published by the Free Software
-; Foundation, in version 2 as it comes in the "COPYING" file of the
-; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-;
-; The contents of this file may alternatively be used under the terms
-; of the Common Development and Distribution License Version 1.0
-; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
-; VirtualBox OSE distribution, in which case the provisions of the
-; CDDL are applicable instead of those of the GPL.
-;
-; You may elect to license modified versions of this file under the
-; terms and conditions of either the GPL or the CDDL or both.
-;
-
-%include "bs3kit-template-header.mac"
-
-
-BS3_EXTERN_CMN Bs3PrintStr
-BS3_EXTERN_CMN Bs3StrLen
-BS3_EXTERN_CMN Bs3PrintChr
-
-;; @todo If we can get 64-bit C code to link smoothly, this should be done in C!
-;; It's really annoying unreadable stuff in multi-mode assembly.
-
-;;
-; Prints a 32-bit unsigned integer value.
-;
-; @param [xSP + xCB+sCB] The desired minimum length of the output. That is
-; string + colon + spaces.
-; @param [xSP + xCB] The string to print.
-
-BS3_PROC_BEGIN_CMN Bs3PrintStrColonSpaces
- BS3_CALL_CONV_PROLOG 2
- push xBP
- mov xBP, xSP
- push xAX
- push xDI
- sub xSP, 20h
-
- mov sAX, [xBP + xCB*2]
- mov [xBP - 20h], sAX
- BS3_CALL Bs3PrintStr, 1
-
- mov sAX, [xBP + xCB*2]
- mov [xBP - 20h], sAX
- BS3_CALL Bs3StrLen, 1
- mov di, ax
- mov byte [xBP - 20h], ':'
- BS3_CALL Bs3PrintChr, 1
- inc di
-.next_space:
- mov byte [xBP - 20h], ' '
- BS3_CALL Bs3PrintChr, 1
- inc di
- cmp di, word [xBP + xCB*2 + sCB]
- jb .next_space
-
- add xSP, 20h
- pop xDI
- pop xAX
- leave
- BS3_CALL_CONV_EPILOG 2
- ret
-BS3_PROC_END_CMN Bs3PrintStrColonSpaces
-
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm
index 07a4287e548..1f186845202 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm
@@ -47,7 +47,7 @@ TMPL_BEGIN_TEXT
;
; ASSUMES cchString < 64KB!
;
-BS3_PROC_BEGIN_CMN Bs3PrintStrN
+BS3_PROC_BEGIN_CMN Bs3PrintStrN, BS3_PBC_NEAR
BS3_CALL_CONV_PROLOG 2
push xBP
mov xBP, xSP
@@ -73,9 +73,9 @@ BS3_PROC_BEGIN_CMN Bs3PrintStrN
;
.do_bios_call:
push ds
- lds si, [xBP + xCB*2] ; DS:SI -> string.
+ lds si, [xBP + xCB + cbCurRetAddr] ; DS:SI -> string.
cld
- mov cx, [xBP + xCB*2 + sCB] ; Use CX for counting down.
+ mov cx, [xBP + xCB + cbCurRetAddr + sCB] ; Use CX for counting down.
call Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
pop ds
jmp .return
@@ -91,12 +91,12 @@ BS3_PROC_BEGIN_CMN Bs3PrintStrN
;
.do_system_call:
%if TMPL_BITS == 16
- mov cx, [xBP + xCB*2 + 2]
+ mov cx, [xBP + xCB + cbCurRetAddr + 2]
%else
mov cx, ds
%endif
- mov xSI, [xBP + xCB*2]
- mov dx, [xBP + xCB*2 + sCB]
+ mov xSI, [xBP + xCB + cbCurRetAddr]
+ mov dx, [xBP + xCB + cbCurRetAddr + sCB]
%if TMPL_BITS == 16
%else
@@ -104,16 +104,16 @@ BS3_PROC_BEGIN_CMN Bs3PrintStrN
jae .char_by_char
%endif
mov ax, BS3_SYSCALL_PRINT_STR
- call Bs3Syscall ; (no BS3_CALL!)
+ call Bs3Syscall ; near! no BS3_CALL!
.return:
pop xSI
pop xBX
pop xCX
pop xAX
- leave
+ pop xBP
BS3_CALL_CONV_EPILOG 2
- ret
+ BS3_HYBRID_RET
;
; Doesn't look like it's real-mode addressable. So, char-by-char.
@@ -129,7 +129,7 @@ BS3_PROC_BEGIN_CMN Bs3PrintStrN
.char_by_char_loop:
mov ax, BS3_SYSCALL_PRINT_CHR
mov cl, [BS3_ONLY_16BIT(es:) xSI]
- call Bs3Syscall ; (no BS3_CALL!)
+ call Bs3Syscall ; near! no BS3_CALL!
inc xSI
dec xDX
jnz .char_by_char_loop
@@ -182,5 +182,13 @@ BS3_PROC_BEGIN Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
mov bx, 0ff00h
jmp .bios_loop_int10h
BS3_PROC_END Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
+
+
+;
+; Generate 16-bit far stub.
+; Peformance critical, so don't penalize near calls.
+;
+BS3_CMN_FAR_STUB Bs3PrintStrN, 6
+
%endif
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrSpacesColonSpace.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrSpacesColonSpace.c
deleted file mode 100644
index f1fc1d7cd07..00000000000
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrSpacesColonSpace.c
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-#include "bs3kit.h"
-
-
-BS3_DECL(void) BS3_CMN_NM(Bs3PrintStrSpacesColonSpace)(const char BS3_FAR *pszString, unsigned cch)
-{
- static volatile char s_szStuff[] = "stuff";
- static volatile const char s_szStuff2[] = "stuff";
- //size_t cchString;
-
- //Bs3PrintStr(pszString);
-
- s_szStuff[0] = s_szStuff2[0];
-}
-
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm
index e058377fa1c..ab54e592247 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm
@@ -34,7 +34,7 @@ BS3_EXTERN_CMN Bs3PrintStr
;
; @param [xBP + xCB*2] 32-bit value to format and print.
;
-BS3_PROC_BEGIN_CMN Bs3PrintU32
+BS3_PROC_BEGIN_CMN Bs3PrintU32, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
@@ -44,7 +44,7 @@ BS3_PROC_BEGIN_CMN Bs3PrintU32
push sBX
BS3_ONLY_16BIT_STMT push ds
- mov eax, [xBP + xCB*2]
+ mov eax, [xBP + xCB + cbCurRetAddr]
; Allocate a stack buffer and terminate it. ds:bx points ot the end.
sub xSP, 30h
@@ -78,6 +78,6 @@ BS3_PROC_BEGIN_CMN Bs3PrintU32
pop sAX
leave
BS3_CALL_CONV_EPILOG 1
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3PrintU32
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm
index c7265399bea..8b09ba1f4fc 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm
@@ -34,7 +34,7 @@ BS3_EXTERN_CMN Bs3PrintStr
;
; @param [xBP + xCB*2] 32-bit value to format and print.
;
-BS3_PROC_BEGIN_CMN Bs3PrintX32
+BS3_PROC_BEGIN_CMN Bs3PrintX32, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
@@ -44,7 +44,7 @@ BS3_PROC_BEGIN_CMN Bs3PrintX32
push sBX
BS3_ONLY_16BIT_STMT push ds
- mov eax, [xBP + xCB*2]
+ mov eax, [xBP + xCB + cbCurRetAddr]
; Allocate a stack buffer and terminate it. ds:bx points ot the end.
sub xSP, 30h
@@ -82,6 +82,6 @@ BS3_PROC_BEGIN_CMN Bs3PrintX32
pop sAX
leave
BS3_CALL_CONV_EPILOG 1
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3PrintX32
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c
index 61914b42411..ba01c8e1e29 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c
@@ -63,7 +63,8 @@ static BS3_DECL_CALLBACK(size_t) bs3PrintFmtOutput(char ch, void BS3_FAR *pvUser
}
-BS3_DECL(size_t) Bs3PrintfV(const char BS3_FAR *pszFormat, va_list va)
+#undef Bs3PrintfV
+BS3_CMN_DEF(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va))
{
BS3PRINTBUF Buf;
Buf.cchBuf = 0;
@@ -71,12 +72,13 @@ BS3_DECL(size_t) Bs3PrintfV(const char BS3_FAR *pszFormat, va_list va)
}
-BS3_DECL(size_t) Bs3Printf(const char BS3_FAR *pszFormat, ...)
+#undef Bs3Printf
+BS3_CMN_DEF(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...))
{
size_t cchRet;
va_list va;
va_start(va, pszFormat);
- cchRet = Bs3PrintfV(pszFormat, va);
+ cchRet = BS3_CMN_NM(Bs3PrintfV)(pszFormat, va);
va_end(va);
return cchRet;
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c
index dd9017cb60b..972001d8a77 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c
@@ -138,7 +138,8 @@ static uint16_t bs3RegCtxConvertProtSelToRingX(uint16_t uSel, uint8_t bRing, uin
* @param pRegCtx The register context.
* @param bRing The target ring (0..3).
*/
-BS3_DECL(void) Bs3RegCtxConvertToRingX(PBS3REGCTX pRegCtx, uint8_t bRing)
+#undef Bs3RegCtxConvertToRingX
+BS3_CMN_DEF(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing))
{
if ( (pRegCtx->rflags.u32 & X86_EFL_VM)
|| pRegCtx->bMode == BS3_MODE_RM)
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c
index 9cedd6faa33..d3563ad6387 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3RegCtxPrint(PCBS3REGCTX pRegCtx)
+#undef Bs3RegCtxPrint
+BS3_CMN_DEF(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx))
{
//if (BS3_MODE_IS_64BIT_CODE(pRegCtx->bMode))
//{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
index 20323349adb..bccb45ca3dd 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
@@ -46,17 +46,19 @@ TMPL_BEGIN_TEXT
;
; @note Only respects the BS3_MODE_CODE_MASK part of pRegCtx->bMode.
;
-%if TMPL_BITS == 16 || TMPL_BITS == 32
-BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts ; special entry point for when watcom applies __aborts
- %if TMPL_BITS == 16
+%if TMPL_BITS == 16
+BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_FAR ; special entry point for when watcom applies __aborts
+BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_NEAR ; special entry point for when watcom applies __aborts
CPU 8086
xor xAX, xAX
push xAX ; fake return address.
- %else
+ push xAX
+ jmp _Bs3RegCtxRestore_f16
+%elif TMPL_BITS == 32
+BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_NEAR ; special entry point for when watcom applies __aborts
push 0feedfaceh ; fake return address.
- %endif
%endif
-BS3_PROC_BEGIN_CMN Bs3RegCtxRestore
+BS3_PROC_BEGIN_CMN Bs3RegCtxRestore, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 2
push xBP
mov xBP, xSP
@@ -70,9 +72,9 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxRestore
test al, 3
jz .in_ring0
%if TMPL_BITS == 16
- mov si, [bp + 4]
- mov cx, [bp + 4+2]
- mov dx, [bp + 8]
+ mov si, [bp + xCB + cbCurRetAddr]
+ mov cx, [bp + xCB + cbCurRetAddr + 2]
+ mov dx, [bp + xCB + cbCurRetAddr + sCB]
mov ax, BS3_SYSCALL_RESTORE_CTX
%else
mov cx, ds
@@ -90,8 +92,8 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxRestore
%if TMPL_BITS == 16
mov ax, BS3_SEL_DATA16
mov es, ax
- lds bx, [bp + 4]
- mov cx, [bp + 8]
+ lds bx, [bp + xCB + cbCurRetAddr]
+ mov cx, [bp + xCB + cbCurRetAddr + sCB]
%elif TMPL_BITS == 32
mov ax, BS3_SEL_R0_DS32
mov ds, ax
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm
index 9f0d8121a90..6ab1d410eda 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm
@@ -37,12 +37,12 @@ TMPL_BEGIN_TEXT
;;
-; Restores the given register context.
+; Saves the current register context.
;
; @param pRegCtx
; @uses None.
;
-BS3_PROC_BEGIN_CMN Bs3RegCtxSave
+BS3_PROC_BEGIN_CMN Bs3RegCtxSave, BS3_PBC_HYBRID_SAFE
TMPL_ONLY_16BIT_STMT CPU 8086
BS3_CALL_CONV_PROLOG 1
push xBP
@@ -55,31 +55,21 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxSave
BS3_ONLY_16BIT_STMT push ds ; xBP - xCB*6
;
- ; Prologue. Load ES:xDI with pRegCtx.
- ; (ASSUMES ds is BS3KIT_GRPNM_DATA16/FLAT of course.)
- ;
-%if TMPL_BITS == 16
- les di, [bp + 4]
-%else
- mov xDI, [xBP + xCB*2]
-%endif
-
- ;
; Clear the whole structure first.
;
xor xAX, xAX
cld
AssertCompileSizeAlignment(BS3REGCTX, 4)
%if TMPL_BITS == 16
- les xDI, [xBP + xCB*2]
+ les xDI, [xBP + xCB + cbCurRetAddr]
mov xCX, BS3REGCTX_size / 2
rep stosw
%else
- mov xDI, [xBP + xCB*2]
+ mov xDI, [xBP + xCB + cbCurRetAddr]
mov xCX, BS3REGCTX_size / 4
rep stosd
%endif
- mov xDI, [xBP + xCB*2]
+ mov xDI, [xBP + xCB + cbCurRetAddr]
;
; Save the current mode.
@@ -200,6 +190,8 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxSave
; 80286 control registers.
.common_80286:
TMPL_ONLY_16BIT_STMT CPU 286
+ cmp cl, BS3_MODE_RM
+ je .common_ancient
str [xDI + BS3REGCTX.tr]
sldt [xDI + BS3REGCTX.ldtr]
@@ -218,16 +210,18 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxSave
mov [xDI + BS3REGCTX.rbp], xAX
mov xAX, [xBP + xCB]
mov [xDI + BS3REGCTX.rip], xAX
- lea xAX, [xBP + xCB*2]
+ lea xAX, [xBP + xCB + cbCurRetAddr]
mov [xDI + BS3REGCTX.rsp], xAX
- mov [xDI + BS3REGCTX.cs], cs
%if TMPL_BITS == 16
+ mov ax, [xBP + xCB + 2]
+ mov [xDI + BS3REGCTX.cs], ax
mov ax, [xBP - xCB*6]
mov [xDI + BS3REGCTX.ds], ax
mov ax, [xBP - xCB*5]
mov [xDI + BS3REGCTX.es], ax
%else
+ mov [xDI + BS3REGCTX.cs], cs
mov [xDI + BS3REGCTX.ds], ds
mov [xDI + BS3REGCTX.es], es
%endif
@@ -244,6 +238,6 @@ BS3_PROC_BEGIN_CMN Bs3RegCtxSave
pop xAX
xPOPF
pop xBP
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3RegCtxSave
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c
index 60310f2bd0d..bf3055a7859 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c
@@ -27,7 +27,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(uint32_t) Bs3SelFar32ToFlat32(uint32_t off, uint16_t uSel)
+#undef Bs3SelFar32ToFlat32
+BS3_CMN_DEF(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel))
{
if (g_bBs3CurrentMode == BS3_MODE_RM)
return ((uint32_t)uSel << 4) + off;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c
index d0f8e978508..f5a6879bc99 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c
@@ -27,7 +27,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32(uint32_t off, uint16_t uSel)
+#undef Bs3SelProtFar32ToFlat32
+BS3_CMN_DEF(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel))
{
uint32_t uRet;
PCX86DESC pEntry;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm
index 582383abcb6..5d1db5ffc57 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm
@@ -28,7 +28,7 @@
BS3_EXTERN_CMN Bs3Panic
-BS3_PROC_BEGIN_CMN Bs3Shutdown
+BS3_PROC_BEGIN_CMN Bs3Shutdown, BS3_PBC_HYBRID_0_ARGS
cli
mov bl, 64
mov dx, 08900h
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c
index e3468cde7d7..4d5b05d7c14 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c
@@ -31,7 +31,8 @@
#include <iprt/asm.h>
-BS3_DECL(void BS3_FAR *) Bs3SlabAlloc(PBS3SLABCTL pSlabCtl)
+#undef Bs3SlabAlloc
+BS3_CMN_DEF(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl))
{
if (pSlabCtl->cFreeChunks)
{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c
index ff0b9a5ef27..0f56bea4f37 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c
@@ -31,7 +31,8 @@
#include <iprt/asm.h>
-BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags)
+#undef Bs3SlabAllocEx
+BS3_CMN_DEF(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags))
{
BS3_ASSERT(cChunks > 0);
if (pSlabCtl->cFreeChunks >= cChunks)
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c
index f744b4e01a2..8ecd9c71a7a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c
@@ -31,7 +31,8 @@
#include <iprt/asm.h>
-BS3_DECL(uint16_t) Bs3SlabFree(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks)
+#undef Bs3SlabFree
+BS3_CMN_DEF(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks))
{
uint16_t cFreed = 0;
BS3_ASSERT(cChunks > 0);
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c
index 0f6d9944f0f..e0c15af547b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c
@@ -31,7 +31,8 @@
#include <iprt/asm.h>
-BS3_DECL(void) Bs3SlabInit(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk)
+#undef Bs3SlabInit
+BS3_CMN_DEF(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk))
{
uint16_t cBits;
BS3_ASSERT(RT_IS_POWER_OF_TWO(cbChunk));
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c
index 1d741ab4055..16357b4c3ae 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c
@@ -27,7 +27,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3SlabListAdd(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl)
+#undef Bs3SlabListAdd
+BS3_CMN_DEF(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl))
{
BS3_ASSERT(pHead->cbChunk == pSlabCtl->cbChunk);
BS3_ASSERT(BS3_XPTR_IS_NULL(BS3SLABHEAD, pSlabCtl->pNext));
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c
index d94a816744f..7fe0a058fc2 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc(PBS3SLABHEAD pHead)
+#undef Bs3SlabListAlloc
+BS3_CMN_DEF(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead))
{
if (pHead->cFreeChunks)
{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c
index bc4b2419315..77e28349164 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags)
+#undef Bs3SlabListAllocEx
+BS3_CMN_DEF(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags))
{
BS3_ASSERT(!(fFlags & ~BS3_SLAB_ALLOC_F_SAME_TILE));
if (pHead->cFreeChunks >= cChunks)
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c
index 3f9228c0697..b5d1ac2f8d9 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c
@@ -27,7 +27,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3SlabListFree(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks)
+#undef Bs3SlabListFree
+BS3_CMN_DEF(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks))
{
BS3_ASSERT(cChunks > 0);
if (cChunks > 0)
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c
index 3cd89580781..8b52a271f78 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c
@@ -27,7 +27,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3SlabListInit(PBS3SLABHEAD pHead, uint16_t cbChunk)
+#undef Bs3SlabListInit
+BS3_CMN_DEF(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk))
{
BS3_ASSERT(RT_IS_POWER_OF_TWO(cbChunk));
BS3_XPTR_SET(struct BS3SLABCTL, pHead->pFirst, 0);
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c
index de84601ea36..b44ea35e831 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3StrCpy
-BS3_DECL(char BS3_FAR *) BS3_CMN_NM(Bs3StrCpy)(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc)
+BS3_CMN_DEF(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc))
{
char BS3_FAR *pszRet = pszDst;
char ch;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c
index 23368d5c386..717c0f30665 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c
@@ -358,8 +358,9 @@ static size_t bs3StrFormatS16(PBS3FMTSTATE pState, int16_t iValue)
#endif
-BS3_DECL(size_t) Bs3StrFormatV(const char BS3_FAR *pszFormat, va_list va,
- PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser)
+#undef Bs3StrFormatV
+BS3_CMN_DEF(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
+ PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser))
{
BS3FMTSTATE State;
size_t cchRet = 0;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c
index e96fc17983d..167f43aabb7 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3StrLen
-BS3_DECL(size_t) BS3_CMN_NM(Bs3StrLen)(const char BS3_FAR *pszString)
+BS3_CMN_DEF(size_t, Bs3StrLen,(const char BS3_FAR *pszString))
{
size_t cch = 0;
while (pszString[cch] != '\0')
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c
index cf3937f0320..2ba6f404acf 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c
@@ -27,7 +27,7 @@
#include "bs3kit-template-header.h"
#undef Bs3StrNLen
-BS3_DECL(size_t) BS3_CMN_NM(Bs3StrNLen)(const char BS3_FAR *pszString, size_t cchMax)
+BS3_CMN_DEF(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax))
{
size_t cch = 0;
while (cchMax-- > 0 && pszString[cch] != '\0')
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c
index ec94fbb42b4..345d5a941e0 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c
@@ -72,7 +72,8 @@ static BS3_DECL_CALLBACK(size_t) bs3StrPrintfFmtOutput(char ch, void BS3_FAR *pv
}
-BS3_DECL(size_t) Bs3StrPrintfV(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list va)
+#undef Bs3StrPrintfV
+BS3_CMN_DEF(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list va))
{
BS3STRPRINTFSTATE State;
State.pchBuf = pszBuf;
@@ -81,12 +82,13 @@ BS3_DECL(size_t) Bs3StrPrintfV(char BS3_FAR *pszBuf, size_t cchBuf, const char B
}
-BS3_DECL(size_t) Bs3StrPrintf(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, ...)
+#undef Bs3StrPrintf
+BS3_CMN_DEF(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, ...))
{
size_t cchRet;
va_list va;
va_start(va, pszFormat);
- cchRet = Bs3StrPrintfV(pszBuf, cchBuf, pszFormat, va);
+ cchRet = BS3_CMN_NM(Bs3StrPrintfV)(pszBuf, cchBuf, pszFormat, va);
va_end(va);
return cchRet;
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
index 10116039a97..b09b035c052 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
@@ -37,7 +37,7 @@ TMPL_BEGIN_TEXT
; @cproto BS3_DECL(void) Bs3SwitchTo16Bit(void);
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit
+BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit, BS3_PBC_NEAR
%if TMPL_BITS == 16
push ax
push ds
@@ -116,3 +116,5 @@ TMPL_BEGIN_TEXT
%endif
BS3_PROC_END_CMN Bs3SwitchTo16Bit
+;; @todo far 16-bit variant.
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm
index f5c2784d6dd..29a8d27b285 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm
@@ -39,7 +39,7 @@ TMPL_BEGIN_TEXT
; @uses No general registers modified. Regment registers loaded with specific
; values and the stack register converted to real mode (not ebp).
;
-BS3_PROC_BEGIN_CMN Bs3SwitchTo16BitV86
+BS3_PROC_BEGIN_CMN Bs3SwitchTo16BitV86, BS3_PBC_NEAR
; Construct basic v8086 return frame.
BS3_ONLY_16BIT_STMT movzx esp, sp
push dword 0 ; +0x20: GS
@@ -117,5 +117,7 @@ BS3_PROC_BEGIN_CMN Bs3SwitchTo16BitV86
iretd
BS3_PROC_END_CMN Bs3SwitchTo16BitV86
+;; @todo far 16-bit variant.
+
%endif ; ! 64-bit
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
index 58088ae7f8b..febf5738eaa 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
@@ -42,7 +42,7 @@ TMPL_BEGIN_TEXT
;
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchTo32Bit
+BS3_PROC_BEGIN_CMN Bs3SwitchTo32Bit, BS3_PBC_NEAR
%if TMPL_BITS == 32
ret
%else
@@ -147,3 +147,5 @@ BS3_SET_BITS 32
%endif
BS3_PROC_END_CMN Bs3SwitchTo32Bit
+;; @todo far 16-bit variant.
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
index 4e524fc5a08..25aeec87c88 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
@@ -36,8 +36,9 @@ TMPL_BEGIN_TEXT
; @cproto BS3_DECL(void) Bs3SwitchTo64Bit(void);
;
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
+; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchTo64Bit
+BS3_PROC_BEGIN_CMN Bs3SwitchTo64Bit, BS3_PBC_NEAR
%if TMPL_BITS == 64
ret
@@ -104,3 +105,6 @@ BS3_SET_BITS 64
%endif
BS3_PROC_END_CMN Bs3SwitchTo64Bit
+
+;; @todo far 16-bit variant.
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm
index 3de16881c60..07ec8d4b0df 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm
@@ -33,7 +33,7 @@
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
-BS3_EXTERN_CMN Bs3SwitchToRingX
+BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
TMPL_BEGIN_TEXT
@@ -43,7 +43,7 @@ TMPL_BEGIN_TEXT
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchToRing0
+BS3_PROC_BEGIN_CMN Bs3SwitchToRing0, BS3_PBC_HYBRID_0_ARGS
%if TMPL_BITS == 64
push rcx
sub rsp, 20h
@@ -54,9 +54,10 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRing0
pop rcx
%else
push 0
+ TMPL_ONLY_16BIT_STMT push cs
call Bs3SwitchToRingX
add xSP, xCB
%endif
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3SwitchToRing0
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm
index 7ceb80579e1..1b231ac1a8a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm
@@ -33,7 +33,7 @@
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
-BS3_EXTERN_CMN Bs3SwitchToRingX
+BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
TMPL_BEGIN_TEXT
@@ -43,7 +43,7 @@ TMPL_BEGIN_TEXT
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchToRing1
+BS3_PROC_BEGIN_CMN Bs3SwitchToRing1, BS3_PBC_HYBRID_0_ARGS
%if TMPL_BITS == 64
push rcx
sub rsp, 20h
@@ -54,9 +54,10 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRing1
pop rcx
%else
push 1
+ TMPL_ONLY_16BIT_STMT push cs
call Bs3SwitchToRingX
add xSP, xCB
%endif
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3SwitchToRing1
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm
index cffafa150ee..1baa5143651 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm
@@ -33,7 +33,7 @@
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
-BS3_EXTERN_CMN Bs3SwitchToRingX
+BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
TMPL_BEGIN_TEXT
@@ -43,7 +43,7 @@ TMPL_BEGIN_TEXT
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchToRing2
+BS3_PROC_BEGIN_CMN Bs3SwitchToRing2, BS3_PBC_HYBRID_0_ARGS
%if TMPL_BITS == 64
push rcx
sub rsp, 20h
@@ -54,9 +54,10 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRing2
pop rcx
%else
push 2
+ TMPL_ONLY_16BIT_STMT push cs
call Bs3SwitchToRingX
add xSP, xCB
%endif
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3SwitchToRing2
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm
index b77b8187c62..c86bd5b313a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm
@@ -33,7 +33,7 @@
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
-BS3_EXTERN_CMN Bs3SwitchToRingX
+BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
TMPL_BEGIN_TEXT
@@ -43,7 +43,7 @@ TMPL_BEGIN_TEXT
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchToRing3
+BS3_PROC_BEGIN_CMN Bs3SwitchToRing3, BS3_PBC_HYBRID_0_ARGS
%if TMPL_BITS == 64
push rcx
sub rsp, 20h
@@ -54,9 +54,10 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRing3
pop rcx
%else
push 3
+ TMPL_ONLY_16BIT_STMT push cs
call Bs3SwitchToRingX
add xSP, xCB
%endif
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3SwitchToRing3
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm
index a2b85dc52be..244607bf345 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm
@@ -42,7 +42,7 @@ TMPL_BEGIN_TEXT
;
; @uses No GPRs.
;
-BS3_PROC_BEGIN_CMN Bs3SwitchToRingX
+BS3_PROC_BEGIN_CMN Bs3SwitchToRingX, BS3_PBC_HYBRID_SAFE
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
@@ -64,12 +64,12 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRingX
; In protected mode: Check the CPL we're currently at skip syscall if ring-0 already.
mov ax, cs
and al, 3
- cmp al, byte [xBP + xCB*2]
+ cmp al, byte [xBP + xCB + cbCurRetAddr]
je .return
.just_do_it:
mov xAX, BS3_SYSCALL_TO_RING0
- add al, [xBP + xCB*2]
+ add al, [xBP + xCB + cbCurRetAddr]
call Bs3Syscall
%ifndef BS3_STRICT
@@ -79,12 +79,12 @@ BS3_PROC_BEGIN_CMN Bs3SwitchToRingX
pop xAX
pop xBP
BS3_CALL_CONV_EPILOG 1
- ret
+ BS3_HYBRID_RET
%ifdef BS3_STRICT
; In real mode, only ring-0 makes any sense.
.return_real_mode:
- cmp byte [xBP + xCB*2], 0
+ cmp byte [xBP + xCB + cbCurRetAddr], 0
je .return
int3
jmp .return
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm
index d8341a0172a..f4013a5d579 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm
@@ -50,7 +50,7 @@ TMPL_BEGIN_TEXT
;
; @uses Whatever the syscall modified (xBX and XBP are always saved).
;
-BS3_PROC_BEGIN_CMN Bs3Syscall
+BS3_PROC_BEGIN_CMN Bs3Syscall, BS3_PBC_HYBRID_0_ARGS ; (all parameters are in registers)
push xBP
mov xBP, xSP
push xBX
@@ -79,6 +79,6 @@ BS3_PROC_BEGIN_CMN Bs3Syscall
pop xBX
pop xBP
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3Syscall
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c
index 55aa3debafd..cb3eb0f5985 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c
@@ -31,8 +31,9 @@
#include "bs3kit-template-header.h"
-BS3_DECL(bool) Bs3TestCheckRegCtxEx(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAcjust,
- uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep)
+#undef Bs3TestCheckRegCtxEx
+BS3_CMN_DEF(bool, Bs3TestCheckRegCtxEx,(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAcjust,
+ uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep))
{
uint16_t cErrorsBefore = Bs3TestSubErrorCount();
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c
index 479b70663c4..2e764d75ecd 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c
@@ -94,7 +94,8 @@ BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput(char ch, void BS3_FAR *pvUser)
/**
* Equivalent to RTTestIFailedV.
*/
-BS3_DECL(void) Bs3TestFailedV(const char *pszFormat, va_list va)
+#undef Bs3TestFailedV
+BS3_CMN_DEF(void, Bs3TestFailedV,(const char *pszFormat, va_list va))
{
BS3TESTFAILEDBUF Buf;
@@ -117,11 +118,12 @@ BS3_DECL(void) Bs3TestFailedV(const char *pszFormat, va_list va)
/**
* Equivalent to RTTestIFailedF.
*/
-BS3_DECL(void) Bs3TestFailedF(const char *pszFormat, ...)
+#undef Bs3TestFailedF
+BS3_CMN_DEF(void, Bs3TestFailedF,(const char *pszFormat, ...))
{
va_list va;
va_start(va, pszFormat);
- Bs3TestFailedV(pszFormat, va);
+ BS3_CMN_NM(Bs3TestFailedV)(pszFormat, va);
va_end(va);
}
@@ -129,8 +131,9 @@ BS3_DECL(void) Bs3TestFailedF(const char *pszFormat, ...)
/**
* Equivalent to RTTestIFailed.
*/
-BS3_DECL(void) Bs3TestFailed(const char *pszMessage)
+#undef Bs3TestFailed
+BS3_CMN_DEF(void, Bs3TestFailed,(const char *pszMessage))
{
- Bs3TestFailedF("%s", pszMessage);
+ BS3_CMN_NM(Bs3TestFailedF)("%s", pszMessage);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c
index d45616927b1..2e1f247670d 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c
@@ -37,7 +37,8 @@
*
* @param pszTest The test name.
*/
-BS3_DECL(void) Bs3TestInit(const char BS3_FAR *pszTest)
+#undef Bs3TestInit
+BS3_CMN_DEF(void, Bs3TestInit,(const char BS3_FAR *pszTest))
{
/*
* Initialize the globals.
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm
index d4f801de081..57481b3ad83 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm
@@ -37,7 +37,7 @@ TMPL_BEGIN_TEXT
;;
; @cproto BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c16(void);
;
-BS3_PROC_BEGIN_CMN bs3TestIsVmmDevTestingPresent
+BS3_PROC_BEGIN_CMN bs3TestIsVmmDevTestingPresent, BS3_PBC_HYBRID_0_ARGS
BS3_CALL_CONV_PROLOG 2
push xBP
mov xBP, xSP
@@ -58,7 +58,7 @@ BS3_PROC_BEGIN_CMN bs3TestIsVmmDevTestingPresent
pop xDX
pop xBP
BS3_CALL_CONV_EPILOG 2
- ret
+ BS3_HYBRID_RET
.ancient_cpu:
in ax, dx
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c
index f2b386f6a88..ee80d92ce0a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c
@@ -114,7 +114,8 @@ static BS3_DECL_CALLBACK(size_t) bs3TestPrintfStrOutput(char ch, void BS3_FAR *p
-BS3_DECL(void) Bs3TestPrintfV(const char BS3_FAR *pszFormat, va_list va)
+#undef Bs3TestPrintfV
+BS3_CMN_DEF(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va))
{
BS3TESTPRINTBUF Buf;
Buf.fNewCmd = true;
@@ -124,11 +125,12 @@ BS3_DECL(void) Bs3TestPrintfV(const char BS3_FAR *pszFormat, va_list va)
-BS3_DECL(void) Bs3TestPrintf(const char BS3_FAR *pszFormat, ...)
+#undef Bs3TestPrintf
+BS3_CMN_DEF(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...))
{
va_list va;
va_start(va, pszFormat);
- Bs3TestPrintfV(pszFormat, va);
+ BS3_CMN_NM(Bs3TestPrintfV)(pszFormat, va);
va_end(va);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm
index fa438b21292..fb282694a8f 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm
@@ -33,7 +33,7 @@ TMPL_BEGIN_TEXT
;;
; @cproto BS3_DECL(void) bs3TestSendCmdWithStr_c16(uint32_t uCmd, const char BS3_FAR *pszString);
;
-BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr
+BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 2
push xBP
mov xBP, xSP
@@ -48,19 +48,19 @@ BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr
; The command (uCmd).
mov dx, VMMDEV_TESTING_IOPORT_CMD
%if TMPL_BITS == 16
- mov ax, [xBP + xCB*2] ; We ignore the top bits in 16-bit mode.
+ mov ax, [xBP + xCB + cbCurRetAddr] ; We ignore the top bits in 16-bit mode.
out dx, ax
%else
- mov eax, [xBP + xCB*2]
+ mov eax, [xBP + xCB + cbCurRetAddr]
out dx, eax
%endif
; The string.
mov dx, VMMDEV_TESTING_IOPORT_DATA
%if TMPL_BITS == 16
- lds si, [xBP + xCB*2 + sCB]
+ lds si, [xBP + xCB + cbCurRetAddr + sCB]
%else
- mov xSI, [xBP + xCB*2 + sCB]
+ mov xSI, [xBP + xCB + cbCurRetAddr + sCB]
%endif
.next_char:
lodsb
@@ -73,8 +73,8 @@ BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr
pop xSI
pop xDX
pop xAX
- leave
+ pop xBP
BS3_CALL_CONV_EPILOG 2
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN bs3TestSendCmdWithStr
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm
index 7c6d33a714c..e858db1207a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm
@@ -33,7 +33,7 @@ TMPL_BEGIN_TEXT
;;
; @cproto BS3_DECL(void) bs3TestSendCmdWithU32_c16(uint32_t uCmd, uint32_t uValue);
;
-BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32
+BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 2
push xBP
mov xBP, xSP
@@ -47,7 +47,7 @@ BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32
; The command (uCmd) -
mov dx, VMMDEV_TESTING_IOPORT_CMD
%if TMPL_BITS == 16
- mov ax, [xBP + xCB*2] ; We ignore the top bits in 16-bit mode.
+ mov ax, [xBP + xCB + cbCurRetAddr] ; We ignore the top bits in 16-bit mode.
out dx, ax
%else
mov eax, [xBP + xCB*2]
@@ -58,9 +58,9 @@ BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32
; The value (uValue).
mov dx, VMMDEV_TESTING_IOPORT_DATA
%if TMPL_BITS == 16
- mov ax, [xBP + xCB*2 + sCB]
+ mov ax, [xBP + xCB + cbCurRetAddr + sCB]
out dx, ax
- mov ax, [xBP + xCB*2 + sCB + 2]
+ mov ax, [xBP + xCB + cbCurRetAddr + sCB + 2]
out dx, ax
%else
mov eax, [xBP + xCB*2 + sCB]
@@ -74,8 +74,8 @@ BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32
pop xSI
pop xDX
pop xAX
- leave
+ pop xBP
BS3_CALL_CONV_EPILOG 2
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN bs3TestSendCmdWithU32
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c
index 50b32079420..8a11a843d01 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c
@@ -36,7 +36,8 @@
/**
* Equivalent to RTTestSkippedV.
*/
-BS3_DECL(void) Bs3TestSkippedV(const char *pszFormat, va_list va)
+#undef Bs3TestSkippedV
+BS3_CMN_DEF(void, Bs3TestSkippedV,(const char *pszFormat, va_list va))
{
if (g_cusBs3TestErrors == g_cusBs3SubTestAtErrors)
{
@@ -68,11 +69,12 @@ BS3_DECL(void) Bs3TestSkippedV(const char *pszFormat, va_list va)
/**
* Equivalent to RTTestSkipped.
*/
-BS3_DECL(void) Bs3TestSkippedF(const char *pszFormat, ...)
+#undef Bs3TestSkippedF
+BS3_CMN_DEF(void, Bs3TestSkippedF,(const char *pszFormat, ...))
{
va_list va;
va_start(va, pszFormat);
- Bs3TestSkippedV(pszFormat, va);
+ BS3_CMN_NM(Bs3TestSkippedV)(pszFormat, va);
va_end(va);
}
@@ -80,8 +82,9 @@ BS3_DECL(void) Bs3TestSkippedF(const char *pszFormat, ...)
/**
* Equivalent to RTTestSkipped.
*/
-BS3_DECL(void) Bs3TestSkipped(const char *pszWhy)
+#undef Bs3TestSkipped
+BS3_CMN_DEF(void, Bs3TestSkipped,(const char *pszWhy))
{
- Bs3TestSkippedF(pszWhy ? "%s" : NULL, pszWhy);
+ BS3_CMN_NM(Bs3TestSkippedF)(pszWhy ? "%s" : NULL, pszWhy);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c
index 79fd4e59fa9..8b08b830fd7 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c
@@ -36,7 +36,8 @@
/**
* Equivalent to RTTestISubV.
*/
-BS3_DECL(void) Bs3TestSubV(const char *pszFormat, va_list va)
+#undef Bs3TestSubV
+BS3_CMN_DEF(void, Bs3TestSubV,(const char *pszFormat, va_list va))
{
size_t cch;
@@ -69,11 +70,12 @@ BS3_DECL(void) Bs3TestSubV(const char *pszFormat, va_list va)
/**
* Equivalent to RTTestIFailedF.
*/
-BS3_DECL(void) Bs3TestSubF(const char *pszFormat, ...)
+#undef Bs3TestSubF
+BS3_CMN_DEF(void, Bs3TestSubF,(const char *pszFormat, ...))
{
va_list va;
va_start(va, pszFormat);
- Bs3TestSubV(pszFormat, va);
+ BS3_CMN_NM(Bs3TestSubV)(pszFormat, va);
va_end(va);
}
@@ -81,8 +83,9 @@ BS3_DECL(void) Bs3TestSubF(const char *pszFormat, ...)
/**
* Equivalent to RTTestISub.
*/
-BS3_DECL(void) Bs3TestSub(const char *pszMessage)
+#undef Bs3TestSub
+BS3_CMN_DEF(void, Bs3TestSub,(const char *pszMessage))
{
- Bs3TestSubF("%s", pszMessage);
+ BS3_CMN_NM(Bs3TestSubF)("%s", pszMessage);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c
index f28ae49cc1d..5fbf95b7809 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c
@@ -36,7 +36,8 @@
/**
* Equivalent to RTTestISubDone.
*/
-BS3_DECL(void) Bs3TestSubDone(void)
+#undef Bs3TestSubDone
+BS3_CMN_DEF(void, Bs3TestSubDone,(void))
{
bs3TestSubCleanup();
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c
index a53e170961c..498728e53a2 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c
@@ -36,7 +36,8 @@
/**
* Equivalent to RTTestSubErrorCount.
*/
-BS3_DECL(uint16_t) Bs3TestSubErrorCount(void)
+#undef Bs3TestSubErrorCount
+BS3_CMN_DEF(uint16_t, Bs3TestSubErrorCount,(void))
{
return g_cusBs3TestErrors - g_cusBs3SubTestAtErrors;
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c
index 4cca47a5956..756282fd7cb 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c
@@ -76,7 +76,8 @@ BS3_DECL(void) bs3TestSubCleanup(void)
/**
* Equivalent to RTTestSummaryAndDestroy.
*/
-BS3_DECL(void) Bs3TestTerm(void)
+#undef Bs3TestTerm
+BS3_CMN_DEF(void, Bs3TestTerm,(void))
{
/*
* Close any current sub-test.
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c
index 9debc572f1d..8f10b1f480e 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c
@@ -44,7 +44,8 @@ extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16GenericEntries(void);
extern uint8_t BS3_FAR_DATA bs3Trap16GenericTrapOrInt[];
-BS3_DECL(void) Bs3Trap16InitEx(bool f386Plus)
+#undef Bs3Trap16InitEx
+BS3_CMN_DEF(void, Bs3Trap16InitEx,(bool f386Plus))
{
X86TSS16 BS3_FAR *pTss;
unsigned iIdt;
@@ -67,12 +68,10 @@ BS3_DECL(void) Bs3Trap16InitEx(bool f386Plus)
/*
* IDT entries, except the system call gate.
*/
- for (iIdt = 0; iIdt < BS3_TRAP_SYSCALL; iIdt++)
- Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
- BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
- for (iIdt = BS3_TRAP_SYSCALL + 1; iIdt < 256; iIdt++)
- Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
- BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
+ for (iIdt = 0; iIdt < 256; iIdt++)
+ if (iIdt != BS3_TRAP_SYSCALL)
+ Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
+ BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
/*
* Initialize the normal TSS so we can do ring transitions via the IDT.
@@ -111,8 +110,9 @@ BS3_DECL(void) Bs3Trap16InitEx(bool f386Plus)
}
-BS3_DECL(void) Bs3Trap16Init(void)
+#undef Bs3Trap16Init
+BS3_CMN_DEF(void, Bs3Trap16Init,(void))
{
- Bs3Trap16InitEx((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
+ BS3_CMN_NM(Bs3Trap16InitEx)((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c
index c673b617442..6daa99d7223 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c
@@ -1,6 +1,6 @@
/* $Id$ */
/** @file
- * BS3Kit - Bs3Trap32SetGate
+ * BS3Kit - Bs3Trap16SetGate
*/
/*
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3Trap16SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams)
+#undef Bs3Trap16SetGate
+BS3_CMN_DEF(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams))
{
X86DESC BS3_FAR *pIdte = &Bs3Idt16[iIdt];
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c
index 3c1348f6640..53a50dcad41 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c
@@ -37,7 +37,8 @@
extern uint32_t g_Bs3Trap32DoubleFaultHandlerFlatAddr;
-BS3_DECL(void) Bs3Trap32Init(void)
+#undef Bs3Trap32Init
+BS3_CMN_DEF(void, Bs3Trap32Init,(void))
{
X86TSS32 BS3_FAR *pTss;
unsigned iIdt;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c
index 73c1d1385ab..739bffac790 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3Trap32SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams)
+#undef Bs3Trap32SetGate
+BS3_CMN_DEF(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams))
{
X86DESC BS3_FAR *pIdte = &Bs3Idt32[iIdt];
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c
index 0d360e08fae..da5247836e1 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3Trap64Init(void)
+#undef Bs3Trap64Init
+BS3_CMN_DEF(void, Bs3Trap64Init,(void))
{
X86TSS64 BS3_FAR *pTss;
unsigned iIdt;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c
index 6a74f6bee26..1527f53801e 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3Trap64SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst)
+#undef Bs3Trap64SetGate
+BS3_CMN_DEF(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst))
{
X86DESC64 BS3_FAR *pIdte = &Bs3Idt64[iIdt];
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c
index 7c58af23f2c..8ffa2f6db69 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c
@@ -47,9 +47,11 @@ static void bs3TrapDefaultHandlerV8086Syscall(PBS3TRAPFRAME pTrapFrame)
if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_PRINT_CHR)
Bs3PrintChr(pTrapFrame->Ctx.rcx.u8);
else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_PRINT_STR)
- Bs3PrintStrN(Bs3XptrFlatToCurrent((pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16), pTrapFrame->Ctx.rdx.u16);
+ Bs3PrintStrN(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
+ pTrapFrame->Ctx.rdx.u16);
else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_RESTORE_CTX)
- Bs3RegCtxRestore(Bs3XptrFlatToCurrent((pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16), pTrapFrame->Ctx.rdx.u16);
+ Bs3RegCtxRestore(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
+ pTrapFrame->Ctx.rdx.u16);
else if ( pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING0
|| pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING1
|| pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING2
@@ -62,7 +64,8 @@ static void bs3TrapDefaultHandlerV8086Syscall(PBS3TRAPFRAME pTrapFrame)
}
#endif
-BS3_DECL(void) Bs3TrapDefaultHandler(PBS3TRAPFRAME pTrapFrame)
+#undef Bs3TrapDefaultHandler
+BS3_CMN_DEF(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame))
{
#if TMPL_BITS != 64
/*
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c
index ddc26ca2dc3..6d1f3805b6f 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3TrapPrintFrame(PCBS3TRAPFRAME pTrapFrame)
+#undef Bs3TrapPrintFrame
+BS3_CMN_DEF(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame))
{
#if 1
Bs3TestPrintf("Trap %#04x errcd=%#06RX64 at %04x:%016RX64 - test step %d (%#x)\n",
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c
new file mode 100644
index 00000000000..d1d022ac0af
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Data.c
@@ -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
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c
new file mode 100644
index 00000000000..e0dc6d63514
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c
@@ -0,0 +1,106 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Bs3TrapRmV86Init
+ */
+
+/*
+ * 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 *
+*********************************************************************************************************************************/
+/* We ASSUME that BS3CLASS16CODE is 64KB aligned, so the low 16-bit of the
+ flat address matches. Also, these symbols are defined both with
+ and without underscore prefixes. */
+extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16GenericEntries(void);
+
+/* These two are ugly. Need data access for patching purposes. */
+extern uint8_t BS3_FAR_DATA bs3Trap16GenericTrapOrInt[];
+
+/* bs3-cmn-TrapRmV86Data.c: */
+#define g_fBs3RmIvtCopied BS3_DATA_NM(g_fBs3RmIvtCopied)
+extern bool g_fBs3RmIvtCopied;
+
+
+#undef Bs3TrapRmV86InitEx
+BS3_CMN_DEF(void, Bs3TrapRmV86InitEx,(bool f386Plus))
+{
+ RTFAR16 BS3_FAR *paIvt = Bs3XptrFlatToCurrent(0);
+ unsigned iIvt;
+
+ /*
+ * Copy the real mode IVT the first time we are here.
+ */
+ if (!g_fBs3RmIvtCopied)
+ {
+ Bs3MemCpy(g_aBs3RmIvtOriginal, paIvt, sizeof(g_aBs3RmIvtOriginal));
+ g_fBs3RmIvtCopied = true;
+ }
+ /*
+ * The rest of the times, we copy back the original and modify it.
+ */
+ else
+ Bs3MemCpy(paIvt, g_aBs3RmIvtOriginal, sizeof(g_aBs3RmIvtOriginal));
+
+
+ /*
+ * If 386 or later, patch the trap handler code to not jump to the 80286
+ * code but continue with the next instruction (the 386+ code).
+ */
+ if (f386Plus)
+ {
+ uint8_t BS3_FAR_DATA *pbFunction = &bs3Trap16GenericTrapOrInt[0];
+#if ARCH_BITS == 16
+ if (g_bBs3CurrentMode != BS3_MODE_RM)
+ pbFunction = (uint8_t BS3_FAR_DATA *)BS3_FP_MAKE(BS3_SEL_TILED + 1, BS3_FP_OFF(pbFunction));
+#endif
+ pbFunction[1] = 0;
+ pbFunction[2] = 0;
+ }
+
+ /*
+ * Since we want to play with V86 mode as well as 8086 and 186 CPUs, we
+ * cannot move the IVT from its default location. So, modify it in place.
+ *
+ * Note! We must keep int 10h working, which is easy since the CPU does
+ * use it (well, it's been reserved for 30+ years).
+ */
+ for (iIvt = 0; iIvt < 256; iIvt++)
+ if (iIvt != 0x10 && iIvt != BS3_TRAP_SYSCALL)
+ {
+ paIvt[iIvt].off = (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIvt * 8;
+ paIvt[iIvt].sel = BS3_SEL_TEXT16;
+ }
+}
+
+
+#undef Bs3TrapRmV86InitEx
+BS3_CMN_DEF(void, Bs3TrapRmV86Init,(void))
+{
+ BS3_CMN_NM(Bs3TrapRmV86InitEx)((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
+}
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86SetGate.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86SetGate.c
new file mode 100644
index 00000000000..302c622b0c3
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86SetGate.c
@@ -0,0 +1,40 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Bs3TrapRmV86SetGate
+ */
+
+/*
+ * 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"
+
+
+#undef Bs3TrapRmV86SetGate
+BS3_CMN_DEF(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off))
+{
+ RTFAR16 BS3_FAR *paIvt = Bs3XptrFlatToCurrent(0);
+ paIvt[iIvt].off = off;
+ paIvt[iIvt].sel = uSeg;
+}
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c
index 604432fca06..1974428f3a6 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c
@@ -36,7 +36,8 @@
extern PFNBS3TRAPHANDLER BS3_DATA_NM(BS3_CMN_NM(g_apfnBs3TrapHandlers))[256];
-BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler)
+#undef Bs3TrapSetHandler
+BS3_CMN_DEF(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler))
{
PFNBS3TRAPHANDLER pfnOld = BS3_DATA_NM(BS3_CMN_NM(g_apfnBs3TrapHandlers))[iIdt];
BS3_DATA_NM(BS3_CMN_NM(g_apfnBs3TrapHandlers))[iIdt] = pfnHandler;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm
index 13f85c3b2ae..7713559902f 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm
@@ -36,7 +36,7 @@
;*********************************************************************************************************************************
BS3_EXTERN_CMN Bs3RegCtxSave
%if TMPL_BITS == 16
-BS3_EXTERN_CMN Bs3SelFar32ToFlat32
+BS3_EXTERN_CMN_FAR Bs3SelFar32ToFlat32
%endif
BS3_EXTERN_DATA16 g_Bs3TrapSetJmpCtx
BS3_EXTERN_DATA16 g_pBs3TrapSetJmpFrame
@@ -48,7 +48,7 @@ TMPL_BEGIN_TEXT
;
; @uses See, applicable C calling convention.
;
-BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
+BS3_PROC_BEGIN_CMN Bs3TrapSetJmp, BS3_PBC_HYBRID
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
@@ -70,9 +70,13 @@ BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
BS3_LEA_MOV_WRT_RIP(xBX, BS3_DATA16_WRT(g_Bs3TrapSetJmpCtx))
mov xAX, [xBP + xCB] ; The return address of this function
mov [xBX + BS3REGCTX.rip], xAX
+%if TMPL_BITS == 16
+ mov xAX, [xBP + xCB+2] ; The return address CS of this function.
+ mov [xBX + BS3REGCTX.cs], xAX
+%endif
mov xAX, [xBP]
mov [xBX + BS3REGCTX.rbp], xAX
- lea xAX, [xBP + xCB*2]
+ lea xAX, [xBP + xCB + cbCurRetAddr]
mov [xBX + BS3REGCTX.rsp], xAX
mov xAX, [xBP - xCB]
mov [xBX + BS3REGCTX.rbx], xAX
@@ -85,7 +89,7 @@ BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
push xDI
%if TMPL_BITS == 16
push es
- les di, [xBP + xCB*2]
+ les di, [xBP + xCB + cbCurRetAddr]
mov cx, BS3TRAPFRAME_size / 2
mov ax, 0faceh
rep stosw
@@ -103,9 +107,10 @@ BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
;
%if TMPL_BITS == 16
xor ax, ax
- push word [xBP + xCB*2 + 2]
+ push word [xBP + xCB + cbCurRetAddr + 2]
push ax
- push word [xBP + xCB*2]
+ push word [xBP + xCB + cbCurRetAddr]
+ push cs
call Bs3SelFar32ToFlat32
add sp, 6h
mov [BS3_DATA16_WRT(g_pBs3TrapSetJmpFrame)], ax
@@ -123,6 +128,6 @@ BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
pop xBX
pop xBP
BS3_CALL_CONV_EPILOG 1
- ret
+ BS3_HYBRID_RET
BS3_PROC_END_CMN Bs3TrapSetJmp
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c
index d149cf37e14..000a7b89503 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c
@@ -30,7 +30,8 @@
#include "bs3kit-template-header.h"
-BS3_DECL(void) Bs3TrapSetJmpAndRestore(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame)
+#undef Bs3TrapSetJmpAndRestore
+BS3_CMN_DEF(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame))
{
if (Bs3TrapSetJmp(pTrapFrame))
{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c
index 2021c25297f..234e0b10e09 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c
@@ -39,7 +39,8 @@
extern uint32_t g_pBs3TrapSetJmpFrame;
-BS3_DECL(void) Bs3TrapUnsetJmp(void)
+#undef Bs3TrapUnsetJmp
+BS3_CMN_DEF(void, Bs3TrapUnsetJmp,(void))
{
g_pBs3TrapSetJmpFrame = 0;
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c
index aa2c61aa062..f63a1cf1b24 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c
@@ -32,8 +32,8 @@
#include <iprt/uint32.h>
-
-void BS3_CMN_NM(Bs3UInt32Div)(RTUINT32U uDividend, RTUINT32U uDivisor, RTUINT32U BS3_FAR *paQuotientReminder)
+#undef Bs3UInt32Div
+BS3_CMN_DEF(void, Bs3UInt32Div,(RTUINT32U uDividend, RTUINT32U uDivisor, RTUINT32U BS3_FAR *paQuotientReminder))
{
RTUInt32DivRem(&paQuotientReminder[0], &paQuotientReminder[1], &uDividend, &uDivisor);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c
index a6c58eabc35..cf835f652b8 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c
@@ -32,8 +32,8 @@
#include <iprt/uint64.h>
-
-void BS3_CMN_NM(Bs3UInt64Div)(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder)
+#undef Bs3UInt64Div
+BS3_CMN_DEF(void, Bs3UInt64Div,(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder))
{
RTUInt64DivRem(&paQuotientReminder[0], &paQuotientReminder[1], &uDividend, &uDivisor);
}
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h
index e7653a35f70..8a21f3e9757 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h
@@ -99,10 +99,10 @@ extern char g_szBs3SubTest[64];
* @param uCmd The command.
* @param pszString The string.
*/
-BS3_DECL(void) bs3TestSendCmdWithStr_c16(uint32_t uCmd, const char BS3_FAR *pszString);
-BS3_DECL(void) bs3TestSendCmdWithStr_c32(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
-BS3_DECL(void) bs3TestSendCmdWithStr_c64(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
-#define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr) /**< Selects #bs3TestSendCmdWithStr_c16, #bs3TestSendCmdWithStr_c32 or #bs3TestSendCmdWithStr_c64. */
+#ifndef DOXYGEN_RUNNING
+# define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr)
+#endif
+BS3_DECL(void) bs3TestSendCmdWithStr(uint32_t uCmd, const char BS3_FAR *pszString);
/**
* Sends a command to VMMDev followed by a 32-bit unsigned integer value.
@@ -113,28 +113,28 @@ BS3_DECL(void) bs3TestSendCmdWithStr_c64(uint32_t uCmd, const char BS3_FAR *pszS
* @param uCmd The command.
* @param uValue The value.
*/
-BS3_DECL(void) bs3TestSendCmdWithU32_c16(uint32_t uCmd, uint32_t uValue);
-BS3_DECL(void) bs3TestSendCmdWithU32_c32(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
-BS3_DECL(void) bs3TestSendCmdWithU32_c64(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
-#define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32) /**< Selects #bs3TestSendCmdWithU32_c16, #bs3TestSendCmdWithU32_c32 or #bs3TestSendCmdWithU32_c64. */
+#ifndef DOXYGEN_RUNNING
+# define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32)
+#endif
+BS3_DECL(void) bs3TestSendCmdWithU32(uint32_t uCmd, uint32_t uValue);
/**
* Checks if the VMMDev is configured for testing.
*
* @returns true / false.
*/
-BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c16(void);
-BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c32(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
-BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c64(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
-#define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent) /**< Selects #bs3TestIsVmmDevTestingPresent_c16, #bs3TestIsVmmDevTestingPresent_c32 or #bs3TestIsVmmDevTestingPresent_c64. */
+#ifndef DOXYGEN_RUNNING
+# define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent)
+#endif
+BS3_DECL(bool) bs3TestIsVmmDevTestingPresent(void);
/**
* Similar to rtTestSubCleanup.
*/
-BS3_DECL(void) bs3TestSubCleanup_c16(void);
-BS3_DECL(void) bs3TestSubCleanup_c32(void); /**< @copydoc bs3TestSubCleanup_c16 */
-BS3_DECL(void) bs3TestSubCleanup_c64(void); /**< @copydoc bs3TestSubCleanup_c16 */
-#define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup) /**< Selects #bs3TestSubCleanup_c16, #bs3TestSubCleanup_c32 or #bs3TestSubCleanup_c64. */
+#ifndef DOXYGEN_RUNNING
+# define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup)
+#endif
+BS3_DECL(void) bs3TestSubCleanup(void);
/**
* @impl_callback_method{FNBS3STRFORMATOUTPUT,
@@ -142,10 +142,10 @@ BS3_DECL(void) bs3TestSubCleanup_c64(void); /**< @copydoc bs3TestSubCleanup_c16
*
* The @a pvUser parameter must point a BS3TESTFAILEDBUF structure. }
*/
-BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c16(char ch, void BS3_FAR *pvUser);
-BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c32(char ch, void BS3_FAR *pvUser);
-BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c64(char ch, void BS3_FAR *pvUser);
-#define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput) /**< Selects #bs3TestFailedStrOutput_c16, #bs3TestFailedStrOutput_c32 or #bs3TestFailedStrOutput_c64. */
+#ifndef DOXYGEN_RUNNING
+# define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput)
+#endif
+BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput(char ch, void BS3_FAR *pvUser);
/**
* Output buffering for bs3TestFailedStrOutput.
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac
index acea6825ef7..d2b1f9038aa 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac
@@ -64,19 +64,23 @@ BS3_BEGIN_TEXT16
.after_eye_catcher:
%ifdef ASM_FORMAT_ELF
-section BS3TEXT16_END align=2 progbits alloc exec nowrite
+section BS3TEXT16_NEARSTUBS align=1 progbits alloc exec nowrite
+section BS3TEXT16_FARSTUBS align=1 progbits alloc exec nowrite
+section BS3TEXT16_END align=1 progbits alloc exec nowrite
%else
-section _TEXT align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
-section BS3TEXT16_END align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
+section _TEXT align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
+section BS3TEXT16_NEARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
+section BS3TEXT16_FARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
+section BS3TEXT16_END align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
%endif
BS3_GLOBAL_DATA Bs3Text16_EndOfSegment, 0
%ifndef ASM_FORMAT_ELF
%ifndef BS3_IS_DOS_EXE
-GROUP CGROUP16 BS3TEXT16 BS3TEXT16_END
+GROUP CGROUP16 BS3TEXT16 _TEXT BS3TEXT16_NEARSTUBS BS3TEXT16_FARSTUBS BS3TEXT16_END
%else
-GROUP CGROUP16 BEGTEXT BS3TEXT16 _TEXT BS3TEXT16_END
+GROUP CGROUP16 BEGTEXT BS3TEXT16 _TEXT BS3TEXT16_NEARSTUBS BS3TEXT16_FARSTUBS BS3TEXT16_END
%endif
%endif
@@ -147,6 +151,27 @@ GROUP BS3KIT_GRPNM_DATA16 \
%endif
%endif
+;
+; 16-bit real-mode text
+;
+%ifdef ASM_FORMAT_ELF
+section BS3RMTEXT16_START align=16 progbits alloc exec nowrite
+%else
+section BS3RMTEXT16_START align=16 CLASS=BS3CLASS16RMCODE PUBLIC USE16
+%endif
+BS3_GLOBAL_DATA Bs3RmText16_StartOfSegment, 0
+ db 10,13,'eye-catcher: BS3RMTEXT16',10,13
+
+BS3_BEGIN_RMTEXT16
+
+%ifdef ASM_FORMAT_ELF
+section BS3RMTEXT16_END align=1 progbits alloc exec nowrite
+%else
+section BS3RMTEXT16_END align=1 CLASS=BS3CLASS16RMCODE PUBLIC USE16
+%endif
+
+BS3_GLOBAL_DATA Bs3RmText16_EndOfSegment, 0
+
;
; 32-bit text
@@ -160,7 +185,6 @@ section BS3TEXT32_END align=1 progbits alloc exec nowrite
%else
section BS3TEXT32_END align=1 CLASS=BS3CLASS32CODE PUBLIC USE32 FLAT
%endif
-
BS3_GLOBAL_DATA Bs3Text32_EndOfSegment, 0
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm
index f0d6e13c822..f816abec393 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm
@@ -261,9 +261,7 @@ BS3_PROC_BEGIN_MODE Bs3EnteredMode
int3
.return_stack_ok:
%endif
- leave
+ pop xBP
ret
-.dbg_str:
- db 'CurrentMode=%#x', 0ah, 0
BS3_PROC_END_MODE Bs3EnteredMode
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c
index 743ad1428b9..73eff593d8e 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c
@@ -28,10 +28,15 @@
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
+//#define BS3_USE_RM_TEXT_SEG 1
#include "bs3kit-template-header.h"
#include "bs3-cmn-test.h"
#include <iprt/asm-amd64-x86.h>
+//#ifdef __WATCOMC__
+//# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
+//#endif
+
BS3_DECL(void) Bs3InitAll_rm(void)
{
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c
index 587ceea5abf..d2b9647ec2a 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c
@@ -27,10 +27,15 @@
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
+#define BS3_USE_RM_TEXT_SEG 1
#include "bs3kit-template-header.h"
#include "bs3-cmn-memory.h"
#include <iprt/asm.h>
+#ifdef __WATCOMC__
+# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
+#endif
+
/*********************************************************************************************************************************
* Structures and Typedefs *
@@ -233,7 +238,7 @@ static void bs3InitMemoryAddRange(uint32_t uRange, uint32_t cbRange)
}
-BS3_DECL(void) Bs3InitMemory_rm(void)
+BS3_DECL(void) BS3_FAR_CODE Bs3InitMemory_rm(void)
{
uint16_t i;
uint16_t cPages;
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
new file mode 100644
index 00000000000..c4ca5ed9a79
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
@@ -0,0 +1,110 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Function needing mangling.
+ */
+
+/*
+ * 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.
+ */
+
+
+#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 Bs3SelProtFar32ToFlat32 BS3_CMN_MANGLER(Bs3SelProtFar32ToFlat32)
+#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)
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
new file mode 100644
index 00000000000..cb4f3d12df7
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
@@ -0,0 +1,109 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Undefining function mangling - automatically generated by bs3kit-mangling-functions-undef.h in Makefile.
+ */
+
+/*
+ * 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.
+ */
+
+
+#undef Bs3A20Disable
+#undef Bs3A20DisableViaKbd
+#undef Bs3A20DisableViaPortA
+#undef Bs3A20Enable
+#undef Bs3A20EnableViaKbd
+#undef Bs3A20EnableViaPortA
+#undef Bs3KbdRead
+#undef Bs3KbdWait
+#undef Bs3KbdWrite
+#undef Bs3MemAlloc
+#undef Bs3MemAllocZ
+#undef Bs3MemCpy
+#undef Bs3MemFree
+#undef Bs3MemMove
+#undef Bs3MemPCpy
+#undef Bs3MemZero
+#undef Bs3PagingInitRootForLM
+#undef Bs3PagingInitRootForPAE
+#undef Bs3PagingInitRootForPP
+#undef Bs3PagingProtect
+#undef Bs3PagingProtectPtr
+#undef Bs3Panic
+#undef Bs3PicMaskAll
+#undef Bs3PrintChr
+#undef Bs3Printf
+#undef Bs3PrintfV
+#undef Bs3PrintStr
+#undef Bs3PrintStrN
+#undef Bs3PrintU32
+#undef Bs3PrintX32
+#undef Bs3RegCtxConvertToRingX
+#undef Bs3RegCtxPrint
+#undef Bs3RegCtxRestore
+#undef Bs3RegCtxSave
+#undef Bs3SelFar32ToFlat32
+#undef Bs3SelProtFar32ToFlat32
+#undef Bs3Shutdown
+#undef Bs3SlabAlloc
+#undef Bs3SlabAllocEx
+#undef Bs3SlabFree
+#undef Bs3SlabInit
+#undef Bs3SlabListAdd
+#undef Bs3SlabListAlloc
+#undef Bs3SlabListAllocEx
+#undef Bs3SlabListFree
+#undef Bs3SlabListInit
+#undef Bs3StrCpy
+#undef Bs3StrFormatV
+#undef Bs3StrLen
+#undef Bs3StrNLen
+#undef Bs3StrPrintf
+#undef Bs3StrPrintfV
+#undef Bs3TestCheckRegCtxEx
+#undef Bs3TestFailed
+#undef Bs3TestFailedF
+#undef Bs3TestFailedV
+#undef Bs3TestInit
+#undef Bs3TestPrintf
+#undef Bs3TestPrintfV
+#undef Bs3TestSkipped
+#undef Bs3TestSkippedF
+#undef Bs3TestSkippedV
+#undef Bs3TestSub
+#undef Bs3TestSubDone
+#undef Bs3TestSubErrorCount
+#undef Bs3TestSubF
+#undef Bs3TestSubV
+#undef Bs3TestTerm
+#undef Bs3Trap16Init
+#undef Bs3Trap16InitEx
+#undef Bs3Trap16SetGate
+#undef Bs3Trap32Init
+#undef Bs3Trap32SetGate
+#undef Bs3Trap64Init
+#undef Bs3Trap64SetGate
+#undef Bs3TrapDefaultHandler
+#undef Bs3TrapPrintFrame
+#undef Bs3TrapRmV86SetGate
+#undef Bs3TrapSetHandler
+#undef Bs3TrapSetJmpAndRestore
+#undef Bs3TrapUnsetJmp
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h
new file mode 100644
index 00000000000..cac6418002a
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h
@@ -0,0 +1,39 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Symbol mangling, code.
+ */
+
+/*
+ * 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.
+ */
+
+
+/*
+ * Do function mangling. This can be redone at compile time (templates).
+ */
+#undef BS3_CMN_MANGLER
+#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
+# define BS3_CMN_MANGLER(a_Function) BS3_CMN_NM(a_Function)
+#else
+# define BS3_CMN_MANGLER(a_Function) BS3_CMN_FAR_NM(a_Function)
+#endif
+#include "bs3kit-mangling-code-undef.h"
+#include "bs3kit-mangling-code-define.h"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-data.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-data.h
new file mode 100644
index 00000000000..4ec5077193b
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-data.h
@@ -0,0 +1,253 @@
+/* $Id$ */
+/** @file
+ * BS3Kit - Symbol mangling.
+ */
+
+/*
+ * 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.
+ */
+
+
+/*
+ * First part is only applied once. It concerns itself with data symbols.
+ */
+#ifndef ___bs3kit_mangling_data_h
+#define ___bs3kit_mangling_data_h
+
+#if ARCH_BITS == 64
+
+# define Bs3Gdt BS3_DATA_NM(Bs3Gdt)
+# define Bs3Gdt_Ldt BS3_DATA_NM(Bs3Gdt_Ldt)
+# define Bs3Gdte_Tss16 BS3_DATA_NM(Bs3Gdte_Tss16)
+# define Bs3Gdte_Tss16DoubleFault BS3_DATA_NM(Bs3Gdte_Tss16DoubleFault)
+# define Bs3Gdte_Tss16Spare0 BS3_DATA_NM(Bs3Gdte_Tss16Spare0)
+# define Bs3Gdte_Tss16Spare1 BS3_DATA_NM(Bs3Gdte_Tss16Spare1)
+# define Bs3Gdte_Tss32 BS3_DATA_NM(Bs3Gdte_Tss32)
+# define Bs3Gdte_Tss32DoubleFault BS3_DATA_NM(Bs3Gdte_Tss32DoubleFault)
+# define Bs3Gdte_Tss32Spare0 BS3_DATA_NM(Bs3Gdte_Tss32Spare0)
+# define Bs3Gdte_Tss32Spare1 BS3_DATA_NM(Bs3Gdte_Tss32Spare1)
+# define Bs3Gdte_Tss32IobpIntRedirBm BS3_DATA_NM(Bs3Gdte_Tss32IobpIntRedirBm)
+# define Bs3Gdte_Tss32IntRedirBm BS3_DATA_NM(Bs3Gdte_Tss32IntRedirBm)
+# define Bs3Gdte_Tss64 BS3_DATA_NM(Bs3Gdte_Tss64)
+# define Bs3Gdte_Tss64Spare0 BS3_DATA_NM(Bs3Gdte_Tss64Spare0)
+# define Bs3Gdte_Tss64Spare1 BS3_DATA_NM(Bs3Gdte_Tss64Spare1)
+# define Bs3Gdte_Tss64Iobp BS3_DATA_NM(Bs3Gdte_Tss64Iobp)
+# define Bs3Gdte_R0_MMIO16 BS3_DATA_NM(Bs3Gdte_R0_MMIO16)
+
+# define Bs3Gdte_R0_First BS3_DATA_NM(Bs3Gdte_R0_First)
+# define Bs3Gdte_R0_CS16 BS3_DATA_NM(Bs3Gdte_R0_CS16)
+# define Bs3Gdte_R0_DS16 BS3_DATA_NM(Bs3Gdte_R0_DS16)
+# define Bs3Gdte_R0_SS16 BS3_DATA_NM(Bs3Gdte_R0_SS16)
+# define Bs3Gdte_R0_CS32 BS3_DATA_NM(Bs3Gdte_R0_CS32)
+# define Bs3Gdte_R0_DS32 BS3_DATA_NM(Bs3Gdte_R0_DS32)
+# define Bs3Gdte_R0_SS32 BS3_DATA_NM(Bs3Gdte_R0_SS32)
+# define Bs3Gdte_R0_CS64 BS3_DATA_NM(Bs3Gdte_R0_CS64)
+# define Bs3Gdte_R0_DS64 BS3_DATA_NM(Bs3Gdte_R0_DS64)
+# define Bs3Gdte_R0_CS16_EO BS3_DATA_NM(Bs3Gdte_R0_CS16_EO)
+# define Bs3Gdte_R0_CS16_CNF BS3_DATA_NM(Bs3Gdte_R0_CS16_CNF)
+# define Bs3Gdte_R0_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R0_CS16_CND_EO)
+# define Bs3Gdte_R0_CS32_EO BS3_DATA_NM(Bs3Gdte_R0_CS32_EO)
+# define Bs3Gdte_R0_CS32_CNF BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF)
+# define Bs3Gdte_R0_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF_EO)
+# define Bs3Gdte_R0_CS64_EO BS3_DATA_NM(Bs3Gdte_R0_CS64_EO)
+# define Bs3Gdte_R0_CS64_CNF BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF)
+# define Bs3Gdte_R0_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF_EO)
+
+# define Bs3Gdte_R1_First BS3_DATA_NM(Bs3Gdte_R1_First)
+# define Bs3Gdte_R1_CS16 BS3_DATA_NM(Bs3Gdte_R1_CS16)
+# define Bs3Gdte_R1_DS16 BS3_DATA_NM(Bs3Gdte_R1_DS16)
+# define Bs3Gdte_R1_SS16 BS3_DATA_NM(Bs3Gdte_R1_SS16)
+# define Bs3Gdte_R1_CS32 BS3_DATA_NM(Bs3Gdte_R1_CS32)
+# define Bs3Gdte_R1_DS32 BS3_DATA_NM(Bs3Gdte_R1_DS32)
+# define Bs3Gdte_R1_SS32 BS3_DATA_NM(Bs3Gdte_R1_SS32)
+# define Bs3Gdte_R1_CS64 BS3_DATA_NM(Bs3Gdte_R1_CS64)
+# define Bs3Gdte_R1_DS64 BS3_DATA_NM(Bs3Gdte_R1_DS64)
+# define Bs3Gdte_R1_CS16_EO BS3_DATA_NM(Bs3Gdte_R1_CS16_EO)
+# define Bs3Gdte_R1_CS16_CNF BS3_DATA_NM(Bs3Gdte_R1_CS16_CNF)
+# define Bs3Gdte_R1_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R1_CS16_CND_EO)
+# define Bs3Gdte_R1_CS32_EO BS3_DATA_NM(Bs3Gdte_R1_CS32_EO)
+# define Bs3Gdte_R1_CS32_CNF BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF)
+# define Bs3Gdte_R1_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF_EO)
+# define Bs3Gdte_R1_CS64_EO BS3_DATA_NM(Bs3Gdte_R1_CS64_EO)
+# define Bs3Gdte_R1_CS64_CNF BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF)
+# define Bs3Gdte_R1_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF_EO)
+
+# define Bs3Gdte_R2_First BS3_DATA_NM(Bs3Gdte_R2_First)
+# define Bs3Gdte_R2_CS16 BS3_DATA_NM(Bs3Gdte_R2_CS16)
+# define Bs3Gdte_R2_DS16 BS3_DATA_NM(Bs3Gdte_R2_DS16)
+# define Bs3Gdte_R2_SS16 BS3_DATA_NM(Bs3Gdte_R2_SS16)
+# define Bs3Gdte_R2_CS32 BS3_DATA_NM(Bs3Gdte_R2_CS32)
+# define Bs3Gdte_R2_DS32 BS3_DATA_NM(Bs3Gdte_R2_DS32)
+# define Bs3Gdte_R2_SS32 BS3_DATA_NM(Bs3Gdte_R2_SS32)
+# define Bs3Gdte_R2_CS64 BS3_DATA_NM(Bs3Gdte_R2_CS64)
+# define Bs3Gdte_R2_DS64 BS3_DATA_NM(Bs3Gdte_R2_DS64)
+# define Bs3Gdte_R2_CS16_EO BS3_DATA_NM(Bs3Gdte_R2_CS16_EO)
+# define Bs3Gdte_R2_CS16_CNF BS3_DATA_NM(Bs3Gdte_R2_CS16_CNF)
+# define Bs3Gdte_R2_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R2_CS16_CND_EO)
+# define Bs3Gdte_R2_CS32_EO BS3_DATA_NM(Bs3Gdte_R2_CS32_EO)
+# define Bs3Gdte_R2_CS32_CNF BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF)
+# define Bs3Gdte_R2_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF_EO)
+# define Bs3Gdte_R2_CS64_EO BS3_DATA_NM(Bs3Gdte_R2_CS64_EO)
+# define Bs3Gdte_R2_CS64_CNF BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF)
+# define Bs3Gdte_R2_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF_EO)
+
+# define Bs3Gdte_R3_First BS3_DATA_NM(Bs3Gdte_R3_First)
+# define Bs3Gdte_R3_CS16 BS3_DATA_NM(Bs3Gdte_R3_CS16)
+# define Bs3Gdte_R3_DS16 BS3_DATA_NM(Bs3Gdte_R3_DS16)
+# define Bs3Gdte_R3_SS16 BS3_DATA_NM(Bs3Gdte_R3_SS16)
+# define Bs3Gdte_R3_CS32 BS3_DATA_NM(Bs3Gdte_R3_CS32)
+# define Bs3Gdte_R3_DS32 BS3_DATA_NM(Bs3Gdte_R3_DS32)
+# define Bs3Gdte_R3_SS32 BS3_DATA_NM(Bs3Gdte_R3_SS32)
+# define Bs3Gdte_R3_CS64 BS3_DATA_NM(Bs3Gdte_R3_CS64)
+# define Bs3Gdte_R3_DS64 BS3_DATA_NM(Bs3Gdte_R3_DS64)
+# define Bs3Gdte_R3_CS16_EO BS3_DATA_NM(Bs3Gdte_R3_CS16_EO)
+# define Bs3Gdte_R3_CS16_CNF BS3_DATA_NM(Bs3Gdte_R3_CS16_CNF)
+# define Bs3Gdte_R3_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R3_CS16_CND_EO)
+# define Bs3Gdte_R3_CS32_EO BS3_DATA_NM(Bs3Gdte_R3_CS32_EO)
+# define Bs3Gdte_R3_CS32_CNF BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF)
+# define Bs3Gdte_R3_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF_EO)
+# define Bs3Gdte_R3_CS64_EO BS3_DATA_NM(Bs3Gdte_R3_CS64_EO)
+# define Bs3Gdte_R3_CS64_CNF BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF)
+# define Bs3Gdte_R3_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF_EO)
+
+# define Bs3GdteSpare00 BS3_DATA_NM(Bs3GdteSpare00)
+# define Bs3GdteSpare01 BS3_DATA_NM(Bs3GdteSpare01)
+# define Bs3GdteSpare02 BS3_DATA_NM(Bs3GdteSpare02)
+# define Bs3GdteSpare03 BS3_DATA_NM(Bs3GdteSpare03)
+# define Bs3GdteSpare04 BS3_DATA_NM(Bs3GdteSpare04)
+# define Bs3GdteSpare05 BS3_DATA_NM(Bs3GdteSpare05)
+# define Bs3GdteSpare06 BS3_DATA_NM(Bs3GdteSpare06)
+# define Bs3GdteSpare07 BS3_DATA_NM(Bs3GdteSpare07)
+# define Bs3GdteSpare08 BS3_DATA_NM(Bs3GdteSpare08)
+# define Bs3GdteSpare09 BS3_DATA_NM(Bs3GdteSpare09)
+# define Bs3GdteSpare0a BS3_DATA_NM(Bs3GdteSpare0a)
+# define Bs3GdteSpare0b BS3_DATA_NM(Bs3GdteSpare0b)
+# define Bs3GdteSpare0c BS3_DATA_NM(Bs3GdteSpare0c)
+# define Bs3GdteSpare0d BS3_DATA_NM(Bs3GdteSpare0d)
+# define Bs3GdteSpare0e BS3_DATA_NM(Bs3GdteSpare0e)
+# define Bs3GdteSpare0f BS3_DATA_NM(Bs3GdteSpare0f)
+# define Bs3GdteSpare10 BS3_DATA_NM(Bs3GdteSpare10)
+# define Bs3GdteSpare11 BS3_DATA_NM(Bs3GdteSpare11)
+# define Bs3GdteSpare12 BS3_DATA_NM(Bs3GdteSpare12)
+# define Bs3GdteSpare13 BS3_DATA_NM(Bs3GdteSpare13)
+# define Bs3GdteSpare14 BS3_DATA_NM(Bs3GdteSpare14)
+# define Bs3GdteSpare15 BS3_DATA_NM(Bs3GdteSpare15)
+# define Bs3GdteSpare16 BS3_DATA_NM(Bs3GdteSpare16)
+# define Bs3GdteSpare17 BS3_DATA_NM(Bs3GdteSpare17)
+# define Bs3GdteSpare18 BS3_DATA_NM(Bs3GdteSpare18)
+# define Bs3GdteSpare19 BS3_DATA_NM(Bs3GdteSpare19)
+# define Bs3GdteSpare1a BS3_DATA_NM(Bs3GdteSpare1a)
+# define Bs3GdteSpare1b BS3_DATA_NM(Bs3GdteSpare1b)
+# define Bs3GdteSpare1c BS3_DATA_NM(Bs3GdteSpare1c)
+# define Bs3GdteSpare1d BS3_DATA_NM(Bs3GdteSpare1d)
+# define Bs3GdteSpare1e BS3_DATA_NM(Bs3GdteSpare1e)
+# define Bs3GdteSpare1f BS3_DATA_NM(Bs3GdteSpare1f)
+
+# define Bs3GdteTiled BS3_DATA_NM(Bs3GdteTiled)
+# define Bs3GdteFreePart1 BS3_DATA_NM(Bs3GdteFreePart1)
+# define Bs3Gdte_CODE16 BS3_DATA_NM(Bs3Gdte_CODE16)
+# define Bs3GdteFreePart2 BS3_DATA_NM(Bs3GdteFreePart2)
+# define Bs3Gdte_SYSTEM16 BS3_DATA_NM(Bs3Gdte_SYSTEM16)
+# define Bs3GdteFreePart3 BS3_DATA_NM(Bs3GdteFreePart3)
+# define Bs3Gdte_DATA16 BS3_DATA_NM(Bs3Gdte_DATA16)
+
+# define Bs3GdteFreePart4 BS3_DATA_NM(Bs3GdteFreePart4)
+# define Bs3GdtePreTestPage08 BS3_DATA_NM(Bs3GdtePreTestPage08)
+# define Bs3GdtePreTestPage07 BS3_DATA_NM(Bs3GdtePreTestPage07)
+# define Bs3GdtePreTestPage06 BS3_DATA_NM(Bs3GdtePreTestPage06)
+# define Bs3GdtePreTestPage05 BS3_DATA_NM(Bs3GdtePreTestPage05)
+# define Bs3GdtePreTestPage04 BS3_DATA_NM(Bs3GdtePreTestPage04)
+# define Bs3GdtePreTestPage03 BS3_DATA_NM(Bs3GdtePreTestPage03)
+# define Bs3GdtePreTestPage02 BS3_DATA_NM(Bs3GdtePreTestPage02)
+# define Bs3GdtePreTestPage01 BS3_DATA_NM(Bs3GdtePreTestPage01)
+# define Bs3GdteTestPage BS3_DATA_NM(Bs3GdteTestPage)
+# define Bs3GdteTestPage00 BS3_DATA_NM(Bs3GdteTestPage00)
+# define Bs3GdteTestPage01 BS3_DATA_NM(Bs3GdteTestPage01)
+# define Bs3GdteTestPage02 BS3_DATA_NM(Bs3GdteTestPage02)
+# define Bs3GdteTestPage03 BS3_DATA_NM(Bs3GdteTestPage03)
+# define Bs3GdteTestPage04 BS3_DATA_NM(Bs3GdteTestPage04)
+# define Bs3GdteTestPage05 BS3_DATA_NM(Bs3GdteTestPage05)
+# define Bs3GdteTestPage06 BS3_DATA_NM(Bs3GdteTestPage06)
+# define Bs3GdteTestPage07 BS3_DATA_NM(Bs3GdteTestPage07)
+
+# define Bs3GdtEnd BS3_DATA_NM(Bs3GdtEnd)
+
+# define Bs3Tss16 BS3_DATA_NM(Bs3Tss16)
+# define Bs3Tss16DoubleFault BS3_DATA_NM(Bs3Tss16DoubleFault)
+# define Bs3Tss16Spare0 BS3_DATA_NM(Bs3Tss16Spare0)
+# define Bs3Tss16Spare1 BS3_DATA_NM(Bs3Tss16Spare1)
+# define Bs3Tss32 BS3_DATA_NM(Bs3Tss32)
+# define Bs3Tss32DoubleFault BS3_DATA_NM(Bs3Tss32DoubleFault)
+# define Bs3Tss32Spare0 BS3_DATA_NM(Bs3Tss32Spare0)
+# define Bs3Tss32Spare1 BS3_DATA_NM(Bs3Tss32Spare1)
+# define Bs3Tss64 BS3_DATA_NM(Bs3Tss64)
+# define Bs3Tss64Spare0 BS3_DATA_NM(Bs3Tss64Spare0)
+# define Bs3Tss64Spare1 BS3_DATA_NM(Bs3Tss64Spare1)
+# define Bs3Tss64WithIopb BS3_DATA_NM(Bs3Tss64WithIopb)
+# define Bs3Tss32WithIopb BS3_DATA_NM(Bs3Tss32WithIopb)
+# define Bs3SharedIntRedirBm BS3_DATA_NM(Bs3SharedIntRedirBm)
+# define Bs3SharedIobp BS3_DATA_NM(Bs3SharedIobp)
+# define Bs3SharedIobpEnd BS3_DATA_NM(Bs3SharedIobpEnd)
+# define Bs3Idt16 BS3_DATA_NM(Bs3Idt16)
+# define Bs3Idt32 BS3_DATA_NM(Bs3Idt32)
+# define Bs3Idt64 BS3_DATA_NM(Bs3Idt64)
+# define Bs3Lidt_Idt16 BS3_DATA_NM(Bs3Lidt_Idt16)
+# define Bs3Lidt_Idt32 BS3_DATA_NM(Bs3Lidt_Idt32)
+# define Bs3Lidt_Idt64 BS3_DATA_NM(Bs3Lidt_Idt64)
+# define Bs3Lidt_Ivt BS3_DATA_NM(Bs3Lidt_Ivt)
+# define Bs3Lgdt_Gdt BS3_DATA_NM(Bs3Lgdt_Gdt)
+# define Bs3Ldt BS3_DATA_NM(Bs3Ldt)
+# define Bs3LdtEnd BS3_DATA_NM(Bs3LdtEnd)
+
+# define Bs3Text16_StartOfSegment BS3_DATA_NM(Bs3Text16_StartOfSegment)
+# define Bs3Text16_EndOfSegment BS3_DATA_NM(Bs3Text16_EndOfSegment)
+# define Bs3Text16_Size BS3_DATA_NM(Bs3Text16_Size)
+# define Bs3System16_StartOfSegment BS3_DATA_NM(Bs3System16_StartOfSegment)
+# define Bs3System16_EndOfSegment BS3_DATA_NM(Bs3System16_EndOfSegment)
+# define Bs3Data16_StartOfSegment BS3_DATA_NM(Bs3Data16_StartOfSegment)
+# define Bs3Data16_EndOfSegment BS3_DATA_NM(Bs3Data16_EndOfSegment)
+# define Bs3Text32_StartOfSegment BS3_DATA_NM(Bs3Text32_StartOfSegment)
+# define Bs3Text32_EndOfSegment BS3_DATA_NM(Bs3Text32_EndOfSegment)
+# define Bs3Data32_StartOfSegment BS3_DATA_NM(Bs3Data32_StartOfSegment)
+# define Bs3Data32_EndOfSegment BS3_DATA_NM(Bs3Data32_EndOfSegment)
+# define Bs3Text64_StartOfSegment BS3_DATA_NM(Bs3Text64_StartOfSegment)
+# define Bs3Text64_EndOfSegment BS3_DATA_NM(Bs3Text64_EndOfSegment)
+# define Bs3Data64_StartOfSegment BS3_DATA_NM(Bs3Data64_StartOfSegment)
+# define Bs3Data64_EndOfSegment BS3_DATA_NM(Bs3Data64_EndOfSegment)
+
+# define Bs3Data16Thru64Text32And64_TotalSize BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize)
+# define Bs3TotalImageSize BS3_DATA_NM(Bs3TotalImageSize)
+# define g_achBs3HexDigits BS3_DATA_NM(g_achBs3HexDigits)
+# define g_achBs3HexDigitsUpper BS3_DATA_NM(g_achBs3HexDigitsUpper)
+# define g_bBs3CurrentMode BS3_DATA_NM(g_bBs3CurrentMode)
+# define g_uBs3TrapEipHint BS3_DATA_NM(g_uBs3TrapEipHint)
+# define g_aBs3RmIvtOriginal BS3_DATA_NM(g_aBs3RmIvtOriginal)
+
+# define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
+# define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
+# define g_Bs3Trap16GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap16GenericEntriesFlatAddr)
+# define g_Bs3Trap32GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap32GenericEntriesFlatAddr)
+# define g_Bs3Trap64GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap64GenericEntriesFlatAddr)
+
+# define g_uBs3CpuDetected BS3_DATA_NM(g_uBs3CpuDetected)
+
+#endif /* ARCH_BITS == 64 */
+#endif /* !___bs3kit_mangling_data_h */
+
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h
index d9ecf47d451..30e01a84470 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h
@@ -137,7 +137,8 @@
#else /* !DOXYGEN_RUNNING */
-#undef BS3_CMN_NM
+//#undef BS3_CMN_NM
+//#undef BS3_CMN_FAR_NM
/*
@@ -204,7 +205,9 @@
# define TMPL_16BIT
# define TMPL_BITS 16
# define TMPL_UNDERSCORE _
-# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
+//# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
+//# define BS3_CMN_FAR_NM(Name) RT_CONCAT(Name,_f16)
+
#elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_32
# if ARCH_BITS != 32
@@ -213,7 +216,8 @@
# define TMPL_32BIT
# define TMPL_BITS 32
# define TMPL_UNDERSCORE _
-# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
+//# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
+//# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(Name,_c32)
#elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_V86
# if ARCH_BITS != 16
@@ -222,7 +226,8 @@
# define TMPL_16BIT
# define TMPL_BITS 16
# define TMPL_UNDERSCORE _
-# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
+//# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
+//# define BS3_CMN_FAR_NM(Name) RT_CONCAT(Name,_f16)
# define TMPL_CMN_R86
# define TMPL_CMN_V86
@@ -233,7 +238,8 @@
# define TMPL_64BIT
# define TMPL_BITS 64
# define TMPL_UNDERSCORE
-# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c64)
+//# define BS3_CMN_NM(Name) RT_CONCAT(Name,_c64)
+//# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(Name,_c64)
#else
# error "Invalid TMPL_MODE value!"
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
index d7605754d14..f5592a06b1b 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
@@ -54,11 +54,20 @@
* BS3_CMN_NM yet, as we need to include IPRT headers with function
* declarations before we can define it. Thus the duplciate effort.)
*/
-#define RT_MANGLER(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
+#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
+# define RT_MANGLER(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
+#else
+# define RT_MANGLER(a_Name) RT_CONCAT(a_Name,_f16)
+#endif
#include <iprt/mangling.h>
#include <iprt/x86.h>
#include <iprt/err.h>
+/*
+ * Include data symbol mangling (function mangling/mapping must be done
+ * after the protypes).
+ */
+#include "bs3kit-mangling-data.h"
RT_C_DECLS_BEGIN
@@ -491,15 +500,39 @@ RT_C_DECLS_BEGIN
#endif
/** @def BS3_DECL
- * Declares a BS3Kit function.
+ * Declares a BS3Kit function with default far/near.
+ *
+ * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
+ *
+ * @param a_Type The return type. */
+#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
+# define BS3_DECL(a_Type) BS3_DECL_NEAR(a_Type)
+#else
+# define BS3_DECL(a_Type) BS3_DECL_FAR(a_Type)
+#endif
+
+/** @def BS3_DECL_NEAR
+ * Declares a BS3Kit function, always near everywhere.
*
* Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
*
* @param a_Type The return type. */
#ifdef IN_BS3KIT
-# define BS3_DECL(a_Type) DECLEXPORT(a_Type) BS3_NEAR_CODE BS3_CALL
+# define BS3_DECL_NEAR(a_Type) DECLEXPORT(a_Type) BS3_NEAR_CODE BS3_CALL
#else
-# define BS3_DECL(a_Type) DECLIMPORT(a_Type) BS3_NEAR_CODE BS3_CALL
+# define BS3_DECL_NEAR(a_Type) DECLIMPORT(a_Type) BS3_NEAR_CODE BS3_CALL
+#endif
+
+/** @def BS3_DECL_FAR
+ * Declares a BS3Kit function, far 16-bit, otherwise near.
+ *
+ * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
+ *
+ * @param a_Type The return type. */
+#ifdef IN_BS3KIT
+# define BS3_DECL_FAR(a_Type) DECLEXPORT(a_Type) BS3_FAR_CODE BS3_CALL
+#else
+# define BS3_DECL_FAR(a_Type) DECLIMPORT(a_Type) BS3_FAR_CODE BS3_CALL
#endif
/** @def BS3_DECL_CALLBACK
@@ -520,18 +553,53 @@ RT_C_DECLS_BEGIN
* Example: BS3_CMN_NM(Bs3Shutdown)
*
* @param a_Name The name of the function or global variable.
+ * @todo fix code vs data issue with _f16
+ */
+#define BS3_CMN_NM(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
+
+/**
+ * Constructs a common function name, far in 16-bit code.
+ *
+ * Example: BS3_CMN_FAR_NM(Bs3Shutdown)
+ *
+ * @param a_Name The name of the function.
*/
-#define BS3_CMN_NM(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
+#if ARCH_BITS == 16
+# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(a_Name,_f16)
+#else
+# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
+#endif
+
+/**
+ * Constructs a common function name, far or near as defined by the source.
+ *
+ * Which to use in 16-bit mode is defined by BS3_USE_RM_TEXT_SEG. In 32-bit and
+ * 64-bit mode there are no far symbols, only near ones.
+ *
+ * Example: BS3_CMN_FN_NM(Bs3Shutdown)
+ *
+ * @param a_Name The name of the function.
+ */
+#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
+# define BS3_CMN_FN_NM(a_Name) BS3_CMN_NM(a_Name)
+#else
+# define BS3_CMN_FN_NM(a_Name) BS3_CMN_FAR_NM(a_Name)
+#endif
+
/**
* Constructs a data name.
*
+ * This glosses over the underscore prefix usage of our 16-bit, 32-bit and
+ * 64-bit compilers.
+ *
* Example: @code{.c}
* \#define Bs3Gdt BS3_DATA_NM(Bs3Gdt)
* extern X86DESC BS3_FAR_DATA Bs3Gdt
* @endcode
*
* @param a_Name The name of the global variable.
+ * @remarks Mainly used in bs3kit-mangling.h, internal headers and templates.
*/
#if ARCH_BITS == 64
# define BS3_DATA_NM(a_Name) RT_CONCAT(_,a_Name)
@@ -617,191 +685,6 @@ BS3_PTR_UNION_TEMPLATE(BS3CVPTRUNION, const volatile);
/** @defgroup grp_bs3kit_system System structures
* @{ */
-#if ARCH_BITS == 64 && !defined(DOXYGEN_RUNNING)
-# define Bs3Gdt BS3_DATA_NM(Bs3Gdt)
-# define Bs3Gdt_Ldt BS3_DATA_NM(Bs3Gdt_Ldt)
-# define Bs3Gdte_Tss16 BS3_DATA_NM(Bs3Gdte_Tss16)
-# define Bs3Gdte_Tss16DoubleFault BS3_DATA_NM(Bs3Gdte_Tss16DoubleFault)
-# define Bs3Gdte_Tss16Spare0 BS3_DATA_NM(Bs3Gdte_Tss16Spare0)
-# define Bs3Gdte_Tss16Spare1 BS3_DATA_NM(Bs3Gdte_Tss16Spare1)
-# define Bs3Gdte_Tss32 BS3_DATA_NM(Bs3Gdte_Tss32)
-# define Bs3Gdte_Tss32DoubleFault BS3_DATA_NM(Bs3Gdte_Tss32DoubleFault)
-# define Bs3Gdte_Tss32Spare0 BS3_DATA_NM(Bs3Gdte_Tss32Spare0)
-# define Bs3Gdte_Tss32Spare1 BS3_DATA_NM(Bs3Gdte_Tss32Spare1)
-# define Bs3Gdte_Tss32IobpIntRedirBm BS3_DATA_NM(Bs3Gdte_Tss32IobpIntRedirBm)
-# define Bs3Gdte_Tss32IntRedirBm BS3_DATA_NM(Bs3Gdte_Tss32IntRedirBm)
-# define Bs3Gdte_Tss64 BS3_DATA_NM(Bs3Gdte_Tss64)
-# define Bs3Gdte_Tss64Spare0 BS3_DATA_NM(Bs3Gdte_Tss64Spare0)
-# define Bs3Gdte_Tss64Spare1 BS3_DATA_NM(Bs3Gdte_Tss64Spare1)
-# define Bs3Gdte_Tss64Iobp BS3_DATA_NM(Bs3Gdte_Tss64Iobp)
-# define Bs3Gdte_R0_MMIO16 BS3_DATA_NM(Bs3Gdte_R0_MMIO16)
-
-# define Bs3Gdte_R0_First BS3_DATA_NM(Bs3Gdte_R0_First)
-# define Bs3Gdte_R0_CS16 BS3_DATA_NM(Bs3Gdte_R0_CS16)
-# define Bs3Gdte_R0_DS16 BS3_DATA_NM(Bs3Gdte_R0_DS16)
-# define Bs3Gdte_R0_SS16 BS3_DATA_NM(Bs3Gdte_R0_SS16)
-# define Bs3Gdte_R0_CS32 BS3_DATA_NM(Bs3Gdte_R0_CS32)
-# define Bs3Gdte_R0_DS32 BS3_DATA_NM(Bs3Gdte_R0_DS32)
-# define Bs3Gdte_R0_SS32 BS3_DATA_NM(Bs3Gdte_R0_SS32)
-# define Bs3Gdte_R0_CS64 BS3_DATA_NM(Bs3Gdte_R0_CS64)
-# define Bs3Gdte_R0_DS64 BS3_DATA_NM(Bs3Gdte_R0_DS64)
-# define Bs3Gdte_R0_CS16_EO BS3_DATA_NM(Bs3Gdte_R0_CS16_EO)
-# define Bs3Gdte_R0_CS16_CNF BS3_DATA_NM(Bs3Gdte_R0_CS16_CNF)
-# define Bs3Gdte_R0_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R0_CS16_CND_EO)
-# define Bs3Gdte_R0_CS32_EO BS3_DATA_NM(Bs3Gdte_R0_CS32_EO)
-# define Bs3Gdte_R0_CS32_CNF BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF)
-# define Bs3Gdte_R0_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF_EO)
-# define Bs3Gdte_R0_CS64_EO BS3_DATA_NM(Bs3Gdte_R0_CS64_EO)
-# define Bs3Gdte_R0_CS64_CNF BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF)
-# define Bs3Gdte_R0_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF_EO)
-
-# define Bs3Gdte_R1_First BS3_DATA_NM(Bs3Gdte_R1_First)
-# define Bs3Gdte_R1_CS16 BS3_DATA_NM(Bs3Gdte_R1_CS16)
-# define Bs3Gdte_R1_DS16 BS3_DATA_NM(Bs3Gdte_R1_DS16)
-# define Bs3Gdte_R1_SS16 BS3_DATA_NM(Bs3Gdte_R1_SS16)
-# define Bs3Gdte_R1_CS32 BS3_DATA_NM(Bs3Gdte_R1_CS32)
-# define Bs3Gdte_R1_DS32 BS3_DATA_NM(Bs3Gdte_R1_DS32)
-# define Bs3Gdte_R1_SS32 BS3_DATA_NM(Bs3Gdte_R1_SS32)
-# define Bs3Gdte_R1_CS64 BS3_DATA_NM(Bs3Gdte_R1_CS64)
-# define Bs3Gdte_R1_DS64 BS3_DATA_NM(Bs3Gdte_R1_DS64)
-# define Bs3Gdte_R1_CS16_EO BS3_DATA_NM(Bs3Gdte_R1_CS16_EO)
-# define Bs3Gdte_R1_CS16_CNF BS3_DATA_NM(Bs3Gdte_R1_CS16_CNF)
-# define Bs3Gdte_R1_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R1_CS16_CND_EO)
-# define Bs3Gdte_R1_CS32_EO BS3_DATA_NM(Bs3Gdte_R1_CS32_EO)
-# define Bs3Gdte_R1_CS32_CNF BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF)
-# define Bs3Gdte_R1_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF_EO)
-# define Bs3Gdte_R1_CS64_EO BS3_DATA_NM(Bs3Gdte_R1_CS64_EO)
-# define Bs3Gdte_R1_CS64_CNF BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF)
-# define Bs3Gdte_R1_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF_EO)
-
-# define Bs3Gdte_R2_First BS3_DATA_NM(Bs3Gdte_R2_First)
-# define Bs3Gdte_R2_CS16 BS3_DATA_NM(Bs3Gdte_R2_CS16)
-# define Bs3Gdte_R2_DS16 BS3_DATA_NM(Bs3Gdte_R2_DS16)
-# define Bs3Gdte_R2_SS16 BS3_DATA_NM(Bs3Gdte_R2_SS16)
-# define Bs3Gdte_R2_CS32 BS3_DATA_NM(Bs3Gdte_R2_CS32)
-# define Bs3Gdte_R2_DS32 BS3_DATA_NM(Bs3Gdte_R2_DS32)
-# define Bs3Gdte_R2_SS32 BS3_DATA_NM(Bs3Gdte_R2_SS32)
-# define Bs3Gdte_R2_CS64 BS3_DATA_NM(Bs3Gdte_R2_CS64)
-# define Bs3Gdte_R2_DS64 BS3_DATA_NM(Bs3Gdte_R2_DS64)
-# define Bs3Gdte_R2_CS16_EO BS3_DATA_NM(Bs3Gdte_R2_CS16_EO)
-# define Bs3Gdte_R2_CS16_CNF BS3_DATA_NM(Bs3Gdte_R2_CS16_CNF)
-# define Bs3Gdte_R2_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R2_CS16_CND_EO)
-# define Bs3Gdte_R2_CS32_EO BS3_DATA_NM(Bs3Gdte_R2_CS32_EO)
-# define Bs3Gdte_R2_CS32_CNF BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF)
-# define Bs3Gdte_R2_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF_EO)
-# define Bs3Gdte_R2_CS64_EO BS3_DATA_NM(Bs3Gdte_R2_CS64_EO)
-# define Bs3Gdte_R2_CS64_CNF BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF)
-# define Bs3Gdte_R2_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF_EO)
-
-# define Bs3Gdte_R3_First BS3_DATA_NM(Bs3Gdte_R3_First)
-# define Bs3Gdte_R3_CS16 BS3_DATA_NM(Bs3Gdte_R3_CS16)
-# define Bs3Gdte_R3_DS16 BS3_DATA_NM(Bs3Gdte_R3_DS16)
-# define Bs3Gdte_R3_SS16 BS3_DATA_NM(Bs3Gdte_R3_SS16)
-# define Bs3Gdte_R3_CS32 BS3_DATA_NM(Bs3Gdte_R3_CS32)
-# define Bs3Gdte_R3_DS32 BS3_DATA_NM(Bs3Gdte_R3_DS32)
-# define Bs3Gdte_R3_SS32 BS3_DATA_NM(Bs3Gdte_R3_SS32)
-# define Bs3Gdte_R3_CS64 BS3_DATA_NM(Bs3Gdte_R3_CS64)
-# define Bs3Gdte_R3_DS64 BS3_DATA_NM(Bs3Gdte_R3_DS64)
-# define Bs3Gdte_R3_CS16_EO BS3_DATA_NM(Bs3Gdte_R3_CS16_EO)
-# define Bs3Gdte_R3_CS16_CNF BS3_DATA_NM(Bs3Gdte_R3_CS16_CNF)
-# define Bs3Gdte_R3_CS16_CND_EO BS3_DATA_NM(Bs3Gdte_R3_CS16_CND_EO)
-# define Bs3Gdte_R3_CS32_EO BS3_DATA_NM(Bs3Gdte_R3_CS32_EO)
-# define Bs3Gdte_R3_CS32_CNF BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF)
-# define Bs3Gdte_R3_CS32_CNF_EO BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF_EO)
-# define Bs3Gdte_R3_CS64_EO BS3_DATA_NM(Bs3Gdte_R3_CS64_EO)
-# define Bs3Gdte_R3_CS64_CNF BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF)
-# define Bs3Gdte_R3_CS64_CNF_EO BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF_EO)
-
-# define Bs3GdteSpare00 BS3_DATA_NM(Bs3GdteSpare00)
-# define Bs3GdteSpare01 BS3_DATA_NM(Bs3GdteSpare01)
-# define Bs3GdteSpare02 BS3_DATA_NM(Bs3GdteSpare02)
-# define Bs3GdteSpare03 BS3_DATA_NM(Bs3GdteSpare03)
-# define Bs3GdteSpare04 BS3_DATA_NM(Bs3GdteSpare04)
-# define Bs3GdteSpare05 BS3_DATA_NM(Bs3GdteSpare05)
-# define Bs3GdteSpare06 BS3_DATA_NM(Bs3GdteSpare06)
-# define Bs3GdteSpare07 BS3_DATA_NM(Bs3GdteSpare07)
-# define Bs3GdteSpare08 BS3_DATA_NM(Bs3GdteSpare08)
-# define Bs3GdteSpare09 BS3_DATA_NM(Bs3GdteSpare09)
-# define Bs3GdteSpare0a BS3_DATA_NM(Bs3GdteSpare0a)
-# define Bs3GdteSpare0b BS3_DATA_NM(Bs3GdteSpare0b)
-# define Bs3GdteSpare0c BS3_DATA_NM(Bs3GdteSpare0c)
-# define Bs3GdteSpare0d BS3_DATA_NM(Bs3GdteSpare0d)
-# define Bs3GdteSpare0e BS3_DATA_NM(Bs3GdteSpare0e)
-# define Bs3GdteSpare0f BS3_DATA_NM(Bs3GdteSpare0f)
-# define Bs3GdteSpare10 BS3_DATA_NM(Bs3GdteSpare10)
-# define Bs3GdteSpare11 BS3_DATA_NM(Bs3GdteSpare11)
-# define Bs3GdteSpare12 BS3_DATA_NM(Bs3GdteSpare12)
-# define Bs3GdteSpare13 BS3_DATA_NM(Bs3GdteSpare13)
-# define Bs3GdteSpare14 BS3_DATA_NM(Bs3GdteSpare14)
-# define Bs3GdteSpare15 BS3_DATA_NM(Bs3GdteSpare15)
-# define Bs3GdteSpare16 BS3_DATA_NM(Bs3GdteSpare16)
-# define Bs3GdteSpare17 BS3_DATA_NM(Bs3GdteSpare17)
-# define Bs3GdteSpare18 BS3_DATA_NM(Bs3GdteSpare18)
-# define Bs3GdteSpare19 BS3_DATA_NM(Bs3GdteSpare19)
-# define Bs3GdteSpare1a BS3_DATA_NM(Bs3GdteSpare1a)
-# define Bs3GdteSpare1b BS3_DATA_NM(Bs3GdteSpare1b)
-# define Bs3GdteSpare1c BS3_DATA_NM(Bs3GdteSpare1c)
-# define Bs3GdteSpare1d BS3_DATA_NM(Bs3GdteSpare1d)
-# define Bs3GdteSpare1e BS3_DATA_NM(Bs3GdteSpare1e)
-# define Bs3GdteSpare1f BS3_DATA_NM(Bs3GdteSpare1f)
-
-# define Bs3GdteTiled BS3_DATA_NM(Bs3GdteTiled)
-# define Bs3GdteFreePart1 BS3_DATA_NM(Bs3GdteFreePart1)
-# define Bs3Gdte_CODE16 BS3_DATA_NM(Bs3Gdte_CODE16)
-# define Bs3GdteFreePart2 BS3_DATA_NM(Bs3GdteFreePart2)
-# define Bs3Gdte_SYSTEM16 BS3_DATA_NM(Bs3Gdte_SYSTEM16)
-# define Bs3GdteFreePart3 BS3_DATA_NM(Bs3GdteFreePart3)
-# define Bs3Gdte_DATA16 BS3_DATA_NM(Bs3Gdte_DATA16)
-
-# define Bs3GdteFreePart4 BS3_DATA_NM(Bs3GdteFreePart4)
-# define Bs3GdtePreTestPage08 BS3_DATA_NM(Bs3GdtePreTestPage08)
-# define Bs3GdtePreTestPage07 BS3_DATA_NM(Bs3GdtePreTestPage07)
-# define Bs3GdtePreTestPage06 BS3_DATA_NM(Bs3GdtePreTestPage06)
-# define Bs3GdtePreTestPage05 BS3_DATA_NM(Bs3GdtePreTestPage05)
-# define Bs3GdtePreTestPage04 BS3_DATA_NM(Bs3GdtePreTestPage04)
-# define Bs3GdtePreTestPage03 BS3_DATA_NM(Bs3GdtePreTestPage03)
-# define Bs3GdtePreTestPage02 BS3_DATA_NM(Bs3GdtePreTestPage02)
-# define Bs3GdtePreTestPage01 BS3_DATA_NM(Bs3GdtePreTestPage01)
-# define Bs3GdteTestPage BS3_DATA_NM(Bs3GdteTestPage)
-# define Bs3GdteTestPage00 BS3_DATA_NM(Bs3GdteTestPage00)
-# define Bs3GdteTestPage01 BS3_DATA_NM(Bs3GdteTestPage01)
-# define Bs3GdteTestPage02 BS3_DATA_NM(Bs3GdteTestPage02)
-# define Bs3GdteTestPage03 BS3_DATA_NM(Bs3GdteTestPage03)
-# define Bs3GdteTestPage04 BS3_DATA_NM(Bs3GdteTestPage04)
-# define Bs3GdteTestPage05 BS3_DATA_NM(Bs3GdteTestPage05)
-# define Bs3GdteTestPage06 BS3_DATA_NM(Bs3GdteTestPage06)
-# define Bs3GdteTestPage07 BS3_DATA_NM(Bs3GdteTestPage07)
-
-# define Bs3GdtEnd BS3_DATA_NM(Bs3GdtEnd)
-
-# define Bs3Tss16 BS3_DATA_NM(Bs3Tss16)
-# define Bs3Tss16DoubleFault BS3_DATA_NM(Bs3Tss16DoubleFault)
-# define Bs3Tss16Spare0 BS3_DATA_NM(Bs3Tss16Spare0)
-# define Bs3Tss16Spare1 BS3_DATA_NM(Bs3Tss16Spare1)
-# define Bs3Tss32 BS3_DATA_NM(Bs3Tss32)
-# define Bs3Tss32DoubleFault BS3_DATA_NM(Bs3Tss32DoubleFault)
-# define Bs3Tss32Spare0 BS3_DATA_NM(Bs3Tss32Spare0)
-# define Bs3Tss32Spare1 BS3_DATA_NM(Bs3Tss32Spare1)
-# define Bs3Tss64 BS3_DATA_NM(Bs3Tss64)
-# define Bs3Tss64Spare0 BS3_DATA_NM(Bs3Tss64Spare0)
-# define Bs3Tss64Spare1 BS3_DATA_NM(Bs3Tss64Spare1)
-# define Bs3Tss64WithIopb BS3_DATA_NM(Bs3Tss64WithIopb)
-# define Bs3Tss32WithIopb BS3_DATA_NM(Bs3Tss32WithIopb)
-# define Bs3SharedIntRedirBm BS3_DATA_NM(Bs3SharedIntRedirBm)
-# define Bs3SharedIobp BS3_DATA_NM(Bs3SharedIobp)
-# define Bs3SharedIobpEnd BS3_DATA_NM(Bs3SharedIobpEnd)
-# define Bs3Idt16 BS3_DATA_NM(Bs3Idt16)
-# define Bs3Idt32 BS3_DATA_NM(Bs3Idt32)
-# define Bs3Idt64 BS3_DATA_NM(Bs3Idt64)
-# define Bs3Lidt_Idt16 BS3_DATA_NM(Bs3Lidt_Idt16)
-# define Bs3Lidt_Idt32 BS3_DATA_NM(Bs3Lidt_Idt32)
-# define Bs3Lidt_Idt64 BS3_DATA_NM(Bs3Lidt_Idt64)
-# define Bs3Lidt_Ivt BS3_DATA_NM(Bs3Lidt_Ivt)
-# define Bs3Lgdt_Gdt BS3_DATA_NM(Bs3Lgdt_Gdt)
-# define Bs3Ldt BS3_DATA_NM(Bs3Ldt)
-# define Bs3LdtEnd BS3_DATA_NM(Bs3LdtEnd)
-#endif /* ARCH_BITS == 64 && !DOXYGEN_RUNNING*/
-
/** The GDT, indexed by BS3_SEL_XXX shifted by 3. */
extern X86DESC BS3_FAR_DATA Bs3Gdt[(BS3_SEL_GDT_LIMIT + 1) / 8];
@@ -1023,124 +906,64 @@ extern X86DESC BS3_FAR_DATA Bs3LdtEnd;
/** @name Segment start and end markers, sizes.
* @{ */
/** Start of the BS3TEXT16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text16_StartOfSegment BS3_DATA_NM(Bs3Text16_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text16_StartOfSegment;
/** End of the BS3TEXT16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text16_EndOfSegment BS3_DATA_NM(Bs3Text16_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text16_EndOfSegment;
/** The size of the BS3TEXT16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text16_Size BS3_DATA_NM(Bs3Text16_Size)
-#endif
extern uint16_t BS3_FAR_DATA Bs3Text16_Size;
/** Start of the BS3SYSTEM16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3System16_StartOfSegment BS3_DATA_NM(Bs3System16_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3System16_StartOfSegment;
/** End of the BS3SYSTEM16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3System16_EndOfSegment BS3_DATA_NM(Bs3System16_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3System16_EndOfSegment;
/** Start of the BS3DATA16/BS3KIT_GRPNM_DATA16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data16_StartOfSegment BS3_DATA_NM(Bs3Data16_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data16_StartOfSegment;
/** End of the BS3DATA16/BS3KIT_GRPNM_DATA16 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data16_EndOfSegment BS3_DATA_NM(Bs3Data16_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data16_EndOfSegment;
/** Start of the BS3TEXT32 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text32_StartOfSegment BS3_DATA_NM(Bs3Text32_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text32_StartOfSegment;
/** Start of the BS3TEXT32 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text32_EndOfSegment BS3_DATA_NM(Bs3Text32_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text32_EndOfSegment;
/** Start of the BS3DATA32 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data32_StartOfSegment BS3_DATA_NM(Bs3Data32_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data32_StartOfSegment;
/** Start of the BS3DATA32 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data32_EndOfSegment BS3_DATA_NM(Bs3Data32_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data32_EndOfSegment;
/** Start of the BS3TEXT64 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text64_StartOfSegment BS3_DATA_NM(Bs3Text64_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text64_StartOfSegment;
/** Start of the BS3TEXT64 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Text64_EndOfSegment BS3_DATA_NM(Bs3Text64_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Text64_EndOfSegment;
/** Start of the BS3DATA64 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data64_StartOfSegment BS3_DATA_NM(Bs3Data64_StartOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data64_StartOfSegment;
/** Start of the BS3DATA64 segment. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data64_EndOfSegment BS3_DATA_NM(Bs3Data64_EndOfSegment)
-#endif
extern uint8_t BS3_FAR_DATA Bs3Data64_EndOfSegment;
/** The size of the Data16, Text32, Text64, Data32 and Data64 blob. */
-#ifndef DOXYGEN_RUNNING
-# define Bs3Data16Thru64Text32And64_TotalSize BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize)
-#endif
extern uint32_t BS3_FAR_DATA Bs3Data16Thru64Text32And64_TotalSize;
/** The total image size (from Text16 thu Data64). */
-#ifndef DOXYGEN_RUNNING
-# define Bs3TotalImageSize BS3_DATA_NM(Bs3TotalImageSize)
-#endif
extern uint32_t BS3_FAR_DATA Bs3TotalImageSize;
/** @} */
/** Lower case hex digits. */
-#ifndef DOXYGEN_RUNNING
-# define g_achBs3HexDigits BS3_DATA_NM(g_achBs3HexDigits)
-#endif
extern char const g_achBs3HexDigits[16+1];
/** Upper case hex digits. */
-#ifndef DOXYGEN_RUNNING
-# define g_achBs3HexDigitsUpper BS3_DATA_NM(g_achBs3HexDigitsUpper)
-#endif
extern char const g_achBs3HexDigitsUpper[16+1];
/** The current mode (BS3_MODE_XXX) of CPU \#0. */
-#ifndef DOXYGEN_RUNNING
-# define g_bBs3CurrentMode BS3_DATA_NM(g_bBs3CurrentMode)
-#endif
extern uint8_t g_bBs3CurrentMode;
/** Hint for 16-bit trap handlers regarding the high word of EIP. */
-#ifndef DOXYGEN_RUNNING
-# define g_uBs3TrapEipHint BS3_DATA_NM(g_uBs3TrapEipHint)
-#endif
extern uint32_t g_uBs3TrapEipHint;
+/** Copy of the original real-mode interrupt vector table. */
+extern RTFAR16 g_aBs3RmIvtOriginal[256];
+
#ifdef __WATCOMC__
/**
@@ -1402,6 +1225,45 @@ DECLINLINE(void BS3_FAR *) Bs3XptrFlatToCurrent(RTCCUINTXREG uFlatPtr)
* @{
*/
+/** @def BS3_CMN_PROTO
+ * 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.
+ */
+#if ARCH_BITS == 16
+# define BS3_CMN_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
+ 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) \
+ BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params
+#endif
+
+/** @def BS3_CMN_DEF
+ * Macro for defining a common function.
+ *
+ * This makes 16-bit common function far, while 32-bit and 64-bit are near.
+ *
+ * @param a_RetType The return type.
+ * @param a_Name The function basename.
+ * @param a_Params The parameter list (in parentheses).
+ */
+#if ARCH_BITS == 16
+# define BS3_CMN_DEF(a_RetType, a_Name, a_Params) \
+ BS3_DECL_FAR(a_RetType) BS3_CMN_FAR_NM(a_Name) a_Params
+#else
+# define BS3_CMN_DEF(a_RetType, a_Name, a_Params) \
+ BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params
+#endif
+
+/** @def BS3_ASSERT
+ * Assert that an expression is true.
+ *
+ * Calls Bs3Panic if false and it's a strict build. Does nothing in
+ * non-strict builds. */
#ifdef BS3_STRICT
# define BS3_ASSERT(a_Expr) do { if (!!(a_Expr)) { /* likely */ } else { Bs3Panic(); } } while (0) /**< @todo later */
#else
@@ -1413,12 +1275,10 @@ DECLINLINE(void BS3_FAR *) Bs3XptrFlatToCurrent(RTCCUINTXREG uFlatPtr)
*
* The current implementation will only halt the CPU.
*/
-BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c16(void);
-BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c32(void); /**< @copydoc Bs3Panic_c16 */
-BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c64(void); /**< @copydoc Bs3Panic_c16 */
-#define Bs3Panic BS3_CMN_NM(Bs3Panic) /**< Selects #Bs3Panic_c16, #Bs3Panic_c32 or #Bs3Panic_c64. */
+BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3Panic,(void), false);
#if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
# pragma aux Bs3Panic_c16 __aborts
+# pragma aux Bs3Panic_f16 __aborts
# pragma aux Bs3Panic_c32 __aborts
#endif
@@ -1428,30 +1288,21 @@ BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c64(void); /**< @copydoc Bs3Panic_c16 *
* This currently only works for VMs. When running on real systems it will
* just halt the CPU.
*/
-BS3_DECL(void) Bs3Shutdown_c16(void);
-BS3_DECL(void) Bs3Shutdown_c32(void); /**< @copydoc Bs3Shutdown_c16 */
-BS3_DECL(void) Bs3Shutdown_c64(void); /**< @copydoc Bs3Shutdown_c16 */
-#define Bs3Shutdown BS3_CMN_NM(Bs3Shutdown) /**< Selects #Bs3Shutdown_c16, #Bs3Shutdown_c32 or #Bs3Shutdown_c64. */
+BS3_CMN_PROTO(void, Bs3Shutdown,(void), false);
/**
* Prints a 32-bit unsigned value as decimal to the screen.
*
* @param uValue The 32-bit value.
*/
-BS3_DECL(void) Bs3PrintU32_c16(uint32_t uValue);
-BS3_DECL(void) Bs3PrintU32_c32(uint32_t uValue); /**< @copydoc Bs3PrintU32_c16 */
-BS3_DECL(void) Bs3PrintU32_c64(uint32_t uValue); /**< @copydoc Bs3PrintU32_c16 */
-#define Bs3PrintU32 BS3_CMN_NM(Bs3PrintU32) /**< Selects #Bs3PrintU32_c16, #Bs3PrintU32_c32 or #Bs3PrintU32_c64. */
+BS3_CMN_PROTO(void, Bs3PrintU32,(uint32_t uValue), false);
/**
* Prints a 32-bit unsigned value as hex to the screen.
*
* @param uValue The 32-bit value.
*/
-BS3_DECL(void) Bs3PrintX32_c16(uint32_t uValue);
-BS3_DECL(void) Bs3PrintX32_c32(uint32_t uValue); /**< @copydoc Bs3PrintX32_c16 */
-BS3_DECL(void) Bs3PrintX32_c64(uint32_t uValue); /**< @copydoc Bs3PrintX32_c16 */
-#define Bs3PrintX32 BS3_CMN_NM(Bs3PrintX32) /**< Selects #Bs3PrintX32_c16, #Bs3PrintX32_c32 or #Bs3PrintX32_c64. */
+BS3_CMN_PROTO(void, Bs3PrintX32,(uint32_t uValue), false);
/**
* Formats and prints a string to the screen.
@@ -1461,10 +1312,7 @@ BS3_DECL(void) Bs3PrintX32_c64(uint32_t uValue); /**< @copydoc Bs3PrintX32_c16 *
* @param pszFormat The format string.
* @param ... Format arguments.
*/
-BS3_DECL(size_t) Bs3Printf_c16(const char BS3_FAR *pszFormat, ...);
-BS3_DECL(size_t) Bs3Printf_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3Printf_c16 */
-BS3_DECL(size_t) Bs3Printf_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3Printf_c16 */
-#define Bs3Printf BS3_CMN_NM(Bs3Printf) /**< Selects #Bs3Printf_c16, #Bs3Printf_c32 or #Bs3Printf_c64. */
+BS3_CMN_PROTO(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...), true);
/**
* Formats and prints a string to the screen, va_list version.
@@ -1474,20 +1322,14 @@ BS3_DECL(size_t) Bs3Printf_c64(const char BS3_FAR *pszFormat, ...); /**< @copydo
* @param pszFormat The format string.
* @param va Format arguments.
*/
-BS3_DECL(size_t) Bs3PrintfV_c16(const char BS3_FAR *pszFormat, va_list va);
-BS3_DECL(size_t) Bs3PrintfV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3PrintfV_c16 */
-BS3_DECL(size_t) Bs3PrintfV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3PrintfV_c16 */
-#define Bs3PrintfV BS3_CMN_NM(Bs3PrintfV) /**< Selects #Bs3PrintfV_c16, #Bs3PrintfV_c32 or #Bs3PrintfV_c64. */
+BS3_CMN_PROTO(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
/**
* Prints a string to the screen.
*
* @param pszString The string to print.
*/
-BS3_DECL(void) Bs3PrintStr_c16(const char BS3_FAR *pszString);
-BS3_DECL(void) Bs3PrintStr_c32(const char BS3_FAR *pszString); /**< @copydoc Bs3PrintStr_c16 */
-BS3_DECL(void) Bs3PrintStr_c64(const char BS3_FAR *pszString); /**< @copydoc Bs3PrintStr_c16 */
-#define Bs3PrintStr BS3_CMN_NM(Bs3PrintStr) /**< Selects #Bs3PrintStr_c16, #Bs3PrintStr_c32 or #Bs3PrintStr_c64. */
+BS3_CMN_PROTO(void, Bs3PrintStr,(const char BS3_FAR *pszString), true);
/**
* Prints a string to the screen.
@@ -1495,20 +1337,14 @@ BS3_DECL(void) Bs3PrintStr_c64(const char BS3_FAR *pszString); /**< @copydoc Bs3
* @param pchString The string to print. Any terminator charss will be printed.
* @param cchString The exact number of characters to print.
*/
-BS3_DECL(void) Bs3PrintStrN_c16(const char BS3_FAR *pszString, size_t cchString);
-BS3_DECL(void) Bs3PrintStrN_c32(const char BS3_FAR *pszString, size_t cchString); /**< @copydoc Bs3PrintStrN_c16 */
-BS3_DECL(void) Bs3PrintStrN_c64(const char BS3_FAR *pszString, size_t cchString); /**< @copydoc Bs3PrintStrN_c16 */
-#define Bs3PrintStrN BS3_CMN_NM(Bs3PrintStrN) /**< Selects #Bs3PrintStrN_c16, #Bs3PrintStrN_c32 or #Bs3PrintStrN_c64. */
+BS3_CMN_PROTO(void, Bs3PrintStrN,(const char BS3_FAR *pszString, size_t cchString), false);
/**
* Prints a char to the screen.
*
* @param ch The character to print.
*/
-BS3_DECL(void) Bs3PrintChr_c16(char ch);
-BS3_DECL(void) Bs3PrintChr_c32(char ch); /**< @copydoc Bs3PrintChr_c16 */
-BS3_DECL(void) Bs3PrintChr_c64(char ch); /**< @copydoc Bs3PrintChr_c16 */
-#define Bs3PrintChr BS3_CMN_NM(Bs3PrintChr) /**< Selects #Bs3PrintChr_c16, #Bs3PrintChr_c32 or #Bs3PrintChr_c64. */
+BS3_CMN_PROTO(void, Bs3PrintChr,(char ch), false);
/**
@@ -1542,15 +1378,8 @@ typedef FNBS3STRFORMATOUTPUT *PFNBS3STRFORMATOUTPUT;
* @param pfnOutput The output function.
* @param pvUser The user argument for the output function.
*/
-BS3_DECL(size_t) Bs3StrFormatV_c16(const char BS3_FAR *pszFormat, va_list va,
- PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
-/** @copydoc Bs3StrFormatV_c16 */
-BS3_DECL(size_t) Bs3StrFormatV_c32(const char BS3_FAR *pszFormat, va_list va,
- PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
-/** @copydoc Bs3StrFormatV_c16 */
-BS3_DECL(size_t) Bs3StrFormatV_c64(const char BS3_FAR *pszFormat, va_list va,
- PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
-#define Bs3StrFormatV BS3_CMN_NM(Bs3StrFormatV) /**< Selects #Bs3StrFormatV_c16, #Bs3StrFormatV_c32 or #Bs3StrFormatV_c64. */
+BS3_CMN_PROTO(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
+ PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser), true);
/**
* Formats a string into a buffer.
@@ -1564,12 +1393,7 @@ BS3_DECL(size_t) Bs3StrFormatV_c64(const char BS3_FAR *pszFormat, va_list va,
* @param pszFormat The format string.
* @param va Format arguments.
*/
-BS3_DECL(size_t) Bs3StrPrintfV_c16(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
-/** @copydoc Bs3StrPrintfV_c16 */
-BS3_DECL(size_t) Bs3StrPrintfV_c32(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
-/** @copydoc Bs3StrPrintfV_c16 */
-BS3_DECL(size_t) Bs3StrPrintfV_c64(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
-#define Bs3StrPrintfV BS3_CMN_NM(Bs3StrPrintfV) /**< Selects #Bs3StrPrintfV_c16, #Bs3StrPrintfV_c32 or #Bs3StrPrintfV_c64. */
+BS3_CMN_PROTO(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va), true);
/**
* Formats a string into a buffer.
@@ -1583,12 +1407,7 @@ BS3_DECL(size_t) Bs3StrPrintfV_c64(char BS3_FAR *pszBuf, size_t cbBuf, const cha
* @param pszFormat The format string.
* @param ... Format arguments.
*/
-BS3_DECL(size_t) Bs3StrPrintf_c16(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
-/** @copydoc Bs3StrPrintf_c16 */
-BS3_DECL(size_t) Bs3StrPrintf_c32(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
-/** @copydoc Bs3StrPrintf_c16 */
-BS3_DECL(size_t) Bs3StrPrintf_c64(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
-#define Bs3StrPrintf BS3_CMN_NM(Bs3StrPrintf) /**< Selects #Bs3StrPrintf_c16, #Bs3StrPrintf_c32 or #Bs3StrPrintf_c64. */
+BS3_CMN_PROTO(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...), true);
/**
@@ -1597,10 +1416,7 @@ BS3_DECL(size_t) Bs3StrPrintf_c64(char BS3_FAR *pszBuf, size_t cbBuf, const char
* @returns String length in chars/bytes.
* @param pszString The string to examine.
*/
-BS3_DECL(size_t) Bs3StrLen_c16(const char BS3_FAR *pszString);
-BS3_DECL(size_t) Bs3StrLen_c32(const char BS3_FAR *pszString); /** @copydoc Bs3StrLen_c16 */
-BS3_DECL(size_t) Bs3StrLen_c64(const char BS3_FAR *pszString); /** @copydoc Bs3StrLen_c16 */
-#define Bs3StrLen BS3_CMN_NM(Bs3StrLen) /**< Selects #Bs3StrLen_c16, #Bs3StrLen_c32 or #Bs3StrLen_c64. */
+BS3_CMN_PROTO(size_t, Bs3StrLen,(const char BS3_FAR *pszString), true);
/**
* Finds the length of a zero terminated string, but with a max length.
@@ -1610,10 +1426,7 @@ BS3_DECL(size_t) Bs3StrLen_c64(const char BS3_FAR *pszString); /** @copydoc Bs3S
* @param pszString The string to examine.
* @param cchMax The max length to examine.
*/
-BS3_DECL(size_t) Bs3StrNLen_c16(const char BS3_FAR *pszString, size_t cchMax);
-BS3_DECL(size_t) Bs3StrNLen_c32(const char BS3_FAR *pszString, size_t cchMax); /** @copydoc Bs3StrNLen_c16 */
-BS3_DECL(size_t) Bs3StrNLen_c64(const char BS3_FAR *pszString, size_t cchMax); /** @copydoc Bs3StrNLen_c16 */
-#define Bs3StrNLen BS3_CMN_NM(Bs3StrNLen) /**< Selects #Bs3StrNLen_c16, #Bs3StrNLen_c32 or #Bs3StrNLen_c64. */
+BS3_CMN_PROTO(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax), true);
/**
* CRT style unsafe strcpy.
@@ -1623,10 +1436,7 @@ BS3_DECL(size_t) Bs3StrNLen_c64(const char BS3_FAR *pszString, size_t cchMax); /
* hold the source string.
* @param pszSrc The source string.
*/
-BS3_DECL(char BS3_FAR *) Bs3StrCpy_c16(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc);
-BS3_DECL(char BS3_FAR *) Bs3StrCpy_c32(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc); /** @copydoc Bs3StrCpy_c16 */
-BS3_DECL(char BS3_FAR *) Bs3StrCpy_c64(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc); /** @copydoc Bs3StrCpy_c16 */
-#define Bs3StrCpy BS3_CMN_NM(Bs3StrCpy) /**< Selects #Bs3StrCpy_c16, #Bs3StrCpy_c32 or #Bs3StrCpy_c64. */
+BS3_CMN_PROTO(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc), true);
/**
* CRT style memcpy.
@@ -1636,10 +1446,7 @@ BS3_DECL(char BS3_FAR *) Bs3StrCpy_c64(char BS3_FAR *pszDst, const char BS3_FAR
* @param pvSrc The source buffer.
* @param cbCopy The number of bytes to copy.
*/
-BS3_DECL(void BS3_FAR *) Bs3MemCpy_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
-BS3_DECL(void BS3_FAR *) Bs3MemCpy_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemCpy_c16 */
-BS3_DECL(void BS3_FAR *) Bs3MemCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemCpy_c16 */
-#define Bs3MemCpy BS3_CMN_NM(Bs3MemCpy) /**< Selects #Bs3MemCpy_c16, #Bs3MemCpy_c32 or #Bs3MemCpy_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
/**
* GNU (?) style mempcpy.
@@ -1649,10 +1456,7 @@ BS3_DECL(void BS3_FAR *) Bs3MemCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR *
* @param pvSrc The source buffer.
* @param cbCopy The number of bytes to copy.
*/
-BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
-BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemPCpy_c16 */
-BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemPCpy_c16 */
-#define Bs3MemPCpy BS3_CMN_NM(Bs3MemPCpy) /**< Selects #Bs3MemPCpy_c16, #Bs3MemPCpy_c32 or #Bs3MemPCpy_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
/**
* CRT style memmove (overlapping buffers is fine).
@@ -1662,10 +1466,7 @@ BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR
* @param pvSrc The source buffer.
* @param cbCopy The number of bytes to copy.
*/
-BS3_DECL(void BS3_FAR *) Bs3MemMove_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
-BS3_DECL(void BS3_FAR *) Bs3MemMove_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemMove_c16 */
-BS3_DECL(void BS3_FAR *) Bs3MemMove_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemMove_c16 */
-#define Bs3MemMove BS3_CMN_NM(Bs3MemMove) /**< Selects #Bs3MemMove_c16, #Bs3MemMove_c32 or #Bs3MemMove_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
/**
* BSD style bzero.
@@ -1673,10 +1474,7 @@ BS3_DECL(void BS3_FAR *) Bs3MemMove_c64(void BS3_FAR *pvDst, const void BS3_FAR
* @param pvDst The buffer to be zeroed.
* @param cbDst The number of bytes to zero.
*/
-BS3_DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);
-BS3_DECL(void) Bs3MemZero_c32(void BS3_FAR *pvDst, size_t cbDst); /** @copydoc Bs3MemZero_c16 */
-BS3_DECL(void) Bs3MemZero_c64(void BS3_FAR *pvDst, size_t cbDst); /** @copydoc Bs3MemZero_c16 */
-#define Bs3MemZero BS3_CMN_NM(Bs3MemZero) /**< Selects #Bs3MemZero_c16, #Bs3MemZero_c32 or #Bs3MemZero_c64. */
+BS3_CMN_PROTO(void, Bs3MemZero,(void BS3_FAR *pvDst, size_t cbDst), false);
/**
@@ -1686,10 +1484,7 @@ BS3_DECL(void) Bs3MemZero_c64(void BS3_FAR *pvDst, size_t cbDst); /** @copydoc B
* @param off The segment offset.
* @param uSel The protected mode segment selector.
*/
-BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c16(uint32_t off, uint16_t uSel);
-BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c32(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelProtFar32ToFlat32_c16 */
-BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelProtFar32ToFlat32_c16 */
-#define Bs3SelProtFar32ToFlat32 BS3_CMN_NM(Bs3SelProtFar32ToFlat32) /**< Selects #Bs3SelProtFar32ToFlat32_c16, #Bs3SelProtFar32ToFlat32_c32 or #Bs3SelProtFar32ToFlat32_c64. */
+BS3_CMN_PROTO(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
/**
@@ -1699,10 +1494,7 @@ BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**
* @param off The segment offset.
* @param uSel The current mode segment selector.
*/
-BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c16(uint32_t off, uint16_t uSel);
-BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c32(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelFar32ToFlat32_c16 */
-BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelFar32ToFlat32_c16 */
-#define Bs3SelFar32ToFlat32 BS3_CMN_NM(Bs3SelFar32ToFlat32) /**< Selects #Bs3SelFar32ToFlat32_c16, #Bs3SelFar32ToFlat32_c32 or #Bs3SelFar32ToFlat32_c64. */
+BS3_CMN_PROTO(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
/**
* Gets a flat address from a working poitner.
@@ -1713,7 +1505,7 @@ BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**< @c
DECLINLINE(RTCCUINTXREG) Bs3SelPtrToFlat(void BS3_FAR *pv)
{
#if ARCH_BITS == 16
- return Bs3SelFar32ToFlat32(BS3_FP_OFF(pv), BS3_FP_SEG(pv));
+ return BS3_CMN_FN_NM(Bs3SelFar32ToFlat32)(BS3_FP_OFF(pv), BS3_FP_SEG(pv));
#else
return (uintptr_t)pv;
#endif
@@ -1783,12 +1575,8 @@ typedef BS3SLABCTL BS3_FAR *PBS3SLABCTL;
* @param cbSlab The size of the slab.
* @param cbChunk The chunk size.
*/
-BS3_DECL(void) Bs3SlabInit_c16(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
-/** @copydoc Bs3SlabInit_c16 */
-BS3_DECL(void) Bs3SlabInit_c32(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
-/** @copydoc Bs3SlabInit_c16 */
-BS3_DECL(void) Bs3SlabInit_c64(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
-#define Bs3SlabInit BS3_CMN_NM(Bs3SlabInit) /**< Selects #Bs3SlabInit_c16, #Bs3SlabInit_c32 or #Bs3SlabInit_c64. */
+BS3_CMN_PROTO(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr,
+ uint32_t cbSlab, uint16_t cbChunk), true);
/**
* Allocates one chunk from a slab.
@@ -1796,10 +1584,7 @@ BS3_DECL(void) Bs3SlabInit_c64(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t
* @returns Pointer to a chunk on success, NULL if we're out of chunks.
* @param pSlabCtl The slab constrol structure to allocate from.
*/
-BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c16(PBS3SLABCTL pSlabCtl);
-BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c32(PBS3SLABCTL pSlabCtl); /**< @copydoc Bs3SlabAlloc_c16 */
-BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c64(PBS3SLABCTL pSlabCtl); /**< @copydoc Bs3SlabAlloc_c16 */
-#define Bs3SlabAlloc BS3_CMN_NM(Bs3SlabAlloc) /**< Selects #Bs3SlabAlloc_c16, #Bs3SlabAlloc_c32 or #Bs3SlabAlloc_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl), true);
/**
* Allocates one or more chunks rom a slab.
@@ -1810,10 +1595,7 @@ BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c64(PBS3SLABCTL pSlabCtl); /**< @copydoc B
* @param cChunks The number of contiguous chunks we want.
* @param fFlags Flags, see BS3_SLAB_ALLOC_F_XXX
*/
-BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c16(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags);
-BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c32(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabAllocEx_c16 */
-BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c64(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabAllocEx_c16 */
-#define Bs3SlabAllocEx BS3_CMN_NM(Bs3SlabAllocEx) /**< Selects #Bs3SlabAllocEx_c16, #Bs3SlabAllocEx_c32 or #Bs3SlabAllocEx_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags), true);
/**
* Frees one or more chunks from a slab.
@@ -1824,10 +1606,7 @@ BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c64(PBS3SLABCTL pSlabCtl, uint16_t cChun
* @param uFlatChunkPtr The flat address of the chunks to free.
* @param cChunks The number of contiguous chunks to free.
*/
-BS3_DECL(uint16_t) Bs3SlabFree_c16(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks);
-BS3_DECL(uint16_t) Bs3SlabFree_c32(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks); /**< @copydoc Bs3SlabFree_c16 */
-BS3_DECL(uint16_t) Bs3SlabFree_c64(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks); /**< @copydoc Bs3SlabFree_c16 */
-#define Bs3SlabFree BS3_CMN_NM(Bs3SlabFree) /**< Selects #Bs3SlabFree_c16, #Bs3SlabFree_c32 or #Bs3SlabFree_c64. */
+BS3_CMN_PROTO(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks), true);
/**
@@ -1836,10 +1615,7 @@ BS3_DECL(uint16_t) Bs3SlabFree_c64(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr,
* @param pHead The slab list head.
* @param cbChunk The chunk size.
*/
-BS3_DECL(void) Bs3SlabListInit_c16(PBS3SLABHEAD pHead, uint16_t cbChunk);
-BS3_DECL(void) Bs3SlabListInit_c32(PBS3SLABHEAD pHead, uint16_t cbChunk); /**< @copydoc Bs3SlabListInit_c16 */
-BS3_DECL(void) Bs3SlabListInit_c64(PBS3SLABHEAD pHead, uint16_t cbChunk); /**< @copydoc Bs3SlabListInit_c16 */
-#define Bs3SlabListInit BS3_CMN_NM(Bs3SlabListInit) /**< Selects #Bs3SlabListInit_c16, #Bs3SlabListInit_c32 or #Bs3SlabListInit_c64. */
+BS3_CMN_PROTO(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk), true);
/**
* Adds an initialized slab control structure to the list.
@@ -1847,12 +1623,7 @@ BS3_DECL(void) Bs3SlabListInit_c64(PBS3SLABHEAD pHead, uint16_t cbChunk); /**< @
* @param pHead The slab list head to add it to.
* @param pSlabCtl The slab control structure to add.
*/
-BS3_DECL(void) Bs3SlabListAdd_c16(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
-/** @copydoc Bs3SlabListAdd_c16 */
-BS3_DECL(void) Bs3SlabListAdd_c32(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
-/** @copydoc Bs3SlabListAdd_c16 */
-BS3_DECL(void) Bs3SlabListAdd_c64(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
-#define Bs3SlabListAdd BS3_CMN_NM(Bs3SlabListAdd) /**< Selects #Bs3SlabListAdd_c16, #Bs3SlabListAdd_c32 or #Bs3SlabListAdd_c64. */
+BS3_CMN_PROTO(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl), true);
/**
* Allocates one chunk.
@@ -1860,10 +1631,7 @@ BS3_DECL(void) Bs3SlabListAdd_c64(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
* @returns Pointer to a chunk on success, NULL if we're out of chunks.
* @param pHead The slab list to allocate from.
*/
-BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c16(PBS3SLABHEAD pHead);
-BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c32(PBS3SLABHEAD pHead); /**< @copydoc Bs3SlabListAlloc_c16 */
-BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c64(PBS3SLABHEAD pHead); /**< @copydoc Bs3SlabListAlloc_c16 */
-#define Bs3SlabListAlloc BS3_CMN_NM(Bs3SlabListAlloc) /**< Selects #Bs3SlabListAlloc_c16, #Bs3SlabListAlloc_c32 or #Bs3SlabListAlloc_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead), true);
/**
* Allocates one or more chunks.
@@ -1874,10 +1642,7 @@ BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c64(PBS3SLABHEAD pHead); /**< @copydoc
* @param cChunks The number of contiguous chunks we want.
* @param fFlags Flags, see BS3_SLAB_ALLOC_F_XXX
*/
-BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c16(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags);
-BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c32(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabListAllocEx_c16 */
-BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c64(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabListAllocEx_c16 */
-#define Bs3SlabListAllocEx BS3_CMN_NM(Bs3SlabListAllocEx) /**< Selects #Bs3SlabListAllocEx_c16, #Bs3SlabListAllocEx_c32 or #Bs3SlabListAllocEx_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags), true);
/**
* Frees one or more chunks from a slab list.
@@ -1886,10 +1651,7 @@ BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c64(PBS3SLABHEAD pHead, uint16_t cCh
* @param pvChunks Pointer to the first chunk to free.
* @param cChunks The number of contiguous chunks to free.
*/
-BS3_DECL(void) Bs3SlabListFree_c16(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks);
-BS3_DECL(void) Bs3SlabListFree_c32(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks); /**< @copydoc Bs3SlabListFree_c16 */
-BS3_DECL(void) Bs3SlabListFree_c64(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks); /**< @copydoc Bs3SlabListFree_c16 */
-#define Bs3SlabListFree BS3_CMN_NM(Bs3SlabListFree) /**< Selects #Bs3SlabListFree_c16, #Bs3SlabListFree_c32 or #Bs3SlabListFree_c64. */
+BS3_CMN_PROTO(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks), true);
/**
* Allocation addressing constraints.
@@ -1918,10 +1680,7 @@ typedef enum BS3MEMKIND
* allocation.
* @param cb How much to allocate. Must be 4KB or less.
*/
-BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c16(BS3MEMKIND enmKind, size_t cb);
-BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c32(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAlloc_c16 */
-BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c64(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAlloc_c16 */
-#define Bs3MemAlloc BS3_CMN_NM(Bs3MemAlloc) /**< Selects #Bs3MemAlloc_c16, #Bs3MemAlloc_c32 or #Bs3MemAlloc_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb), true);
/**
* Allocates zero'ed memory.
@@ -1930,10 +1689,7 @@ BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c64(BS3MEMKIND enmKind, size_t cb); /**< @c
* allocation.
* @param cb How much to allocate. Must be 4KB or less.
*/
-BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c16(BS3MEMKIND enmKind, size_t cb);
-BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c32(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAllocZ_c16 */
-BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c64(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAllocZ_c16 */
-#define Bs3MemAllocZ BS3_CMN_NM(Bs3MemAllocZ) /**< Selects #Bs3MemAllocZ_c16, #Bs3MemAllocZ_c32 or #Bs3MemAllocZ_c64. */
+BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb), true);
/**
* Frees memory.
@@ -1942,59 +1698,38 @@ BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c64(BS3MEMKIND enmKind, size_t cb); /**< @
* @param pv The memory to free (returned by #Bs3MemAlloc).
* @param cb The size of the allocation.
*/
-BS3_DECL(void) Bs3MemFree_c16(void BS3_FAR *pv, size_t cb);
-BS3_DECL(void) Bs3MemFree_c32(void BS3_FAR *pv, size_t cb); /**< @copydoc Bs3MemFree_c16 */
-BS3_DECL(void) Bs3MemFree_c64(void BS3_FAR *pv, size_t cb); /**< @copydoc Bs3MemFree_c16 */
-#define Bs3MemFree BS3_CMN_NM(Bs3MemFree) /**< Selects #Bs3MemFree_c16, #Bs3MemFree_c32 or #Bs3MemFree_c64. */
+BS3_CMN_PROTO(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb), true);
/**
* Enables the A20 gate.
*/
-BS3_DECL(void) Bs3A20Enable_c16(void);
-BS3_DECL(void) Bs3A20Enable_c32(void); /**< @copydoc Bs3A20Enable_c16 */
-BS3_DECL(void) Bs3A20Enable_c64(void); /**< @copydoc Bs3A20Enable_c16 */
-#define Bs3A20Enable BS3_CMN_NM(Bs3A20Enable) /**< Selects #Bs3A20Enable_c16, #Bs3A20Enable_c32 or #Bs3A20Enable_c64. */
+BS3_CMN_PROTO(void, Bs3A20Enable,(void), false);
/**
* Enables the A20 gate via the keyboard controller
*/
-BS3_DECL(void) Bs3A20EnableViaKbd_c16(void);
-BS3_DECL(void) Bs3A20EnableViaKbd_c32(void); /**< @copydoc Bs3A20EnableViaKbd_c16 */
-BS3_DECL(void) Bs3A20EnableViaKbd_c64(void); /**< @copydoc Bs3A20EnableViaKbd_c16 */
-#define Bs3A20EnableViaKbd BS3_CMN_NM(Bs3A20EnableViaKbd) /**< Selects #Bs3A20EnableViaKbd_c16, #Bs3A20EnableViaKbd_c32 or #Bs3A20EnableViaKbd_c64. */
+BS3_CMN_PROTO(void, Bs3A20EnableViaKbd,(void), false);
/**
* Enables the A20 gate via the PS/2 control port A.
*/
-BS3_DECL(void) Bs3A20EnableViaPortA_c16(void);
-BS3_DECL(void) Bs3A20EnableViaPortA_c32(void); /**< @copydoc Bs3A20EnableViaPortA_c16 */
-BS3_DECL(void) Bs3A20EnableViaPortA_c64(void); /**< @copydoc Bs3A20EnableViaPortA_c16 */
-#define Bs3A20EnableViaPortA BS3_CMN_NM(Bs3A20EnableViaPortA) /**< Selects #Bs3A20EnableViaPortA_c16, #Bs3A20EnableViaPortA_c32 or #Bs3A20EnableViaPortA_c64. */
+BS3_CMN_PROTO(void, Bs3A20EnableViaPortA,(void), false);
/**
* Disables the A20 gate.
*/
-BS3_DECL(void) Bs3A20Disable_c16(void);
-BS3_DECL(void) Bs3A20Disable_c32(void); /**< @copydoc Bs3A20Disable_c16 */
-BS3_DECL(void) Bs3A20Disable_c64(void); /**< @copydoc Bs3A20Disable_c16 */
-#define Bs3A20Disable BS3_CMN_NM(Bs3A20Disable) /**< Selects #Bs3A20Disable_c16, #Bs3A20Disable_c32 or #Bs3A20Disable_c64. */
+BS3_CMN_PROTO(void, Bs3A20Disable,(void), false);
/**
* Disables the A20 gate via the keyboard controller
*/
-BS3_DECL(void) Bs3A20DisableViaKbd_c16(void);
-BS3_DECL(void) Bs3A20DisableViaKbd_c32(void); /**< @copydoc Bs3A20DisableViaKbd_c16 */
-BS3_DECL(void) Bs3A20DisableViaKbd_c64(void); /**< @copydoc Bs3A20DisableViaKbd_c16 */
-#define Bs3A20DisableViaKbd BS3_CMN_NM(Bs3A20DisableViaKbd) /**< Selects #Bs3A20DisableViaKbd_c16, #Bs3A20DisableViaKbd_c32 or #Bs3A20DisableViaKbd_c64. */
+BS3_CMN_PROTO(void, Bs3A20DisableViaKbd,(void), false);
/**
* Disables the A20 gate via the PS/2 control port A.
*/
-BS3_DECL(void) Bs3A20DisableViaPortA_c16(void);
-BS3_DECL(void) Bs3A20DisableViaPortA_c32(void); /**< @copydoc Bs3A20DisableViaPortA_c16 */
-BS3_DECL(void) Bs3A20DisableViaPortA_c64(void); /**< @copydoc Bs3A20DisableViaPortA_c16 */
-#define Bs3A20DisableViaPortA BS3_CMN_NM(Bs3A20DisableViaPortA) /**< Selects #Bs3A20DisableViaPortA_c16, #Bs3A20DisableViaPortA_c32 or #Bs3A20DisableViaPortA_c64. */
+BS3_CMN_PROTO(void, Bs3A20DisableViaPortA,(void), false);
/**
@@ -2003,10 +1738,7 @@ BS3_DECL(void) Bs3A20DisableViaPortA_c64(void); /**< @copydoc Bs3A20DisableViaPo
* @returns IPRT status code.
* @remarks Must not be called in real-mode!
*/
-BS3_DECL(int) Bs3PagingInitRootForPP_c16(void);
-BS3_DECL(int) Bs3PagingInitRootForPP_c32(void); /**< @copydoc Bs3PagingInitRootForPP_c16 */
-BS3_DECL(int) Bs3PagingInitRootForPP_c64(void); /**< @copydoc Bs3PagingInitRootForPP_c16 */
-#define Bs3PagingInitRootForPP BS3_CMN_NM(Bs3PagingInitRootForPP) /**< Selects #Bs3PagingInitRootForPP_c16, #Bs3PagingInitRootForPP_c32 or #Bs3PagingInitRootForPP_c64. */
+BS3_CMN_PROTO(int, Bs3PagingInitRootForPP,(void), true);
/**
* Initializes root page tables for PAE page protected mode (PAE16, PAE32).
@@ -2015,10 +1747,7 @@ BS3_DECL(int) Bs3PagingInitRootForPP_c64(void); /**< @copydoc Bs3PagingInitRootF
* @remarks The default long mode page tables depends on the PAE ones.
* @remarks Must not be called in real-mode!
*/
-BS3_DECL(int) Bs3PagingInitRootForPAE_c16(void);
-BS3_DECL(int) Bs3PagingInitRootForPAE_c32(void); /**< @copydoc Bs3PagingInitRootForPAE_c16 */
-BS3_DECL(int) Bs3PagingInitRootForPAE_c64(void); /**< @copydoc Bs3PagingInitRootForPAE_c16 */
-#define Bs3PagingInitRootForPAE BS3_CMN_NM(Bs3PagingInitRootForPAE) /**< Selects #Bs3PagingInitRootForPAE_c16, #Bs3PagingInitRootForPAE_c32 or #Bs3PagingInitRootForPAE_c64. */
+BS3_CMN_PROTO(int, Bs3PagingInitRootForPAE,(void), true);
/**
* Initializes root page tables for long mode (LM16, LM32, LM64).
@@ -2027,10 +1756,7 @@ BS3_DECL(int) Bs3PagingInitRootForPAE_c64(void); /**< @copydoc Bs3PagingInitRoot
* @remarks The default long mode page tables depends on the PAE ones.
* @remarks Must not be called in real-mode!
*/
-BS3_DECL(int) Bs3PagingInitRootForLM_c16(void);
-BS3_DECL(int) Bs3PagingInitRootForLM_c32(void); /**< @copydoc Bs3PagingInitRootForLM_c16 */
-BS3_DECL(int) Bs3PagingInitRootForLM_c64(void); /**< @copydoc Bs3PagingInitRootForLM_c16 */
-#define Bs3PagingInitRootForLM BS3_CMN_NM(Bs3PagingInitRootForLM) /**< Selects #Bs3PagingInitRootForLM_c16, #Bs3PagingInitRootForLM_c32 or #Bs3PagingInitRootForLM_c64. */
+BS3_CMN_PROTO(int, Bs3PagingInitRootForLM,(void), true);
/**
* Modifies the page table protection of an address range.
@@ -2048,10 +1774,7 @@ BS3_DECL(int) Bs3PagingInitRootForLM_c64(void); /**< @copydoc Bs3PagingInitRootF
* @param fSet Mask of zero or more X86_PTE_XXX values to set for the range.
* @param fClear Mask of zero or more X86_PTE_XXX values to clear for the range.
*/
-BS3_DECL(int) Bs3PagingProtect_c16(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear);
-BS3_DECL(int) Bs3PagingProtect_c32(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtect_c16 */
-BS3_DECL(int) Bs3PagingProtect_c64(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtect_c16 */
-#define Bs3PagingProtect BS3_CMN_NM(Bs3PagingProtect) /**< Selects #Bs3PagingProtect_c16, #Bs3PagingProtect_c32 or #Bs3PagingProtect_c64. */
+BS3_CMN_PROTO(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear), true);
/**
* Modifies the page table protection of an address range.
@@ -2069,18 +1792,12 @@ BS3_DECL(int) Bs3PagingProtect_c64(uint64_t uFlat, uint64_t cb, uint64_t fSet, u
* @param fSet Mask of zero or more X86_PTE_XXX values to set for the range.
* @param fClear Mask of zero or more X86_PTE_XXX values to clear for the range.
*/
-BS3_DECL(int) Bs3PagingProtectPtr_c16(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear);
-BS3_DECL(int) Bs3PagingProtectPtr_c32(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtectPtr_c16 */
-BS3_DECL(int) Bs3PagingProtectPtr_c64(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtectPtr_c16 */
-#define Bs3PagingProtectPtr BS3_CMN_NM(Bs3PagingProtectPtr) /**< Selects #Bs3PagingProtectPtr_c16, #Bs3PagingProtectPtr_c32 or #Bs3PagingProtectPtr_c64. */
+BS3_CMN_PROTO(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear), true);
/**
* Waits for the keyboard controller to become ready.
*/
-BS3_DECL(void) Bs3KbdWait_c16(void);
-BS3_DECL(void) Bs3KbdWait_c32(void); /**< @copydoc Bs3KbdWait_c16 */
-BS3_DECL(void) Bs3KbdWait_c64(void); /**< @copydoc Bs3KbdWait_c16 */
-#define Bs3KbdWait BS3_CMN_NM(Bs3KbdWait) /**< Selects #Bs3KbdWait_c16, #Bs3KbdWait_c32 or #Bs3KbdWait_c64. */
+BS3_CMN_PROTO(void, Bs3KbdWait,(void), false);
/**
* Sends a read command to the keyboard controller and gets the result.
@@ -2091,10 +1808,7 @@ BS3_DECL(void) Bs3KbdWait_c64(void); /**< @copydoc Bs3KbdWait_c16 */
* @returns The value read is returned (in al).
* @param bCmd The read command.
*/
-BS3_DECL(uint8_t) Bs3KbdRead_c16(uint8_t bCmd);
-BS3_DECL(uint8_t) Bs3KbdRead_c32(uint8_t bCmd); /**< @copydoc Bs3KbdRead_c16 */
-BS3_DECL(uint8_t) Bs3KbdRead_c64(uint8_t bCmd); /**< @copydoc Bs3KbdRead_c16 */
-#define Bs3KbdRead BS3_CMN_NM(Bs3KbdRead) /**< Selects #Bs3KbdRead_c16, #Bs3KbdRead_c32 or #Bs3KbdRead_c64. */
+BS3_CMN_PROTO(uint8_t, Bs3KbdRead,(uint8_t bCmd), false);
/**
* Sends a write command to the keyboard controller and then sends the data.
@@ -2105,19 +1819,13 @@ BS3_DECL(uint8_t) Bs3KbdRead_c64(uint8_t bCmd); /**< @copydoc Bs3KbdRead_c16 */
* @param bCmd The write command.
* @param bData The data to write.
*/
-BS3_DECL(void) Bs3KbdWrite_c16(uint8_t bCmd, uint8_t bData);
-BS3_DECL(void) Bs3KbdWrite_c32(uint8_t bCmd, uint8_t bData); /**< @copydoc Bs3KbdWrite_c16 */
-BS3_DECL(void) Bs3KbdWrite_c64(uint8_t bCmd, uint8_t bData); /**< @copydoc Bs3KbdWrite_c16 */
-#define Bs3KbdWrite BS3_CMN_NM(Bs3KbdWrite) /**< Selects #Bs3KbdWrite_c16, #Bs3KbdWrite_c32 or #Bs3KbdWrite_c64. */
+BS3_CMN_PROTO(void, Bs3KbdWrite,(uint8_t bCmd, uint8_t bData), false);
/**
* Disables all IRQs on the PIC.
*/
-BS3_DECL(void) Bs3PicMaskAll_c16(void);
-BS3_DECL(void) Bs3PicMaskAll_c32(void); /**< @copydoc Bs3PicMaskAll_c16 */
-BS3_DECL(void) Bs3PicMaskAll_c64(void); /**< @copydoc Bs3PicMaskAll_c16 */
-#define Bs3PicMaskAll BS3_CMN_NM(Bs3PicMaskAll) /**< Selects #Bs3PicMaskAll_c16, #Bs3PicMaskAll_c32 or #Bs3PicMaskAll_c64. */
+BS3_CMN_PROTO(void, Bs3PicMaskAll,(void), true);
@@ -2217,10 +1925,7 @@ typedef BS3REGCTX const BS3_FAR *PCBS3REGCTX;
*
* @param pRegCtx Where to store the register context.
*/
-BS3_DECL(void) Bs3RegCtxSave_c16(PCBS3REGCTX pRegCtx);
-BS3_DECL(void) Bs3RegCtxSave_c32(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxSave_c16 */
-BS3_DECL(void) Bs3RegCtxSave_c64(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxSave_c16 */
-#define Bs3RegCtxSave BS3_CMN_NM(Bs3RegCtxSave) /**< Selects #Bs3RegCtxSave_c16, #Bs3RegCtxSave_c32 or #Bs3RegCtxSave_c64. */
+BS3_CMN_PROTO(void, Bs3RegCtxSave,(PCBS3REGCTX pRegCtx), false);
/**
* Transforms a register context to a different ring.
@@ -2228,10 +1933,7 @@ BS3_DECL(void) Bs3RegCtxSave_c64(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxSa
* @param pRegCtx The register context.
* @param bRing The target ring (0..3).
*/
-BS3_DECL(void) Bs3RegCtxConvertToRingX_c16(PBS3REGCTX pRegCtx, uint8_t bRing);
-BS3_DECL(void) Bs3RegCtxConvertToRingX_c32(PBS3REGCTX pRegCtx, uint8_t bRing); /**< @copydoc Bs3RegCtxConvertToRingX_c16 */
-BS3_DECL(void) Bs3RegCtxConvertToRingX_c64(PBS3REGCTX pRegCtx, uint8_t bRing); /**< @copydoc Bs3RegCtxConvertToRingX_c16 */
-#define Bs3RegCtxConvertToRingX BS3_CMN_NM(Bs3RegCtxConvertToRingX) /**< Selects #Bs3RegCtxConvertToRingX_c16, #Bs3RegCtxConvertToRingX_c32 or #Bs3RegCtxConvertToRingX_c64. */
+BS3_CMN_PROTO(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing), true);
/**
* Restores a register context.
@@ -2242,12 +1944,10 @@ BS3_DECL(void) Bs3RegCtxConvertToRingX_c64(PBS3REGCTX pRegCtx, uint8_t bRing); /
* @remarks Will switch to ring-0.
* @remarks Does not return.
*/
-BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c16(PCBS3REGCTX pRegCtx, uint16_t fFlags);
-BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c32(PCBS3REGCTX pRegCtx, uint16_t fFlags); /**< @copydoc Bs3RegCtxRestore_c16 */
-BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c64(PCBS3REGCTX pRegCtx, uint16_t fFlags); /**< @copydoc Bs3RegCtxRestore_c16 */
-#define Bs3RegCtxRestore BS3_CMN_NM(Bs3RegCtxRestore) /**< Selects #Bs3RegCtxRestore_c16, #Bs3RegCtxRestore_c32 or #Bs3RegCtxRestore_c64. */
+BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3RegCtxRestore,(PCBS3REGCTX pRegCtx, uint16_t fFlags), false);
#if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
# pragma aux Bs3RegCtxRestore_c16 "_Bs3RegCtxRestore_aborts_c16" __aborts
+# pragma aux Bs3RegCtxRestore_f16 "_Bs3RegCtxRestore_aborts_f16" __aborts
# pragma aux Bs3RegCtxRestore_c32 "_Bs3RegCtxRestore_aborts_c32" __aborts
#endif
@@ -2259,10 +1959,7 @@ BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c64(PCBS3REGCTX pRegCtx, uint16_
*
* @param pRegCtx The register context to be printed.
*/
-BS3_DECL(void) Bs3RegCtxPrint_c16(PCBS3REGCTX pRegCtx);
-BS3_DECL(void) Bs3RegCtxPrint_c32(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxPrint_c16 */
-BS3_DECL(void) Bs3RegCtxPrint_c64(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxPrint_c16 */
-#define Bs3RegCtxPrint BS3_CMN_NM(Bs3RegCtxPrint) /**< Selects #Bs3RegCtxPrint_c16, #Bs3RegCtxPrint_c32 or #Bs3RegCtxPrint_c64. */
+BS3_CMN_PROTO(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx), true);
/**
@@ -2303,10 +2000,7 @@ typedef BS3TRAPFRAME const BS3_FAR *PCBS3TRAPFRAME;
* @remarks Does not install 16-bit trap handling, just initializes the
* structures.
*/
-BS3_DECL(void) Bs3Trap16Init_c16(void);
-BS3_DECL(void) Bs3Trap16Init_c32(void); /**< @copydoc Bs3Trap16Init_c16 */
-BS3_DECL(void) Bs3Trap16Init_c64(void); /**< @copydoc Bs3Trap16Init_c16 */
-#define Bs3Trap16Init BS3_CMN_NM(Bs3Trap16Init) /**< Selects #Bs3Trap16Init_c16, #Bs3Trap16Init_c32 or #Bs3Trap16Init_c64. */
+BS3_CMN_PROTO(void, Bs3Trap16Init,(void), true);
/**
* Initializes 16-bit (protected mode) trap handling, extended version.
@@ -2319,10 +2013,7 @@ BS3_DECL(void) Bs3Trap16Init_c64(void); /**< @copydoc Bs3Trap16Init_c16 */
* @remarks Does not install 16-bit trap handling, just initializes the
* structures.
*/
-BS3_DECL(void) Bs3Trap16InitEx_c16(bool f386Plus);
-BS3_DECL(void) Bs3Trap16InitEx_c32(bool f386Plus); /**< @copydoc Bs3Trap16InitEx_c16 */
-BS3_DECL(void) Bs3Trap16InitEx_c64(bool f386Plus); /**< @copydoc Bs3Trap16InitEx_c16 */
-#define Bs3Trap16InitEx BS3_CMN_NM(Bs3Trap16InitEx) /**< Selects #Bs3Trap16InitEx_c16, #Bs3Trap16InitEx_c32 or #Bs3Trap16InitEx_c64. */
+BS3_CMN_PROTO(void, Bs3Trap16InitEx,(bool f386Plus), true);
/**
* Initializes 32-bit trap handling.
@@ -2330,10 +2021,7 @@ BS3_DECL(void) Bs3Trap16InitEx_c64(bool f386Plus); /**< @copydoc Bs3Trap16InitEx
* @remarks Does not install 32-bit trap handling, just initializes the
* structures.
*/
-BS3_DECL(void) Bs3Trap32Init_c16(void);
-BS3_DECL(void) Bs3Trap32Init_c32(void); /**< @copydoc Bs3Trap32Init_c16 */
-BS3_DECL(void) Bs3Trap32Init_c64(void); /**< @copydoc Bs3Trap32Init_c16 */
-#define Bs3Trap32Init BS3_CMN_NM(Bs3Trap32Init) /**< Selects #Bs3Trap32Init_c16, #Bs3Trap32Init_c32 or #Bs3Trap32Init_c64. */
+BS3_CMN_PROTO(void, Bs3Trap32Init,(void), true);
/**
* Initializes 64-bit trap handling
@@ -2341,10 +2029,16 @@ BS3_DECL(void) Bs3Trap32Init_c64(void); /**< @copydoc Bs3Trap32Init_c16 */
* @remarks Does not install 64-bit trap handling, just initializes the
* structures.
*/
-BS3_DECL(void) Bs3Trap64Init_c16(void);
-BS3_DECL(void) Bs3Trap64Init_c32(void); /**< @copydoc Bs3Trap64Init_c16 */
-BS3_DECL(void) Bs3Trap64Init_c64(void); /**< @copydoc Bs3Trap64Init_c16 */
-#define Bs3Trap64Init BS3_CMN_NM(Bs3Trap64Init) /**< Selects #Bs3Trap64Init_c16, #Bs3Trap64Init_c32 or #Bs3Trap64Init_c64. */
+BS3_CMN_PROTO(void, Bs3Trap64Init,(void), true);
+
+/**
+ * Modifies the real-mode / V86 IVT entry specified by @a iIvt.
+ *
+ * @param iIvt The index of the IDT entry to set.
+ * @param uSel The handler real-mode segment.
+ * @param off The handler offset.
+ */
+BS3_CMN_PROTO(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off), true);
/**
* Modifies the 16-bit IDT entry (protected mode) specified by @a iIdt.
@@ -2356,18 +2050,13 @@ BS3_DECL(void) Bs3Trap64Init_c64(void); /**< @copydoc Bs3Trap64Init_c16 */
* @param off The handler offset (if applicable).
* @param cParams The parameter count (for call gates).
*/
-BS3_DECL(void) Bs3Trap16SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams);
-BS3_DECL(void) Bs3Trap16SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
-BS3_DECL(void) Bs3Trap16SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
-#define Bs3Trap16SetGate BS3_CMN_NM(Bs3Trap16SetGate) /**< Selects #Bs3Trap16SetGate_c16, #Bs3Trap16SetGate_c32 or #Bs3Trap16SetGate_c64. */
+BS3_CMN_PROTO(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
+ uint16_t uSel, uint16_t off, uint8_t cParams), true);
/** The address of Bs3Trap16GenericEntries.
* Bs3Trap16GenericEntries is an array of interrupt/trap/whatever entry
* points, 8 bytes each, that will create a register frame and call the generic
* C compatible trap handlers. */
-#ifndef DOXYGEN_RUNNING
-# define g_Bs3Trap16GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap16GenericEntriesFlatAddr)
-#endif
extern uint32_t g_Bs3Trap16GenericEntriesFlatAddr;
/**
@@ -2380,18 +2069,13 @@ extern uint32_t g_Bs3Trap16GenericEntriesFlatAddr;
* @param off The handler offset (if applicable).
* @param cParams The parameter count (for call gates).
*/
-BS3_DECL(void) Bs3Trap32SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams);
-BS3_DECL(void) Bs3Trap32SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap32SetGate_c16 */
-BS3_DECL(void) Bs3Trap32SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap32SetGate_c16 */
-#define Bs3Trap32SetGate BS3_CMN_NM(Bs3Trap32SetGate) /**< Selects #Bs3Trap32SetGate_c16, #Bs3Trap32SetGate_c32 or #Bs3Trap32SetGate_c64. */
+BS3_CMN_PROTO(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
+ uint16_t uSel, uint32_t off, uint8_t cParams), true);
/** The address of Bs3Trap32GenericEntries.
* Bs3Trap32GenericEntries is an array of interrupt/trap/whatever entry
* points, 10 bytes each, that will create a register frame and call the generic
* C compatible trap handlers. */
-#ifndef DOXYGEN_RUNNING
-# define g_Bs3Trap32GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap32GenericEntriesFlatAddr)
-#endif
extern uint32_t g_Bs3Trap32GenericEntriesFlatAddr;
/**
@@ -2404,18 +2088,13 @@ extern uint32_t g_Bs3Trap32GenericEntriesFlatAddr;
* @param off The handler offset (if applicable).
* @param bIst The interrupt stack to use.
*/
-BS3_DECL(void) Bs3Trap64SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst);
-BS3_DECL(void) Bs3Trap64SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst); /**< @copydoc Bs3Trap64SetGate_c16 */
-BS3_DECL(void) Bs3Trap64SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst); /**< @copydoc Bs3Trap64SetGate_c16 */
-#define Bs3Trap64SetGate BS3_CMN_NM(Bs3Trap64SetGate) /**< Selects #Bs3Trap64SetGate_c16, #Bs3Trap64SetGate_c32 or #Bs3Trap64SetGate_c64. */
+BS3_CMN_PROTO(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
+ uint16_t uSel, uint64_t off, uint8_t bIst), true);
/** The address of Bs3Trap64GenericEntries.
* Bs3Trap64GenericEntries is an array of interrupt/trap/whatever entry
* points, 8 bytes each, that will create a register frame and call the generic
* C compatible trap handlers. */
-#ifndef DOXYGEN_RUNNING
-# define g_Bs3Trap64GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap64GenericEntriesFlatAddr)
-#endif
extern uint32_t g_Bs3Trap64GenericEntriesFlatAddr;
/**
@@ -2447,10 +2126,7 @@ typedef FNBS3TRAPHANDLER *PFNBS3TRAPHANDLER;
* @param iIdt The index of the IDT entry to set.
* @param pfnHandler Pointer to the handler.
*/
-BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c16(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler);
-BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c32(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler); /**< @copydoc Bs3Trap32SetHandler_c16 */
-BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c64(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler); /**< @copydoc Bs3Trap32SetHandler_c16 */
-#define Bs3Trap32SetHandler BS3_CMN_NM(Bs3Trap32SetHandler) /**< Selects #Bs3Trap32SetHandler_c16, #Bs3Trap32SetHandler_c32 or #Bs3Trap32SetHandler_c64. */
+BS3_CMN_PROTO(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler), true);
/**
* Default C/C++ trap handler.
@@ -2459,19 +2135,13 @@ BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c64(uint8_t iIdt, PFNBS3TRAPHANDLE
*
* @param pTrapFrame Trap frame of the trap to handle.
*/
-BS3_DECL(void) Bs3TrapDefaultHandler_c16(PBS3TRAPFRAME pTrapFrame);
-BS3_DECL(void) Bs3TrapDefaultHandler_c32(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
-BS3_DECL(void) Bs3TrapDefaultHandler_c64(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
-#define Bs3TrapDefaultHandler BS3_CMN_NM(Bs3TrapDefaultHandler) /**< Selects #Bs3TrapDefaultHandler_c16, #Bs3TrapDefaultHandler_c32 or #Bs3TrapDefaultHandler_c64. */
+BS3_CMN_PROTO(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame), true);
/**
* Prints the trap frame (to screen).
* @param pTrapFrame Trap frame to print.
*/
-BS3_DECL(void) Bs3TrapPrintFrame_c16(PCBS3TRAPFRAME pTrapFrame);
-BS3_DECL(void) Bs3TrapPrintFrame_c32(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
-BS3_DECL(void) Bs3TrapPrintFrame_c64(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
-#define Bs3TrapPrintFrame BS3_CMN_NM(Bs3TrapPrintFrame) /**< Selects #Bs3TrapPrintFrame_c16, #Bs3TrapPrintFrame_c32 or #Bs3TrapPrintFrame_c64. */
+BS3_CMN_PROTO(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame), true);
/**
* Sets up a long jump from a trap handler.
@@ -2485,10 +2155,7 @@ BS3_DECL(void) Bs3TrapPrintFrame_c64(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc B
* returning @c false.
* @sa #Bs3TrapUnsetJmp
*/
-BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c16(PBS3TRAPFRAME pTrapFrame);
-BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c32(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmp_c16 */
-BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c64(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmp_c16 */
-#define Bs3TrapSetJmp BS3_CMN_NM(Bs3TrapSetJmp) /**< Selects #Bs3TrapSetJmp_c16, #Bs3TrapSetJmp_c32 or #Bs3TrapSetJmp_c64. */
+BS3_CMN_PROTO(DECL_RETURNS_TWICE(bool),Bs3TrapSetJmp,(PBS3TRAPFRAME pTrapFrame), false);
/**
* Combination of #Bs3TrapSetJmp and #Bs3RegCtxRestore.
@@ -2496,89 +2163,56 @@ BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c64(PBS3TRAPFRAME pTrapFrame);
* @param pCtxRestore The context to restore.
* @param pTrapFrame Where to store the trap information.
*/
-BS3_DECL(void) Bs3TrapSetJmpAndRestore_c16(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame);
-BS3_DECL(void) Bs3TrapSetJmpAndRestore_c32(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmpAndRestore_c16 */
-BS3_DECL(void) Bs3TrapSetJmpAndRestore_c64(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmpAndRestore_c16 */
-#define Bs3TrapSetJmpAndRestore BS3_CMN_NM(Bs3TrapSetJmpAndRestore) /**< Selects #Bs3TrapSetJmpAndRestore_c16, #Bs3TrapSetJmpAndRestore_c32 or #Bs3TrapSetJmpAndRestore_c64. */
+BS3_CMN_PROTO(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame), true);
/**
* Disables a previous #Bs3TrapSetJmp call.
*/
-BS3_DECL(void) Bs3TrapUnsetJmp_c16(void);
-BS3_DECL(void) Bs3TrapUnsetJmp_c32(void); /**< @copydoc Bs3TrapUnsetJmp_c16 */
-BS3_DECL(void) Bs3TrapUnsetJmp_c64(void); /**< @copydoc Bs3TrapUnsetJmp_c16 */
-#define Bs3TrapUnsetJmp BS3_CMN_NM(Bs3TrapUnsetJmp) /**< Selects #Bs3TrapUnsetJmp_c16, #Bs3TrapUnsetJmp_c32 or #Bs3TrapUnsetJmp_c64. */
+BS3_CMN_PROTO(void, Bs3TrapUnsetJmp,(void), true);
/**
* The current test step.
*/
-#ifndef DOXYGEN_RUNNING
-# define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
-#endif
extern uint16_t g_usBs3TestStep;
-#ifndef DOXYGEN_RUNNING
-# define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
-#endif
/**
* Equivalent to RTTestCreate + RTTestBanner.
*
* @param pszTest The test name.
*/
-BS3_DECL(void) Bs3TestInit_c16(const char BS3_FAR *pszTest);
-BS3_DECL(void) Bs3TestInit_c32(const char BS3_FAR *pszTest); /**< @copydoc Bs3TestInit_c16 */
-BS3_DECL(void) Bs3TestInit_c64(const char BS3_FAR *pszTest); /**< @copydoc Bs3TestInit_c16 */
-#define Bs3TestInit BS3_CMN_NM(Bs3TestInit) /**< Selects #Bs3TestInit_c16, #Bs3TestInit_c32 or #Bs3TestInit_c64. */
+BS3_CMN_PROTO(void, Bs3TestInit,(const char BS3_FAR *pszTest), true);
/**
* Equivalent to RTTestSummaryAndDestroy.
*/
-BS3_DECL(void) Bs3TestTerm_c16(void);
-BS3_DECL(void) Bs3TestTerm_c32(void); /**< @copydoc Bs3TestTerm_c16 */
-BS3_DECL(void) Bs3TestTerm_c64(void); /**< @copydoc Bs3TestTerm_c16 */
-#define Bs3TestTerm BS3_CMN_NM(Bs3TestTerm) /**< Selects #Bs3TestTerm_c16, #Bs3TestTerm_c32 or #Bs3TestTerm_c64. */
+BS3_CMN_PROTO(void, Bs3TestTerm,(void), true);
/**
* Equivalent to RTTestISub.
*/
-BS3_DECL(void) Bs3TestSub_c16(const char BS3_FAR *pszSubTest);
-BS3_DECL(void) Bs3TestSub_c32(const char BS3_FAR *pszSubTest); /**< @copydoc Bs3TestSub_c16 */
-BS3_DECL(void) Bs3TestSub_c64(const char BS3_FAR *pszSubTest); /**< @copydoc Bs3TestSub_c16 */
-#define Bs3TestSub BS3_CMN_NM(Bs3TestSub) /**< Selects #Bs3TestSub_c16, #Bs3TestSub_c32 or #Bs3TestSub_c64. */
+BS3_CMN_PROTO(void, Bs3TestSub,(const char BS3_FAR *pszSubTest), true);
/**
* Equivalent to RTTestIFailedF.
*/
-BS3_DECL(void) Bs3TestSubF_c16(const char BS3_FAR *pszFormat, ...);
-BS3_DECL(void) Bs3TestSubF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSubF_c16 */
-BS3_DECL(void) Bs3TestSubF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSubF_c16 */
-#define Bs3TestSubF BS3_CMN_NM(Bs3TestSubF) /**< Selects #Bs3TestSubF_c16, #Bs3TestSubF_c32 or #Bs3TestSubF_c64. */
+BS3_CMN_PROTO(void, Bs3TestSubF,(const char BS3_FAR *pszFormat, ...), true);
/**
* Equivalent to RTTestISubV.
*/
-BS3_DECL(void) Bs3TestSubV_c16(const char BS3_FAR *pszFormat, va_list va);
-BS3_DECL(void) Bs3TestSubV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSubV_c16 */
-BS3_DECL(void) Bs3TestSubV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSubV_c16 */
-#define Bs3TestSubV BS3_CMN_NM(Bs3TestSubV) /**< Selects #Bs3TestSubV_c16, #Bs3TestSubV_c32 or #Bs3TestSubV_c64. */
+BS3_CMN_PROTO(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list va), true);
/**
* Equivalent to RTTestISubDone.
*/
-BS3_DECL(void) Bs3TestSubDone_c16(void);
-BS3_DECL(void) Bs3TestSubDone_c32(void); /**< @copydoc Bs3TestSubDone_c16 */
-BS3_DECL(void) Bs3TestSubDone_c64(void); /**< @copydoc Bs3TestSubDone_c16 */
-#define Bs3TestSubDone BS3_CMN_NM(Bs3TestSubDone) /**< Selects #Bs3TestSubDone_c16, #Bs3TestSubDone_c32 or #Bs3TestSubDone_c64. */
+BS3_CMN_PROTO(void, Bs3TestSubDone,(void), true);
/**
* Equivalent to RTTestSubErrorCount.
*/
-BS3_DECL(uint16_t) Bs3TestSubErrorCount_c16(void);
-BS3_DECL(uint16_t) Bs3TestSubErrorCount_c32(void); /**< @copydoc Bs3TestSubErrorCount_c16 */
-BS3_DECL(uint16_t) Bs3TestSubErrorCount_c64(void); /**< @copydoc Bs3TestSubErrorCount_c16 */
-#define Bs3TestSubErrorCount BS3_CMN_NM(Bs3TestSubErrorCount) /**< Selects #Bs3TestSubErrorCount_c16, #Bs3TestSubErrorCount_c32 or #Bs3TestSubErrorCount_c64. */
+BS3_CMN_PROTO(uint16_t, Bs3TestSubErrorCount,(void), true);
/**
* Equivalent to RTTestIPrintf with RTTESTLVL_ALWAYS.
@@ -2586,10 +2220,7 @@ BS3_DECL(uint16_t) Bs3TestSubErrorCount_c64(void); /**< @copydoc Bs3TestSubError
* @param pszFormat What to print, format string. Explicit newline char.
* @param ... String format arguments.
*/
-BS3_DECL(void) Bs3TestPrintf_c16(const char BS3_FAR *pszFormat, ...);
-BS3_DECL(void) Bs3TestPrintf_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestPrintf_c16 */
-BS3_DECL(void) Bs3TestPrintf_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestPrintf_c16 */
-#define Bs3TestPrintf BS3_CMN_NM(Bs3TestPrintf) /**< Selects #Bs3TestPrintf_c16, #Bs3TestPrintf_c32 or #Bs3TestPrintf_c64. */
+BS3_CMN_PROTO(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...), true);
/**
* Equivalent to RTTestIPrintfV with RTTESTLVL_ALWAYS.
@@ -2597,44 +2228,29 @@ BS3_DECL(void) Bs3TestPrintf_c64(const char BS3_FAR *pszFormat, ...); /**< @copy
* @param pszFormat What to print, format string. Explicit newline char.
* @param va String format arguments.
*/
-BS3_DECL(void) Bs3TestPrintfV_c16(const char BS3_FAR *pszFormat, va_list va);
-BS3_DECL(void) Bs3TestPrintfV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestPrintfV_c16 */
-BS3_DECL(void) Bs3TestPrintfV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestPrintfV_c16 */
-#define Bs3TestPrintfV BS3_CMN_NM(Bs3TestPrintfV) /**< Selects #Bs3TestPrintfV_c16, #Bs3TestPrintfV_c32 or #Bs3TestPrintfV_c64. */
+BS3_CMN_PROTO(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
/**
* Equivalent to RTTestIFailed.
*/
-BS3_DECL(void) Bs3TestFailed_c16(const char BS3_FAR *pszMessage);
-BS3_DECL(void) Bs3TestFailed_c32(const char BS3_FAR *pszMessage); /**< @copydoc Bs3TestFailed_c16 */
-BS3_DECL(void) Bs3TestFailed_c64(const char BS3_FAR *pszMessage); /**< @copydoc Bs3TestFailed_c16 */
-#define Bs3TestFailed BS3_CMN_NM(Bs3TestFailed) /**< Selects #Bs3TestFailed_c16, #Bs3TestFailed_c32 or #Bs3TestFailed_c64. */
+BS3_CMN_PROTO(void, Bs3TestFailed,(const char BS3_FAR *pszMessage), true);
/**
* Equivalent to RTTestIFailedF.
*/
-BS3_DECL(void) Bs3TestFailedF_c16(const char BS3_FAR *pszFormat, ...);
-BS3_DECL(void) Bs3TestFailedF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestFailedF_c16 */
-BS3_DECL(void) Bs3TestFailedF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestFailedF_c16 */
-#define Bs3TestFailedF BS3_CMN_NM(Bs3TestFailedF) /**< Selects #Bs3TestFailedF_c16, #Bs3TestFailedF_c32 or #Bs3TestFailedF_c64. */
+BS3_CMN_PROTO(void, Bs3TestFailedF,(const char BS3_FAR *pszFormat, ...), true);
/**
* Equivalent to RTTestIFailedV.
*/
-BS3_DECL(void) Bs3TestFailedV_c16(const char BS3_FAR *pszFormat, va_list va);
-BS3_DECL(void) Bs3TestFailedV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestFailedV_c16 */
-BS3_DECL(void) Bs3TestFailedV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestFailedV_c16 */
-#define Bs3TestFailedV BS3_CMN_NM(Bs3TestFailedV) /**< Selects #Bs3TestFailedV_c16, #Bs3TestFailedV_c32 or #Bs3TestFailedV_c64. */
+BS3_CMN_PROTO(void, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list va), true);
/**
* Equivalent to RTTestISkipped.
*
* @param pszWhy Optional reason why it's being skipped.
*/
-BS3_DECL(void) Bs3TestSkipped_c16(const char BS3_FAR *pszWhy);
-BS3_DECL(void) Bs3TestSkipped_c32(const char BS3_FAR *pszWhy); /**< @copydoc Bs3TestSkipped_c16 */
-BS3_DECL(void) Bs3TestSkipped_c64(const char BS3_FAR *pszWhy); /**< @copydoc Bs3TestSkipped_c16 */
-#define Bs3TestSkipped BS3_CMN_NM(Bs3TestSkipped) /**< Selects #Bs3TestSkipped_c16, #Bs3TestSkipped_c32 or #Bs3TestSkipped_c64. */
+BS3_CMN_PROTO(void, Bs3TestSkipped,(const char BS3_FAR *pszWhy), true);
/**
* Equivalent to RTTestISkippedF.
@@ -2642,10 +2258,7 @@ BS3_DECL(void) Bs3TestSkipped_c64(const char BS3_FAR *pszWhy); /**< @copydoc Bs3
* @param pszFormat Optional reason why it's being skipped.
* @param ... Format arguments.
*/
-BS3_DECL(void) Bs3TestSkippedF_c16(const char BS3_FAR *pszFormat, ...);
-BS3_DECL(void) Bs3TestSkippedF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSkippedF_c16 */
-BS3_DECL(void) Bs3TestSkippedF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSkippedF_c16 */
-#define Bs3TestSkippedF BS3_CMN_NM(Bs3TestSkippedF) /**< Selects #Bs3TestSkippedF_c16, #Bs3TestSkippedF_c32 or #Bs3TestSkippedF_c64. */
+BS3_CMN_PROTO(void, Bs3TestSkippedF,(const char BS3_FAR *pszFormat, ...), true);
/**
* Equivalent to RTTestISkippedV.
@@ -2653,10 +2266,7 @@ BS3_DECL(void) Bs3TestSkippedF_c64(const char BS3_FAR *pszFormat, ...); /**< @co
* @param pszFormat Optional reason why it's being skipped.
* @param va Format arguments.
*/
-BS3_DECL(void) Bs3TestSkippedV_c16(const char BS3_FAR *pszFormat, va_list va);
-BS3_DECL(void) Bs3TestSkippedV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSkippedV_c16 */
-BS3_DECL(void) Bs3TestSkippedV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSkippedV_c16 */
-#define Bs3TestSkippedV BS3_CMN_NM(Bs3TestSkippedV) /**< Selects #Bs3TestSkippedV_c16, #Bs3TestSkippedV_c32 or #Bs3TestSkippedV_c64. */
+BS3_CMN_PROTO(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list va), true);
/**
* Compares two register contexts, with PC and SP adjustments.
@@ -2672,13 +2282,8 @@ BS3_DECL(void) Bs3TestSkippedV_c64(const char BS3_FAR *pszFormat, va_list va); /
* @param pszMode CPU mode or some other helpful text.
* @param idTestStep Test step identifier.
*/
-BS3_DECL(bool) Bs3TestCheckRegCtxEx_c16(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
- uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep);
-BS3_DECL(bool) Bs3TestCheckRegCtxEx_c32(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
- uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep); /** @copydoc Bs3TestCheckRegCtxEx_c16 */
-BS3_DECL(bool) Bs3TestCheckRegCtxEx_c64(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
- uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep); /** @copydoc Bs3TestCheckRegCtxEx_c16 */
-#define Bs3TestCheckRegCtxEx BS3_CMN_NM(Bs3TestCheckRegCtxEx) /**< Selects #Bs3TestCheckRegCtxEx_c16, #Bs3TestCheckRegCtxEx_c32 or #Bs3TestCheckRegCtxEx_c64. */
+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);
/**
* Performs the testing for the given mode.
@@ -2844,7 +2449,7 @@ BS3_DECL(void) Bs3InitAll_rm(void);
*
* For proper operation on OLDer CPUs, call #Bs3CpuDetect_mmm first.
*/
-BS3_DECL(void) Bs3InitMemory_rm(void);
+BS3_DECL_FAR(void) Bs3InitMemory_rm(void);
@@ -2865,28 +2470,29 @@ BS3_DECL(void) Bs3InitMemory_rm(void);
* Doxygen knows how to expand this, well, kind of.
*/
#define BS3_MODE_EXPAND_PROTOTYPES(a_RetType, a_BaseFnNm, a_Parameters) \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_rm) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_v86) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32_16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pev86) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_v86) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32_16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_ppv86) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_v86)a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32_16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_paev86) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm16) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm32) a_Parameters; \
- BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm64) a_Parameters
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_rm) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_rm_far) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_v86) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32_16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pev86) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_v86) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32_16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_ppv86) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_v86)a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32_16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_paev86) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm16) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm32) a_Parameters; \
+ BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm64) a_Parameters
/**
* Macro for reducing typing.
@@ -2964,9 +2570,6 @@ BS3_MODE_EXPAND_PROTOTYPES(uint8_t, Bs3CpuDetect,(void));
/** @} */
/** The return value of #Bs3CpuDetect_mmm. (Initial value is BS3CPU_TYPE_MASK.) */
-#ifndef DOXYGEN_RUNNING
-# define g_uBs3CpuDetected BS3_DATA_NM(g_uBs3CpuDetected)
-#endif
extern uint16_t g_uBs3CpuDetected;
/**
@@ -2990,5 +2593,11 @@ BS3_MODE_EXPAND_PROTOTYPES(void, Bs3TestDoModes, (PCBS3TESTMODEENTRY paEntries,
RT_C_DECLS_END
+/*
+ * Include default function symbol mangling.
+ */
+#include "bs3kit-mangling-code.h"
+
+
#endif
diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
index d8ee4241bd8..2252b8d3bd7 100644
--- a/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
+++ b/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
@@ -137,25 +137,16 @@
%endif
%endmacro
-; Default to register aliases for ARCH_BITS.
-BS3_SET_REG_ALIASES ARCH_BITS
-
-
-;; Wrapper around BITS.
-; Updates __BITS__ (built-in variable in nasm, we work it for yasm) as well
-; a number of convenient macros and register aliases.
-;
-; @param %1 The CPU bit count: 16, 32 or 64
-; @remarks ARCH_BITS is not modified and will remain what it was on the
-; assembler command line.
-%macro BS3_SET_BITS 1
- BITS %1
-
+;;
+; Redefines macros that follows __BITS__.
+%macro BS3_SET_BITS_MACROS 1
+ ;; Emulate the __BITS__ macro in NASM 2.0+. Follows BS3_SET_BITS.
%ifdef __YASM__
%undef __BITS__
%define __BITS__ %1
%endif
+ ;; Mostly internal macro. Follows BS3_SET_BITS.
%undef BS3_NAME_UNDERSCORE
%if %1 == 64
%define BS3_NAME_UNDERSCORE
@@ -163,6 +154,7 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_NAME_UNDERSCORE _
%endif
+ ;; For segment overrides and stuff. Follows BS3_SET_BITS.
%undef BS3_ONLY_16BIT
%if %1 == 16
%define BS3_ONLY_16BIT(a_Expr) a_Expr
@@ -170,6 +162,7 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_ONLY_16BIT(a_Expr)
%endif
+ ;; For odd 64-bit stuff. Follows BS3_SET_BITS.
%undef BS3_ONLY_64BIT
%if %1 == 64
%define BS3_ONLY_64BIT(a_Expr) a_Expr
@@ -177,6 +170,7 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_ONLY_64BIT(a_Expr)
%endif
+ ;; For segment overrides and stuff. Follows BS3_SET_BITS.
%undef BS3_NOT_64BIT
%if %1 == 64
%define BS3_NOT_64BIT(a_Expr)
@@ -184,6 +178,7 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_NOT_64BIT(a_Expr) a_Expr
%endif
+ ;; For stack cleanups and similar where each bit mode is different. Follows BS3_SET_BITS.
%undef BS3_IF_16_32_64BIT
%if %1 == 16
%define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_16BitExpr
@@ -193,6 +188,8 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_64BitExpr
%endif
+ ;; For RIP relative addressing in 64-bit mode and absolute addressing in
+ ; other modes. Follows BS3_SET_BITS.
%undef BS3_WRT_RIP
%if %1 == 64
%define BS3_WRT_RIP(a_Sym) rel a_Sym
@@ -240,64 +237,37 @@ BS3_SET_REG_ALIASES ARCH_BITS
%define BS3_IF_64BIT_OTHERWISE(a_64BitExpr, a_OtherwiseExpr) a_OtherwiseExpr
%endif
- BS3_SET_REG_ALIASES %1
-%endmacro
-
-
-;; Emulate the __BITS__ macro in NASM 2.0+. Follows BS3_SET_BITS.
-%ifdef __YASM__
- %define __BITS__ ARCH_BITS
-%endif
-
-;; Mostly internal macro. Follows BS3_SET_BITS.
-%if ARCH_BITS == 64
- %define BS3_NAME_UNDERSCORE
-%else
- %define BS3_NAME_UNDERSCORE _
-%endif
-
-;; For RIP relative addressing in 64-bit mode and absolute addressing in
-; other modes. Follows BS3_SET_BITS.
-%if ARCH_BITS == 64
- %ifdef __YASM__
- %define BS3_WRT_RIP(a_Sym) a_Sym wrt rip
+ ;;
+ ; Same as BS3_CMN_NM except in 16-bit mode, it will generate the far name.
+ ; (16-bit code generally have both near and far callable symbols, so we won't
+ ; be restricted to 64KB test code.)
+ %if %1 == 16
+ %define BS3_CMN_NM_FAR(a_Name) BS3_NAME_UNDERSCORE %+ a_Name %+ _f %+ __BITS__
%else
- %define BS3_WRT_RIP(a_Sym) rel a_Sym ; Baka! Why couldn't they do 'wrt rip' like yasm?
+ %define BS3_CMN_NM_FAR(a_Name) BS3_CMN_NM(a_Name)
%endif
-%else
- %define BS3_WRT_RIP(a_Sym) a_Sym
-%endif
-;; For segment overrides and stuff. Follows BS3_SET_BITS.
-%if ARCH_BITS == 16
- %define BS3_ONLY_16BIT(a_Expr) a_Expr
-%else
- %define BS3_ONLY_16BIT(a_Expr)
-%endif
+%endmacro
-;; For odd 64-bit stuff. Follows BS3_SET_BITS.
-%if ARCH_BITS == 64
- %define BS3_ONLY_64BIT(a_Expr) a_Expr
-%else
- %define BS3_ONLY_64BIT(a_Expr)
-%endif
+; Default to register aliases for ARCH_BITS.
+BS3_SET_REG_ALIASES ARCH_BITS
-;; For segment overrides and stuff. Follows BS3_SET_BITS.
-%if ARCH_BITS == 64
- %define BS3_NOT_64BIT(a_Expr)
-%else
- %define BS3_NOT_64BIT(a_Expr) a_Expr
-%endif
+; Define macros for ARCH_BITS.
+BS3_SET_BITS_MACROS ARCH_BITS
-;; For stack cleanups and similar where each bit mode is different. Follows BS3_SET_BITS.
-%if ARCH_BITS == 16
- %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_16BitExpr
-%elif ARCH_BITS == 32
- %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_32BitExpr
-%else
- %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_64BitExpr
-%endif
+;; Wrapper around BITS.
+; Updates __BITS__ (built-in variable in nasm, we work it for yasm) as well
+; a number of convenient macros and register aliases.
+;
+; @param %1 The CPU bit count: 16, 32 or 64
+; @remarks ARCH_BITS is not modified and will remain what it was on the
+; assembler command line.
+%macro BS3_SET_BITS 1
+ BITS %1
+ BS3_SET_BITS_MACROS %1
+ BS3_SET_REG_ALIASES %1
+%endmacro
;;
; For instruction that should only be emitted in 16-bit mode. Follows BS3_SET_BITS.
@@ -357,6 +327,56 @@ GROUP FLAT BS3FLAT
%else
section BS3TEXT16
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_TEXT16
+ BS3_SET_BITS 16
+%endmacro
+
+%macro BS3_BEGIN_TEXT16_NEARSTUBS 0
+ %ifndef BS3_BEGIN_TEXT16_NEARSTUBS_NOT_FIRST
+ %define BS3_BEGIN_TEXT16_NEARSTUBS_NOT_FIRST
+ %ifdef ASM_FORMAT_ELF
+ section BS3TEXT16_NEARSTUBS align=1 progbits alloc exec nowrite
+ %else
+ section BS3TEXT16_NEARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
+ %endif
+ %else
+ section BS3TEXT16_NEARSTUBS
+ %endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_TEXT16_NEARSTUBS
+ BS3_SET_BITS 16
+%endmacro
+
+%macro BS3_BEGIN_TEXT16_FARSTUBS 0
+ %ifndef BS3_BEGIN_TEXT16_FARSTUBS_NOT_FIRST
+ %define BS3_BEGIN_TEXT16_FARSTUBS_NOT_FIRST
+ %ifdef ASM_FORMAT_ELF
+ section BS3TEXT16_FARSTUBS align=1 progbits alloc exec nowrite
+ %else
+ section BS3TEXT16_FARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
+ %endif
+ %else
+ section BS3TEXT16_FARSTUBS
+ %endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_TEXT16_FARSTUBS
+ BS3_SET_BITS 16
+%endmacro
+
+%macro BS3_BEGIN_RMTEXT16 0
+ %ifndef BS3_BEGIN_RMTEXT16_NOT_FIRST
+ %define BS3_BEGIN_RMTEXT16_NOT_FIRST
+ %ifdef ASM_FORMAT_ELF
+ section BS3RMTEXT16 align=2 progbits alloc exec nowrite
+ %else
+ section BS3RMTEXT16 align=2 CLASS=BS3CLASS16RMCODE PUBLIC USE16
+ %endif
+ %else
+ section BS3RMTEXT16
+ %endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_RMTEXT16
BS3_SET_BITS 16
%endmacro
@@ -374,6 +394,8 @@ GROUP FLAT BS3FLAT
%else
section BS3DATA16
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_DATA16
BS3_SET_BITS 16
%endmacro
@@ -388,6 +410,8 @@ GROUP FLAT BS3FLAT
%else
section BS3TEXT32
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_TEXT32
BS3_SET_BITS 32
%endmacro
@@ -402,6 +426,8 @@ GROUP FLAT BS3FLAT
%else
section BS3DATA32
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_DATA32
BS3_SET_BITS 32
%endmacro
@@ -416,6 +442,8 @@ GROUP FLAT BS3FLAT
%else
section BS3TEXT64
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_TEXT64
BS3_SET_BITS 64
%endmacro
@@ -430,6 +458,8 @@ GROUP FLAT BS3FLAT
%else
section BS3DATA64
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_DATA64
BS3_SET_BITS 64
%endmacro
@@ -445,6 +475,8 @@ GROUP FLAT BS3FLAT
%else
section BS3SYSTEM16
%endif
+ %undef BS3_CUR_SEG_BEGIN_MACRO
+ %xdefine BS3_CUR_SEG_BEGIN_MACRO BS3_BEGIN_SYSTEM16
BS3_SET_BITS 16
%endmacro
@@ -514,6 +546,19 @@ GROUP FLAT BS3FLAT
%define %1 BS3_CMN_NM(%1)
%endmacro
+;;
+; Same as BS3_EXTERN_CMN except it picks the far variant in 16-bit code.
+;
+; @param %1 The unmangled common name.
+;
+; @remarks Must enter the segment in which this name is defined.
+;
+%macro BS3_EXTERN_CMN_FAR 1
+ extern BS3_CMN_NM_FAR(%1)
+ %undef %1
+ %define %1 BS3_CMN_NM_FAR(%1)
+%endmacro
+
;; @def BS3_EXTERN_TMPL
; Mangles the given name into a template specific one. For ease of use, the
; name is redefined to the mangled one, just like BS3_EXTERN_CMN does.
@@ -628,16 +673,151 @@ size %1 %+ _EndProc 0
%endmacro
+;; @name BS3_PBC_XXX - For use as the 2nd parameter to BS3_PROC_BEGIN_CMN.
+;; @{
+%define BS3_PBC_NEAR 0 ;;< Only near.
+%define BS3_PBC_FAR 1 ;;< Only far.
+%define BS3_PBC_HYBRID 2 ;;< Hybrid near/far procedure, trashing AX
+%define BS3_PBC_HYBRID_SAFE 3 ;;< Hybrid near/far procedure, no trashing but slower.
+%define BS3_PBC_HYBRID_0_ARGS 4 ;;< Hybrid near/far procedure, no parameters so separate far stub, no trashing, fast near calls.
+;; @}
+
;; Convenience macro for defining common procedures.
-%macro BS3_PROC_BEGIN_CMN 1
- BS3_PROC_BEGIN BS3_CMN_NM(%1)
+; This will emit both near and far 16-bit symbols according to parameter %2 (BS3_PBC_XXX).
+%macro BS3_PROC_BEGIN_CMN 2
+ %undef BS3_CUR_PROC_FLAGS
+ %if __BITS__ == 16
+ %if %2 == BS3_PBC_NEAR
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_NEAR
+ %xdefine cbCurRetAddr 2
+ BS3_PROC_BEGIN BS3_CMN_NM(%1)
+
+ %elif %2 == BS3_PBC_FAR
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_FAR
+ %xdefine cbCurRetAddr 4
+ BS3_PROC_BEGIN BS3_CMN_NM_FAR(%1)
+
+ %elif %2 == BS3_PBC_HYBRID
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_HYBRID
+ %xdefine cbCurRetAddr 4
+ BS3_GLOBAL_NAME_EX BS3_CMN_NM(%1), function, 3
+ pop ax
+ push cs
+ push ax
+ BS3_PROC_BEGIN BS3_CMN_NM_FAR(%1)
+
+ %elif %2 == BS3_PBC_HYBRID_SAFE
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_HYBRID_SAFE
+ %xdefine cbCurRetAddr 4
+ BS3_GLOBAL_NAME_EX BS3_CMN_NM(%1), function, 3
+ extern Bs3CreateHybridFarRet_c16
+ call Bs3CreateHybridFarRet_c16
+ BS3_PROC_BEGIN BS3_CMN_NM_FAR(%1)
+
+ %elif %2 == BS3_PBC_HYBRID_0_ARGS
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_NEAR
+ %xdefine cbCurRetAddr 2
+ %undef TMP_BEGIN_PREV_SEG
+ %xdefine TMP_BEGIN_PREV_SEG BS3_CUR_SEG_BEGIN_MACRO
+
+ BS3_BEGIN_TEXT16_FARSTUBS
+ BS3_PROC_BEGIN BS3_CMN_NM_FAR(%1)
+ call BS3_CMN_NM(%1)
+ retf
+ BS3_PROC_END BS3_CMN_NM_FAR(%1)
+
+ TMP_BEGIN_PREV_SEG
+ BS3_PROC_BEGIN BS3_CMN_NM(%1)
+
+ %else
+ %error BS3_PROC_BEGIN_CMN parameter 2 value %2 is not recognized.
+
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_NEAR
+ %xdefine cbCurRetAddr 4
+ BS3_PROC_BEGIN BS3_CMN_NM(%1)
+ %endif
+ %else
+ %define BS3_CUR_PROC_FLAGS BS3_PBC_NEAR
+ %xdefine cbCurRetAddr xCB
+ BS3_PROC_BEGIN BS3_CMN_NM(%1)
+ %endif
%endmacro
;; Convenience macro for defining common procedures.
%macro BS3_PROC_END_CMN 1
- BS3_PROC_END BS3_CMN_NM(%1)
+ %if __BITS__ == 16
+ %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR
+ BS3_PROC_END BS3_CMN_NM(%1)
+ %else
+ BS3_PROC_END BS3_CMN_NM_FAR(%1)
+ %endif
+ %else
+ BS3_PROC_END BS3_CMN_NM(%1)
+ %endif
+ %undef cbCurRetAddr
%endmacro
+;; Does a far return in 16-bit code, near return in 32-bit and 64-bit.
+; This is for use with BS3_PBC_XXX
+%macro BS3_HYBRID_RET 0-1
+ %if __BITS__ == 16
+ %if %0 > 0
+ %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR || BS3_CUR_PROC_FLAGS == BS3_PBC_HYBRID_0_ARGS
+ ret %1
+ %else
+ retf %1
+ %endif
+ %else
+ %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR || BS3_CUR_PROC_FLAGS == BS3_PBC_HYBRID_0_ARGS
+ ret
+ %else
+ retf
+ %endif
+ %endif
+ %else
+ %if BS3_CUR_PROC_FLAGS != BS3_PBC_NEAR
+ %error Expected BS3_CUR_PROC_FLAGS to be BS3_PBC_NEAR in non-16-bit code.
+ %endif
+ %if %0 > 0
+ ret %1
+ %else
+ ret
+ %endif
+ %endif
+%endmacro
+
+;;
+; Generate a safe 16-bit far stub for function %1, shuffling %2 bytes of parameters.
+;
+; This does absolutely nothing in 32-bit and 64-bit mode.
+;
+; @param 1 The function basename.
+; @param 2 The number of bytes of parameters on the stack, must be a multiple of 2.
+; @remarks Changes the segment to TEXT16.
+;
+%macro BS3_CMN_FAR_STUB 2
+ %if %2 <= 1 || (%2 & 1)
+ %error Invalid parameter frame size passed to BS3_CMN_FAR_STUB: %2
+ %endif
+ %if __BITS__ == 16
+BS3_BEGIN_TEXT16_FARSTUBS
+BS3_PROC_BEGIN_CMN %1, BS3_PBC_FAR
+ CPU 8086
+ push bp
+ mov bp, sp
+ %assign offParam %2
+ %rep %2/2
+ push word [bp + xCB + cbCurRetAddr + offParam - 2]
+ %assign offParam offParam - 2
+ %endrep
+ call BS3_CMN_NM(%1)
+ add sp, %2
+ pop bp
+ retf
+BS3_PROC_END_CMN %1
+BS3_BEGIN_TEXT16
+ %endif
+%endmacro
;; Convenience macro for defining mode specific procedures.
%macro BS3_PROC_BEGIN_MODE 1