Changeset 104182 in vbox
- Timestamp:
- Apr 5, 2024 12:54:03 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImpl.asm
r104174 r104182 572 572 573 573 ;; 574 ; Checks that the size expression %1 matches %2 adjusted according to 575 ; RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK and for 256 entries. 576 ; @param 1 The jump array size assembly expression. 577 ; @param 2 The size without accounting for the IBT_ENDBRxx_WITHOUT_NOTRACK instruction. 578 ; 579 %macro IEMCHECK_256_JUMP_ARRAY_SIZE 2 574 ; Loads register with offset of imm8 instruction -- used by all of the instruction 575 ; implementations which lay out jump tables of 256x immediate byte variants. 576 ; Also checks that the instruction size matches the offsets in the table. 577 ; 578 ; @param 1 The register to receive the jump target address (T1). 579 ; @param 2 The register containing the imm8 index (A1 / A2 / A3). 580 ; @param 3 Byte size of one instruction + ret (+ ?int3) in the table 581 ; @note Implicitly uses local symbols .imm0, .imm1, and .immEmd 582 ; (implementation artifacts of each instruction jump table). 583 ; 584 ; Emits the equivalent (in actual code) of `lea %1, [.imm0 + %2 * %3]`. 585 ; 586 %macro IEMIMPL_JUMP_TABLE_TARGET_INT 3 587 lea %1, [.imm0 xWrtRIP] 588 %if %3 == 5 589 lea T0, [%2 + %2*4] ; *5 590 lea %1, [%1 + T0] ; *5 + .imm0 591 %elif %3 == 6 592 lea T0, [%2 + %2*2] ; *3 593 lea %1, [%1 + T0*2] ; *6 + .imm0 594 %elif %3 == 7 595 lea T0, [%2 + %2*2] ; *3 596 lea T0, [T0 + %2*4] ; *7 597 lea %1, [%1 + T0] ; *7 + .imm0 598 %elif %3 == 8 599 lea %1, [%1 + %2*8] ; *8 + .imm0 600 %elif %3 == 9 601 lea T0, [%2 + %2*8] ; *9 602 lea %1, [%1 + T0] ; *9 + .imm0 603 %elif %3 == 10 604 lea T0, [%2 + %2*4] ; *5 605 lea %1, [%1 + T0*2] ; *10 + .imm0 606 %elif %3 == 11 607 lea T0, [%2 + %2*4] ; *5 608 lea T0, [%2 + T0*2] ; *11 609 lea %1, [%1 + T0] ; *11 + .imm0 610 %elif %3 == 12 611 lea T0, [%2 + %2*2] ; *3 612 lea %1, [%1 + T0*4] ; *12 + .imm0 613 %else 614 %error Unexpected instruction byte count in IEMIMPL_JUMP_TABLE_TARGET_INT 615 %endif 616 ; check size: 'warning: value does not fit in 8 bit field' if bad 617 times (.imm1 - .imm0 + %3) %% %3 db 999 * \ 618 (.imm1 - .imm0 + %3) 619 ; check alignment: 'warning: value does not fit in 8 bit field' if bad 620 times ((.immEnd - .imm0) - 256 * %3) db 999 * \ 621 ((.immEnd - .imm0) - 256 * %3) 622 %endmacro 623 624 %macro IEMIMPL_JUMP_TABLE_TARGET 3 580 625 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 581 dw (0xffff - %2 - 256*4) + %1 ; will cause warning if entries are too big. 582 dw (0xffff + %2 + 256*4) - %1 ; will cause warning if entries are too small. 626 IEMIMPL_JUMP_TABLE_TARGET_INT %1, %2, (%3 + 4) 583 627 %else 584 dw (0xffff - %2) + %1 ; will cause warning if entries are too big. 585 dw (0xffff + %2) - %1 ; will cause warning if entries are too small. 628 IEMIMPL_JUMP_TABLE_TARGET_INT %1, %2, %3 586 629 %endif 630 %endmacro 631 632 633 ;; 634 ; Calls the given imm8 instruction -- used by all of the instruction 635 ; implementations which lay out jump tables of 256x immediate byte variants. 636 ; 637 ; @param 1 The register to receive the jump target address (T1). 638 ; @param 2 The register containing the imm8 index (A1 / A2 / A3). 639 ; @param 3 Byte size of one instruction + ret (+ ?int3) in the table 640 ; 641 ; Emits the equivalent (in actual code) of `lea %1, [.imm0 + %2 * %3]` + 642 ; `IBT_NOTRACK, call %1`. 643 ; 644 %macro IEMIMPL_CALL_JUMP_TABLE_TARGET 3 645 IEMIMPL_JUMP_TABLE_TARGET %1, %2, %3 646 IBT_NOTRACK 647 call %1 587 648 %endmacro 588 649 … … 4182 4243 movq mm1, [A1] 4183 4244 movq mm0, mm0 ; paranoia! 4184 lea T1, [.imm0 xWrtRIP] 4185 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4186 lea T0, [A2 + A2*8] ; sizeof(pshufw+ret) == 9 4187 %else 4188 lea T0, [A2 + A2*4] ; sizeof(pshufw+ret) == 5 4189 %endif 4190 lea T1, [T1 + T0] 4191 IBT_NOTRACK 4192 call T1 4245 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 5 4193 4246 movq [A0], mm0 4194 4247 … … 4203 4256 %assign bImm bImm + 1 4204 4257 %endrep 4205 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x5004258 .immEnd: 4206 4259 ENDPROC iemAImpl_pshufw_u64 4207 4260 … … 4215 4268 movdqu xmm1, [A1] 4216 4269 movdqu xmm0, xmm1 ; paranoia! 4217 lea T1, [.imm0 xWrtRIP] 4218 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4219 lea T0, [A2 + A2*4] ; sizeof(pshufXX+ret) == 10: A2 * 10 = (A2 * 5) * 2 4220 %else 4221 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: A2 * 6 = (A2 * 3) * 2 4222 %endif 4223 lea T1, [T1 + T0*2] 4224 IBT_NOTRACK 4225 call T1 4270 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 4226 4271 movdqu [A0], xmm0 4227 4272 … … 4237 4282 %assign bImm bImm + 1 4238 4283 %endrep 4239 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6004284 .immEnd: 4240 4285 ENDPROC iemAImpl_ %+ %1 %+ _u128 4241 4286 %endmacro … … 4252 4297 4253 4298 movzx A2, A2_8 ; must clear top bits 4254 vmovdqu ymm1, [A1] 4255 vmovdqu ymm0, ymm1 ; paranoia! 4256 lea T1, [.imm0 xWrtRIP] 4257 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4258 lea T0, [A2 + A2*4] ; sizeof(pshufXX+ret) == 10: A2 * 10 = (A2 * 5) * 2 4259 %else 4260 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: A2 * 6 = (A2 * 3) * 2 4261 %endif 4262 lea T1, [T1 + T0*2] 4263 IBT_NOTRACK 4264 call T1 4299 vmovdqu ymm1, [A1] 4300 vmovdqu ymm0, ymm1 ; paranoia! 4301 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 4265 4302 vmovdqu [A0], ymm0 4266 4303 … … 4275 4312 %assign bImm bImm + 1 4276 4313 %endrep 4277 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6004314 .immEnd: 4278 4315 ENDPROC iemAImpl_ %+ %1 %+ _u256 4279 4316 %endmacro … … 4295 4332 movzx A1, A1_8 ; must clear top bits 4296 4333 movq mm0, [A0] 4297 lea T1, [.imm0 xWrtRIP] 4298 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4299 lea T0, [A1 + A1*8] ; sizeof(psXX+ret) == 9 4300 %else 4301 lea T0, [A1 + A1*4] ; sizeof(psXX+ret) == 5 4302 %endif 4303 lea T1, [T1 + T0] 4304 IBT_NOTRACK 4305 call T1 4334 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A1, 5 4306 4335 movq [A0], mm0 4307 4336 … … 4316 4345 %assign bImm bImm + 1 4317 4346 %endrep 4318 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x5004347 .immEnd: 4319 4348 ENDPROC iemAImpl_ %+ %1 %+ _imm_u64 4320 4349 %endmacro … … 4337 4366 movzx A1, A1_8 ; must clear top bits 4338 4367 movdqu xmm0, [A0] 4339 lea T1, [.imm0 xWrtRIP] 4340 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4341 lea T0, [A1 + A1*4] ; sizeof(psXX+ret) == 10: A1 * 10 = (A1 * 5) * 2 4342 %else 4343 lea T0, [A1 + A1*2] ; sizeof(psXX+ret) == 6: A1 * 6 = (A1 * 3) * 2 4344 %endif 4345 lea T1, [T1 + T0*2] 4346 IBT_NOTRACK 4347 call T1 4368 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A1, 6 4348 4369 movdqu [A0], xmm0 4349 4370 … … 4358 4379 %assign bImm bImm + 1 4359 4380 %endrep 4360 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6004381 .immEnd: 4361 4382 ENDPROC iemAImpl_ %+ %1 %+ _imm_u128 4362 4383 %endmacro … … 4370 4391 IEMIMPL_MEDIA_SSE_PSHIFTXX psraw 4371 4392 IEMIMPL_MEDIA_SSE_PSHIFTXX psrad 4372 IEMIMPL_MEDIA_SSE_PSHIFTXX pslldq4373 IEMIMPL_MEDIA_SSE_PSHIFTXX psrldq4374 4393 4375 4394 … … 5177 5196 movdqu xmm0, [A0] 5178 5197 movdqu xmm1, [A1] 5179 lea T1, [.imm0 xWrtRIP] 5180 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5181 lea T0, [A2 + A2*4] ; sizeof(shufpX+ret+int3) == 10: A2 * 10 = (A2 * 5) * 2 5182 %else 5183 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret+int3) == 6: A2 * 6 = (A2 * 3) * 2 5184 %endif 5185 lea T1, [T1 + T0*2] 5186 IBT_NOTRACK 5187 call T1 5198 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 5188 5199 movdqu [A0], xmm0 5189 5200 … … 5199 5210 %assign bImm bImm + 1 5200 5211 %endrep 5201 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6005212 .immEnd: 5202 5213 ENDPROC iemAImpl_shufps_u128 5203 5214 … … 5217 5228 movdqu xmm0, [A0] 5218 5229 movdqu xmm1, [A1] 5219 lea T1, [.imm0 xWrtRIP] 5220 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5221 lea T0, [A2 + A2*4] ; sizeof(shufpX+ret) == 10: A2 * 10 = (A2 * 5) * 2 5222 %else 5223 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret) == 6: A2 * 6 = (A2 * 3) * 2 5224 %endif 5225 lea T1, [T1 + T0*2] 5226 IBT_NOTRACK 5227 call T1 5230 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 5228 5231 movdqu [A0], xmm0 5229 5232 … … 5238 5241 %assign bImm bImm + 1 5239 5242 %endrep 5240 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6005243 .immEnd: 5241 5244 ENDPROC iemAImpl_shufpd_u128 5242 5245 … … 5260 5263 movdqu xmm0, [A1] 5261 5264 movdqu xmm1, [A2] 5262 lea T1, [.imm0 xWrtRIP] 5263 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5264 lea T0, [A3 + A3*4] ; sizeof(vshufpX+ret) == 10: A3 * 10 = (A3 * 5) * 2 5265 %else 5266 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: A3 * 6 = (A3 * 3) * 2 5267 %endif 5268 lea T1, [T1 + T0*2] 5269 IBT_NOTRACK 5270 call T1 5265 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 6 5271 5266 movdqu [A0], xmm0 5272 5267 … … 5281 5276 %assign bImm bImm + 1 5282 5277 %endrep 5283 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6005278 .immEnd: 5284 5279 ENDPROC iemAImpl_ %+ %1 %+ _u128 5285 5280 … … 5291 5286 vmovdqu ymm0, [A1] 5292 5287 vmovdqu ymm1, [A2] 5293 lea T1, [.imm0 xWrtRIP] 5294 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5295 lea T0, [A3 + A3*4] ; sizeof(vshufpX+ret) == 10: A3 * 10 = (A3 * 5) * 2 5296 %else 5297 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: A3 * 6 = (A3 * 3) * 2 5298 %endif 5299 lea T1, [T1 + T0*2] 5300 IBT_NOTRACK 5301 call T1 5288 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 6 5302 5289 vmovdqu [A0], ymm0 5303 5290 … … 5312 5299 %assign bImm bImm + 1 5313 5300 %endrep 5314 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6005301 .immEnd: 5315 5302 ENDPROC iemAImpl_ %+ %1 %+ _u256 5316 5303 %endmacro … … 5407 5394 movq mm0, [A0] 5408 5395 movq mm1, A1 5409 lea T1, [.imm0 xWrtRIP] 5410 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5411 lea T0, [A2 + A2*4] ; sizeof(endbrxx+palignr+ret) == 10: A2 * 10 = (A2 * 5) * 2 5412 %else 5413 lea T0, [A2 + A2*2] ; sizeof(palignr+ret) == 6: A2 * 6 = (A2 * 3) * 2 5414 %endif 5415 lea T1, [T1 + T0*2] 5416 IBT_NOTRACK 5417 call T1 5396 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 5418 5397 movq [A0], mm0 5419 5398 … … 5428 5407 %assign bImm bImm + 1 5429 5408 %endrep 5430 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6005409 .immEnd: 5431 5410 ENDPROC iemAImpl_palignr_u64 5432 5411 … … 5451 5430 movdqu xmm0, [A0] 5452 5431 movdqu xmm1, [A1] 5453 lea T1, [.imm0 xWrtRIP] 5454 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5455 lea T0, [A2 + A2*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A2 * 12 = (A2 * 3) * 4 5456 lea T1, [T1 + T0*4] 5457 %else 5458 lea T1, [T1 + A2*8] ; sizeof(insnX+ret+int3) == 8: A2 * 8 5459 %endif 5460 IBT_NOTRACK 5461 call T1 5432 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 8 5462 5433 movdqu [A0], xmm0 5463 5434 … … 5473 5444 %assign bImm bImm + 1 5474 5445 %endrep 5475 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005446 .immEnd: 5476 5447 ENDPROC iemAImpl_ %+ %1 %+ _u128 5477 5448 %endmacro … … 5509 5480 movdqu xmm0, [A1] 5510 5481 movdqu xmm1, [A2] 5511 lea T1, [.imm0 xWrtRIP] 5512 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5513 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 5514 lea T1, [T1 + T0*4] 5515 %else 5516 lea T1, [T1 + A3*8] ; sizeof(insnX+ret+int3) == 8: A3 * 8 5517 %endif 5518 IBT_NOTRACK 5519 call T1 5482 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 8 5520 5483 movdqu [A0], xmm0 5521 5484 … … 5531 5494 %assign bImm bImm + 1 5532 5495 %endrep 5533 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005496 .immEnd: 5534 5497 ENDPROC iemAImpl_ %+ %1 %+ _u128 5535 5498 %endif … … 5543 5506 vmovdqu ymm0, [A1] 5544 5507 vmovdqu ymm1, [A2] 5545 lea T1, [.imm0 xWrtRIP] 5546 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5547 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 5548 lea T1, [T1 + T0*4] 5549 %else 5550 lea T1, [T1 + A3*8] ; sizeof(insnX+ret+int3) == 8: A3 * 8 5551 %endif 5552 IBT_NOTRACK 5553 call T1 5508 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 8 5554 5509 vmovdqu [A0], ymm0 5555 5510 … … 5565 5520 %assign bImm bImm + 1 5566 5521 %endrep 5567 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005522 .immEnd: 5568 5523 ENDPROC iemAImpl_ %+ %1 %+ _u256 5569 5524 %endif … … 5589 5544 ; @param 2 Whether the instruction has a 128-bit variant (1) or not (0). 5590 5545 ; @param 3 Whether the instruction has a 256-bit variant (1) or not (0). 5546 ; @param 4 The number of bytes taken up by a single instance of the instruction. 5591 5547 ; 5592 5548 ; @param A0 Pointer to the destination media register size operand (output). … … 5594 5550 ; @param A2 The 8-bit immediate 5595 5551 ; 5596 %macro IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP _6 35552 %macro IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP 4 5597 5553 %if %2 == 1 5598 5554 BEGINPROC_FASTCALL iemAImpl_ %+ %1 %+ _imm_u128, 16 … … 5602 5558 movzx A2, A2_8 ; must clear top bits 5603 5559 movdqu xmm1, [A1] 5604 lea T1, [.imm0 xWrtRIP] 5605 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5606 lea T0, [A2 + A2*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A2 * 12 = (A2 * 3) * 4 5607 lea T1, [T1 + T0*4] 5608 %else 5609 lea T1, [T1 + A2*8] ; sizeof(insnX+ret+int3) == 8: A2 * 8 5610 %endif 5611 IBT_NOTRACK 5612 call T1 5560 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, %4 5613 5561 movdqu [A0], xmm0 5614 5562 … … 5624 5572 %assign bImm bImm + 1 5625 5573 %endrep 5626 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005574 .immEnd: 5627 5575 ENDPROC iemAImpl_ %+ %1 %+ _imm_u128 5628 5576 %endif … … 5635 5583 movzx A2, A2_8 ; must clear top bits 5636 5584 vmovdqu ymm1, [A1] 5637 lea T1, [.imm0 xWrtRIP] 5638 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5639 lea T0, [A2 + A2*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A2 * 12 = (A2 * 3) * 4 5640 lea T1, [T1 + T0*4] 5641 %else 5642 lea T1, [T1 + A2*8] ; sizeof(insnX+ret+int3) == 8: A2 * 8 5643 %endif 5644 IBT_NOTRACK 5645 call T1 5585 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, %4 5646 5586 vmovdqu [A0], ymm0 5647 5587 … … 5657 5597 %assign bImm bImm + 1 5658 5598 %endrep 5659 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005599 .immEnd: 5660 5600 ENDPROC iemAImpl_ %+ %1 %+ _imm_u256 5661 5601 %endif 5662 5602 %endmacro 5663 5603 5664 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP_6 vpermilps, 1, 1 5665 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP_6 vpermilpd, 1, 1 5604 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP vpermilps, 1, 1, 8 5605 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP vpermilpd, 1, 1, 8 5606 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP vpslldq, 1, 1, 7 5607 IEMIMPL_MEDIA_AVX_INSN_IMM8_2OP vpsrldq, 1, 1, 7 5666 5608 5667 5609 … … 5697 5639 movdqu xmm1, [A2 + IEMPCMPISTRXSRC.uSrc2] 5698 5640 mov T2, A0 ; A0 can be ecx/rcx in some calling conventions which gets overwritten later (T2 only available on AMD64) 5699 lea T1, [.imm0 xWrtRIP] 5700 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5701 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5702 lea T1, [T1 + T0*4] 5703 %else 5704 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5705 %endif 5706 IBT_NOTRACK 5707 call T1 5641 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 8 5708 5642 5709 5643 IEM_SAVE_FLAGS A1, X86_EFL_CF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF, 0, X86_EFL_AF | X86_EFL_PF … … 5721 5655 %assign bImm bImm + 1 5722 5656 %endrep 5723 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005657 .immEnd: 5724 5658 ENDPROC iemAImpl_pcmpistri_u128 5725 5659 … … 5740 5674 movdqu xmm1, [A2 + IEMPCMPESTRXSRC.uSrc2] 5741 5675 mov T2, A0 ; A0 can be ecx/rcx in some calling conventions which gets overwritten later (T2 only available on AMD64) 5742 lea T1, [.imm0 xWrtRIP] 5743 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5744 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5745 lea T1, [T1 + T0*4] 5746 %else 5747 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5748 %endif 5676 IEMIMPL_JUMP_TABLE_TARGET T1, A3, 8 5749 5677 push xDX ; xDX can be A1 or A2 depending on the calling convention 5750 5678 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it … … 5768 5696 %assign bImm bImm + 1 5769 5697 %endrep 5770 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005698 .immEnd: 5771 5699 ENDPROC iemAImpl_pcmpestri_u128 5772 5700 … … 5786 5714 movdqu xmm1, [A2 + IEMPCMPISTRXSRC.uSrc1] 5787 5715 movdqu xmm2, [A2 + IEMPCMPISTRXSRC.uSrc2] 5788 lea T1, [.imm0 xWrtRIP] 5789 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5790 lea T0, [A3 + A3*2] ; sizeof(endbrxx+pcmpistrm+ret) == 12: A3 * 12 = (A3 * 3) * 4 5791 lea T1, [T1 + T0*4] 5792 %else 5793 lea T1, [T1 + A3*8] ; sizeof(pcmpistrm+ret) == 8: A3 * 8 5794 %endif 5795 IBT_NOTRACK 5796 call T1 5716 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 8 5797 5717 5798 5718 IEM_SAVE_FLAGS A1, X86_EFL_CF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF, 0, X86_EFL_AF | X86_EFL_PF … … 5810 5730 %assign bImm bImm + 1 5811 5731 %endrep 5812 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005732 .immEnd: 5813 5733 ENDPROC iemAImpl_pcmpistrm_u128 5814 5734 … … 5828 5748 movdqu xmm1, [A2 + IEMPCMPESTRXSRC.uSrc1] 5829 5749 movdqu xmm2, [A2 + IEMPCMPESTRXSRC.uSrc2] 5830 lea T1, [.imm0 xWrtRIP] 5831 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5832 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5833 lea T1, [T1 + T0*4] 5834 %else 5835 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5836 %endif 5750 IEMIMPL_JUMP_TABLE_TARGET T1, A3, 8 5837 5751 push xDX ; xDX can be A1 or A2 depending on the calling convention 5838 5752 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it … … 5856 5770 %assign bImm bImm + 1 5857 5771 %endrep 5858 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8005772 .immEnd: 5859 5773 ENDPROC iemAImpl_pcmpestrm_u128 5860 5774 … … 6354 6268 movdqu xmm0, [A2 + IEMMEDIAF2XMMSRC.uSrc1] 6355 6269 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6356 lea T1, [.imm0 xWrtRIP] 6357 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6358 lea T0, [A3 + A3*8] ; sizeof(endbrxx+cmpps+ret) == 9: A3 * 9 6359 %else 6360 lea T0, [A3 + A3*4] ; sizeof(cmpps+ret) == 5: A3 * 5 6361 %endif 6362 lea T1, [T1 + T0] 6363 IBT_NOTRACK 6364 call T1 6270 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 5 6365 6271 movdqu [A1], xmm0 6366 6272 … … 6376 6282 %assign bImm bImm + 1 6377 6283 %endrep 6378 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x5006284 .immEnd: 6379 6285 ENDPROC iemAImpl_cmpps_u128 6380 6286 … … 6402 6308 movdqu xmm0, [A2 + IEMMEDIAF2XMMSRC.uSrc1] 6403 6309 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6404 lea T1, [.imm0 xWrtRIP] 6405 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6406 lea T0, [A3 + A3*4] ; sizeof(endbrxx+cmpXX+ret) == 10: A3 * 10 = (A3 * 5) * 2 6407 %else 6408 lea T0, [A3 + A3*2] ; sizeof(cmpXX+ret) == 6: A3 * 6 = (A3 * 3) * 2 6409 %endif 6410 lea T1, [T1 + T0*2] 6411 IBT_NOTRACK 6412 call T1 6310 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 6 6413 6311 movdqu [A1], xmm0 6414 6312 … … 6424 6322 %assign bImm bImm + 1 6425 6323 %endrep 6426 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6006324 .immEnd: 6427 6325 ENDPROC iemAImpl_ %+ %1 %+ _u128 6428 6326 %endmacro … … 6455 6353 movdqu xmm0, [A2 + IEMMEDIAF2XMMSRC.uSrc1] 6456 6354 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6457 lea T1, [.imm0 xWrtRIP] 6458 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6459 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insn+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 6460 lea T1, [T1 + T0*4] 6461 %else 6462 lea T1, [T1 + A3*8] ; sizeof(insn+ret+int3) == 8: A3 * 8 6463 %endif 6464 IBT_NOTRACK 6465 call T1 6355 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A3, 8 6466 6356 movdqu [A1], xmm0 6467 6357 … … 6478 6368 %assign bImm bImm + 1 6479 6369 %endrep 6480 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x8006370 .immEnd: 6481 6371 ENDPROC iemAImpl_ %+ %1 %+ _u128 6482 6372 %endmacro … … 6626 6516 movdqu xmm0, [A0] 6627 6517 movdqu xmm1, [A1] 6628 lea T1, [.imm0 xWrtRIP] 6629 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6630 lea T0, [A2 + A2*4] ; sizeof(endbrxx+sha1rnds4+ret) == 10: A2 * 10 = (A2 * 5) * 2 6631 %else 6632 lea T0, [A2 + A2*2] ; sizeof(sha1rnds4+ret) == 6: A2 * 6 = (A2 * 3) * 2 6633 %endif 6634 lea T1, [T1 + T0*2] 6635 IBT_NOTRACK 6636 call T1 6518 IEMIMPL_CALL_JUMP_TABLE_TARGET T1, A2, 6 6637 6519 movdqu [A0], xmm0 6638 6520 … … 6647 6529 %assign bImm bImm + 1 6648 6530 %endrep 6649 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x6006531 .immEnd: 6650 6532 ENDPROC iemAImpl_sha1rnds4_u128 6651 6533
Note:
See TracChangeset
for help on using the changeset viewer.