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
|
Multiblock will fail on certain conditional AVX/FMA usage (BreakOnFrontendFailure is forced to true)
In the following function (as seen in modern versions of MSVC CRT), there is a conditional check for AVX (dword_18042FD20, 'FMA supported').
```asm
.text:00000001803077A0 sub rsp, 58h ; lm2k data:
.text:00000001803077A4 movdqa [rsp+58h+var_38], xmm6
.text:00000001803077AA cmp cs:dword_18042FD20, 0
.text:00000001803077B1 jnz loc_180307AA0
.text:00000001803077B7 movapd xmm3, xmm0
.text:00000001803077BB movapd xmm4, xmm0
.text:00000001803077BF psrlq xmm3, 34h ; '4'
.text:00000001803077C4 movq rax, xmm0
.text:00000001803077C9 psubq xmm3, cs:xmmword_1803A3970
.text:00000001803077D1 movapd xmm5, xmm0
.text:00000001803077D5 andpd xmm5, cs:xmmword_1803A3940
.text:00000001803077DD comisd xmm5, qword ptr cs:xmmword_1803A3940
.text:00000001803077E5 jz loc_180307A70
.text:00000001803077EB movapd xmm2, xmm0
.text:00000001803077EF cvtdq2pd xmm6, xmm3
.text:00000001803077F3 xorpd xmm5, xmm5
.text:00000001803077F7 comisd xmm0, xmm5
.text:00000001803077FB jbe loc_180307A30
.text:0000000180307801 pand xmm2, cs:xmmword_1803A3990
.text:0000000180307809 subsd xmm4, qword ptr cs:xmmword_1803A3A20
.text:0000000180307811 comisd xmm6, cs:qword_1803A3AB0
.text:0000000180307819 jz loc_1803079F7
.text:000000018030781F
.text:000000018030781F loc_18030781F: ; CODE XREF: log10+289?j
.text:000000018030781F andpd xmm4, cs:xmmword_1803A3B10
.text:0000000180307827 mov r9, rax
.text:000000018030782A and rax, qword ptr cs:xmmword_1803A39A0
.text:0000000180307831 and r9, qword ptr cs:xmmword_1803A39B0
.text:0000000180307838 shl r9, 1
.text:000000018030783B add rax, r9
.text:000000018030783E movq xmm1, rax
.text:0000000180307843 comisd xmm4, cs:qword_1803A3AD0
.text:000000018030784B jb loc_180307930
.text:0000000180307851 shr rax, 2Ch
.text:0000000180307855 por xmm2, cs:xmmword_1803A3A30
.text:000000018030785D por xmm1, cs:xmmword_1803A3A30
.text:0000000180307865 lea r9, dbl_1803A03E0
.text:000000018030786C subsd xmm1, xmm2
.text:0000000180307870 mulsd xmm1, qword ptr [r9+rax*8]
.text:0000000180307876 movapd xmm2, xmm1
.text:000000018030787A movapd xmm0, xmm1
.text:000000018030787E lea r9, dbl_1803A3B80
.text:0000000180307885 movsd xmm3, cs:qword_1803A3AA0
.text:000000018030788D movsd xmm1, cs:qword_1803A3A70
.text:0000000180307895 mulsd xmm3, xmm2
.text:0000000180307899 mulsd xmm1, xmm2
.text:000000018030789D mulsd xmm0, xmm2
.text:00000001803078A1 movapd xmm4, xmm0
.text:00000001803078A5 addsd xmm3, cs:qword_1803A3A90
.text:00000001803078AD addsd xmm1, cs:qword_1803A3A60
.text:00000001803078B5 mulsd xmm4, xmm0
.text:00000001803078B9 mulsd xmm3, xmm2
.text:00000001803078BD mulsd xmm1, xmm0
.text:00000001803078C1 addsd xmm3, cs:qword_1803A3A80
.text:00000001803078C9 addsd xmm1, xmm2
.text:00000001803078CD mulsd xmm3, xmm4
.text:00000001803078D1 addsd xmm1, xmm3
.text:00000001803078D5 movsd xmm5, cs:qword_1803A3A00
.text:00000001803078DD mulsd xmm1, cs:qword_1803A39C0
.text:00000001803078E5 mulsd xmm5, xmm6
.text:00000001803078E9 subsd xmm5, xmm1
.text:00000001803078ED movsd xmm0, qword ptr [r9+rax*8]
.text:00000001803078F3 lea rdx, dbl_1803A4390
.text:00000001803078FA movsd xmm2, qword ptr [rdx+rax*8]
.text:00000001803078FF movsd xmm4, cs:qword_1803A39F0
.text:0000000180307907 mulsd xmm4, xmm6
.text:000000018030790B addsd xmm0, xmm4
.text:000000018030790F addsd xmm2, xmm5
.text:0000000180307913 addsd xmm0, xmm2
.text:0000000180307917 movdqa xmm6, [rsp+58h+var_38]
.text:000000018030791D add rsp, 58h
.text:0000000180307921 retn
.text:0000000180307921 ; ---------------------------------------------------------------------------
.text:0000000180307922 align 10h
.text:0000000180307930
.text:0000000180307930 loc_180307930: ; CODE XREF: log10+AB?j
.text:0000000180307930 movsd xmm2, cs:qword_1803A3A10 ; ------ INTEZER ------
.text:0000000180307930 ; Common - INTEZER.Common
.text:0000000180307930 ; ---------------------
.text:0000000180307938 subsd xmm0, qword ptr cs:xmmword_1803A3A20
.text:0000000180307940 addsd xmm2, xmm0
.text:0000000180307944 movapd xmm1, xmm0
.text:0000000180307948 divsd xmm1, xmm2
.text:000000018030794C movsd xmm4, cs:qword_1803A3B30
.text:0000000180307954 movsd xmm5, cs:qword_1803A3B50
.text:000000018030795C movapd xmm6, xmm0
.text:0000000180307960 mulsd xmm6, xmm1
.text:0000000180307964 addsd xmm1, xmm1
.text:0000000180307968 movapd xmm2, xmm1
.text:000000018030796C mulsd xmm2, xmm1
.text:0000000180307970 mulsd xmm4, xmm2
.text:0000000180307974 mulsd xmm5, xmm2
.text:0000000180307978 addsd xmm4, cs:qword_1803A3B20
.text:0000000180307980 addsd xmm5, cs:qword_1803A3B40
.text:0000000180307988 mulsd xmm2, xmm1
.text:000000018030798C mulsd xmm4, xmm2
.text:0000000180307990 mulsd xmm2, xmm2
.text:0000000180307994 mulsd xmm2, xmm1
.text:0000000180307998 mulsd xmm5, xmm2
.text:000000018030799C movsd xmm2, cs:qword_1803A39E0
.text:00000001803079A4 addsd xmm4, xmm5
.text:00000001803079A8 subsd xmm4, xmm6
.text:00000001803079AC movsd xmm6, cs:qword_1803A39D0
.text:00000001803079B4 movapd xmm3, xmm0
.text:00000001803079B8 pand xmm3, cs:xmmword_1803A3B60
.text:00000001803079C0 subsd xmm0, xmm3
.text:00000001803079C4 addsd xmm4, xmm0
.text:00000001803079C8 movapd xmm0, xmm3
.text:00000001803079CC movapd xmm1, xmm4
.text:00000001803079D0 mulsd xmm4, xmm2
.text:00000001803079D4 mulsd xmm0, xmm2
.text:00000001803079D8 mulsd xmm1, xmm6
.text:00000001803079DC mulsd xmm3, xmm6
.text:00000001803079E0 addsd xmm0, xmm4
.text:00000001803079E4 addsd xmm0, xmm1
.text:00000001803079E8 addsd xmm0, xmm3
.text:00000001803079EC movdqa xmm6, [rsp+58h+var_38]
.text:00000001803079F2 add rsp, 58h
.text:00000001803079F6 retn
.text:00000001803079F7 ; ---------------------------------------------------------------------------
.text:00000001803079F7
.text:00000001803079F7 loc_1803079F7: ; CODE XREF: log10+79?j
.text:00000001803079F7 por xmm2, cs:xmmword_1803A3A20
.text:00000001803079FF subsd xmm2, qword ptr cs:xmmword_1803A3A20
.text:0000000180307A07 movsd xmm5, xmm2
.text:0000000180307A0B pand xmm2, cs:xmmword_1803A3990
.text:0000000180307A13 movq rax, xmm2
.text:0000000180307A18 psrlq xmm5, 34h ; '4'
.text:0000000180307A1D psubd xmm5, cs:xmmword_1803A3AC0
.text:0000000180307A25 cvtdq2pd xmm6, xmm5
.text:0000000180307A29 jmp loc_18030781F
.text:0000000180307A29 ; ---------------------------------------------------------------------------
.text:0000000180307A2E align 10h
.text:0000000180307A30
.text:0000000180307A30 loc_180307A30: ; CODE XREF: log10+5B?j
.text:0000000180307A30 jnz short loc_180307A50
.text:0000000180307A32 movsd xmm1, cs:qword_1803A3930
.text:0000000180307A3A mov r8d, cs:dword_1803A3B70
.text:0000000180307A41 call _log10_special
.text:0000000180307A46 jmp short loc_180307A90
.text:0000000180307A46 ; ---------------------------------------------------------------------------
.text:0000000180307A48 align 10h
.text:0000000180307A50
.text:0000000180307A50 loc_180307A50: ; CODE XREF: log10:loc_180307A30?j
.text:0000000180307A50 ; log10+2E0?j
.text:0000000180307A50 movsd xmm1, cs:qword_1803A3950
.text:0000000180307A58 mov r8d, cs:dword_1803A3B74
.text:0000000180307A5F call _log10_special
.text:0000000180307A64 jmp short loc_180307A90
.text:0000000180307A64 ; ---------------------------------------------------------------------------
.text:0000000180307A66 align 10h
.text:0000000180307A70
.text:0000000180307A70 loc_180307A70: ; CODE XREF: log10+45?j
.text:0000000180307A70 cmp rax, qword ptr cs:xmmword_1803A3940
.text:0000000180307A77 jz short loc_180307A90
.text:0000000180307A79 cmp rax, cs:qword_1803A3930
.text:0000000180307A80 jz short loc_180307A50
.text:0000000180307A82 or rax, cs:qword_1803A3960
.text:0000000180307A89 movq xmm0, rax
.text:0000000180307A8E xchg ax, ax
.text:0000000180307A90
.text:0000000180307A90 loc_180307A90: ; CODE XREF: log10+2A6?j
.text:0000000180307A90 ; log10+2C4?j ...
.text:0000000180307A90 movdqa xmm6, [rsp+58h+var_38]
.text:0000000180307A96 add rsp, 58h
.text:0000000180307A9A retn
.text:0000000180307A9A ; ---------------------------------------------------------------------------
.text:0000000180307A9B align 20h
.text:0000000180307AA0
.text:0000000180307AA0 loc_180307AA0: ; CODE XREF: log10+11?j
.text:0000000180307AA0 xor rax, rax
.text:0000000180307AA3 vpsrlq xmm3, xmm0, 34h ; '4'
.text:0000000180307AA8 vmovq rax, xmm0
.text:0000000180307AAD vpsubq xmm3, xmm3, cs:xmmword_1803A3970
.text:0000000180307AB5 vcvtdq2pd xmm6, xmm3
.text:0000000180307AB9 vpand xmm5, xmm0, cs:xmmword_1803A3940
.text:0000000180307AC1 vcomisd xmm5, qword ptr cs:xmmword_1803A3940
.text:0000000180307AC9 jz loc_180307D10
.text:0000000180307ACF vpxor xmm5, xmm5, xmm5
.text:0000000180307AD3 vcomisd xmm0, xmm5
.text:0000000180307AD7 jbe loc_180307CC0
.text:0000000180307ADD vpand xmm2, xmm0, cs:xmmword_1803A3990 ; ------ INTEZER ------
.text:0000000180307ADD ; Common - INTEZER.Common
.text:0000000180307ADD ; ---------------------
.text:0000000180307AE5 vsubsd xmm4, xmm0, qword ptr cs:xmmword_1803A3A20
.text:0000000180307AED vcomisd xmm6, cs:qword_1803A3AB0
.text:0000000180307AF5 jz loc_180307C89
.text:0000000180307AFB
.text:0000000180307AFB loc_180307AFB: ; CODE XREF: log10+516?j
.text:0000000180307AFB vpand xmm1, xmm0, cs:xmmword_1803A39A0 ; ------ INTEZER ------
.text:0000000180307AFB ; Common - INTEZER.Common
.text:0000000180307AFB ; ---------------------
.text:0000000180307B03 vpand xmm3, xmm0, cs:xmmword_1803A39B0
.text:0000000180307B0B vpsllq xmm3, xmm3, 1
.text:0000000180307B10 vpaddq xmm1, xmm3, xmm1
.text:0000000180307B14 vmovq rax, xmm1
.text:0000000180307B19 vpand xmm4, xmm4, cs:xmmword_1803A3B10
.text:0000000180307B21 vcomisd xmm4, cs:qword_1803A3AD0
.text:0000000180307B29 jb loc_180307BE0
.text:0000000180307B2F shr rax, 2Ch ; ------ INTEZER ------
.text:0000000180307B2F ; Common - INTEZER.Common
.text:0000000180307B2F ; ---------------------
.text:0000000180307B33 vpor xmm2, xmm2, cs:xmmword_1803A3A30
.text:0000000180307B3B vpor xmm1, xmm1, cs:xmmword_1803A3A30
.text:0000000180307B43 lea r9, dbl_1803A03E0
.text:0000000180307B4A vsubsd xmm1, xmm1, xmm2
.text:0000000180307B4E vmulsd xmm1, xmm1, qword ptr [r9+rax*8]
.text:0000000180307B54 lea r9, dbl_1803A3B80
.text:0000000180307B5B vmulsd xmm0, xmm1, xmm1
.text:0000000180307B5F vmovsd xmm3, cs:qword_1803A3AA0
.text:0000000180307B67 vmovsd xmm5, cs:qword_1803A3A70
.text:0000000180307B6F vfmadd213sd xmm3, xmm1, cs:qword_1803A3A90
.text:0000000180307B78 vfmadd213sd xmm5, xmm1, qword ptr cs:xmmword_1803A3A30
.text:0000000180307B81 movsd xmm4, xmm0
.text:0000000180307B85 vfmadd213sd xmm3, xmm1, cs:qword_1803A3A80
.text:0000000180307B8E vmulsd xmm4, xmm0, xmm0
.text:0000000180307B92 vfmadd231sd xmm1, xmm5, xmm0
.text:0000000180307B97 vfmadd231sd xmm1, xmm3, xmm4
.text:0000000180307B9C vmulsd xmm1, xmm1, cs:qword_1803A39C0
.text:0000000180307BA4 vmovsd xmm5, cs:qword_1803A3A00
.text:0000000180307BAC vfmsub213sd xmm5, xmm6, xmm1
.text:0000000180307BB1 movsd xmm0, qword ptr [r9+rax*8]
.text:0000000180307BB7 lea rdx, dbl_1803A4390
.text:0000000180307BBE movsd xmm2, qword ptr [rdx+rax*8]
.text:0000000180307BC3 vaddsd xmm2, xmm2, xmm5
.text:0000000180307BC7 vfmadd231sd xmm0, xmm6, cs:qword_1803A39F0
.text:0000000180307BD0 vaddsd xmm0, xmm0, xmm2
.text:0000000180307BD4 vmovdqa xmm6, [rsp+58h+var_38]
.text:0000000180307BDA add rsp, 58h
.text:0000000180307BDE retn
.text:0000000180307BDE ; ---------------------------------------------------------------------------
.text:0000000180307BDF align 20h
.text:0000000180307BE0
.text:0000000180307BE0 loc_180307BE0: ; CODE XREF: log10+389?j
.text:0000000180307BE0 vmovsd xmm2, cs:qword_1803A3A10 ; ------ INTEZER ------
.text:0000000180307BE0 ; Common - INTEZER.Common
.text:0000000180307BE0 ; ---------------------
.text:0000000180307BE8 vsubsd xmm0, xmm0, qword ptr cs:xmmword_1803A3A20
.text:0000000180307BF0 vaddsd xmm2, xmm2, xmm0
.text:0000000180307BF4 vdivsd xmm1, xmm0, xmm2
.text:0000000180307BF8 vmovsd xmm4, cs:qword_1803A3B30
.text:0000000180307C00 vmovsd xmm5, cs:qword_1803A3B50
.text:0000000180307C08 vmulsd xmm6, xmm0, xmm1
.text:0000000180307C0C vaddsd xmm1, xmm1, xmm1
.text:0000000180307C10 vmulsd xmm2, xmm1, xmm1
.text:0000000180307C14 vfmadd213sd xmm4, xmm2, cs:qword_1803A3B20
.text:0000000180307C1D vfmadd213sd xmm5, xmm2, cs:qword_1803A3B40
.text:0000000180307C26 vmulsd xmm2, xmm2, xmm1
.text:0000000180307C2A vmulsd xmm4, xmm4, xmm2
.text:0000000180307C2E vmulsd xmm2, xmm2, xmm2
.text:0000000180307C32 vmulsd xmm2, xmm2, xmm1
.text:0000000180307C36 vmulsd xmm5, xmm5, xmm2
.text:0000000180307C3A vaddsd xmm4, xmm4, xmm5
.text:0000000180307C3E vsubsd xmm4, xmm4, xmm6
.text:0000000180307C42 vpand xmm3, xmm0, cs:xmmword_1803A3B60
.text:0000000180307C4A vsubsd xmm0, xmm0, xmm3
.text:0000000180307C4E vaddsd xmm4, xmm4, xmm0
.text:0000000180307C52 vmulsd xmm1, xmm4, cs:qword_1803A39D0
.text:0000000180307C5A vmulsd xmm4, xmm4, cs:qword_1803A39E0
.text:0000000180307C62 vmulsd xmm0, xmm3, cs:qword_1803A39E0
.text:0000000180307C6A vmulsd xmm3, xmm3, cs:qword_1803A39D0
.text:0000000180307C72 vaddsd xmm0, xmm0, xmm4
.text:0000000180307C76 vaddsd xmm0, xmm0, xmm1
.text:0000000180307C7A vaddsd xmm0, xmm0, xmm3
.text:0000000180307C7E vmovdqa xmm6, [rsp+58h+var_38]
.text:0000000180307C84 add rsp, 58h
.text:0000000180307C88 retn
.text:0000000180307C89 ; ---------------------------------------------------------------------------
.text:0000000180307C89
.text:0000000180307C89 loc_180307C89: ; CODE XREF: log10+355?j
.text:0000000180307C89 vpor xmm2, xmm2, cs:xmmword_1803A3A20
.text:0000000180307C91 vsubsd xmm2, xmm2, qword ptr cs:xmmword_1803A3A20
.text:0000000180307C99 vpsrlq xmm5, xmm2, 34h ; '4'
.text:0000000180307C9E vpand xmm2, xmm2, cs:xmmword_1803A3990
.text:0000000180307CA6 vmovapd xmm0, xmm2
.text:0000000180307CAA vpsubd xmm5, xmm5, cs:xmmword_1803A3AC0
.text:0000000180307CB2 vcvtdq2pd xmm6, xmm5
.text:0000000180307CB6 jmp loc_180307AFB
.text:0000000180307CB6 ; ---------------------------------------------------------------------------
.text:0000000180307CBB align 20h
.text:0000000180307CC0
.text:0000000180307CC0 loc_180307CC0: ; CODE XREF: log10+337?j
.text:0000000180307CC0 jnz short loc_180307CF0
.text:0000000180307CC2 vmovsd xmm1, cs:qword_1803A3930
.text:0000000180307CCA mov r8d, cs:dword_1803A3B70
.text:0000000180307CD1 call _log10_special
.text:0000000180307CD6 vmovdqa xmm6, [rsp+58h+var_38]
.text:0000000180307CDC add rsp, 58h
.text:0000000180307CE0 retn
.text:0000000180307CE0 ; ---------------------------------------------------------------------------
.text:0000000180307CE1 align 10h
.text:0000000180307CF0
.text:0000000180307CF0 loc_180307CF0: ; CODE XREF: log10:loc_180307CC0?j
.text:0000000180307CF0 ; log10+580?j
.text:0000000180307CF0 vmovsd xmm1, cs:qword_1803A3950
.text:0000000180307CF8 mov r8d, cs:dword_1803A3B74
.text:0000000180307CFF call _log10_special
.text:0000000180307D04 vmovdqa xmm6, [rsp+58h+var_38]
.text:0000000180307D0A add rsp, 58h
.text:0000000180307D0E retn
.text:0000000180307D0E ; ---------------------------------------------------------------------------
.text:0000000180307D0F align 10h
.text:0000000180307D10
.text:0000000180307D10 loc_180307D10: ; CODE XREF: log10+329?j
.text:0000000180307D10 cmp rax, qword ptr cs:xmmword_1803A3940
.text:0000000180307D17 jz short loc_180307D40
.text:0000000180307D19 cmp rax, cs:qword_1803A3930
.text:0000000180307D20 jz short loc_180307CF0
.text:0000000180307D22 or rax, cs:qword_1803A3960
.text:0000000180307D29 movq xmm1, rax
.text:0000000180307D2E mov r8d, cs:dword_1803A3B78
.text:0000000180307D35 call _log10_special
.text:0000000180307D3A jmp short loc_180307D40
.text:0000000180307D3A ; ---------------------------------------------------------------------------
.text:0000000180307D3C align 20h
.text:0000000180307D40
.text:0000000180307D40 loc_180307D40: ; CODE XREF: log10+577?j
.text:0000000180307D40 ; log10+59A?j
.text:0000000180307D40 vmovdqa xmm6, [rsp+58h+var_38]
.text:0000000180307D46 add rsp, 58h
.text:0000000180307D4A retn
.text:0000000180307D4A log10 endp
```
However, with multiblock + a 500 block size, the block at `loc_180307AA0` will still be compiled, and will hit an assertion on the `vcvtdq2pd` instruction (`C5 FA E6 F3`):
```asm
.text:0000000180307AA0 loc_180307AA0: ; CODE XREF: log10+11?j
.text:0000000180307AA0 xor rax, rax
.text:0000000180307AA3 vpsrlq xmm3, xmm0, 34h ; '4'
.text:0000000180307AA8 vmovq rax, xmm0
.text:0000000180307AAD vpsubq xmm3, xmm3, cs:xmmword_1803A3970
.text:0000000180307AB5 vcvtdq2pd xmm6, xmm3
.text:0000000180307AB9 vpand xmm5, xmm0, cs:xmmword_1803A3940
.text:0000000180307AC1 vcomisd xmm5, qword ptr cs:xmmword_1803A3940
.text:0000000180307AC9 jz loc_180307D10
```
A number of other cases of a similar conditional check also failed on a similar unsupported/undecodable instruction.
It seems that `Context::CompileCode` does allow interrupting multi-block handling in case of a decoding error, but with BreakOnFrontendFailure being enabled (which it is _always_ as it doesn't seem exposed to the configuration system) this'll lead to a fatal error instead.
|