VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/Config.kmk@ 102131

Last change on this file since 102131 was 102131, checked in by vboxsync, 15 months ago

ValKit/bs3kit: No need to have and _END segment for the BS3SEPARATE16AND32BITCODE and BS3SEPARATE32AND64BITCODE separators.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.4 KB
Line 
1# $Id: Config.kmk 102131 2023-11-17 09:53:07Z vboxsync $
2## @file
3# kBuild Configuration file for VirtualBox Boot Sector Kit 3.
4#
5
6#
7# Copyright (C) 2010-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37VBOX_BOOTSECTORS_CONFIG_KMK_INCLUDED = 1
38
39# Include the parent configure file.
40ifndef VBOX_VALIDATIONKIT_CONFIG_KMK_INCLUDED
41 include $(PATH_ROOT)/src/VBox/ValidationKit/Config.kmk
42endif
43
44# Add our 32-bit and 64-bit C properties.
45KBUILD_COMPILE_CATEGTORIES += C32 C64
46PROPS_TOOLS += C32TOOL C64TOOL
47PROPS_SINGLE += C32TOOL C64TOOL C32OBJSUFF C64OBJSUFF
48PROPS_ACCUMULATE_R += C32FLAGS C64FLAGS C32DEFS C64DEFS
49PROPS_ACCUMULATE_L += C32INCS C64INCS
50
51if 0 # Adding as few as possible new properties.
52 KBUILD_COMPILE_CATEGTORIES += C16
53 PROPS_TOOLS += C16TOOL
54 PROPS_SINGLE += C16TOOL C16OBJSUFF
55 PROPS_ACCUMULATE_R += C16FLAGS C16DEFS
56 PROPS_ACCUMULATE_L += C16INCS
57endif
58
59# Add noarch to the architectures list (will be there by default in a new kBuild).
60KBUILD_ARCHES += noarch
61
62
63# The bootsector directory.
64VBOX_PATH_BOOTSECTORS_SRC = $(VBOX_PATH_VALIDATIONKIT_SRC)/bootsectors
65
66# The bs3kit source directory.
67VBOX_PATH_BS3KIT_SRC = $(VBOX_PATH_BOOTSECTORS_SRC)/bs3kit
68
69
70# The 16-bit code & data segment classes.
71if 1
72 BS3KIT_CLASS_CODE16 = CODE
73 BS3KIT_SEGNM_DATA16 =
74 BS3KIT_CLASS_DATA16 = DATA
75 BS3KIT_GRPNM_DATA16 = DGROUP
76 BS3KIT_CLASS_BSS16 = BSS
77else
78 BS3KIT_CLASS_CODE16 = BS3CLASS16CODE
79 BS3KIT_SEGNM_DATA16 = BS3DATA16
80 BS3KIT_CLASS_DATA16 = FAR_DATA
81 BS3KIT_GRPNM_DATA16 = BS3DATA16_GROUP
82 BS3KIT_CLASS_BSS16 = ???
83endif
84
85
86##
87# Macro for generating near-call aliases for one 16-bit C function.
88# @param 1 The target name.
89# @param 2 The common function.
90BS3KIT_FN_GEN_CMN_NEARSTUB = $(evalcall2 def_Bs3KitGenNearStubSource,$1,_$2_c16,_$2_f16)
91
92##
93# Macro for generating near-call aliases for one 16-bit C mode function.
94# @param 1 The target name.
95# @param 2 The mode function.
96BS3KIT_FN_GEN_MODE_NEARSTUB = $(foreach suff, \
97 _rm \
98 _pe16 \
99 _pe16_v86 \
100 _pe32_16 \
101 _pev86 \
102 _pp16 \
103 _pp16_v86 \
104 _pp32_16 \
105 _ppv86 \
106 _pae16 \
107 _pae16_v86 \
108 _pae32_16 \
109 _paev86 \
110 _lm16 \
111 ,$(evalcall2 def_Bs3KitGenNearStubSource,$1,_$2$(suff),_$2$(suff)_far))
112
113# @param 1 The target name.
114# @param 2 The near function name.
115# @param 3 The far function name.
116define def_Bs3KitGenNearStubSource
117 $1_SOURCES += $$($1_0_OUTDIR)/stub$2.asm
118 $1_CLEAN += $$($1_0_OUTDIR)/stub$2.asm
119 $$$$($1_0_OUTDIR)/stub$2.asm: $$(VBOX_PATH_BOOTSECTORS_SRC)/Config.kmk | $$$$(dir $$$$@)
120 $(QUIET)$(APPEND) -tn $$@ \
121 '%include "bs3kit.mac"' \
122 'BS3_BEGIN_TEXT16' \
123 ' extern $3' \
124 'BS3_BEGIN_TEXT16_NEARSTUBS' \
125 'BS3_GLOBAL_NAME_EX $2, function, 6' \
126 ' pop ax' \
127 ' push cs' \
128 ' push ax' \
129 ' jmp $3 wrt CGROUP16'
130endef
131
132
133##
134# Macro for generating far-call aliases for zero or more 16-bit C or assembly functions.
135# @param 1 The target name.
136# @param 2 The common function.
137# @param 3 The parameter size in bytes.
138BS3KIT_FN_GEN_CMN_FARSTUB = $(evalcall2 def_Bs3KitGenFarStubSource,$1,$2,_f16,_c16,$3)
139
140##
141# Macro for generating far-call aliases for zero or more 16-bit C mode functions.
142# @param 1 The target name.
143# @param 2 The mode function.
144# @param 3 The parameter size in bytes.
145BS3KIT_FN_GEN_MODE_FARSTUB = $(foreach suff, \
146 _rm \
147 _pe16 \
148 _pe16_v86 \
149 _pe32_16 \
150 _pev86 \
151 _pp16 \
152 _pp16_v86 \
153 _pp32_16 \
154 _ppv86 \
155 _pae16 \
156 _pae16_v86 \
157 _pae32_16 \
158 _paev86 \
159 _lm16 \
160 ,$(evalcall2 def_Bs3KitGenFarStubSource,$1,$2,$(suff)_far,$(suff),$3))
161
162# @param 1 The target name.
163# @param 2 The function name.
164# @param 3 The far function suffix.
165# @param 4 The near function suffix.
166# @param 5 The parameter size in bytes.
167define def_Bs3KitGenFarStubSource
168 $1_SOURCES += $$($1_0_OUTDIR)/stub_$2$3.asm
169 $1_CLEAN += $$($1_0_OUTDIR)/stub_$2$3.asm
170 $$$$($1_0_OUTDIR)/stub_$2$3.asm: $$(VBOX_PATH_BOOTSECTORS_SRC)/Config.kmk | $$$$(dir $$$$@)
171 $(QUIET)$(APPEND) -tn $$@ \
172 '%include "bs3kit.mac"' \
173 'BS3_BEGIN_TEXT16' \
174 ' extern _$2$4' \
175 'BS3_BEGIN_TEXT16_FARSTUBS' \
176 'BS3_PROC_BEGIN _$2$3' \
177 ' CPU 8086' \
178 ' inc bp' \
179 ' push bp' \
180 ' mov bp, sp' \
181 '%assign offParam $5' \
182 '%rep $5 / 2' \
183 ' push word [bp + 2 + 4 + offParam - 2]' \
184 '%assign offParam offParam - 2' \
185 '%endrep' \
186 ' call _$2$4' \
187 ' add sp, $5' \
188 ' pop bp' \
189 ' dec bp' \
190 ' retf' \
191 'BS3_PROC_END _$2$3' \
192 ''
193endef
194
195
196#
197# Tools Tools Tools
198# Tools Tools Tools
199# Tools Tools Tools
200#
201
202if defined(VBOX_USE_KSUBMIT) && "$(KBUILD_HOST)" == "win"
203 VBOX_BS3KIT_KSUBMIT_OBJ_CONV := kmk_builtin_kSubmit --
204else
205 VBOX_BS3KIT_KSUBMIT_OBJ_CONV :=
206endif
207
208# Dummy CP "linker" tool.
209TOOL_VBoxBsCpLd = Dummy copy linker.
210TOOL_VBoxBsCpLd_LINK_MISCBIN_OUTPUT =
211TOOL_VBoxBsCpLd_LINK_MISCBIN_DEPEND =
212TOOL_VBoxBsCpLd_LINK_MISCBIN_DEPORD =
213define TOOL_VBoxBsCpLd_LINK_MISCBIN_CMDS
214 $(CP) -- $(objs) $(othersrc) "$(out)"
215endef
216
217# Dummy exit 1 "linker" tool.
218TOOL_VBoxBsUnusedLd = Dummy unused linker.
219TOOL_VBoxBsUnusedLd_LINK_MISCBIN_OUTPUT =
220TOOL_VBoxBsUnusedLd_LINK_MISCBIN_DEPEND =
221TOOL_VBoxBsUnusedLd_LINK_MISCBIN_DEPORD =
222define TOOL_VBoxBsUnusedLd_LINK_MISCBIN_CMDS
223 echo "cannot use this template for linking"
224 exit 1
225endef
226
227# NASM tool with dependency workarounds (change dir to force consistent results; add -MP).
228# Requires http://permalink.gmane.org/gmane.comp.lang.nasm.devel/3704 to work.
229include $(KBUILD_PATH)/tools/NASM.kmk
230TOOL_VBoxNasm = Our version of the NASM tool
231ifndef TOOL_VBoxNasm_PATH
232 TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
233 if "$(TOOL_VBoxNasm_PATH)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
234 TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
235 endif
236endif
237ifneq ($(TOOL_VBoxNasm_PATH),)
238 TOOL_VBoxNasm_AS ?= $(TOOL_VBoxNasm_PATH)/nasm$(HOSTSUFF_EXE)
239else
240 TOOL_VBoxNasm_AS ?= nasm$(HOSTSUFF_EXE)
241endif
242TOOL_VBoxNasm_ASFLAGS ?= $(TOOL_NASM_ASFLAGS)
243TOOL_VBoxNasm_COMPILE_AS_OUTPUT = $(outbase).lst
244TOOL_VBoxNasm_COMPILE_AS_OUTPUT_MAYBE = $(obj).original
245TOOL_VBoxNasm_COMPILE_AS_DEPEND = $(VBoxBs3ObjConverter_1_TARGET)
246TOOL_VBoxNasm_COMPILE_AS_DEPORD =
247define TOOL_VBoxNasm_COMPILE_AS_CMDS
248 ifdef TOOL_VBoxNasm_USE_KSUBMIT
249 $(QUIET)kmk_builtin_kSubmit -C $(PATH_OUT_BASE) -- $(TOOL_VBoxNasm_AS)\
250 $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
251 -l $(outbase).lst\
252 -o $(obj)\
253 -MD "$(dep)" -MP\
254 $(abspath $(source))
255 else
256 $(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -- $(TOOL_VBoxNasm_AS)\
257 $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
258 -l $(outbase).lst\
259 -o $(obj)\
260 -MD "$(dep)" -MP\
261 $(abspath $(source))
262 endif
263 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
264endef
265
266#
267# ELF 64-bit compiler tool with object conversion.
268#
269# Mac needs cross compiler: sudo port install x86_64-elf-gcc
270#
271TOOL_Bs3Gcc64Elf64 := AMD64/ELF64 gcc/g++ (cross) compiler.
272ifeq ($(KBUILD_HOST),darwin)
273 TOOL_Bs3Gcc64Elf64_CC ?= x86_64-elf-gcc$(HOSTSUFF_EXE) -m64
274 TOOL_Bs3Gcc64Elf64_CXX ?= x86_64-elf-g++$(HOSTSUFF_EXE) -m64
275else
276 TOOL_Bs3Gcc64Elf64_CC ?= gcc$(HOSTSUFF_EXE) -m64
277 TOOL_Bs3Gcc64Elf64_CXX ?= g++$(HOSTSUFF_EXE) -m64
278endif
279ifdef SLKRUNS
280 TOOL_Bs3Gcc64Elf64_CC += -fmessage-length=0
281 TOOL_Bs3Gcc64Elf64_CXX += -fmessage-length=0
282endif
283TOOL_Bs3Gcc64Elf64_COBJSUFF = .o64
284TOOL_Bs3Gcc64Elf64_CFLAGS = -fno-pie -x c $(VBOX_GCC_Wa_cma_nocompress_debug_sections) -ffreestanding
285TOOL_Bs3Gcc64Elf64_CFLAGS.debug = -g
286TOOL_Bs3Gcc64Elf64_CFLAGS.profile = -O2 #-g -pg
287TOOL_Bs3Gcc64Elf64_CFLAGS.release = -O2
288TOOL_Bs3Gcc64Elf64_CINCS =
289TOOL_Bs3Gcc64Elf64_CDEFS =
290TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPEND = $(VBoxBs3ObjConverter_1_TARGET)
291TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPORD =
292TOOL_Bs3Gcc64Elf64_COMPILE_C_OUTPUT =
293TOOL_Bs3Gcc64Elf64_COMPILE_C_OUTPUT_MAYBE = $(obj).original
294define TOOL_Bs3Gcc64Elf64_COMPILE_C_CMDS
295 $(QUIET)$(TOOL_Bs3Gcc64Elf64_CC) -c\
296 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
297 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
298 -o $(obj)\
299 $(abspath $(source))
300 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
301 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
302endef
303
304TOOL_Bs3Gcc64Elf64_C64OBJSUFF = $(TOOL_Bs3Gcc64Elf64_COBJSUFF)
305TOOL_Bs3Gcc64Elf64_C64FLAGS = $(TOOL_Bs3Gcc64Elf64_CFLAGS)
306TOOL_Bs3Gcc64Elf64_C64FLAGS.debug = $(TOOL_Bs3Gcc64Elf64_CFLAGS.debug)
307TOOL_Bs3Gcc64Elf64_C64FLAGS.profile = $(TOOL_Bs3Gcc64Elf64_CFLAGS.profile)
308TOOL_Bs3Gcc64Elf64_C64FLAGS.release = $(TOOL_Bs3Gcc64Elf64_CFLAGS.release)
309TOOL_Bs3Gcc64Elf64_C64INCS = $(TOOL_Bs3Gcc64Elf64_CINCS)
310TOOL_Bs3Gcc64Elf64_C64DEFS = $(TOOL_Bs3Gcc64Elf64_CDEFS)
311TOOL_Bs3Gcc64Elf64_COMPILE_C64_DEPEND = $(TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPEND)
312TOOL_Bs3Gcc64Elf64_COMPILE_C64_DEPORD = $(TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPORD)
313TOOL_Bs3Gcc64Elf64_COMPILE_C64_OUTPUT = $(TOOL_Bs3Gcc64Elf64_COMPILE_C_OUTPUT)
314TOOL_Bs3Gcc64Elf64_COMPILE_C64_OUTPUT_MAYBE = $(TOOL_Bs3Gcc64Elf64_COMPILE_C_OUTPUT_MAYBE)
315define TOOL_Bs3Gcc64Elf64_COMPILE_C64_CMDS
316$(TOOL_Bs3Gcc64Elf64_COMPILE_C_CMDS)
317endef
318
319TOOL_Bs3Gcc64Elf64_CXXOBJSUFF ?= .o
320TOOL_Bs3Gcc64Elf64_CXXFLAGS ?= -fno-pie $(VBOX_GCC_Wa_cma_nocompress_debug_sections) -ffreestanding
321TOOL_Bs3Gcc64Elf64_CXXFLAGS.debug ?= -g0 # no debug info, thank you
322TOOL_Bs3Gcc64Elf64_CXXFLAGS.profile ?= -O2 #-g -pg
323TOOL_Bs3Gcc64Elf64_CXXFLAGS.release ?= -O2
324TOOL_Bs3Gcc64Elf64_CXXINCS ?=
325TOOL_Bs3Gcc64Elf64_CXXDEFS ?=
326TOOL_Bs3Gcc64Elf64_COMPILE_CXX_DEPEND = $(VBoxBs3ObjConverter_1_TARGET)
327TOOL_Bs3Gcc64Elf64_COMPILE_CXX_DEPORD =
328TOOL_Bs3Gcc64Elf64_COMPILE_CXX_OUTPUT =
329TOOL_Bs3Gcc64Elf64_COMPILE_CXX_OUTPUT_MAYBE = $(obj).original
330define TOOL_Bs3Gcc64Elf64_COMPILE_CXX_CMDS
331 $(QUIET)$(TOOL_Bs3Gcc64Elf64_CXX) -c\
332 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
333 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
334 -o $(obj)\
335 $(abspath $(source))
336 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
337 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
338endef
339
340#
341# Visual C++ tool variant that runs the object converter afterwards.
342#
343# We also run SED on the assembly listing looking for SSE instructions, since
344# the compiler doesn't have any known option to suppress SSE optimization. When
345# the SED script finds something, the source code needs to be tweaked to work
346# around it. See r160217 for examples.
347#
348TOOL_Bs3Vcc64 := Visual C++ 64-bit
349TOOL_Bs3Vcc64_CC = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CC)
350TOOL_Bs3Vcc64_CXX = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXX)
351TOOL_Bs3Vcc64_COBJSUFF = .o64
352TOOL_Bs3Vcc64_CFLAGS = $(filter-out -TC -Zi,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CFLAGS)) -TC -Z7
353TOOL_Bs3Vcc64_CFLAGS.debug =
354TOOL_Bs3Vcc64_CFLAGS.dbgopt = -O1
355TOOL_Bs3Vcc64_CFLAGS.profile = -O1
356TOOL_Bs3Vcc64_CFLAGS.release = -O1
357TOOL_Bs3Vcc64_CINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
358TOOL_Bs3Vcc64_CDEFS =
359TOOL_Bs3Vcc64_COMPILE_C_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
360TOOL_Bs3Vcc64_COMPILE_C_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPORD)
361TOOL_Bs3Vcc64_COMPILE_C_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT)
362TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE) $(obj).original
363TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE_PRECIOUS = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE_PRECIOUS) $(outbase)-obj.asm
364define TOOL_Bs3Vcc64_COMPILE_C_CMDS
365$(subst -Fo,-Fa$(outbase)-obj.asm -Fo,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_CMDS))
366 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
367 $(QUIET)$(SED) -e '/xmm[0-9]/!d' -e 'q11' $(outbase)-obj.asm
368endef
369
370TOOL_Bs3Vcc64_C64OBJSUFF = $(TOOL_Bs3Vcc64_COBJSUFF)
371TOOL_Bs3Vcc64_C64FLAGS = $(TOOL_Bs3Vcc64_CFLAGS)
372TOOL_Bs3Vcc64_C64FLAGS.debug = $(TOOL_Bs3Vcc64_CFLAGS.debug)
373TOOL_Bs3Vcc64_C64FLAGS.dbgopt = $(TOOL_Bs3Vcc64_CFLAGS.dbgopt)
374TOOL_Bs3Vcc64_C64FLAGS.profile = $(TOOL_Bs3Vcc64_CFLAGS.profile)
375TOOL_Bs3Vcc64_C64FLAGS.release = $(TOOL_Bs3Vcc64_CFLAGS.release)
376TOOL_Bs3Vcc64_C64INCS = $(TOOL_Bs3Vcc64_CINCS)
377TOOL_Bs3Vcc64_C64DEFS = $(TOOL_Bs3Vcc64_CDEFS)
378TOOL_Bs3Vcc64_COMPILE_C64_DEPEND = $(TOOL_Bs3Vcc64_COMPILE_C_DEPEND)
379TOOL_Bs3Vcc64_COMPILE_C64_DEPORD = $(TOOL_Bs3Vcc64_COMPILE_C_DEPORD)
380TOOL_Bs3Vcc64_COMPILE_C64_OUTPUT = $(TOOL_Bs3Vcc64_COMPILE_C_OUTPUT)
381TOOL_Bs3Vcc64_COMPILE_C64_OUTPUT_MAYBE = $(TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE)
382define TOOL_Bs3Vcc64_COMPILE_C64_CMDS
383$(TOOL_Bs3Vcc64_COMPILE_C_CMDS)
384endef
385
386TOOL_Bs3Vcc64_CXXOBJSUFF = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXOBJSUFF)
387TOOL_Bs3Vcc64_CXXFLAGS = $(filter-out -Zi,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXFLAGS)) -TP -Z7
388TOOL_Bs3Vcc64_CXXFLAGS.debug =
389TOOL_Bs3Vcc64_CXXFLAGS.dbgopt = -O1
390TOOL_Bs3Vcc64_CXXFLAGS.profile = -O1
391TOOL_Bs3Vcc64_CXXFLAGS.release = -O1
392TOOL_Bs3Vcc64_CXXINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
393TOOL_Bs3Vcc64_CXXDEFS =
394TOOL_Bs3Vcc64_COMPILE_CXX_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
395TOOL_Bs3Vcc64_COMPILE_CXX_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPORD)
396TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT)
397TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
398TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE_PRECIOUS = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE_PRECIOUS) $(outbase)-obj.asm
399define TOOL_Bs3Vcc64_COMPILE_CXX_CMDS
400$(subst -Fo,-Fa$(outbase)-obj.asm -Fo,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_CMDS))
401 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
402 $(QUIET)$(SED) -e '/xmm[0-9]/!d' -e 'q11' $(outbase)-obj.asm
403endef
404
405#
406# 32-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
407# to rename intrinsic functions so they don't clash with the 16-bit compiler.
408#
409TOOL_Bs3Ow32 := OpenWatcom C/C++ 32-bit with object convertsion
410TOOL_Bs3Ow32_CC = $(TOOL_OPENWATCOM_CC)
411TOOL_Bs3Ow32_CXX = $(TOOL_OPENWATCOM_CXX)
412TOOL_Bs3Ow32_COBJSUFF = .o32
413TOOL_Bs3Ow32_CFLAGS = $(TOOL_OPENWATCOM_CFLAGS)
414# -adfs \ - This is too complicated and it doesn't support stubbing files (svn rename fun.h pain.h). Use kDepObj instead.
415# -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) \
416# -adt=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
417# -add=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) \
418# -adhp=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dir $(abspath $(source))))
419TOOL_Bs3Ow32_CFLAGS.debug = $(TOOL_OPENWATCOM_CFLAGS.debug)
420TOOL_Bs3Ow32_CFLAGS.dbgopt = $(TOOL_OPENWATCOM_CFLAGS.dbgopt)
421TOOL_Bs3Ow32_CFLAGS.profile = $(TOOL_OPENWATCOM_CFLAGS.profile)
422TOOL_Bs3Ow32_CFLAGS.release = $(TOOL_OPENWATCOM_CFLAGS.release)
423TOOL_Bs3Ow32_CINCS = $(TOOL_OPENWATCOM_CINCS)
424TOOL_Bs3Ow32_CDEFS =
425TOOL_Bs3Ow32_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
426TOOL_Bs3Ow32_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM_COMPILE_C_DEPORD)
427TOOL_Bs3Ow32_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT)
428TOOL_Bs3Ow32_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT_MAYBE) $(obj).original
429define TOOL_Bs3Ow32_COMPILE_C_CMDS
430$(TOOL_OPENWATCOM_COMPILE_C_CMDS)
431 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
432endef
433
434TOOL_Bs3Ow32_C32OBJSUFF = $(TOOL_Bs3Ow32_COBJSUFF)
435TOOL_Bs3Ow32_C32FLAGS = $(TOOL_Bs3Ow32_CFLAGS)
436TOOL_Bs3Ow32_C32FLAGS.debug = $(TOOL_Bs3Ow32_CFLAGS.debug)
437TOOL_Bs3Ow32_C32FLAGS.dbgopt = $(TOOL_Bs3Ow32_CFLAGS.dbgopt)
438TOOL_Bs3Ow32_C32FLAGS.profile = $(TOOL_Bs3Ow32_CFLAGS.profile)
439TOOL_Bs3Ow32_C32FLAGS.release = $(TOOL_Bs3Ow32_CFLAGS.release)
440TOOL_Bs3Ow32_C32INCS = $(TOOL_Bs3Ow32_CINCS)
441TOOL_Bs3Ow32_C32DEFS =
442TOOL_Bs3Ow32_COMPILE_C32_DEPEND = $(TOOL_Bs3Ow32_COMPILE_C_DEPEND)
443TOOL_Bs3Ow32_COMPILE_C32_DEPORD = $(TOOL_Bs3Ow32_COMPILE_C_DEPORD)
444TOOL_Bs3Ow32_COMPILE_C32_OUTPUT = $(TOOL_Bs3Ow32_COMPILE_C_OUTPUT)
445TOOL_Bs3Ow32_COMPILE_C32_OUTPUT_MAYBE = $(TOOL_Bs3Ow32_COMPILE_C_OUTPUT_MAYBE)
446define TOOL_Bs3Ow32_COMPILE_C32_CMDS
447$(TOOL_Bs3Ow32_COMPILE_C_CMDS)
448endef
449
450TOOL_Bs3Ow32_CXXOBJSUFF = $(TOOL_OPENWATCOM_CXXOBJSUFF)
451TOOL_Bs3Ow32_CXXFLAGS = $(TOOL_OPENWATCOM_CXXFLAGS) -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) -adfs
452TOOL_Bs3Ow32_CXXFLAGS.debug = $(TOOL_OPENWATCOM_CXXFLAGS.debug)
453TOOL_Bs3Ow32_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM_CXXFLAGS.dbgopt)
454TOOL_Bs3Ow32_CXXFLAGS.profile = $(TOOL_OPENWATCOM_CXXFLAGS.profile)
455TOOL_Bs3Ow32_CXXFLAGS.release = $(TOOL_OPENWATCOM_CXXFLAGS.release)
456TOOL_Bs3Ow32_CXXINCS = $(TOOL_OPENWATCOM_CXXINCS)
457TOOL_Bs3Ow32_CXXDEFS =
458TOOL_Bs3Ow32_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
459TOOL_Bs3Ow32_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPORD)
460TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT)
461TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
462define TOOL_Bs3Ow32_COMPILE_CXX_CMDS
463$(TOOL_OPENWATCOM_COMPILE_CXX_CMDS)
464 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
465endef
466
467
468#
469# 16-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
470# to rename intrinsic functions so they don't clash with the 16-bit compiler.
471#
472TOOL_Bs3Ow16 := OpenWatcom C/C++ 16-bit with object convertsion
473TOOL_Bs3Ow16_CC = $(TOOL_OPENWATCOM-16_CC)
474TOOL_Bs3Ow16_CXX = $(TOOL_OPENWATCOM-16_CXX)
475TOOL_Bs3Ow16_COBJSUFF = .o16
476TOOL_Bs3Ow16_CFLAGS = $(TOOL_OPENWATCOM-16_CFLAGS)
477TOOL_Bs3Ow16_CFLAGS.debug = $(TOOL_OPENWATCOM-16_CFLAGS.debug)
478TOOL_Bs3Ow16_CFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CFLAGS.dbgopt)
479TOOL_Bs3Ow16_CFLAGS.profile = $(TOOL_OPENWATCOM-16_CFLAGS.profile)
480TOOL_Bs3Ow16_CFLAGS.release = $(TOOL_OPENWATCOM-16_CFLAGS.release)
481TOOL_Bs3Ow16_CINCS = $(TOOL_OPENWATCOM-16_CINCS)
482TOOL_Bs3Ow16_CDEFS =
483TOOL_Bs3Ow16_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
484TOOL_Bs3Ow16_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPORD)
485TOOL_Bs3Ow16_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT)
486TOOL_Bs3Ow16_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT_MAYBE) $(obj).original
487define TOOL_Bs3Ow16_COMPILE_C_CMDS
488$(TOOL_OPENWATCOM-16_COMPILE_C_CMDS)
489 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
490endef
491
492TOOL_Bs3Ow16_C16OBJSUFF = $(TOOL_Bs3Ow16_C16OBJSUFF)
493TOOL_Bs3Ow16_C16FLAGS = $(TOOL_Bs3Ow16_C16FLAGS)
494TOOL_Bs3Ow16_C16FLAGS.debug = $(TOOL_Bs3Ow16_C16FLAGS.debug)
495TOOL_Bs3Ow16_C16FLAGS.dbgopt = $(TOOL_Bs3Ow16_C16FLAGS.dbgopt)
496TOOL_Bs3Ow16_C16FLAGS.profile = $(TOOL_Bs3Ow16_C16FLAGS.profile)
497TOOL_Bs3Ow16_C16FLAGS.release = $(TOOL_Bs3Ow16_C16FLAGS.release)
498TOOL_Bs3Ow16_C16INCS = $(TOOL_Bs3Ow16_C16INCS)
499TOOL_Bs3Ow16_C16DEFS = $(TOOL_Bs3Ow16_C16DEFS)
500TOOL_Bs3Ow16_COMPILE_C16_DEPEND = $(TOOL_Bs3Ow16_COMPILE_C16_DEPEND)
501TOOL_Bs3Ow16_COMPILE_C16_DEPORD = $(TOOL_Bs3Ow16_COMPILE_C16_DEPORD)
502TOOL_Bs3Ow16_COMPILE_C16_OUTPUT = $(TOOL_Bs3Ow16_COMPILE_C16_OUTPUT)
503TOOL_Bs3Ow16_COMPILE_C16_OUTPUT_MAYBE = $(TOOL_Bs3Ow16_COMPILE_C16_OUTPUT_MAYBE)
504define TOOL_Bs3Ow16_COMPILE_C16_CMDS
505$(TOOL_Bs3Ow16_COMPILE_C_CMDS)
506endef
507
508TOOL_Bs3Ow16_CXXOBJSUFF = $(TOOL_OPENWATCOM-16_CXXOBJSUFF)
509TOOL_Bs3Ow16_CXXFLAGS = $(TOOL_OPENWATCOM-16_CXXFLAGS)
510TOOL_Bs3Ow16_CXXFLAGS.debug = $(TOOL_OPENWATCOM-16_CXXFLAGS.debug)
511TOOL_Bs3Ow16_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CXXFLAGS.dbgopt)
512TOOL_Bs3Ow16_CXXFLAGS.profile = $(TOOL_OPENWATCOM-16_CXXFLAGS.profile)
513TOOL_Bs3Ow16_CXXFLAGS.release = $(TOOL_OPENWATCOM-16_CXXFLAGS.release)
514TOOL_Bs3Ow16_CXXINCS = $(TOOL_OPENWATCOM-16_CXXINCS)
515TOOL_Bs3Ow16_CXXDEFS =
516TOOL_Bs3Ow16_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
517TOOL_Bs3Ow16_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPORD)
518TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT)
519TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
520define TOOL_Bs3Ow16_COMPILE_CXX_CMDS
521$(TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS)
522 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
523endef
524
525# Debug info format depends on what we use for 64-bit.
526if 1 #1of ($(KBUILD_HOST), win) - wlink dwarf .sym files are useless for binary blobs
527 BS3_OW_DBG_OPT = -hc -d1+
528 #BS3_OW_DBG_OPT = -hd -d1+
529 BS3_OW_DBG_LDOPT = codeview
530else
531 BS3_OW_DBG_OPT = -hd -d1+
532 BS3_OW_DBG_LDOPT = dwarf
533endif
534
535#
536# Source handlers for .c16, .c32 and .c64
537#
538define VBoxBs3KitImgSrcHandler_16bit_c
539 local type := C
540 $(kb-src-one 2)
541endef
542
543C32TOOL = Bs3Ow32
544define VBoxBs3KitImgSrcHandler_32bit_c
545 local type := C32
546 $(kb-src-one 2)
547endef
548
549define VBoxBs3KitImgSrcHandler_64bit_c
550 local type := C64
551 $(kb-src-one 2)
552endef
553
554
555#
556# BS3Kit template for assembly and 16-bit code.
557#
558# Note! Using -d1 as -d1+ and -d2 causes suboptimal code to be generated (strlen
559# reloading string pointer argument all the time).
560# Update! -d1+ is required for line number information in code living in include
561# files and any DWARF stuff at all. So, we'll ignore poor code quality.
562# Note! Optimization options should come after debug stuff as -d2 for instance
563# disables all optimziations.
564# Note! We use BS3CLASS16CODE because of wdis code detection heuristics requires the class
565# of a code segment to be exactly 'CODE', or ending with 'CODE' or 'TEXT' (more
566# recent wdis have a -c=<clsnm> option, but not the one we currently use ).
567#
568#
569# Compiler options explained:
570# -nt=xxxx Sets the text segment name.
571# -nc=xxxx Sets the text segment class name.
572# -nd=xxxx Sets the data segment name.
573# -ecc Sets the default calling convension to __cdecl
574# Update: We don't use this in 16-bit code as it causes unfavorable reloading of DS before calling
575# inlined functions (e.g. iprt/asm.h). Instead we use -ecw and __cdecl where needed.
576# Update: With -zdp the DS reloading is gone. Code is slightly larger, but seems to cure stability
577# issues in bs3CpuBasic2_RaiseXcpt1 (workers ending up with default calling convention).
578# -ecw Sets the default calling convension to __watcall ()
579# -q Quiet, no logos or stuff.
580# -0 Use 8086 instruction set (16-bit only).
581# -3 Use 386 instruction set (16-bit only).
582# -e<num> Stop after <num> errors.
583# -wx Maxium warning level.
584# -zl Don't emit default library information.
585# -zdp DS pegged to BS3DATA16_GROUP/DGROUP.
586# -zu Assume SS != DS.
587# -mc Compact memory model, far data, small code.
588# -ml Large memory model, far data, far code.
589# -mf Flat memory model (32-bit).
590# -d+ Enabled better /dVAR=XXX parsing, using space as delimiter instead of alpha-numerical/whatever.
591# -d1 Debug info: Globals and line numbers.
592# -s No stack overflow checks.
593# -oa Relaxed aliasing constraints.
594# -ob Branch prediction.
595# -of Generate stack frames when needed.
596# -oi Inline instrinsics functions.
597# -ol Loop optimizations.
598# -oh Expensive optimizations. (saves a byte or two)
599# -or Reorder for best pipeline.
600# -os Favor size over speed.
601#
602TEMPLATE_VBoxBS3KitImg = Template for building BS3Kit test images.
603TEMPLATE_VBoxBS3KitImg_BLD_TRG = os-agnostic
604TEMPLATE_VBoxBS3KitImg_BLD_TRG_ARCH = noarch
605TEMPLATE_VBoxBS3KitImg_INST = $(INST_VALIDATIONKIT)bootsectors/
606TEMPLATE_VBoxBS3KitImg_BINSUFF = .img
607TEMPLATE_VBoxBS3KitImg_MODE = 0644
608TEMPLATE_VBoxBS3KitImg_SRC_HANDLERS = \
609 .c16:VBoxBs3KitImgSrcHandler_16bit_c \
610 .c32:VBoxBs3KitImgSrcHandler_32bit_c \
611 .c64:VBoxBs3KitImgSrcHandler_64bit_c
612TEMPLATE_VBoxBS3KitImg_ASOBJSUFF = .o16
613TEMPLATE_VBoxBS3KitImg_ASTOOL = VBoxNasm
614#TEMPLATE_VBoxBS3KitImg_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
615TEMPLATE_VBoxBS3KitImg_ASFLAGS = -f obj $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
616TEMPLATE_VBoxBS3KitImg_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__ ARCH_BITS=16 RT_ARCH_X86 ASM_MODEL_FAR_CODE \
617 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
618 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
619TEMPLATE_VBoxBS3KitImg_DEFS = IN_BS3KIT
620TEMPLATE_VBoxBS3KitImg_DEFS.debug = BS3_STRICT
621
622TEMPLATE_VBoxBS3KitImg_ARTOOL = OPENWATCOM-16
623
624TEMPLATE_VBoxBS3KitImg_CTOOL = Bs3Ow16
625TEMPLATE_VBoxBS3KitImg_CXXTOOL = Bs3Ow16
626TEMPLATE_VBoxBS3KitImg_CFLAGS = $(if $(BS3KIT_SEGNM_DATA16),-nd=$(BS3KIT_SEGNM_DATA16),) \
627 -nt=BS3TEXT16 -nc=$(BS3KIT_CLASS_CODE16) -ecc -q -0 -e125 -wx -zl -zdp -zu -ml $(BS3_OW_DBG_OPT) -s -oa -ob -of -oi -ol -or -os -oh -d+
628TEMPLATE_VBoxBS3KitImg_CXXFLAGS = $(if $(BS3KIT_SEGNM_DATA16),-nd=$(BS3KIT_SEGNM_DATA16),) \
629 -nt=BS3TEXT16 -nc=$(BS3KIT_CLASS_CODE16) -ecc -q -0 -e125 -wx -zl -zdp -zu -ml $(BS3_OW_DBG_OPT) -s -oa -ob -of -oi -ol -or -os -oh -d+
630TEMPLATE_VBoxBS3KitImg_CDEFS = ARCH_BITS=16 RT_ARCH_X86
631
632TEMPLATE_VBoxBS3KitImg_TOOL = $(NO_SUCH_VARIABLE)
633TEMPLATE_VBoxBS3KitImg_C16TOOL = $(TEMPLATE_VBoxBS3KitImg_CTOOL)
634TEMPLATE_VBoxBS3KitImg_C16FLAGS = $(TEMPLATE_VBoxBS3KitImg_CFLAGS)
635TEMPLATE_VBoxBS3KitImg_C16DEFS = $(TEMPLATE_VBoxBS3KitImg_CDEFS)
636TEMPLATE_VBoxBS3KitImg_C32TOOL := Bs3Ow32
637TEMPLATE_VBoxBS3KitImg_C32FLAGS = $(TEMPLATE_VBoxBS3KitImg32_CFLAGS)
638TEMPLATE_VBoxBS3KitImg_C32DEFS = ARCH_BITS=32 RT_ARCH_X86
639TEMPLATE_VBoxBS3KitImg_C64TOOL = $(TEMPLATE_VBoxBS3KitImg64_CTOOL)
640TEMPLATE_VBoxBS3KitImg_C64FLAGS = $(TEMPLATE_VBoxBS3KitImg64_CFLAGS)
641TEMPLATE_VBoxBS3KitImg_C64DEFS = ARCH_BITS=64 RT_ARCH_AMD64
642
643TEMPLATE_VBoxBS3KitImg_INCS = $(VBOX_PATH_BS3KIT_SRC) .
644TEMPLATE_VBoxBS3KitImg_LDTOOL = OPENWATCOM-WL
645
646# linker options:
647# system dos: Link a 16-bit DOS binary.
648# output raw ...: Produce a raw DOS binary for loading at flat address 10000h.
649# The following is for ordering segments.
650# option start=_start: The start symbol in bs3-first-xxx.asm.
651# debug codeview/dwarf all: Full debug information either in codeview or dwarf.
652# option symfile: Produce a separate symbol file with the debug info.
653# option map: Produce a map file.
654# option farcalls: Change intrasegment far calls into 'push cs; seg ds; call symbol' where possible.
655# option statics: ?
656# option verbose: Verbose map file?
657# option disable 1014: Disable warning about 'stack segment not found'.
658# option disable 1080: Disable warning about '%1 is a 32-bit object file'.
659#
660# Note! We're pushing DATA16 to 0x20000 because it's impossible to force wlink
661# to give us a real-mode + GDT compatible alignment (0ffffff80h), i.e.
662# real-mode address on the form 0fff8:0000.
663TEMPLATE_VBoxBS3KitImg_LDFLAGS = system dos \
664 debug $(BS3_OW_DBG_LDOPT) all \
665 option quiet, map, statics, verbose, symfile, start=_start, farcalls \
666 disable 1014, 1080 \
667 \
668 output raw offset=0x10000 \
669 order \
670 clname BS3FLAT segaddr=0x0000 \
671 segment BS3FLAT segaddr=0x0000 \
672 clname $(BS3KIT_CLASS_CODE16) segaddr=0x1000 \
673 segment BS3TEXT16 \
674 segment BS3TEXT16_NEARSTUBS \
675 segment BS3TEXT16_FARSTUBS \
676 segment BS3TEXT16_END \
677 clname BS3SYSTEM16 segaddr=0x2000 \
678 segment BS3SYSTEM16 \
679 $(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
680 clname DATA \
681 segment BS3DATA16 segaddr=0x2900 \
682 segment BS3DATA16_DATA \
683 segment DATA \
684 segment _DATA \
685 segment BS3DATA16CONST \
686 segment CONST \
687 segment BS3DATA16CONST2 \
688 segment CONST2 \
689 segment STRINGS \
690 segment BS3DATA16_END \
691 clname BSS \
692 segment BSS \
693 segment _BSS \
694 segment BS3DATA16_END \
695 clname FAR_DATA \
696 segment FAR_DATA \
697 , \
698 clname FAR_DATA \
699 segment BS3DATA16 segaddr=0x2900 \
700 segment FAR_DATA \
701 segment BS3DATA16CONST \
702 segment BS3DATA16CONST2 \
703 segment BS3DATA16_DATA \
704 segment BS3DATA16_END \
705 ) \
706 segment BS3DATA32 \
707 segment BS3DATA32CONST \
708 segment BS3DATA32CONST2 \
709 segment BS3DATA32_DATA \
710 segment BS3DATA32_BSS \
711 segment BS3DATA32_END \
712 \
713 segment BS3DATA64 \
714 segment BS3DATA64CONST \
715 segment BS3DATA64_BSS \
716 segment BS3DATA64_END \
717 clname BS3CLASS16RMCODE \
718 segment BS3RMTEXT16_START \
719 segment BS3RMTEXT16 \
720 segment BS3RMTEXT16_END \
721 clname BS3CLASS16X0CODE \
722 segment BS3X0TEXT16_START \
723 segment BS3X0TEXT16 \
724 segment BS3X0TEXT16_END \
725 clname BS3CLASS16X1CODE \
726 segment BS3X1TEXT16_START \
727 segment BS3X1TEXT16 \
728 segment BS3X1TEXT16_END \
729 clname BS3CLASSSEPARATE16AND32BITCODE \
730 segment BS3SEPARATE16AND32BITCODE \
731 clname BS3CLASS32CODE \
732 segment BS3TEXT32_START \
733 segment BS3TEXT32 \
734 segment BS3TEXT32_END \
735 clname BS3CLASSSEPARATE32AND64BITCODE \
736 segment BS3SEPARATE32AND64BITCODE \
737 clname BS3CLASS64CODE \
738 segment BS3TEXT64_START \
739 segment BS3TEXT64 \
740 segment BS3TEXT64_END
741
742TEMPLATE_VBoxBS3KitImg_LNK_DEPS = \
743 $(bs3-bootsector_1_TARGET) \
744 $(VBoxBs3Linker_1_TARGET)
745TEMPLATE_VBoxBS3KitImg_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY) \
746 ,,$(QUIET)$(MV_EXT) -f -- "$(out)" "$(out).tmp" \
747 $$(NLTAB)$(QUIET)$(VBoxBs3Linker_1_TARGET) -o $(out) $(bs3-bootsector_1_TARGET) $(out).tmp \
748 $$(NLTAB)$(QUIET)$(RM_EXT) -f -- "$(out).tmp") \
749 $(eval .PRECIOUS: $(outbase).map) # ugly hack!
750
751
752TEMPLATE_VBoxBS3KitImg_LIBS = \
753 $(PATH_OBJ)/bs3kit-common-16/bs3kit-common-16.lib \
754 $(PATH_OBJ)/bs3kit-common-32/bs3kit-common-32.lib \
755 $(PATH_OBJ)/bs3kit-common-64/bs3kit-common-64.lib \
756 \
757 $(PATH_OBJ)/bs3kit-rm/bs3kit-rm.lib \
758 $(PATH_OBJ)/bs3kit-pe16/bs3kit-pe16.lib \
759 $(PATH_OBJ)/bs3kit-pe16_32/bs3kit-pe16_32.lib \
760 $(PATH_OBJ)/bs3kit-pe16_v86/bs3kit-pe16_v86.lib \
761 $(PATH_OBJ)/bs3kit-pe32/bs3kit-pe32.lib \
762 $(PATH_OBJ)/bs3kit-pe32_16/bs3kit-pe32_16.lib \
763 $(PATH_OBJ)/bs3kit-pev86/bs3kit-pev86.lib \
764 $(PATH_OBJ)/bs3kit-pp16/bs3kit-pp16.lib \
765 $(PATH_OBJ)/bs3kit-pp16_32/bs3kit-pp16_32.lib \
766 $(PATH_OBJ)/bs3kit-pp16_v86/bs3kit-pp16_v86.lib \
767 $(PATH_OBJ)/bs3kit-pp32/bs3kit-pp32.lib \
768 $(PATH_OBJ)/bs3kit-pp32_16/bs3kit-pp32_16.lib \
769 $(PATH_OBJ)/bs3kit-ppv86/bs3kit-ppv86.lib \
770 $(PATH_OBJ)/bs3kit-pae16/bs3kit-pae16.lib \
771 $(PATH_OBJ)/bs3kit-pae16_32/bs3kit-pae16_32.lib \
772 $(PATH_OBJ)/bs3kit-pae16_v86/bs3kit-pae16_v86.lib \
773 $(PATH_OBJ)/bs3kit-pae32/bs3kit-pae32.lib \
774 $(PATH_OBJ)/bs3kit-pae32_16/bs3kit-pae32_16.lib \
775 $(PATH_OBJ)/bs3kit-paev86/bs3kit-paev86.lib \
776 $(PATH_OBJ)/bs3kit-lm16/bs3kit-lm16.lib \
777 $(PATH_OBJ)/bs3kit-lm32/bs3kit-lm32.lib \
778 $(PATH_OBJ)/bs3kit-lm64/bs3kit-lm64.lib
779
780# BS3Kit template for 32-bit code.
781TEMPLATE_VBoxBS3KitImg32 = Template for building BS3Kit test images.
782TEMPLATE_VBoxBS3KitImg32_BLD_TRG = os-agnostic
783TEMPLATE_VBoxBS3KitImg32_BLD_TRG_ARCH = x86
784TEMPLATE_VBoxBS3KitImg32_INSTTYPE = none
785TEMPLATE_VBoxBS3KitImg32_ASTOOL = VBoxNasm
786TEMPLATE_VBoxBS3KitImg32_ASOBJSUFF = .o32
787TEMPLATE_VBoxBS3KitImg32_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
788TEMPLATE_VBoxBS3KitImg32_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__ \
789 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
790 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
791TEMPLATE_VBoxBS3KitImg32_DEFS = ARCH_BITS=32 IN_BS3KIT
792TEMPLATE_VBoxBS3KitImg32_DEFS.debug = BS3_STRICT
793TEMPLATE_VBoxBS3KitImg32_ARTOOL = OPENWATCOM
794TEMPLATE_VBoxBS3KitImg32_CTOOL = Bs3Ow32
795TEMPLATE_VBoxBS3KitImg32_CXXTOOL = Bs3Ow32
796TEMPLATE_VBoxBS3KitImg32_CFLAGS = \
797 -nt=BS3TEXT32 -nd=BS3DATA32 -nc=BS3CLASS32CODE -ecc -q -e125 -wx -zl -mf $(BS3_OW_DBG_OPT) -s -oa -ob -of -oi -ol -or -os -d+
798TEMPLATE_VBoxBS3KitImg32_CXXFLAGS = \
799 -nt=BS3TEXT32 -nd=BS3DATA32 -nc=BS3CLASS32CODE -ecc -q -e125 -wx -zl -mf $(BS3_OW_DBG_OPT) -s -oa -ob -of -oi -ol -or -os -d+
800TEMPLATE_VBoxBS3KitImg32_INCS = $(VBOX_PATH_BS3KIT_SRC) .
801TEMPLATE_VBoxBS3KitImg32_LDTOOL = VBoxBsUnusedLd
802
803# BS3Kit template for 64-bit code.
804TEMPLATE_VBoxBS3KitImg64 = Template for building BS3Kit test images.
805TEMPLATE_VBoxBS3KitImg64_BLD_TRG = os-agnostic
806TEMPLATE_VBoxBS3KitImg64_BLD_TRG_ARCH = amd64
807TEMPLATE_VBoxBS3KitImg64_INSTTYPE = none
808TEMPLATE_VBoxBS3KitImg64_ASTOOL = VBoxNasm
809TEMPLATE_VBoxBS3KitImg64_ASOBJSUFF = .o64
810TEMPLATE_VBoxBS3KitImg64_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
811TEMPLATE_VBoxBS3KitImg64_ASDEFS = ASM_FORMAT_OMF ASM_CALL64_MSC RT_NOINC_SEGMENTS __NASM__ \
812 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
813 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
814TEMPLATE_VBoxBS3KitImg64_DEFS = IN_BS3KIT ARCH_BITS=64
815TEMPLATE_VBoxBS3KitImg64_DEFS.debug = BS3_STRICT
816TEMPLATE_VBoxBS3KitImg64_ARTOOL = OPENWATCOM
817TEMPLATE_VBoxBS3KitImg64_INCS = $(VBOX_PATH_BS3KIT_SRC) .
818if1of ($(KBUILD_HOST), win)
819 ifndef TOOL_VCC100AMD64 # For win.x86 builds.
820 include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL_STEM)AMD64.kmk
821 endif
822 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Vcc64
823 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Vcc64
824 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -Z7 -O1 -Oi -GF -GS- -Gy- -Gs65536
825 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -Z7 -O1 -Oi -GF -GS- -Gy- -Gs65536
826else
827 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Gcc64Elf64
828 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Gcc64Elf64
829 # Note! -mx32 would be exactly what we needed here, however it causes internal compiler errors with 4.8.4 on gentoo.
830 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_WARN_PEDANTIC_C) \
831 -msoft-float -fno-exceptions -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
832 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_WARN_PEDANTIC_CXX) \
833 -msoft-float -fno-exceptions -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
834endif
835TEMPLATE_VBoxBS3KitImg64_LDTOOL = VBoxBsUnusedLd
836
837# BS3Kit template for the bootsector.
838TEMPLATE_VBoxBS3KitBS = Template for building BS3Kit test images.
839TEMPLATE_VBoxBS3KitBS_BLD_TRG = os-agnostic
840TEMPLATE_VBoxBS3KitBS_BLD_TRG_ARCH = x86
841TEMPLATE_VBoxBS3KitBS_INST = $(INST_VALIDATIONKIT)bootsectors/
842TEMPLATE_VBoxBS3KitBS_INSTTYPE = none
843TEMPLATE_VBoxBS3KitBS_BINSUFF = .img
844TEMPLATE_VBoxBS3KitBS_MODE = 0644
845TEMPLATE_VBoxBS3KitBS_ASTOOL = YASM
846TEMPLATE_VBoxBS3KitBS_ASFLAGS = -f bin --mapfile
847TEMPLATE_VBoxBS3KitBS_ASDEFS = ASM_FORMAT_BIN RT_NOINC_SEGMENTS ARCH_BITS=16 __YASM__ \
848 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
849 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
850TEMPLATE_VBoxBS3KitBS_INCS = $(VBOX_PATH_BS3KIT_SRC) .
851TEMPLATE_VBoxBS3KitBS_LDTOOL = VBoxBsCpLd
852
853
854
855#
856# Extends VBoxBS3KitImg
857# User must starts SOURCES with: $(VBOX_PATH_BS3KIT_SRC)/bs3-first-dosexe.asm
858## disable 1014, 1080, 1150
859#
860TEMPLATE_VBoxBS3KitUtil = Utility using bs3kit code.
861TEMPLATE_VBoxBS3KitUtil_EXTENDS = VBoxBS3KitImg
862TEMPLATE_VBoxBS3KitUtil_BINSUFF = .exe
863TEMPLATE_VBoxBS3KitUtil_DEFS = $(TEMPLATE_VBoxBS3KitImg_DEFS) BS3_IS_DOS_EXE
864TEMPLATE_VBoxBS3KitUtil_CFLAGS = $(filter-out -zl,$(TEMPLATE_VBoxBS3KitImg_CFLAGS))
865TEMPLATE_VBoxBS3KitUtil_CXXFLAGS = $(filter-out -zl,$(TEMPLATE_VBoxBS3KitImg_CXXFLAGS))
866TEMPLATE_VBoxBS3KitUtil_LDFLAGS = system dos \
867 debug $(BS3_OW_DBG_LDOPT) all \
868 option quiet, map, statics, verbose, symfile \
869 disable 1080 \
870 order \
871 clname $(BS3KIT_CLASS_CODE16) \
872 segment BEGTEXT \
873 segment BS3TEXT16 \
874 segment _TEXT \
875 segment BS3TEXT16_NEARSTUBS \
876 segment BS3TEXT16_FARSTUBS \
877 segment BS3TEXT16_END \
878 clname BS3SYSTEM16 \
879 segment BS3SYSTEM16 \
880 \
881 clname BEGDATA \
882 segment _NULL \
883 segment _AFTERNULL \
884 clname DATA \
885 $(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
886 segment BS3DATA16 \
887 segment BS3DATA16CONST \
888 segment CONST \
889 segment BS3DATA16CONST2 \
890 segment CONST2 \
891 , \
892 segment CONST \
893 segment CONST2 \
894 ) \
895 segment _DATA \
896 segment XIB \
897 segment XI \
898 segment XIE \
899 segment YIB \
900 segment YI \
901 segment YIE \
902 segment STRINGS \
903 $(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
904 segment BS3DATA16_DATA \
905 ,) \
906 segment DATA \
907 clname BSS \
908 segment _BSS \
909 segment BSS \
910 segment BS3DATA16_END \
911 clname STACK \
912 segment STACK \
913 \
914 clname FAR_DATA \
915 $(if-expr "$(BS3KIT_SEGNM_DATA16)" != "", \
916 segment BS3DATA16 \
917 segment BS3DATA16_DATA \
918 segment BS3DATA16CONST \
919 segment BS3DATA16CONST2 \
920 segment FAR_DATA \
921 segment BS3DATA16_END \
922 , \
923 segment FAR_DATA \
924 ) \
925 segment BS3DATA32 \
926 segment BS3DATA32CONST \
927 segment BS3DATA32CONST2 \
928 segment BS3DATA32_DATA \
929 segment BS3DATA32_BSS \
930 segment BS3DATA32_END \
931 \
932 segment BS3DATA64 \
933 segment BS3DATA64CONST \
934 segment BS3DATA64_BSS \
935 segment BS3DATA64_END \
936 clname BS3CLASS16RMCODE \
937 segment BS3RMTEXT16_START \
938 segment BS3RMTEXT16 \
939 segment BS3RMTEXT16_END \
940 clname BS3CLASS16X0CODE \
941 segment BS3X0TEXT16_START \
942 segment BS3X0TEXT16 \
943 segment BS3X0TEXT16_END \
944 clname BS3CLASS16X1CODE \
945 segment BS3X1TEXT16_START \
946 segment BS3X1TEXT16 \
947 segment BS3X1TEXT16_END \
948 clname BS3CLASSSEPARATE16AND32BITCODE \
949 segment BS3SEPARATE16AND32BITCODE \
950 clname BS3CLASS32CODE \
951 segment BS3TEXT32 \
952 segment BS3TEXT32_END \
953 clname BS3CLASSSEPARATE32AND64BITCODE \
954 segment BS3SEPARATE32AND64BITCODE \
955 clname BS3CLASS64CODE \
956 segment BS3TEXT64 \
957 segment BS3TEXT64_END
958# clname BS3FLAT segaddr=0x0000 \
959# segment BS3FLAT segaddr=0x0000
960
961TEMPLATE_VBoxBS3KitUtil_LNK_DEPS = $(NO_SUCH_VARIABLE)
962TEMPLATE_VBoxBS3KitUtil_POST_CMDS = $(NO_SUCH_VARIABLE)
963
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette