1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
# $Id: Makefile.kmk $
## @file
# VirtualBox Validation Kit - Bootsector Tests for Test Drivers or standalone testing.
#
#
# Copyright (C) 2006-2019 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.
#
SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk
#
# Make sure our Config.kmk gets included when kmk is running from a parent directory.
#
ifndef VBOX_BOOTSECTORS_CONFIG_KMK_INCLUDED
include $(PATH_SUB_CURRENT)/Config.kmk
endif
#
# Include sub-makefile.
#
# The VBOX_WITH_BS3KIT feature requires NASM 2.12 and either MSVC or gcc
# with ms_abi function attribute (gcc v4.4+, MSVC default).
# Some 32-bit gcc compilers come without 64-bit support (e.g. EL5).
#
if defined(VBOX_WITH_OPEN_WATCOM)
if1of ($(KBUILD_TARGET), win)
VBOX_WITH_BS3KIT = 1
else if $(VBOX_GCC_VERSION_CC) >= 40400 # ms_abi was added in 4.4
if1of ($(KBUILD_TARGET), linux)
ifneq ($(VBOX_GCC_m64),)
VBOX_WITH_BS3KIT = 1
endif
endif
endif
ifdef VBOX_WITH_BS3KIT
include $(PATH_SUB_CURRENT)/bs3kit/Makefile.kmk
endif
endif
#
# Boot Sector "Linker" tool.
#
TOOL_VBoxBootSectorLd = Joins one or more BS2 object files into a floppy img.
TOOL_VBoxBootSectorLd_LINK_MISCBIN_OUTPUT =
TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPEND =
TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPORD = $(VBoxBs2Linker_1_TARGET)
define TOOL_VBoxBootSectorLd_LINK_MISCBIN_CMDS
$(VBoxBs2Linker_1_TARGET) -o $(out) $(objs) $(othersrc)
endef
BLDPROGS += VBoxBs2Linker
VBoxBs2Linker_TEMPLATE = VBoxBldProg
VBoxBs2Linker_SOURCES = VBoxBs2Linker.cpp
#
# Makes a boot sector test image.
#
TEMPLATE_VBoxBsTestImg = kBuild tool config for building boot sector stuff.
TEMPLATE_VBoxBsTestImg_INST = $(INST_VALIDATIONKIT)bootsectors/
TEMPLATE_VBoxBsTestImg_BINSUFF = .img
TEMPLATE_VBoxBsTestImg_MODE = 0644
TEMPLATE_VBoxBsTestImg_ASTOOL = YASM
TEMPLATE_VBoxBsTestImg_ASFLAGS = -f bin -P $(VBOX_PATH_BOOTSECTORS_SRC)/bootsector2-first.mac $(VBOX_YASM_Wno-segreg-in-64bit) --mapfile
TEMPLATE_VBoxBsTestImg_ASDEFS = ASM_FORMAT_BIN
TEMPLATE_VBoxBsTestImg_INCS = \
. \
../../VMM/testcase/Instructions
TEMPLATE_VBoxBsTestImg_LDTOOL = VBoxBootSectorLd
#
# The boot sector tests.
#
MISCBINS += bootsector-shutdown
bootsector-shutdown_TEMPLATE = VBoxBsTestImg
bootsector-shutdown_SOURCES = bootsector-shutdown.asm
MISCBINS += bootsector-pae
bootsector-pae_TEMPLATE = VBoxBsTestImg
bootsector-pae_SOURCES = bootsector-pae.asm
MISCBINS += bootsector-empty
bootsector-empty_TEMPLATE = VBoxBsTestImg
bootsector-empty_SOURCES = bootsector-empty.asm
MISCBINS += bootsector2-test1
bootsector2-test1_TEMPLATE = VBoxBsTestImg
bootsector2-test1_SOURCES = bootsector2-test1.asm
MISCBINS += bootsector2-cpu-hidden-regs-1
bootsector2-cpu-hidden-regs-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-hidden-regs-1_SOURCES = bootsector2-cpu-hidden-regs-1.asm
MISCBINS += bootsector2-cpu-instr-1
bootsector2-cpu-instr-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-instr-1_SOURCES = bootsector2-cpu-instr-1.asm
MISCBINS += bootsector2-cpu-pf-1
bootsector2-cpu-pf-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-pf-1_SOURCES = bootsector2-cpu-pf-1.asm
MISCBINS += bootsector2-cpu-xcpt-1
bootsector2-cpu-xcpt-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-xcpt-1_SOURCES = bootsector2-cpu-xcpt-1.asm
MISCBINS += bootsector2-cpu-xcpt-2
bootsector2-cpu-xcpt-2_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-xcpt-2_SOURCES = bootsector2-cpu-xcpt-2.asm
MISCBINS += bootsector2-cpu-a20-1
bootsector2-cpu-a20-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-a20-1_SOURCES = bootsector2-cpu-a20-1.asm
MISCBINS += bootsector2-cpu-basic-1
bootsector2-cpu-basic-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-basic-1_SOURCES = bootsector2-cpu-basic-1.asm
MISCBINS += bootsector2-cpu-ac-loop
bootsector2-cpu-ac-loop_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-ac-loop_SOURCES = bootsector2-cpu-ac-loop.asm
MISCBINS += bootsector2-cpu-db-loop
bootsector2-cpu-db-loop_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-db-loop_SOURCES = bootsector2-cpu-db-loop.asm
MISCBINS += bootsector2-boot-registers-1
bootsector2-boot-registers-1_TEMPLATE = VBoxBsTestImg
bootsector2-boot-registers-1_SOURCES = bootsector2-boot-registers-1.asm
MISCBINS += bootsector2-triple-fault-1
bootsector2-triple-fault-1_TEMPLATE = VBoxBsTestImg
bootsector2-triple-fault-1_SOURCES = bootsector2-triple-fault-1.asm
ifeq ($(USERNAME),birdxx)
if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
#
# Generated instruction tests (work in progress).
#
VBOX_PATH_VBINSTST = $(PATH_ROOT)/src/VBox/VMM/testcase/Instructions
VBOX_VBINSTST_GEN = $(VBOX_PATH_VBINSTST)/InstructionTestGen.py
VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN = $(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) \
--split 3 --target bs2-r0-64 --output-base $(bootsectors_0_OUTDIR)/VBInsTst-64 --test-size tiny
VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES = $(shell $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN) --makefile-mode)
#$$(bootsectors_0_OUTDIR)/VBInsTst.ts + $$(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES): $(VBOX_VBINSTST_GEN) | $$(dir $$@)
# $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN)
# $(APPEND) -t $@
#
#bootsectors_SOURCES += $(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img
#bootsectors_CLEAN += $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES)
#
#$$(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img: \
# $(PATH_SUB_CURRENT)/bootsector2-vbinstst-64-1.asm \
# $$(bootsectors_0_OUTDIR)/VBInsTst-64.asm
# $(TOOL_$(VBOX_ASTOOL)_AS) -f bin -D ASM_FORMAT_BIN -I $(dir $@) -I $(PATH_ROOT)/include -I $(VBOX_PATH_VBINSTST) -o $@ -L nasm -l $@.lst $<
MISCBINS += bootsector2-vbinstst-kernel
bootsector2-vbinstst-kernel_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-kernel_SOURCES = \
bootsector2-vbinstst-kernel.asm
MISCBINS += bootsector2-vbinstst-64-1
bootsector2-vbinstst-64-1_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-64-1_DEFS = \
BS2_BIG_IMAGE_LM64 \
BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-64-1.asm \
BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-64-1\"
bootsector2-vbinstst-64-1_INCS = $(bootsector2-vbinstst-64-1_0_OUTDIR)/
bootsector2-vbinstst-64-1_SOURCES = \
bootsector2-vbinstst-kernel.asm \
bootsector2-vbinstst-big-template.asm
bootsector2-vbinstst-64-1_INTERMEDIATES = \
$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
bootsector2-vbinstst-64-1_CLEAN = \
$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
$$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
$(REDIRECT) -0 /dev/null -- $(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-64-big --output-base $(basename $@) --test-size medium
MISCBINS += bootsector2-vbinstst-32-1
bootsector2-vbinstst-32-1_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-32-1_DEFS = \
BS2_BIG_IMAGE_PP32 \
BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-32-1.asm \
BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-32-1\"
bootsector2-vbinstst-32-1_INCS = $(bootsector2-vbinstst-32-1_0_OUTDIR)/
bootsector2-vbinstst-32-1_SOURCES = \
bootsector2-vbinstst-kernel.asm \
bootsector2-vbinstst-big-template.asm
bootsector2-vbinstst-32-1_INTERMEDIATES = \
$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
bootsector2-vbinstst-32-1_CLEAN = \
$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
$$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
$(REDIRECT) -0 /dev/null -- $(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-32-big --output-base $(basename $@) --test-size medium
endif
endif # bird-only
ifdef VBOX_WITH_BS3KIT
#
# Bs3kit
#
# CPU basics #2 (first being bootsector2-cpu-basic-1).
MISCBINS += bs3-cpu-basic-2
bs3-cpu-basic-2_TEMPLATE = VBoxBS3KitImg
bs3-cpu-basic-2_INCS = .
bs3-cpu-basic-2_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-cpu-basic-2-template.c
bs3-cpu-basic-2_DEFS += BS3_MODE_INSTANTIATE_FILE1=bs3-cpu-basic-2-template.c
ifeq ($(KBUILD_HOST),win)
bs3-cpu-basic-2_DEFS += HAVE_OMF_CONVERTER
endif
bs3-cpu-basic-2_SOURCES = \
bs3kit/bs3-first-rm.asm \
bs3-cpu-basic-2.c \
bs3-cpu-basic-2-x0.c \
bs3-cpu-basic-2-32.c32 \
bs3-cpu-basic-2-pf.c32 \
bs3-cpu-basic-2-asm.asm \
bs3kit/bs3-cmn-instantiate-x0.c16 \
bs3kit/bs3-cmn-instantiate.c32 \
bs3kit/bs3-cmn-instantiate.c64
bs3-cpu-basic-2-template.o:: \
$$(bs3-cpu-basic-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate-x0.o16 \
$$(bs3-cpu-basic-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
$$(bs3-cpu-basic-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
$$(bs3-cpu-basic-2_0_OUTDIR)/bs3-cpu-basic-2-asm.o16
# CPU weird stuff #1.
MISCBINS += bs3-cpu-weird-1
bs3-cpu-weird-1_TEMPLATE = VBoxBS3KitImg
bs3-cpu-weird-1_INCS = .
bs3-cpu-weird-1_SOURCES = \
bs3kit/bs3-first-rm.asm \
bs3-cpu-weird-1.c \
bs3-cpu-weird-1-x0.c \
bs3-cpu-weird-1-asm.asm
# FPU state corruption checker.
MISCBINS += bs3-fpustate-1
bs3-fpustate-1_TEMPLATE = VBoxBS3KitImg
bs3-fpustate-1_INCS = .
bs3-fpustate-1_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-fpustate-1-template.c
bs3-fpustate-1_DEFS += BS3_MODE_INSTANTIATE_FILE1=bs3-fpustate-1-template.c
bs3-fpustate-1_SOURCES = \
bs3kit/bs3-first-rm.asm \
bs3-fpustate-1.c \
bs3kit/bs3-cmn-instantiate.c16 \
bs3kit/bs3-cmn-instantiate.c32 \
bs3kit/bs3-cmn-instantiate.c64 \
bs3-fpustate-1-asm.asm
bs3-fpustate-1-template.o:: \
$$(bs3-fpustate-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o16 \
$$(bs3-fpustate-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
$$(bs3-fpustate-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
$$(bs3-fpustate-1_0_OUTDIR)/bs3-fpustate-1-asm.o16
# CPU instruction decoding experiments.
MISCBINS += bs3-cpu-decoding-1
bs3-cpu-decoding-1_TEMPLATE = VBoxBS3KitImg
bs3-cpu-decoding-1_INCS = .
bs3-cpu-decoding-1_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-cpu-decoding-1-template.c
bs3-cpu-decoding-1_DEFS += BS3_MODE_INSTANTIATE_FILE1=bs3-cpu-decoding-1-template.c
bs3-cpu-decoding-1_SOURCES = \
bs3kit/bs3-first-init-all-pp32.asm \
bs3-cpu-decoding-1.c32 \
bs3-cpu-decoding-1-asm.asm
# bs3kit/bs3-cmn-instantiate.c16 \
# bs3kit/bs3-cmn-instantiate.c32 \
# bs3kit/bs3-cmn-instantiate.c64
bs3-cpu-decoding-1-template.o:: \
$$(bs3-cpu-decoding-1_0_OUTDIR)/bs3-cpu-decoding-1-asm.o16
# $$(bs3-cpu-decoding-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o16 \
# $$(bs3-cpu-decoding-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
# $$(bs3-cpu-decoding-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
# CPU instructions #2 (first being bootsector2-cpu-instr-1).
MISCBINS += bs3-cpu-instr-2
bs3-cpu-instr-2_TEMPLATE = VBoxBS3KitImg
bs3-cpu-instr-2_INCS = .
bs3-cpu-instr-2_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-cpu-instr-2-template.c
bs3-cpu-instr-2_DEFS += BS3_MODE_INSTANTIATE_FILE1=bs3-cpu-instr-2-template.c
bs3-cpu-instr-2_SOURCES = \
bs3kit/bs3-first-rm.asm \
bs3-cpu-instr-2.c \
bs3-cpu-instr-2-asm.asm \
bs3kit/bs3-cmn-instantiate-x0.c16 \
bs3kit/bs3-cmn-instantiate.c32 \
bs3kit/bs3-cmn-instantiate.c64
bs3-cpu-instr-2-template.o:: \
$$(bs3-cpu-instr-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate-x0.o16 \
$$(bs3-cpu-instr-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
$$(bs3-cpu-instr-2_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
$$(bs3-cpu-instr-2_0_OUTDIR)/bs3-cpu-instr-2-asm.o16
# CPU generated instruction tests #1
MISCBINS += bs3-cpu-generated-1
bs3-cpu-generated-1_TEMPLATE = VBoxBS3KitImg
bs3-cpu-generated-1_INCS = .
bs3-cpu-generated-1_DEFS = BS3_CMN_INSTANTIATE_FILE1=bs3-cpu-generated-1-template.c
bs3-cpu-generated-1_SOURCES = \
bs3kit/bs3-first-rm.asm \
bs3-cpu-generated-1.c \
bs3-cpu-generated-1-asm.asm \
bs3kit/bs3-cmn-instantiate-x0.c16 \
bs3kit/bs3-cmn-instantiate.c32 \
bs3kit/bs3-cmn-instantiate.c64 \
$(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16
bs3-cpu-generated-1_CLEAN = $(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16
bs3-cpu-generated-1-template.o:: \
$$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate-x0.o16 \
$$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o32 \
$$(bs3-cpu-generated-1_0_OUTDIR)/bs3kit/bs3-cmn-instantiate.o64 \
$$(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-asm.o16
$$(bs3-cpu-generated-1_0_OUTDIR)/bs3-cpu-generated-1-data.c16: \
$(PATH_SUB_CURRENT)/bs3-cpu-generated-1-data.py \
$(PATH_SUB_CURRENT)/../../VMM/VMMAll/IEMAllInstructionsPython.py \
$(PATH_SUB_CURRENT)/../../VMM/VMMAll/IEMAllInstructions*.cpp.h \
| $$(dir $$@)
$(REDIRECT) -0 /dev/null -- $(VBOX_BLD_PYTHON) $< $@
endif # VBOX_WITH_BS3KIT
#
# pylint
#
VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
$(evalcall def_vbox_validationkit_process_python_sources)
include $(FILE_KBUILD_SUB_FOOTER)
|