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
|
; $Id: bootsector2-common-routines.mac $
;; @file
; Common bootsector routines.
;
; This is just a bit file with common code that can be included at the end of
; a bootsector2-xxx.asm file. Conventions (used elsewhere as well):
; - _rm - real-mode function suffix.
; - _r86 - common real and virtual 8086 mode suffix.
; - _p16 - common 16-bit protected mode suffix.
; - _p32 - common 32-bit protected mode suffix.
; - _p64 - common 64-bit long mode suffix.
; - _pe16 - 16-bit unpaged protected mode suffix.
; - _pe32 - 32-bit unpaged protected mode suffix.
; - _pev86 - v8086 unpaged protected mode suffix.
; - _pp16 - 16-bit paged protected mode suffix.
; - _pp32 - 32-bit paged protected mode suffix.
; - _ppv86 - v8086 paged protected mode suffix.
; - _pae16 - 16-bit pae protected mode suffix.
; - _pae32 - 32-bit pae protected mode suffix.
; - _paev86- v8086 pae protected mode suffix.
; - _lm16 - 16-bit long mode suffix.
; - _lm32 - 32-bit long mode suffix.
; - _lm64 - 64-bit long mode suffix.
;
; The routines uses a custom register based calling convention for all cpu
; modes so that the users can template multi mode code. To make life easy for
; the programmer all registers are preserved with the exception of rflags and
; any return registers that may be used. Routines that does not return
; anything will only clobber eflags.
;
; The parameter register allocation order:
; rax, rdx, rcx, rbx, rsi, rdi(, r8, r9, r10, r11)
;
; When pointers are passed by 16-bit code, segments registers are allocated in
; the following order:
; ds, es, fs, gs.
;
; The return register allocations are:
; - edx:eax for 64-bit values in 16 and 32-bit mode,
; - eax for 32-bit,
; - ax for 16-bit,
; - al for 8-bit.
;
; Routines may use other calling convensions will be named differently.
;
;
; Copyright (C) 2007-2023 Oracle and/or its affiliates.
;
; This file is part of VirtualBox base platform packages, as
; available from https://www.virtualbox.org.
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation, in version 3 of the
; License.
;
; This program is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, see <https://www.gnu.org/licenses>.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
; in the VirtualBox 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.
;
; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
;
;*******************************************************************************
;* Structures and Typedefs *
;*******************************************************************************
;*******************************************************************************
;* Global Variables *
;*******************************************************************************
BEGINCODELOW
ALIGNDATA(32)
;; Indicates whether the VMMDev is operational.
GLOBALNAME g_fbBs2VMMDevTesting
db 1
db 0 ; padding
;; The test name (DS16:xxx).
g_npszBs2Test:
dd 0
;; The number of tests that have failed.
g_uscBs2TestErrors:
dw 0
;; The subtest name (DS16:xxx).
g_npszBs2SubTest
dd 0
;; The start error count of the current subtest.
g_uscBs2SubTestAtErrors:
dw 0
;; Whether we've reported the sub-test result or not.
g_fbBs2SubTestReported:
db 0
db 0 ; padding
;; The number of sub tests.
g_uscBs2SubTests:
dw 0
;; The number of sub tests that failed.
g_uscBs2SubTestsFailed:
dw 0
;; VMMDEV_TESTING_UNIT_XXX -> string
g_aszBs2TestUnitNames:
db 'i','n','v', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db '%', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'b','y','t','e','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'b','y','t','e','s','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'K','B', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'K','B','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'M','B', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'M','B','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','a','c','k','e','t','s', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','a','c','k','e','t','s','/','s', 0, 0, 0, 0, 0, 0, 0
db 'f','r','a','m','e','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'f','r','a','m','e','s','/', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'o','c','c', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'o','c','c','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'r','n','d','t','r','p', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'c','a','l','l','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'c','a','l','l','s','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 's', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'm','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'n','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'n','s','/','c','a','l','l', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'n','s','/','f','r','a','m','e', 0, 0, 0, 0, 0, 0, 0, 0
db 'n','s','/','o','c','c', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'n','s','/','p','a','c','k','e','t', 0, 0, 0, 0, 0, 0, 0
db 'n','s','/','r','n','d','t','r','p', 0, 0, 0, 0, 0, 0, 0
db 'i','n','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'i','n','s','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; none
db 'p','p','1','k', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','p','1','0','k', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','p','m', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','p','b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 't','i','c','k','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 't','i','c','k','s','/','c','a','l','l', 0, 0, 0, 0, 0, 0
db 't','i','c','k','s','/','o','c','c', 0, 0, 0, 0, 0, 0, 0
db 'p','a','g','e','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','a','g','e','s','/','s', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 't','i','c','k','s','/','p','a','g','e', 0, 0, 0, 0, 0, 0
db 'n','s','/','p','a','g','e', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','c','a','l','l', 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','f','r','a','m','e', 0, 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','o','c','c', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','p','a','c','k','e','t', 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','r','n','d','t','r','p', 0, 0, 0, 0, 0, 0, 0
db 'p','s','/','p','a','g','e', 0, 0, 0, 0, 0, 0, 0, 0, 0
; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f
;
; Instantiate the common template code.
;
%ifdef BS2_INC_CMN_R86
%define TMPL_RM
%include "bootsector2-common-routines-template-1.mac"
%endif
%ifdef BS2_INC_CMN_P16
%define TMPL_PE16
%include "bootsector2-common-routines-template-1.mac"
%endif
%ifdef BS2_INC_CMN_P32
%define TMPL_PE32
%include "bootsector2-common-routines-template-1.mac"
%endif
%ifdef BS2_INC_LM64
%define TMPL_LM64
%include "bootsector2-common-routines-template-1.mac"
%endif
;
; Instantiate the mode specific code.
;
%ifdef BS2_INC_RM
%define TMPL_RM
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PE16
%define TMPL_PE16
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PE32
%define TMPL_PE32
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PEV86
%define TMPL_PEV86
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PP16
%define TMPL_PP16
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PP32
%define TMPL_PP32
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PPV86
%define TMPL_PPV86
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PAE16
%define TMPL_PAE16
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PAE32
%define TMPL_PAE32
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_PAEV86
%define TMPL_PAEV86
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_LM16
%define TMPL_LM16
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_LM32
%define TMPL_LM32
%include "bootsector2-common-routines-template-2.mac"
%endif
%ifdef BS2_INC_LM64
%define TMPL_LM64
%include "bootsector2-common-routines-template-2.mac"
%endif
BEGINCODELOW
|