VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.mac@ 60724

Last change on this file since 60724 was 60724, checked in by vboxsync, 9 years ago

bs3kit: updates (started on lidt)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.0 KB
Line 
1; $Id: bs3-cpu-basic-2-template.mac 60724 2016-04-27 17:00:29Z vboxsync $
2;; @file
3; BS3Kit - bs3-cpu-basic-2 assembly template.
4;
5
6;
7; Copyright (C) 2007-2016 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27
28;*********************************************************************************************************************************
29;* Header Files *
30;*********************************************************************************************************************************
31%include "bs3kit-template-header.mac" ; setup environment
32
33
34;*********************************************************************************************************************************
35;* External Symbols *
36;*********************************************************************************************************************************
37TMPL_BEGIN_TEXT
38
39
40;
41; Test code snippets containing code which differs between 16-bit, 32-bit
42; and 64-bit CPUs modes.
43;
44%ifdef BS3_INSTANTIATING_CMN
45
46;
47; SIDT
48;
49BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_bx_ud2, BS3_PBC_NEAR
50 sidt [xBX]
51.again: ud2
52 jmp .again
53AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_bx_ud2) == 3)
54BS3_PROC_END_CMN bs3CpuBasic2_sidt_bx_ud2
55
56BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_bx_ud2, BS3_PBC_NEAR
57 db X86_OP_PRF_SIZE_OP
58 sidt [xBX]
59.again: ud2
60 jmp .again
61AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_bx_ud2) == 4)
62BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_bx_ud2
63
64 %if TMPL_BITS == 64
65BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_rexw_bx_ud2, BS3_PBC_NEAR
66 db X86_OP_REX_W
67 sidt [xBX]
68.again: ud2
69 jmp .again
70AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_rexw_bx_ud2) == 4)
71BS3_PROC_END_CMN bs3CpuBasic2_sidt_rexw_bx_ud2
72
73BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
74 db X86_OP_PRF_SIZE_OP
75 db X86_OP_REX_W
76 sidt [xBX]
77.again: ud2
78 jmp .again
79AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_rexw_bx_ud2) == 5)
80BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
81 %endif
82
83 %if TMPL_BITS != 64
84BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_ss_bx_ud2, BS3_PBC_NEAR
85 sidt [ss:xBX]
86.again: ud2
87 jmp .again
88AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_ss_bx_ud2) == 4)
89BS3_PROC_END_CMN bs3CpuBasic2_sidt_ss_bx_ud2
90
91BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2, BS3_PBC_NEAR
92 db X86_OP_PRF_SIZE_OP
93 sidt [ss:xBX]
94.again: ud2
95 jmp .again
96AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_ss_bx_ud2) == 5)
97BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2
98 %endif
99
100
101;
102; SGDT
103;
104BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_bx_ud2, BS3_PBC_NEAR
105 sgdt [xBX]
106.again: ud2
107 jmp .again
108AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_bx_ud2) == 3)
109BS3_PROC_END_CMN bs3CpuBasic2_sgdt_bx_ud2
110
111BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2, BS3_PBC_NEAR
112 db X86_OP_PRF_SIZE_OP
113 sgdt [xBX]
114.again: ud2
115 jmp .again
116AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_bx_ud2) == 4)
117BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2
118
119 %if TMPL_BITS == 64
120BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2, BS3_PBC_NEAR
121 db X86_OP_REX_W
122 sgdt [xBX]
123.again: ud2
124 jmp .again
125AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_rexw_bx_ud2) == 4)
126BS3_PROC_END_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2
127
128BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
129 db X86_OP_PRF_SIZE_OP
130 db X86_OP_REX_W
131 sgdt [xBX]
132.again: ud2
133 jmp .again
134AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2) == 5)
135BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2
136 %endif
137
138 %if TMPL_BITS != 64
139BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_ss_bx_ud2, BS3_PBC_NEAR
140 sgdt [ss:xBX]
141.again: ud2
142 jmp .again
143AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_ss_bx_ud2) == 4)
144BS3_PROC_END_CMN bs3CpuBasic2_sgdt_ss_bx_ud2
145
146BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2, BS3_PBC_NEAR
147 db X86_OP_PRF_SIZE_OP
148 sgdt [ss:xBX]
149.again: ud2
150 jmp .again
151AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_ss_bx_ud2) == 5)
152BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2
153 %endif
154
155
156;
157; LIDT
158;
159BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
160 lidt [xBX]
161 sidt [BS3_NOT_64BIT(es:) xDI]
162 lidt [BS3_NOT_64BIT(es:) xSI]
163.again:
164 ud2
165 jmp .again
166AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(9,11))
167BS3_PROC_END_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2
168
169BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
170 db X86_OP_PRF_SIZE_OP
171 lidt [xBX]
172 sidt [BS3_NOT_64BIT(es:) xDI]
173 lidt [BS3_NOT_64BIT(es:) xSI]
174.again:
175 ud2
176 jmp .again
177AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(10,12))
178BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2
179
180 %if TMPL_BITS == 64
181BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
182 db X86_OP_REX_W
183 lidt [xBX]
184 sidt [xDI]
185 lidt [xSI]
186.again:
187 ud2
188 jmp .again
189AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 10)
190BS3_PROC_END_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2
191
192BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
193 db X86_OP_PRF_SIZE_OP
194 db X86_OP_REX_W
195 lidt [xBX]
196 sidt [xDI]
197 lidt [xSI]
198.again:
199 ud2
200 jmp .again
201AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 11)
202BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2
203 %endif
204
205 %if TMPL_BITS != 64
206BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
207 lidt [ss:xBX]
208 sidt [BS3_NOT_64BIT(es:) xDI]
209 lidt [BS3_NOT_64BIT(es:) xSI]
210.again:
211 ud2
212 jmp .again
213AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2) == 12)
214BS3_PROC_END_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2
215
216BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
217 db X86_OP_PRF_SIZE_OP
218 lidt [ss:xBX]
219 sidt [BS3_NOT_64BIT(es:) xDI]
220 lidt [BS3_NOT_64BIT(es:) xSI]
221.again:
222 ud2
223 jmp .again
224AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2) == 13)
225BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2
226 %endif
227
228
229%endif ; BS3_INSTANTIATING_CMN
230
231%include "bs3kit-template-footer.mac" ; reset environment
232
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