1 | ; $Id: bs3-cpu-instr-4-template.mac 104649 2024-05-16 08:52:06Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - bs3-cpu-instr-4 - SSE, AVX FPU instructions, assembly template.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2024 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 |
|
---|
37 |
|
---|
38 | ;*********************************************************************************************************************************
|
---|
39 | ;* Header Files *
|
---|
40 | ;*********************************************************************************************************************************
|
---|
41 | %include "bs3kit-template-header.mac" ; setup environment
|
---|
42 |
|
---|
43 |
|
---|
44 | ;*********************************************************************************************************************************
|
---|
45 | ;* External Symbols *
|
---|
46 | ;*********************************************************************************************************************************
|
---|
47 | TMPL_BEGIN_TEXT
|
---|
48 |
|
---|
49 |
|
---|
50 | ;
|
---|
51 | ; Test code snippets containing code which differs between 16-bit, 32-bit
|
---|
52 | ; and 64-bit CPUs modes.
|
---|
53 | ;
|
---|
54 | %ifdef BS3_INSTANTIATING_CMN
|
---|
55 |
|
---|
56 |
|
---|
57 | ;;
|
---|
58 | ; Variant on BS3_PROC_BEGIN_CMN w/ BS3_PBC_NEAR that prefixes the function
|
---|
59 | ; with an instruction length byte.
|
---|
60 | ;
|
---|
61 | ; ASSUMES the length is between the start of the function and the .again label.
|
---|
62 | ;
|
---|
63 | %ifndef BS3CPUINSTRX_PROC_BEGIN_CMN_DEFINED
|
---|
64 | %define BS3CPUINSTRX_PROC_BEGIN_CMN_DEFINED
|
---|
65 | %macro BS3CPUINSTRX_PROC_BEGIN_CMN 1
|
---|
66 | align 8, db 0cch
|
---|
67 | db BS3_CMN_NM(%1).again - BS3_CMN_NM(%1)
|
---|
68 | BS3_PROC_BEGIN_CMN %1, BS3_PBC_NEAR
|
---|
69 | %endmacro
|
---|
70 | %endif ; !BS3CPUINSTRX_PROC_BEGIN_CMN_DEFINED
|
---|
71 |
|
---|
72 | ;;
|
---|
73 | ; The EMIT_INSTR_PLUS_ICEBP macros is for creating a common function for and
|
---|
74 | ; named after a single instruction, followed by a looping ICEBP.
|
---|
75 | ;
|
---|
76 | ; This works like a prefix to the instruction invocation, only exception is that
|
---|
77 | ; instead of [fs:xBX] you write FSxBS as that's what is wanted in the name.
|
---|
78 | ;
|
---|
79 | %ifndef EMIT_INSTR_PLUS_ICEBP_DEFINED
|
---|
80 | %define EMIT_INSTR_PLUS_ICEBP_DEFINED
|
---|
81 |
|
---|
82 | %macro EMIT_INSTR_PLUS_ICEBP 2
|
---|
83 | BS3CPUINSTRX_PROC_BEGIN_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _icebp
|
---|
84 | %define FSxBX [fs:xBX]
|
---|
85 | %1 %2
|
---|
86 | %undef FSxBX
|
---|
87 | .again:
|
---|
88 | icebp
|
---|
89 | jmp .again
|
---|
90 | BS3_PROC_END_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _icebp
|
---|
91 | %endmacro
|
---|
92 |
|
---|
93 | %macro EMIT_INSTR_PLUS_ICEBP 3
|
---|
94 | BS3CPUINSTRX_PROC_BEGIN_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _icebp
|
---|
95 | %define FSxBX [fs:xBX]
|
---|
96 | %1 %2, %3
|
---|
97 | %undef FSxBX
|
---|
98 | .again:
|
---|
99 | icebp
|
---|
100 | jmp .again
|
---|
101 | BS3_PROC_END_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _icebp
|
---|
102 | %endmacro
|
---|
103 |
|
---|
104 | %macro EMIT_INSTR_PLUS_ICEBP 4
|
---|
105 | BS3CPUINSTRX_PROC_BEGIN_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _ %+ %4 %+ _icebp
|
---|
106 | %define FSxBX [fs:xBX]
|
---|
107 | %1 %2, %3, %4
|
---|
108 | %undef FSxBX
|
---|
109 | .again:
|
---|
110 | icebp
|
---|
111 | jmp .again
|
---|
112 | BS3_PROC_END_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _ %+ %4 %+ _icebp
|
---|
113 | %endmacro
|
---|
114 |
|
---|
115 | %macro EMIT_INSTR_PLUS_ICEBP 5
|
---|
116 | BS3CPUINSTRX_PROC_BEGIN_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _ %+ %4 %+ _ %+ %5 %+ _icebp
|
---|
117 | %define FSxBX [fs:xBX]
|
---|
118 | %1 %2, %3, %4, %5
|
---|
119 | %undef FSxBX
|
---|
120 | .again:
|
---|
121 | icebp
|
---|
122 | jmp .again
|
---|
123 | BS3_PROC_END_CMN bs3CpuInstrX_ %+ %1 %+ _ %+ %2 %+ _ %+ %3 %+ _ %+ %4 %+ _ %+ %5 %+ _icebp
|
---|
124 | %endmacro
|
---|
125 |
|
---|
126 | %macro EMIT_INSTR_PLUS_ICEBP_C64 2
|
---|
127 | %if TMPL_BITS == 64
|
---|
128 | EMIT_INSTR_PLUS_ICEBP %1, %2
|
---|
129 | %endif
|
---|
130 | %endmacro
|
---|
131 |
|
---|
132 | %macro EMIT_INSTR_PLUS_ICEBP_C64 3
|
---|
133 | %if TMPL_BITS == 64
|
---|
134 | EMIT_INSTR_PLUS_ICEBP %1, %2, %3
|
---|
135 | %endif
|
---|
136 | %endmacro
|
---|
137 |
|
---|
138 | %macro EMIT_INSTR_PLUS_ICEBP_C64 4
|
---|
139 | %if TMPL_BITS == 64
|
---|
140 | EMIT_INSTR_PLUS_ICEBP %1, %2, %3, %4
|
---|
141 | %endif
|
---|
142 | %endmacro
|
---|
143 |
|
---|
144 | %macro EMIT_INSTR_PLUS_ICEBP_C64 5
|
---|
145 | %if TMPL_BITS == 64
|
---|
146 | EMIT_INSTR_PLUS_ICEBP %1, %2, %3, %4, %5
|
---|
147 | %endif
|
---|
148 | %endmacro
|
---|
149 |
|
---|
150 | %endif ; !EMIT_INSTR_PLUS_ICEBP_DEFINED
|
---|
151 |
|
---|
152 | ;
|
---|
153 | ;; [v]addpd
|
---|
154 | ;
|
---|
155 | EMIT_INSTR_PLUS_ICEBP addpd, XMM1, XMM2
|
---|
156 |
|
---|
157 | %endif ; BS3_INSTANTIATING_CMN
|
---|
158 |
|
---|
159 | %include "bs3kit-template-footer.mac" ; reset environment
|
---|