VirtualBox

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

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

bs3kit: updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1; $Id: bs3-cpu-basic-2-template.mac 60676 2016-04-24 11:04:57Z 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%include "bs3kit-template-header.mac" ; setup environment
29
30
31;*********************************************************************************************************************************
32;* External Symbols *
33;*********************************************************************************************************************************
34%undef Bs3Printf
35BS3_EXTERN_CMN Bs3Printf
36
37
38
39TMPL_BEGIN_TEXT
40
41;
42; Code that is instantiated for every possible CPU mode
43;
44%ifdef BS3_INSTANTIATING_MODE
45
46 %if 0 ; Will be doing the testing in C, I think.
47BS3_PROC_BEGIN_MODE bs3CpuBasic2_iret, BS3_PBC_FAR
48 BS3_CALL_CONV_PROLOG 1
49 push xBP
50 mov xBP, xSP
51 sub xSP, 20h
52
53 %if TMPL_BITS == 64
54 %if TMPL_BITS == 16
55 xor ax, ax
56 mov al, [xBP + xCB*2]
57 push ax
58 push cs
59 push .szMsg wrt BS3TEXT16
60 call Bs3Printf
61 add sp, 6
62 %else
63 movzx xDX, byte [xBP + xCB*2]
64 push xDX
65 push .szMsg wrt FLAT
66 BS3_CALL Bs3Printf, 2
67 add xSP, xCB * 2
68 %endif
69 %endif
70
71 ; Return
72 xor al, al
73;mov al, TMPL_MODE ; remove me
74
75
76 mov xSP, xBP
77 pop xBP
78 BS3_CALL_CONV_EPILOG 1
79 ret
80.szMsg: db 'hello world %#x!', 13, 10, 0
81
82BS3_PROC_END_MODE bs3CpuBasic2_iret
83 %endif
84
85%endif ; BS3_INSTANTIATING_MODE
86
87
88;
89; Test code snippets containing code which differs between 16-bit, 32-bit
90; and 64-bit CPUs modes.
91;
92%ifdef BS3_INSTANTIATING_CMN
93
94;
95; SIDT
96;
97BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_bx_ud2, BS3_PBC_NEAR
98 sidt [xBX]
99.again: ud2
100 jmp .again
101AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_bx_ud2) == 3)
102BS3_PROC_END_CMN bs3CpuBasic2_sidt_bx_ud2
103
104BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_bx_ud2, BS3_PBC_NEAR
105 db X86_OP_PRF_SIZE_OP
106 sidt [xBX]
107.again: ud2
108 jmp .again
109AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_bx_ud2) == 4)
110BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_bx_ud2
111
112%if TMPL_BITS == 64
113BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_rexw_bx_ud2, BS3_PBC_NEAR
114 db X86_OP_REX_W
115 sidt [xBX]
116.again: ud2
117 jmp .again
118AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_rexw_bx_ud2) == 4)
119BS3_PROC_END_CMN bs3CpuBasic2_sidt_rexw_bx_ud2
120
121BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
122 db X86_OP_PRF_SIZE_OP
123 db X86_OP_REX_W
124 sidt [xBX]
125.again: ud2
126 jmp .again
127AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_rexw_bx_ud2) == 5)
128BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
129%endif
130
131%if TMPL_BITS != 64
132BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_ss_bx_ud2, BS3_PBC_NEAR
133 sidt [ss:xBX]
134.again: ud2
135 jmp .again
136AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_ss_bx_ud2) == 4)
137BS3_PROC_END_CMN bs3CpuBasic2_sidt_ss_bx_ud2
138
139BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2, BS3_PBC_NEAR
140 db X86_OP_PRF_SIZE_OP
141 sidt [ss:xBX]
142.again: ud2
143 jmp .again
144AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_ss_bx_ud2) == 5)
145BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2
146%endif
147
148;
149; SGDT
150;
151BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_bx_ud2, BS3_PBC_NEAR
152 sgdt [xBX]
153.again: ud2
154 jmp .again
155AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_bx_ud2) == 3)
156BS3_PROC_END_CMN bs3CpuBasic2_sgdt_bx_ud2
157
158BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2, BS3_PBC_NEAR
159 db X86_OP_PRF_SIZE_OP
160 sgdt [xBX]
161.again: ud2
162 jmp .again
163AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_bx_ud2) == 4)
164BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2
165
166%if TMPL_BITS == 64
167BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2, BS3_PBC_NEAR
168 db X86_OP_REX_W
169 sgdt [xBX]
170.again: ud2
171 jmp .again
172AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_rexw_bx_ud2) == 4)
173BS3_PROC_END_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2
174%endif
175
176%if TMPL_BITS != 64
177BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_ss_bx_ud2, BS3_PBC_NEAR
178 sgdt [ss:xBX]
179.again: ud2
180 jmp .again
181AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_ss_bx_ud2) == 4)
182BS3_PROC_END_CMN bs3CpuBasic2_sgdt_ss_bx_ud2
183%endif
184
185
186;
187;
188;
189BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_bx_ud2, BS3_PBC_NEAR
190 lidt [xBX]
191.again: ud2
192 jmp .again
193AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_bx_ud2) == 3)
194BS3_PROC_END_CMN bs3CpuBasic2_lidt_bx_ud2
195
196%endif ; BS3_INSTANTIATING_CMN
197
198%include "bs3kit-template-footer.mac" ; reset environment
199
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