VirtualBox

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

Last change on this file since 98326 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.0 KB
Line 
1# $Id: Config.kmk 98103 2023-01-17 14:15:46Z 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.
52KBUILD_COMPILE_CATEGTORIES += C16
53PROPS_TOOLS += C16TOOL
54PROPS_SINGLE += C16TOOL C16OBJSUFF
55PROPS_ACCUMULATE_R += C16FLAGS C16DEFS
56PROPS_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
72BS3KIT_CLASS_CODE16 = CODE
73BS3KIT_SEGNM_DATA16 =
74BS3KIT_CLASS_DATA16 = DATA
75BS3KIT_GRPNM_DATA16 = DGROUP
76BS3KIT_CLASS_BSS16 = BSS
77else
78BS3KIT_CLASS_CODE16 = BS3CLASS16CODE
79BS3KIT_SEGNM_DATA16 = BS3DATA16
80BS3KIT_CLASS_DATA16 = FAR_DATA
81BS3KIT_GRPNM_DATA16 = BS3DATA16_GROUP
82BS3KIT_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
248ifdef 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))
255else
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))
262endif
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#
343TOOL_Bs3Vcc64 := Visual C++ 64-bit
344TOOL_Bs3Vcc64_CC = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CC)
345TOOL_Bs3Vcc64_CXX = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXX)
346TOOL_Bs3Vcc64_COBJSUFF = .o64
347TOOL_Bs3Vcc64_CFLAGS = $(filter-out -TC -Zi,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CFLAGS)) -TC -Z7
348TOOL_Bs3Vcc64_CFLAGS.debug =
349TOOL_Bs3Vcc64_CFLAGS.dbgopt = -O1
350TOOL_Bs3Vcc64_CFLAGS.profile = -O1
351TOOL_Bs3Vcc64_CFLAGS.release = -O1
352TOOL_Bs3Vcc64_CINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
353TOOL_Bs3Vcc64_CDEFS =
354TOOL_Bs3Vcc64_COMPILE_C_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
355TOOL_Bs3Vcc64_COMPILE_C_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPORD)
356TOOL_Bs3Vcc64_COMPILE_C_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT)
357TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE) $(obj).original
358define TOOL_Bs3Vcc64_COMPILE_C_CMDS
359$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_CMDS)
360 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
361endef
362
363TOOL_Bs3Vcc64_C64OBJSUFF = $(TOOL_Bs3Vcc64_COBJSUFF)
364TOOL_Bs3Vcc64_C64FLAGS = $(TOOL_Bs3Vcc64_CFLAGS)
365TOOL_Bs3Vcc64_C64FLAGS.debug = $(TOOL_Bs3Vcc64_CFLAGS.debug)
366TOOL_Bs3Vcc64_C64FLAGS.dbgopt = $(TOOL_Bs3Vcc64_CFLAGS.dbgopt)
367TOOL_Bs3Vcc64_C64FLAGS.profile = $(TOOL_Bs3Vcc64_CFLAGS.profile)
368TOOL_Bs3Vcc64_C64FLAGS.release = $(TOOL_Bs3Vcc64_CFLAGS.release)
369TOOL_Bs3Vcc64_C64INCS = $(TOOL_Bs3Vcc64_CINCS)
370TOOL_Bs3Vcc64_C64DEFS = $(TOOL_Bs3Vcc64_CDEFS)
371TOOL_Bs3Vcc64_COMPILE_C64_DEPEND = $(TOOL_Bs3Vcc64_COMPILE_C_DEPEND)
372TOOL_Bs3Vcc64_COMPILE_C64_DEPORD = $(TOOL_Bs3Vcc64_COMPILE_C_DEPORD)
373TOOL_Bs3Vcc64_COMPILE_C64_OUTPUT = $(TOOL_Bs3Vcc64_COMPILE_C_OUTPUT)
374TOOL_Bs3Vcc64_COMPILE_C64_OUTPUT_MAYBE = $(TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE)
375define TOOL_Bs3Vcc64_COMPILE_C64_CMDS
376$(TOOL_Bs3Vcc64_COMPILE_C_CMDS)
377endef
378
379TOOL_Bs3Vcc64_CXXOBJSUFF = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXOBJSUFF)
380TOOL_Bs3Vcc64_CXXFLAGS = $(filter-out -Zi,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXFLAGS)) -TP -Z7
381TOOL_Bs3Vcc64_CXXFLAGS.debug =
382TOOL_Bs3Vcc64_CXXFLAGS.dbgopt = -O1
383TOOL_Bs3Vcc64_CXXFLAGS.profile = -O1
384TOOL_Bs3Vcc64_CXXFLAGS.release = -O1
385TOOL_Bs3Vcc64_CXXINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
386TOOL_Bs3Vcc64_CXXDEFS =
387TOOL_Bs3Vcc64_COMPILE_CXX_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
388TOOL_Bs3Vcc64_COMPILE_CXX_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPORD)
389TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT)
390TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
391define TOOL_Bs3Vcc64_COMPILE_CXX_CMDS
392$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_CMDS)
393 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
394endef
395
396#
397# 32-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
398# to rename intrinsic functions so they don't clash with the 16-bit compiler.
399#
400TOOL_Bs3Ow32 := OpenWatcom C/C++ 32-bit with object convertsion
401TOOL_Bs3Ow32_CC = $(TOOL_OPENWATCOM_CC)
402TOOL_Bs3Ow32_CXX = $(TOOL_OPENWATCOM_CXX)
403TOOL_Bs3Ow32_COBJSUFF = .o32
404TOOL_Bs3Ow32_CFLAGS = $(TOOL_OPENWATCOM_CFLAGS)
405# -adfs \ - This is too complicated and it doesn't support stubbing files (svn rename fun.h pain.h). Use kDepObj instead.
406# -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) \
407# -adt=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
408# -add=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) \
409# -adhp=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dir $(abspath $(source))))
410TOOL_Bs3Ow32_CFLAGS.debug = $(TOOL_OPENWATCOM_CFLAGS.debug)
411TOOL_Bs3Ow32_CFLAGS.dbgopt = $(TOOL_OPENWATCOM_CFLAGS.dbgopt)
412TOOL_Bs3Ow32_CFLAGS.profile = $(TOOL_OPENWATCOM_CFLAGS.profile)
413TOOL_Bs3Ow32_CFLAGS.release = $(TOOL_OPENWATCOM_CFLAGS.release)
414TOOL_Bs3Ow32_CINCS = $(TOOL_OPENWATCOM_CINCS)
415TOOL_Bs3Ow32_CDEFS =
416TOOL_Bs3Ow32_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
417TOOL_Bs3Ow32_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM_COMPILE_C_DEPORD)
418TOOL_Bs3Ow32_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT)
419TOOL_Bs3Ow32_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT_MAYBE) $(obj).original
420define TOOL_Bs3Ow32_COMPILE_C_CMDS
421$(TOOL_OPENWATCOM_COMPILE_C_CMDS)
422 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
423endef
424
425TOOL_Bs3Ow32_C32OBJSUFF = $(TOOL_Bs3Ow32_COBJSUFF)
426TOOL_Bs3Ow32_C32FLAGS = $(TOOL_Bs3Ow32_CFLAGS)
427TOOL_Bs3Ow32_C32FLAGS.debug = $(TOOL_Bs3Ow32_CFLAGS.debug)
428TOOL_Bs3Ow32_C32FLAGS.dbgopt = $(TOOL_Bs3Ow32_CFLAGS.dbgopt)
429TOOL_Bs3Ow32_C32FLAGS.profile = $(TOOL_Bs3Ow32_CFLAGS.profile)
430TOOL_Bs3Ow32_C32FLAGS.release = $(TOOL_Bs3Ow32_CFLAGS.release)
431TOOL_Bs3Ow32_C32INCS = $(TOOL_Bs3Ow32_CINCS)
432TOOL_Bs3Ow32_C32DEFS =
433TOOL_Bs3Ow32_COMPILE_C32_DEPEND = $(TOOL_Bs3Ow32_COMPILE_C_DEPEND)
434TOOL_Bs3Ow32_COMPILE_C32_DEPORD = $(TOOL_Bs3Ow32_COMPILE_C_DEPORD)
435TOOL_Bs3Ow32_COMPILE_C32_OUTPUT = $(TOOL_Bs3Ow32_COMPILE_C_OUTPUT)
436TOOL_Bs3Ow32_COMPILE_C32_OUTPUT_MAYBE = $(TOOL_Bs3Ow32_COMPILE_C_OUTPUT_MAYBE)
437define TOOL_Bs3Ow32_COMPILE_C32_CMDS
438$(TOOL_Bs3Ow32_COMPILE_C_CMDS)
439endef
440
441TOOL_Bs3Ow32_CXXOBJSUFF = $(TOOL_OPENWATCOM_CXXOBJSUFF)
442TOOL_Bs3Ow32_CXXFLAGS = $(TOOL_OPENWATCOM_CXXFLAGS) -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) -adfs
443TOOL_Bs3Ow32_CXXFLAGS.debug = $(TOOL_OPENWATCOM_CXXFLAGS.debug)
444TOOL_Bs3Ow32_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM_CXXFLAGS.dbgopt)
445TOOL_Bs3Ow32_CXXFLAGS.profile = $(TOOL_OPENWATCOM_CXXFLAGS.profile)
446TOOL_Bs3Ow32_CXXFLAGS.release = $(TOOL_OPENWATCOM_CXXFLAGS.release)
447TOOL_Bs3Ow32_CXXINCS = $(TOOL_OPENWATCOM_CXXINCS)
448TOOL_Bs3Ow32_CXXDEFS =
449TOOL_Bs3Ow32_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
450TOOL_Bs3Ow32_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPORD)
451TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT)
452TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
453define TOOL_Bs3Ow32_COMPILE_CXX_CMDS
454$(TOOL_OPENWATCOM_COMPILE_CXX_CMDS)
455 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
456endef
457
458
459#
460# 16-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
461# to rename intrinsic functions so they don't clash with the 16-bit compiler.
462#
463TOOL_Bs3Ow16 := OpenWatcom C/C++ 16-bit with object convertsion
464TOOL_Bs3Ow16_CC = $(TOOL_OPENWATCOM-16_CC)
465TOOL_Bs3Ow16_CXX = $(TOOL_OPENWATCOM-16_CXX)
466TOOL_Bs3Ow16_COBJSUFF = .o16
467TOOL_Bs3Ow16_CFLAGS = $(TOOL_OPENWATCOM-16_CFLAGS)
468TOOL_Bs3Ow16_CFLAGS.debug = $(TOOL_OPENWATCOM-16_CFLAGS.debug)
469TOOL_Bs3Ow16_CFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CFLAGS.dbgopt)
470TOOL_Bs3Ow16_CFLAGS.profile = $(TOOL_OPENWATCOM-16_CFLAGS.profile)
471TOOL_Bs3Ow16_CFLAGS.release = $(TOOL_OPENWATCOM-16_CFLAGS.release)
472TOOL_Bs3Ow16_CINCS = $(TOOL_OPENWATCOM-16_CINCS)
473TOOL_Bs3Ow16_CDEFS =
474TOOL_Bs3Ow16_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
475TOOL_Bs3Ow16_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPORD)
476TOOL_Bs3Ow16_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT)
477TOOL_Bs3Ow16_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT_MAYBE) $(obj).original
478define TOOL_Bs3Ow16_COMPILE_C_CMDS
479$(TOOL_OPENWATCOM-16_COMPILE_C_CMDS)
480 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
481endef
482
483TOOL_Bs3Ow16_C16OBJSUFF = $(TOOL_Bs3Ow16_C16OBJSUFF)
484TOOL_Bs3Ow16_C16FLAGS = $(TOOL_Bs3Ow16_C16FLAGS)
485TOOL_Bs3Ow16_C16FLAGS.debug = $(TOOL_Bs3Ow16_C16FLAGS.debug)
486TOOL_Bs3Ow16_C16FLAGS.dbgopt = $(TOOL_Bs3Ow16_C16FLAGS.dbgopt)
487TOOL_Bs3Ow16_C16FLAGS.profile = $(TOOL_Bs3Ow16_C16FLAGS.profile)
488TOOL_Bs3Ow16_C16FLAGS.release = $(TOOL_Bs3Ow16_C16FLAGS.release)
489TOOL_Bs3Ow16_C16INCS = $(TOOL_Bs3Ow16_C16INCS)
490TOOL_Bs3Ow16_C16DEFS = $(TOOL_Bs3Ow16_C16DEFS)
491TOOL_Bs3Ow16_COMPILE_C16_DEPEND = $(TOOL_Bs3Ow16_COMPILE_C16_DEPEND)
492TOOL_Bs3Ow16_COMPILE_C16_DEPORD = $(TOOL_Bs3Ow16_COMPILE_C16_DEPORD)
493TOOL_Bs3Ow16_COMPILE_C16_OUTPUT = $(TOOL_Bs3Ow16_COMPILE_C16_OUTPUT)
494TOOL_Bs3Ow16_COMPILE_C16_OUTPUT_MAYBE = $(TOOL_Bs3Ow16_COMPILE_C16_OUTPUT_MAYBE)
495define TOOL_Bs3Ow16_COMPILE_C16_CMDS
496$(TOOL_Bs3Ow16_COMPILE_C_CMDS)
497endef
498
499TOOL_Bs3Ow16_CXXOBJSUFF = $(TOOL_OPENWATCOM-16_CXXOBJSUFF)
500TOOL_Bs3Ow16_CXXFLAGS = $(TOOL_OPENWATCOM-16_CXXFLAGS)
501TOOL_Bs3Ow16_CXXFLAGS.debug = $(TOOL_OPENWATCOM-16_CXXFLAGS.debug)
502TOOL_Bs3Ow16_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CXXFLAGS.dbgopt)
503TOOL_Bs3Ow16_CXXFLAGS.profile = $(TOOL_OPENWATCOM-16_CXXFLAGS.profile)
504TOOL_Bs3Ow16_CXXFLAGS.release = $(TOOL_OPENWATCOM-16_CXXFLAGS.release)
505TOOL_Bs3Ow16_CXXINCS = $(TOOL_OPENWATCOM-16_CXXINCS)
506TOOL_Bs3Ow16_CXXDEFS =
507TOOL_Bs3Ow16_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
508TOOL_Bs3Ow16_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPORD)
509TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT)
510TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
511define TOOL_Bs3Ow16_COMPILE_CXX_CMDS
512$(TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS)
513 $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
514endef
515
516# Debug info format depends on what we use for 64-bit.
517if 1 #1of ($(KBUILD_HOST), win) - wlink dwarf .sym files are useless for binary blobs
518 BS3_OW_DBG_OPT = -hc -d1+
519 #BS3_OW_DBG_OPT = -hd -d1+
520 BS3_OW_DBG_LDOPT = codeview
521else
522 BS3_OW_DBG_OPT = -hd -d1+
523 BS3_OW_DBG_LDOPT = dwarf
524endif
525
526#
527# Source handlers for .c16, .c32 and .c64
528#
529define VBoxBs3KitImgSrcHandler_16bit_c
530local type := C
531 $(kb-src-one 2)
532endef
533
534C32TOOL = Bs3Ow32
535define VBoxBs3KitImgSrcHandler_32bit_c
536local type := C32
537 $(kb-src-one 2)
538endef
539
540define VBoxBs3KitImgSrcHandler_64bit_c
541local type := C64
542 $(kb-src-one 2)
543endef
544
545
546#
547# BS3Kit template for assembly and 16-bit code.
548#
549# Note! Using -d1 as -d1+ and -d2 causes suboptimal code to be generated (strlen
550# reloading string pointer argument all the time).
551# Update! -d1+ is required for line number information in code living in include
552# files and any DWARF stuff at all. So, we'll ignore poor code quality.
553# Note! Optimization options should come after debug stuff as -d2 for instance
554# disables all optimziations.
555# Note! We use BS3CLASS16CODE because of wdis code detection heuristics requires the class
556# of a code segment to be exactly 'CODE', or ending with 'CODE' or 'TEXT' (more
557# recent wdis have a -c=<clsnm> option, but not the one we currently use ).
558#
559#
560# Compiler options explained:
561# -nt=xxxx Sets the text segment name.
562# -nc=xxxx Sets the text segment class name.
563# -nd=xxxx Sets the data segment name.
564# -ecc Sets the default calling convension to __cdecl
565# Update: We don't use this in 16-bit code as it causes unfavorable reloading of DS before calling
566# inlined functions (e.g. iprt/asm.h). Instead we use -ecw and __cdecl where needed.
567# Update: With -zdp the DS reloading is gone. Code is slightly larger, but seems to cure stability
568# issues in bs3CpuBasic2_RaiseXcpt1 (workers ending up with default calling convention).
569# -ecw Sets the default calling convension to __watcall ()
570# -q Quiet, no logos or stuff.
571# -0 Use 8086 instruction set (16-bit only).
572# -3 Use 386 instruction set (16-bit only).
573# -e<num> Stop after <num> errors.
574# -wx Maxium warning level.
575# -zl Don't emit default library information.
576# -zdp DS pegged to BS3DATA16_GROUP/DGROUP.
577# -zu Assume SS != DS.
578# -mc Compact memory model, far data, small code.
579# -ml Large memory model, far data, far code.
580# -mf Flat memory model (32-bit).
581# -d+ Enabled better /dVAR=XXX parsing, using space as delimiter instead of alpha-numerical/whatever.
582# -d1 Debug info: Globals and line numbers.
583# -s No stack overflow checks.
584# -oa Relaxed aliasing constraints.
585# -ob Branch prediction.
586# -of Generate stack frames when needed.
587# -oi Inline instrinsics functions.
588# -ol Loop optimizations.
589# -oh Expensive optimizations. (saves a byte or two)
590# -or Reorder for best pipeline.
591# -os Favor size over speed.
592#
593TEMPLATE_VBoxBS3KitImg = Template for building BS3Kit test images.
594TEMPLATE_VBoxBS3KitImg_BLD_TRG = os-agnostic
595TEMPLATE_VBoxBS3KitImg_BLD_TRG_ARCH = noarch
596TEMPLATE_VBoxBS3KitImg_INST = $(INST_VALIDATIONKIT)bootsectors/
597TEMPLATE_VBoxBS3KitImg_BINSUFF = .img
598TEMPLATE_VBoxBS3KitImg_MODE = 0644
599TEMPLATE_VBoxBS3KitImg_SRC_HANDLERS = \
600 .c16:VBoxBs3KitImgSrcHandler_16bit_c \
601 .c32:VBoxBs3KitImgSrcHandler_32bit_c \
602 .c64:VBoxBs3KitImgSrcHandler_64bit_c
603TEMPLATE_VBoxBS3KitImg_ASOBJSUFF = .o16
604TEMPLATE_VBoxBS3KitImg_ASTOOL = VBoxNasm
605TEMPLATE_VBoxBS3KitImg_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
606TEMPLATE_VBoxBS3KitImg_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__ ARCH_BITS=16 RT_ARCH_X86 ASM_MODEL_FAR_CODE \
607 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
608 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
609TEMPLATE_VBoxBS3KitImg_DEFS = IN_BS3KIT
610TEMPLATE_VBoxBS3KitImg_DEFS.debug = BS3_STRICT
611
612TEMPLATE_VBoxBS3KitImg_ARTOOL = OPENWATCOM-16
613
614TEMPLATE_VBoxBS3KitImg_CTOOL = Bs3Ow16
615TEMPLATE_VBoxBS3KitImg_CXXTOOL = Bs3Ow16
616TEMPLATE_VBoxBS3KitImg_CFLAGS = $(if $(BS3KIT_SEGNM_DATA16),-nd=$(BS3KIT_SEGNM_DATA16),) \
617 -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+
618TEMPLATE_VBoxBS3KitImg_CXXFLAGS = $(if $(BS3KIT_SEGNM_DATA16),-nd=$(BS3KIT_SEGNM_DATA16),) \
619 -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+
620TEMPLATE_VBoxBS3KitImg_CDEFS = ARCH_BITS=16 RT_ARCH_X86
621
622TEMPLATE_VBoxBS3KitImg_TOOL = $(NO_SUCH_VARIABLE)
623TEMPLATE_VBoxBS3KitImg_C16TOOL = $(TEMPLATE_VBoxBS3KitImg_CTOOL)
624TEMPLATE_VBoxBS3KitImg_C16FLAGS = $(TEMPLATE_VBoxBS3KitImg_CFLAGS)
625TEMPLATE_VBoxBS3KitImg_C16DEFS = $(TEMPLATE_VBoxBS3KitImg_CDEFS)
626TEMPLATE_VBoxBS3KitImg_C32TOOL := Bs3Ow32
627TEMPLATE_VBoxBS3KitImg_C32FLAGS = $(TEMPLATE_VBoxBS3KitImg32_CFLAGS)
628TEMPLATE_VBoxBS3KitImg_C32DEFS = ARCH_BITS=32 RT_ARCH_X86
629TEMPLATE_VBoxBS3KitImg_C64TOOL = $(TEMPLATE_VBoxBS3KitImg64_CTOOL)
630TEMPLATE_VBoxBS3KitImg_C64FLAGS = $(TEMPLATE_VBoxBS3KitImg64_CFLAGS)
631TEMPLATE_VBoxBS3KitImg_C64DEFS = ARCH_BITS=64 RT_ARCH_AMD64
632
633TEMPLATE_VBoxBS3KitImg_INCS = $(VBOX_PATH_BS3KIT_SRC) .
634TEMPLATE_VBoxBS3KitImg_LDTOOL = OPENWATCOM-WL
635
636# linker options:
637# system dos: Link a 16-bit DOS binary.
638# output raw ...: Produce a raw DOS binary for loading at flat address 10000h.
639# The following is for ordering segments.
640# option start=_start: The start symbol in bs3-first-xxx.asm.
641# debug codeview/dwarf all: Full debug information either in codeview or dwarf.
642# option symfile: Produce a separate symbol file with the debug info.
643# option map: Produce a map file.
644# option farcalls: Change intrasegment far calls into 'push cs; seg ds; call symbol' where possible.
645# option statics: ?
646# option verbose: Verbose map file?
647# option disable 1014: Disable warning about 'stack segment not found'.
648# option disable 1080: Disable warning about '%1 is a 32-bit object file'.
649#
650# Note! We're pushing DATA16 to 0x20000 because it's impossible to force wlink
651# to give us a real-mode + GDT compatible alignment (0ffffff80h), i.e.
652# real-mode address on the form 0fff8:0000.
653TEMPLATE_VBoxBS3KitImg_LDFLAGS = system dos \
654 debug $(BS3_OW_DBG_LDOPT) all \
655 option quiet, map, statics, verbose, symfile, start=_start, farcalls \
656 disable 1014, 1080 \
657 \
658 output raw offset=0x10000 \
659 order \
660 clname BS3FLAT segaddr=0x0000 \
661 segment BS3FLAT segaddr=0x0000 \
662 clname $(BS3KIT_CLASS_CODE16) segaddr=0x1000 \
663 segment BS3TEXT16 \
664 segment BS3TEXT16_NEARSTUBS \
665 segment BS3TEXT16_FARSTUBS \
666 segment BS3TEXT16_END \
667 clname BS3SYSTEM16 segaddr=0x2000 \
668 segment BS3SYSTEM16 \
669$(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
670 clname DATA \
671 segment BS3DATA16 segaddr=0x2900 \
672 segment BS3DATA16_DATA \
673 segment DATA \
674 segment _DATA \
675 segment BS3DATA16CONST \
676 segment CONST \
677 segment BS3DATA16CONST2 \
678 segment CONST2 \
679 segment STRINGS \
680 segment BS3DATA16_END \
681 clname BSS \
682 segment BSS \
683 segment _BSS \
684 segment BS3DATA16_END \
685 clname FAR_DATA \
686 segment FAR_DATA \
687, \
688 clname FAR_DATA \
689 segment BS3DATA16 segaddr=0x2900 \
690 segment FAR_DATA \
691 segment BS3DATA16CONST \
692 segment BS3DATA16CONST2 \
693 segment BS3DATA16_DATA \
694 segment BS3DATA16_END \
695) \
696 segment BS3DATA32 \
697 segment BS3DATA32CONST \
698 segment BS3DATA32CONST2 \
699 segment BS3DATA32_DATA \
700 segment BS3DATA32_BSS \
701 segment BS3DATA32_END \
702 \
703 segment BS3DATA64 \
704 segment BS3DATA64CONST \
705 segment BS3DATA64_BSS \
706 segment BS3DATA64_END \
707 clname BS3CLASS16RMCODE \
708 segment BS3RMCODE16_START \
709 segment BS3RMCODE16 \
710 segment BS3RMCODE16_END \
711 clname BS3CLASS16X0CODE \
712 segment BS3X0CODE16_START \
713 segment BS3X0CODE16 \
714 segment BS3X0CODE16_END \
715 clname BS3CLASS16X1CODE \
716 segment BS3X1CODE16_START \
717 segment BS3X1CODE16 \
718 segment BS3X1CODE16_END \
719 clname BS3CLASS32CODE \
720 segment BS3TEXT32_START \
721 segment BS3TEXT32 \
722 segment BS3TEXT32_END \
723 clname BS3CLASSSEPARATE32AND64BITCODE \
724 segment BS3SEPARATE32AND64BITCODE \
725 segment BS3SEPARATE32AND64BITCODE_END \
726 clname BS3CLASS64CODE \
727 segment BS3TEXT64_START \
728 segment BS3TEXT64 \
729 segment BS3TEXT64_END
730
731TEMPLATE_VBoxBS3KitImg_LNK_DEPS = \
732 $(bs3-bootsector_1_TARGET) \
733 $(VBoxBs3Linker_1_TARGET)
734TEMPLATE_VBoxBS3KitImg_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY)\
735 ,,$(QUIET)$(MV_EXT) -f -- "$(out)" "$(out).tmp" \
736 $$(NLTAB)$(QUIET)$(VBoxBs3Linker_1_TARGET) -o $(out) $(bs3-bootsector_1_TARGET) $(out).tmp \
737 $$(NLTAB)$(QUIET)$(RM_EXT) -f -- "$(out).tmp") \
738 $(eval .PRECIOUS: $(outbase).map) # ugly hack!
739
740
741TEMPLATE_VBoxBS3KitImg_LIBS = \
742 $(PATH_OBJ)/bs3kit-common-16/bs3kit-common-16.lib \
743 $(PATH_OBJ)/bs3kit-common-32/bs3kit-common-32.lib \
744 $(PATH_OBJ)/bs3kit-common-64/bs3kit-common-64.lib \
745 \
746 $(PATH_OBJ)/bs3kit-rm/bs3kit-rm.lib \
747 $(PATH_OBJ)/bs3kit-pe16/bs3kit-pe16.lib \
748 $(PATH_OBJ)/bs3kit-pe16_32/bs3kit-pe16_32.lib \
749 $(PATH_OBJ)/bs3kit-pe16_v86/bs3kit-pe16_v86.lib \
750 $(PATH_OBJ)/bs3kit-pe32/bs3kit-pe32.lib \
751 $(PATH_OBJ)/bs3kit-pe32_16/bs3kit-pe32_16.lib \
752 $(PATH_OBJ)/bs3kit-pev86/bs3kit-pev86.lib \
753 $(PATH_OBJ)/bs3kit-pp16/bs3kit-pp16.lib \
754 $(PATH_OBJ)/bs3kit-pp16_32/bs3kit-pp16_32.lib \
755 $(PATH_OBJ)/bs3kit-pp16_v86/bs3kit-pp16_v86.lib \
756 $(PATH_OBJ)/bs3kit-pp32/bs3kit-pp32.lib \
757 $(PATH_OBJ)/bs3kit-pp32_16/bs3kit-pp32_16.lib \
758 $(PATH_OBJ)/bs3kit-ppv86/bs3kit-ppv86.lib \
759 $(PATH_OBJ)/bs3kit-pae16/bs3kit-pae16.lib \
760 $(PATH_OBJ)/bs3kit-pae16_32/bs3kit-pae16_32.lib \
761 $(PATH_OBJ)/bs3kit-pae16_v86/bs3kit-pae16_v86.lib \
762 $(PATH_OBJ)/bs3kit-pae32/bs3kit-pae32.lib \
763 $(PATH_OBJ)/bs3kit-pae32_16/bs3kit-pae32_16.lib \
764 $(PATH_OBJ)/bs3kit-paev86/bs3kit-paev86.lib \
765 $(PATH_OBJ)/bs3kit-lm16/bs3kit-lm16.lib \
766 $(PATH_OBJ)/bs3kit-lm32/bs3kit-lm32.lib \
767 $(PATH_OBJ)/bs3kit-lm64/bs3kit-lm64.lib
768
769# BS3Kit template for 32-bit code.
770TEMPLATE_VBoxBS3KitImg32 = Template for building BS3Kit test images.
771TEMPLATE_VBoxBS3KitImg32_BLD_TRG = os-agnostic
772TEMPLATE_VBoxBS3KitImg32_BLD_TRG_ARCH = x86
773TEMPLATE_VBoxBS3KitImg32_INSTTYPE = none
774TEMPLATE_VBoxBS3KitImg32_ASTOOL = VBoxNasm
775TEMPLATE_VBoxBS3KitImg32_ASOBJSUFF = .o32
776TEMPLATE_VBoxBS3KitImg32_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
777TEMPLATE_VBoxBS3KitImg32_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__ \
778 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
779 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
780TEMPLATE_VBoxBS3KitImg32_DEFS = ARCH_BITS=32 IN_BS3KIT
781TEMPLATE_VBoxBS3KitImg32_DEFS.debug = BS3_STRICT
782TEMPLATE_VBoxBS3KitImg32_ARTOOL = OPENWATCOM
783TEMPLATE_VBoxBS3KitImg32_CTOOL = Bs3Ow32
784TEMPLATE_VBoxBS3KitImg32_CXXTOOL = Bs3Ow32
785TEMPLATE_VBoxBS3KitImg32_CFLAGS = \
786 -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+
787TEMPLATE_VBoxBS3KitImg32_CXXFLAGS = \
788 -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+
789TEMPLATE_VBoxBS3KitImg32_INCS = $(VBOX_PATH_BS3KIT_SRC) .
790TEMPLATE_VBoxBS3KitImg32_LDTOOL = VBoxBsUnusedLd
791
792# BS3Kit template for 64-bit code.
793TEMPLATE_VBoxBS3KitImg64 = Template for building BS3Kit test images.
794TEMPLATE_VBoxBS3KitImg64_BLD_TRG = os-agnostic
795TEMPLATE_VBoxBS3KitImg64_BLD_TRG_ARCH = amd64
796TEMPLATE_VBoxBS3KitImg64_INSTTYPE = none
797TEMPLATE_VBoxBS3KitImg64_ASTOOL = VBoxNasm
798TEMPLATE_VBoxBS3KitImg64_ASOBJSUFF = .o64
799TEMPLATE_VBoxBS3KitImg64_ASFLAGS = -f obj -g $(BS3KIT_NASM_allow_64_bit) -w+orphan-labels
800TEMPLATE_VBoxBS3KitImg64_ASDEFS = ASM_FORMAT_OMF ASM_CALL64_MSC RT_NOINC_SEGMENTS __NASM__ \
801 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
802 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
803TEMPLATE_VBoxBS3KitImg64_DEFS = IN_BS3KIT ARCH_BITS=64
804TEMPLATE_VBoxBS3KitImg64_DEFS.debug = BS3_STRICT
805TEMPLATE_VBoxBS3KitImg64_ARTOOL = OPENWATCOM
806TEMPLATE_VBoxBS3KitImg64_INCS = $(VBOX_PATH_BS3KIT_SRC) .
807if1of ($(KBUILD_HOST), win)
808 ifndef TOOL_VCC100AMD64 # For win.x86 builds.
809 include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL_STEM)AMD64.kmk
810 endif
811 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Vcc64
812 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Vcc64
813 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -Z7 -O1 -Oi -GF -GS- -Gy- -Gs65536
814 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -Z7 -O1 -Oi -GF -GS- -Gy- -Gs65536
815else
816 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Gcc64Elf64
817 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Gcc64Elf64
818 # Note! -mx32 would be exactly what we needed here, however it causes internal compiler errors with 4.8.4 on gentoo.
819 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_WARN_PEDANTIC_C) \
820 -msoft-float -fno-exceptions -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
821 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_WARN_PEDANTIC_CXX) \
822 -msoft-float -fno-exceptions -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
823endif
824TEMPLATE_VBoxBS3KitImg64_LDTOOL = VBoxBsUnusedLd
825
826# BS3Kit template for the bootsector.
827TEMPLATE_VBoxBS3KitBS = Template for building BS3Kit test images.
828TEMPLATE_VBoxBS3KitBS_BLD_TRG = os-agnostic
829TEMPLATE_VBoxBS3KitBS_BLD_TRG_ARCH = x86
830TEMPLATE_VBoxBS3KitBS_INST = $(INST_VALIDATIONKIT)bootsectors/
831TEMPLATE_VBoxBS3KitBS_INSTTYPE = none
832TEMPLATE_VBoxBS3KitBS_BINSUFF = .img
833TEMPLATE_VBoxBS3KitBS_MODE = 0644
834TEMPLATE_VBoxBS3KitBS_ASTOOL = YASM
835TEMPLATE_VBoxBS3KitBS_ASFLAGS = -f bin --mapfile
836TEMPLATE_VBoxBS3KitBS_ASDEFS = ASM_FORMAT_BIN RT_NOINC_SEGMENTS ARCH_BITS=16 __YASM__ \
837 BS3CLASS16CODE=$(BS3KIT_CLASS_CODE16) BS3KIT_CLASS_DATA16=$(BS3KIT_CLASS_DATA16) \
838 BS3KIT_GRPNM_DATA16=$(BS3KIT_GRPNM_DATA16) BS3KIT_CLASS_BSS16=$(BS3KIT_CLASS_BSS16)
839TEMPLATE_VBoxBS3KitBS_INCS = $(VBOX_PATH_BS3KIT_SRC) .
840TEMPLATE_VBoxBS3KitBS_LDTOOL = VBoxBsCpLd
841
842
843
844#
845# Extends VBoxBS3KitImg
846# User must starts SOURCES with: $(VBOX_PATH_BS3KIT_SRC)/bs3-first-dosexe.asm
847## disable 1014, 1080, 1150
848#
849TEMPLATE_VBoxBS3KitUtil = Utility using bs3kit code.
850TEMPLATE_VBoxBS3KitUtil_EXTENDS = VBoxBS3KitImg
851TEMPLATE_VBoxBS3KitUtil_BINSUFF = .exe
852TEMPLATE_VBoxBS3KitUtil_DEFS = $(TEMPLATE_VBoxBS3KitImg_DEFS) BS3_IS_DOS_EXE
853TEMPLATE_VBoxBS3KitUtil_CFLAGS = $(filter-out -zl,$(TEMPLATE_VBoxBS3KitImg_CFLAGS))
854TEMPLATE_VBoxBS3KitUtil_CXXFLAGS = $(filter-out -zl,$(TEMPLATE_VBoxBS3KitImg_CXXFLAGS))
855TEMPLATE_VBoxBS3KitUtil_LDFLAGS = system dos \
856 debug $(BS3_OW_DBG_LDOPT) all \
857 option quiet, map, statics, verbose, symfile \
858 disable 1080 \
859 order \
860 clname $(BS3KIT_CLASS_CODE16) \
861 segment BEGTEXT \
862 segment BS3TEXT16 \
863 segment _TEXT \
864 segment BS3TEXT16_NEARSTUBS \
865 segment BS3TEXT16_FARSTUBS \
866 segment BS3TEXT16_END \
867 clname BS3SYSTEM16 \
868 segment BS3SYSTEM16 \
869 \
870 clname BEGDATA \
871 segment _NULL \
872 segment _AFTERNULL \
873 clname DATA \
874$(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
875 segment BS3DATA16 \
876 segment BS3DATA16CONST \
877 segment CONST \
878 segment BS3DATA16CONST2 \
879 segment CONST2 \
880,\
881 segment CONST \
882 segment CONST2 \
883) \
884 segment _DATA \
885 segment XIB \
886 segment XI \
887 segment XIE \
888 segment YIB \
889 segment YI \
890 segment YIE \
891 segment STRINGS \
892$(if-expr "$(BS3KIT_SEGNM_DATA16)" == "", \
893 segment BS3DATA16_DATA \
894,) \
895 segment DATA \
896 clname BSS \
897 segment _BSS \
898 segment BSS \
899 segment BS3DATA16_END \
900 clname STACK \
901 segment STACK \
902 \
903 clname FAR_DATA \
904$(if-expr "$(BS3KIT_SEGNM_DATA16)" != "", \
905 segment BS3DATA16 \
906 segment BS3DATA16_DATA \
907 segment BS3DATA16CONST \
908 segment BS3DATA16CONST2 \
909 segment FAR_DATA \
910 segment BS3DATA16_END \
911,\
912 segment FAR_DATA \
913)\
914 segment BS3DATA32 \
915 segment BS3DATA32CONST \
916 segment BS3DATA32CONST2 \
917 segment BS3DATA32_DATA \
918 segment BS3DATA32_BSS \
919 segment BS3DATA32_END \
920 \
921 segment BS3DATA64 \
922 segment BS3DATA64CONST \
923 segment BS3DATA64_BSS \
924 segment BS3DATA64_END \
925 clname BS3CLASS16RMCODE \
926 segment BS3RMCODE16_START \
927 segment BS3RMCODE16 \
928 segment BS3RMCODE16_END \
929 clname BS3CLASS16X0CODE \
930 segment BS3X0CODE16_START \
931 segment BS3X0CODE16 \
932 segment BS3X0CODE16_END \
933 clname BS3CLASS16X1CODE \
934 segment BS3X1CODE16_START \
935 segment BS3X1CODE16 \
936 segment BS3X1CODE16_END \
937 clname BS3CLASS32CODE \
938 segment BS3TEXT32 \
939 segment BS3TEXT32_END \
940 clname BS3CLASSSEPARATE32AND64BITCODE \
941 segment BS3SEPARATE32AND64BITCODE \
942 segment BS3SEPARATE32AND64BITCODE_END \
943 clname BS3CLASS64CODE \
944 segment BS3TEXT64 \
945 segment BS3TEXT64_END
946# clname BS3FLAT segaddr=0x0000 \
947# segment BS3FLAT segaddr=0x0000
948
949TEMPLATE_VBoxBS3KitUtil_LNK_DEPS = $(NO_SUCH_VARIABLE)
950TEMPLATE_VBoxBS3KitUtil_POST_CMDS = $(NO_SUCH_VARIABLE)
951
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