- Timestamp:
- Jul 2, 2023 10:50:12 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImpl.asm
r99790 r100340 88 88 %endif 89 89 NAME_FASTCALL(%1,%2,@): 90 IBT_ENDBRxx 90 91 %endmacro 91 92 … … 461 462 %endif 462 463 mov [%1], T0_32 ; Save the result. 464 %endmacro 465 466 467 ;; 468 ; Checks that the size expression %1 matches %2 adjusted according to 469 ; RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK and for 256 entries. 470 ; @param 1 The jump array size assembly expression. 471 ; @param 2 The size without accounting for the IBT_ENDBRxx_WITHOUT_NOTRACK instruction. 472 ; 473 %macro IEMCHECK_256_JUMP_ARRAY_SIZE 2 474 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 475 dw (0xffff - %2 - 256*4) + %1 ; will cause warning if entries are too big. 476 dw (0xffff + %2 + 256*4) - %1 ; will cause warning if entries are too small. 477 %else 478 dw (0xffff - %2) + %1 ; will cause warning if entries are too big. 479 dw (0xffff + %2) - %1 ; will cause warning if entries are too small. 480 %endif 463 481 %endmacro 464 482 … … 3905 3923 movq mm1, [A1] 3906 3924 movq mm0, mm0 ; paranoia! 3925 lea T1, [.imm0 xWrtRIP] 3926 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 3927 lea T0, [A2 + A2*8] ; sizeof(pshufw+ret) == 9 3928 %else 3907 3929 lea T0, [A2 + A2*4] ; sizeof(pshufw+ret) == 5 3908 lea T1, [.imm0 xWrtRIP]3930 %endif 3909 3931 lea T1, [T1 + T0] 3932 IBT_NOTRACK 3910 3933 call T1 3911 3934 movq [A0], mm0 … … 3916 3939 %rep 256 3917 3940 .imm %+ bImm: 3918 pshufw mm0, mm1, bImm 3919 ret 3941 IBT_ENDBRxx_WITHOUT_NOTRACK 3942 pshufw mm0, mm1, bImm 3943 ret 3920 3944 %assign bImm bImm + 1 3921 3945 %endrep 3922 .immEnd: ; 256*5 == 0x500 3923 dw 0xfaff + (.immEnd - .imm0) ; will cause warning if entries are too big. 3924 dw 0x104ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 3946 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x500 3925 3947 ENDPROC iemAImpl_pshufw_u64 3926 3948 … … 3934 3956 movdqu xmm0, xmm1 ; paranoia! 3935 3957 lea T1, [.imm0 xWrtRIP] 3936 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: (A3 * 3) *2 3958 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 3959 lea T0, [A2 + A2*4] ; sizeof(pshufXX+ret) == 10: A2 * 10 = (A2 * 5) * 2 3960 %else 3961 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: A2 * 6 = (A2 * 3) * 2 3962 %endif 3937 3963 lea T1, [T1 + T0*2] 3964 IBT_NOTRACK 3938 3965 call T1 3939 3966 movdqu [A0], xmm0 … … 3941 3968 IEMIMPL_SSE_EPILOGUE 3942 3969 EPILOGUE_3_ARGS 3970 3943 3971 %assign bImm 0 3944 3972 %rep 256 3945 3973 .imm %+ bImm: 3946 %1 xmm0, xmm1, bImm 3947 ret 3974 IBT_ENDBRxx_WITHOUT_NOTRACK 3975 %1 xmm0, xmm1, bImm 3976 ret 3948 3977 %assign bImm bImm + 1 3949 3978 %endrep 3950 .immEnd: ; 256*6 == 0x600 3951 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 3952 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 3979 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 3953 3980 ENDPROC iemAImpl_ %+ %1 %+ _u128 3954 3981 %endmacro … … 3967 3994 vmovdqu ymm0, ymm1 ; paranoia! 3968 3995 lea T1, [.imm0 xWrtRIP] 3969 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: (A3 * 3) *2 3996 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 3997 lea T0, [A2 + A2*4] ; sizeof(pshufXX+ret) == 10: A2 * 10 = (A2 * 5) * 2 3998 %else 3999 lea T0, [A2 + A2*2] ; sizeof(pshufXX+ret) == 6: A2 * 6 = (A2 * 3) * 2 4000 %endif 3970 4001 lea T1, [T1 + T0*2] 4002 IBT_NOTRACK 3971 4003 call T1 3972 4004 vmovdqu [A0], ymm0 … … 3977 4009 %rep 256 3978 4010 .imm %+ bImm: 3979 %1 ymm0, ymm1, bImm 3980 ret 4011 IBT_ENDBRxx_WITHOUT_NOTRACK 4012 %1 ymm0, ymm1, bImm 4013 ret 3981 4014 %assign bImm bImm + 1 3982 4015 %endrep 3983 .immEnd: ; 256*6 == 0x600 3984 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 3985 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 4016 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 3986 4017 ENDPROC iemAImpl_ %+ %1 %+ _u256 3987 4018 %endmacro … … 4002 4033 4003 4034 movq mm0, [A0] 4035 lea T1, [.imm0 xWrtRIP] 4036 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4037 lea T0, [A1 + A1*8] ; sizeof(psXX+ret) == 9 4038 %else 4004 4039 lea T0, [A1 + A1*4] ; sizeof(psXX+ret) == 5 4005 lea T1, [.imm0 xWrtRIP]4040 %endif 4006 4041 lea T1, [T1 + T0] 4042 IBT_NOTRACK 4007 4043 call T1 4008 4044 movq [A0], mm0 … … 4013 4049 %rep 256 4014 4050 .imm %+ bImm: 4015 %1 mm0, bImm 4016 ret 4051 IBT_ENDBRxx_WITHOUT_NOTRACK 4052 %1 mm0, bImm 4053 ret 4017 4054 %assign bImm bImm + 1 4018 4055 %endrep 4019 .immEnd: ; 256*5 == 0x500 4020 dw 0xfaff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4021 dw 0x104ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 4056 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x500 4022 4057 ENDPROC iemAImpl_ %+ %1 %+ _imm_u64 4023 4058 %endmacro … … 4040 4075 movdqu xmm0, [A0] 4041 4076 lea T1, [.imm0 xWrtRIP] 4042 lea T0, [A1 + A1*2] ; sizeof(psXX+ret) == 6: (A3 * 3) *2 4077 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4078 lea T0, [A1 + A1*4] ; sizeof(psXX+ret) == 10: A1 * 10 = (A1 * 5) * 2 4079 %else 4080 lea T0, [A1 + A1*2] ; sizeof(psXX+ret) == 6: A1 * 6 = (A1 * 3) * 2 4081 %endif 4043 4082 lea T1, [T1 + T0*2] 4083 IBT_NOTRACK 4044 4084 call T1 4045 4085 movdqu [A0], xmm0 … … 4050 4090 %rep 256 4051 4091 .imm %+ bImm: 4052 %1 xmm0, bImm 4053 ret 4092 IBT_ENDBRxx_WITHOUT_NOTRACK 4093 %1 xmm0, bImm 4094 ret 4054 4095 %assign bImm bImm + 1 4055 4096 %endrep 4056 .immEnd: ; 256*6 == 0x600 4057 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4058 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 4097 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 4059 4098 ENDPROC iemAImpl_ %+ %1 %+ _imm_u128 4060 4099 %endmacro … … 4881 4920 movdqu xmm1, [A1] 4882 4921 lea T1, [.imm0 xWrtRIP] 4883 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret+int3) == 6: (A2 * 3) *2 4922 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4923 lea T0, [A2 + A2*4] ; sizeof(shufpX+ret+int3) == 10: A2 * 10 = (A2 * 5) * 2 4924 %else 4925 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret+int3) == 6: A2 * 6 = (A2 * 3) * 2 4926 %endif 4884 4927 lea T1, [T1 + T0*2] 4928 IBT_NOTRACK 4885 4929 call T1 4886 4930 movdqu [A0], xmm0 … … 4891 4935 %rep 256 4892 4936 .imm %+ bImm: 4893 shufps xmm0, xmm1, bImm 4894 ret 4895 int3 4937 IBT_ENDBRxx_WITHOUT_NOTRACK 4938 shufps xmm0, xmm1, bImm 4939 ret 4940 int3 4896 4941 %assign bImm bImm + 1 4897 4942 %endrep 4898 .immEnd: ; 256*6 == 0x600 4899 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4900 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 4943 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 4901 4944 ENDPROC iemAImpl_shufps_u128 4902 4945 … … 4916 4959 movdqu xmm1, [A1] 4917 4960 lea T1, [.imm0 xWrtRIP] 4918 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret) == 6: (A2 * 3) *2 4961 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 4962 lea T0, [A2 + A2*4] ; sizeof(shufpX+ret) == 10: A2 * 10 = (A2 * 5) * 2 4963 %else 4964 lea T0, [A2 + A2*2] ; sizeof(shufpX+ret) == 6: A2 * 6 = (A2 * 3) * 2 4965 %endif 4919 4966 lea T1, [T1 + T0*2] 4967 IBT_NOTRACK 4920 4968 call T1 4921 4969 movdqu [A0], xmm0 … … 4926 4974 %rep 256 4927 4975 .imm %+ bImm: 4928 shufpd xmm0, xmm1, bImm 4929 ret 4976 IBT_ENDBRxx_WITHOUT_NOTRACK 4977 shufpd xmm0, xmm1, bImm 4978 ret 4930 4979 %assign bImm bImm + 1 4931 4980 %endrep 4932 .immEnd: ; 256*6 == 0x600 4933 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4934 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 4981 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 4935 4982 ENDPROC iemAImpl_shufpd_u128 4936 4983 … … 4954 5001 movdqu xmm1, [A2] 4955 5002 lea T1, [.imm0 xWrtRIP] 4956 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: (A3 * 3) *2 5003 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5004 lea T0, [A3 + A3*4] ; sizeof(vshufpX+ret) == 10: A3 * 10 = (A3 * 5) * 2 5005 %else 5006 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: A3 * 6 = (A3 * 3) * 2 5007 %endif 4957 5008 lea T1, [T1 + T0*2] 5009 IBT_NOTRACK 4958 5010 call T1 4959 5011 movdqu [A0], xmm0 … … 4964 5016 %rep 256 4965 5017 .imm %+ bImm: 4966 %1 xmm0, xmm0, xmm1, bImm 4967 ret 5018 IBT_ENDBRxx_WITHOUT_NOTRACK 5019 %1 xmm0, xmm0, xmm1, bImm 5020 ret 4968 5021 %assign bImm bImm + 1 4969 5022 %endrep 4970 .immEnd: ; 256*6 == 0x600 4971 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4972 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5023 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 4973 5024 ENDPROC iemAImpl_ %+ %1 %+ _u128 4974 5025 … … 4980 5031 vmovdqu ymm1, [A2] 4981 5032 lea T1, [.imm0 xWrtRIP] 4982 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: (A3 * 3) *2 5033 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5034 lea T0, [A3 + A3*4] ; sizeof(vshufpX+ret) == 10: A3 * 10 = (A3 * 5) * 2 5035 %else 5036 lea T0, [A3 + A3*2] ; sizeof(vshufpX+ret) == 6: A3 * 6 = (A3 * 3) * 2 5037 %endif 4983 5038 lea T1, [T1 + T0*2] 5039 IBT_NOTRACK 4984 5040 call T1 4985 5041 vmovdqu [A0], ymm0 … … 4990 5046 %rep 256 4991 5047 .imm %+ bImm: 4992 %1 ymm0, ymm0, ymm1, bImm 4993 ret 5048 IBT_ENDBRxx_WITHOUT_NOTRACK 5049 %1 ymm0, ymm0, ymm1, bImm 5050 ret 4994 5051 %assign bImm bImm + 1 4995 5052 %endrep 4996 .immEnd: ; 256*6 == 0x600 4997 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 4998 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5053 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 4999 5054 ENDPROC iemAImpl_ %+ %1 %+ _u256 5000 5055 %endmacro … … 5091 5146 movq mm1, A1 5092 5147 lea T1, [.imm0 xWrtRIP] 5093 lea T0, [A2 + A2*2] ; sizeof(palignr+ret) == 6: (A2 * 3) *2 5148 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5149 lea T0, [A2 + A2*4] ; sizeof(endbrxx+palignr+ret) == 10: A2 * 10 = (A2 * 5) * 2 5150 %else 5151 lea T0, [A2 + A2*2] ; sizeof(palignr+ret) == 6: A2 * 6 = (A2 * 3) * 2 5152 %endif 5094 5153 lea T1, [T1 + T0*2] 5154 IBT_NOTRACK 5095 5155 call T1 5096 5156 movq [A0], mm0 … … 5101 5161 %rep 256 5102 5162 .imm %+ bImm: 5103 palignr mm0, mm1, bImm 5104 ret 5163 IBT_ENDBRxx_WITHOUT_NOTRACK 5164 palignr mm0, mm1, bImm 5165 ret 5105 5166 %assign bImm bImm + 1 5106 5167 %endrep 5107 .immEnd: ; 256*6 == 0x600 5108 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5109 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5168 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 5110 5169 ENDPROC iemAImpl_palignr_u64 5111 5170 … … 5130 5189 movdqu xmm1, [A1] 5131 5190 lea T1, [.imm0 xWrtRIP] 5132 lea T0, [A2 + A2*3] ; sizeof(insnX+ret) == 8: (A2 * 4) * 2 5133 lea T1, [T1 + T0*2] 5191 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5192 lea T0, [A2 + A2*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A2 * 12 = (A2 * 3) * 4 5193 lea T1, [T1 + T0*4] 5194 %else 5195 lea T1, [T1 + A2*8] ; sizeof(insnX+ret+int3) == 8: A2 * 8 5196 %endif 5197 IBT_NOTRACK 5134 5198 call T1 5135 5199 movdqu [A0], xmm0 … … 5140 5204 %rep 256 5141 5205 .imm %+ bImm: 5142 %1 xmm0, xmm1, bImm 5143 ret 5144 int3 5206 IBT_ENDBRxx_WITHOUT_NOTRACK 5207 %1 xmm0, xmm1, bImm 5208 ret 5209 int3 5145 5210 %assign bImm bImm + 1 5146 5211 %endrep 5147 .immEnd: ; 256*8 == 0x800 5148 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5149 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5212 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5150 5213 ENDPROC iemAImpl_ %+ %1 %+ _u128 5151 5214 %endmacro … … 5181 5244 movdqu xmm1, [A2] 5182 5245 lea T1, [.imm0 xWrtRIP] 5183 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5184 lea T1, [T1 + T0*2] 5246 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5247 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 5248 lea T1, [T1 + T0*4] 5249 %else 5250 lea T1, [T1 + A3*8] ; sizeof(insnX+ret+int3) == 8: A3 * 8 5251 %endif 5252 IBT_NOTRACK 5185 5253 call T1 5186 5254 movdqu [A0], xmm0 … … 5191 5259 %rep 256 5192 5260 .imm %+ bImm: 5193 %1 xmm0, xmm0, xmm1, bImm 5194 ret 5195 int3 5261 IBT_ENDBRxx_WITHOUT_NOTRACK 5262 %1 xmm0, xmm0, xmm1, bImm 5263 ret 5264 int3 5196 5265 %assign bImm bImm + 1 5197 5266 %endrep 5198 .immEnd: ; 256*8 == 0x800 5199 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5200 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5267 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5201 5268 ENDPROC iemAImpl_ %+ %1 %+ _u128 5202 5269 … … 5209 5276 vmovdqu ymm1, [A2] 5210 5277 lea T1, [.imm0 xWrtRIP] 5211 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5212 lea T1, [T1 + T0*2] 5278 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5279 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 5280 lea T1, [T1 + T0*4] 5281 %else 5282 lea T1, [T1 + A3*8] ; sizeof(insnX+ret+int3) == 8: A3 * 8 5283 %endif 5284 IBT_NOTRACK 5213 5285 call T1 5214 5286 vmovdqu [A0], ymm0 … … 5219 5291 %rep 256 5220 5292 .imm %+ bImm: 5221 %1 ymm0, ymm0, ymm1, bImm 5222 ret 5223 int3 5293 IBT_ENDBRxx_WITHOUT_NOTRACK 5294 %1 ymm0, ymm0, ymm1, bImm 5295 ret 5296 int3 5224 5297 %assign bImm bImm + 1 5225 5298 %endrep 5226 .immEnd: ; 256*8 == 0x800 5227 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5228 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5299 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5229 5300 ENDPROC iemAImpl_ %+ %1 %+ _u256 5230 5301 %endif … … 5269 5340 mov T2, A0 ; A0 can be ecx/rcx in some calling conventions which gets overwritten later (T2 only available on AMD64) 5270 5341 lea T1, [.imm0 xWrtRIP] 5271 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5272 lea T1, [T1 + T0*2] 5342 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5343 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5344 lea T1, [T1 + T0*4] 5345 %else 5346 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5347 %endif 5348 IBT_NOTRACK 5273 5349 call T1 5274 5350 … … 5281 5357 %rep 256 5282 5358 .imm %+ bImm: 5283 pcmpistri xmm0, xmm1, bImm 5284 ret 5285 int3 5359 IBT_ENDBRxx_WITHOUT_NOTRACK 5360 pcmpistri xmm0, xmm1, bImm 5361 ret 5362 int3 5286 5363 %assign bImm bImm + 1 5287 5364 %endrep 5288 .immEnd: ; 256*8 == 0x800 5289 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5290 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5365 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5291 5366 ENDPROC iemAImpl_pcmpistri_u128 5292 5367 … … 5307 5382 mov T2, A0 ; A0 can be ecx/rcx in some calling conventions which gets overwritten later (T2 only available on AMD64) 5308 5383 lea T1, [.imm0 xWrtRIP] 5309 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5310 lea T1, [T1 + T0*2] 5311 push xDX ; xDX can be A1 or A2 depending on the calling convention 5312 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it 5313 mov xDX, [A2 + IEMPCMPESTRXSRC.u64Rdx] 5384 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5385 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5386 lea T1, [T1 + T0*4] 5387 %else 5388 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5389 %endif 5390 push xDX ; xDX can be A1 or A2 depending on the calling convention 5391 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it 5392 mov xDX, [A2 + IEMPCMPESTRXSRC.u64Rdx] 5393 IBT_NOTRACK 5314 5394 call T1 5315 5395 … … 5323 5403 %rep 256 5324 5404 .imm %+ bImm: 5325 db 0x48 ; Use the REX.W prefix to make pcmpestr{i,m} use full RAX/RDX (would use EAX/EDX only otherwise.) 5326 pcmpestri xmm0, xmm1, bImm 5327 ret 5405 IBT_ENDBRxx_WITHOUT_NOTRACK 5406 db 0x48 ; Use the REX.W prefix to make pcmpestr{i,m} use full RAX/RDX (would use EAX/EDX only otherwise.) 5407 pcmpestri xmm0, xmm1, bImm 5408 ret 5328 5409 %assign bImm bImm + 1 5329 5410 %endrep 5330 .immEnd: ; 256*8 == 0x800 5331 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5332 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5411 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5333 5412 ENDPROC iemAImpl_pcmpestri_u128 5334 5413 … … 5348 5427 movdqu xmm2, [A2 + IEMPCMPISTRXSRC.uSrc2] 5349 5428 lea T1, [.imm0 xWrtRIP] 5350 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5351 lea T1, [T1 + T0*2] 5429 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5430 lea T0, [A3 + A3*2] ; sizeof(endbrxx+pcmpistrm+ret) == 12: A3 * 12 = (A3 * 3) * 4 5431 lea T1, [T1 + T0*4] 5432 %else 5433 lea T0, [T1 + A3*8] ; sizeof(pcmpistrm+ret) == 8: A3 * 8 5434 %endif 5435 IBT_NOTRACK 5352 5436 call T1 5353 5437 … … 5360 5444 %rep 256 5361 5445 .imm %+ bImm: 5362 pcmpistrm xmm1, xmm2, bImm 5363 ret 5364 int3 5446 IBT_ENDBRxx_WITHOUT_NOTRACK 5447 pcmpistrm xmm1, xmm2, bImm 5448 ret 5449 int3 5365 5450 %assign bImm bImm + 1 5366 5451 %endrep 5367 .immEnd: ; 256*8 == 0x800 5368 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5369 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5452 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5370 5453 ENDPROC iemAImpl_pcmpistrm_u128 5371 5454 … … 5385 5468 movdqu xmm2, [A2 + IEMPCMPESTRXSRC.uSrc2] 5386 5469 lea T1, [.imm0 xWrtRIP] 5387 lea T0, [A3 + A3*3] ; sizeof(insnX+ret) == 8: (A3 * 4) * 2 5388 lea T1, [T1 + T0*2] 5389 push xDX ; xDX can be A1 or A2 depending on the calling convention 5390 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it 5391 mov xDX, [A2 + IEMPCMPESTRXSRC.u64Rdx] 5470 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5471 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insnX+ret) == 12: A3 * 12 = (A3 * 3) * 4 5472 lea T1, [T1 + T0*4] 5473 %else 5474 lea T1, [T1 + A3*8] ; sizeof(insnX+ret) == 8: A3 * 8 5475 %endif 5476 push xDX ; xDX can be A1 or A2 depending on the calling convention 5477 mov xAX, [A2 + IEMPCMPESTRXSRC.u64Rax] ; T0 is rax, so only overwrite it after we're done using it 5478 mov xDX, [A2 + IEMPCMPESTRXSRC.u64Rdx] 5479 IBT_NOTRACK 5392 5480 call T1 5393 5481 5394 pop xDX5482 pop xDX 5395 5483 IEM_SAVE_FLAGS A1, X86_EFL_STATUS_BITS, 0 5396 5484 movdqu [A0], xmm0 … … 5401 5489 %rep 256 5402 5490 .imm %+ bImm: 5403 db 0x48 ; Use the REX.W prefix to make pcmpestr{i,m} use full RAX/RDX (would use EAX/EDX only otherwise.) 5404 pcmpestrm xmm1, xmm2, bImm 5405 ret 5491 IBT_ENDBRxx_WITHOUT_NOTRACK 5492 db 0x48 ; Use the REX.W prefix to make pcmpestr{i,m} use full RAX/RDX (would use EAX/EDX only otherwise.) 5493 pcmpestrm xmm1, xmm2, bImm 5494 ret 5406 5495 %assign bImm bImm + 1 5407 5496 %endrep 5408 .immEnd: ; 256*8 == 0x800 5409 dw 0xf7ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5410 dw 0x107ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5497 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 5411 5498 ENDPROC iemAImpl_pcmpestrm_u128 5412 5499 … … 5424 5511 5425 5512 movq mm0, [A0] 5426 lea T0, [A2 + A2*4] ; sizeof(pinsrw+ret) == 55427 5513 lea T1, [.imm0 xWrtRIP] 5514 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5515 lea T0, [A2 + A2*8] ; sizeof(endbrxx+pinsrw+ret) == 9: A2 * 9 5516 %else 5517 lea T0, [A2 + A2*4] ; sizeof(pinsrw+ret) == 5: A2 * 5 5518 %endif 5428 5519 lea T1, [T1 + T0] 5520 IBT_NOTRACK 5429 5521 call T1 5430 5522 movq [A0], mm0 … … 5435 5527 %rep 256 5436 5528 .imm %+ bImm: 5437 pinsrw mm0, A1_32, bImm 5438 ret 5529 IBT_ENDBRxx_WITHOUT_NOTRACK 5530 pinsrw mm0, A1_32, bImm 5531 ret 5439 5532 %assign bImm bImm + 1 5440 5533 %endrep 5441 .immEnd: ; 256*5 == 0x500 5442 dw 0xfaff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5443 dw 0x104ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5534 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x500 5444 5535 ENDPROC iemAImpl_pinsrw_u64 5445 5536 … … 5450 5541 movdqu xmm0, [A0] 5451 5542 lea T1, [.imm0 xWrtRIP] 5452 lea T0, [A2 + A2*2] ; sizeof(pinsrw+ret) == 6: (A2 * 3) *2 5543 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5544 lea T0, [A2 + A2*4] ; sizeof(endbrxx+pinsrw+ret) == 10: A2 * 10 = (A2 * 5) * 2 5545 %else 5546 lea T0, [A2 + A2*2] ; sizeof(pinsrw+ret) == 6: A2 * 6 = (A2 * 3) * 2 5547 %endif 5453 5548 lea T1, [T1 + T0*2] 5549 IBT_NOTRACK 5454 5550 call T1 5455 5551 movdqu [A0], xmm0 … … 5460 5556 %rep 256 5461 5557 .imm %+ bImm: 5462 pinsrw xmm0, A1_32, bImm 5463 ret 5558 IBT_ENDBRxx_WITHOUT_NOTRACK 5559 pinsrw xmm0, A1_32, bImm 5560 ret 5464 5561 %assign bImm bImm + 1 5465 5562 %endrep 5466 .immEnd: ; 256*6 == 0x600 5467 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5468 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5563 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 5469 5564 ENDPROC iemAImpl_pinsrw_u128 5470 5565 … … 5483 5578 movdqu xmm0, [A1] 5484 5579 lea T1, [.imm0 xWrtRIP] 5485 lea T0, [A3 + A3*2] ; sizeof(vpinsrw+ret) == 6: (A3 * 3) *2 5580 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5581 lea T0, [A3 + A3*4] ; sizeof(endbrxx+vpinsrw+ret) == 10: A3 * 10 = (A3 * 5) * 2 5582 %else 5583 lea T0, [A3 + A3*2] ; sizeof(vpinsrw+ret) == 6: A3 * 6 = (A3 * 3) * 2 5584 %endif 5486 5585 lea T1, [T1 + T0*2] 5487 5586 mov A1, A2 ; A2 requires longer encoding on Windows 5587 IBT_NOTRACK 5488 5588 call T1 5489 5589 movdqu [A0], xmm0 … … 5494 5594 %rep 256 5495 5595 .imm %+ bImm: 5496 vpinsrw xmm0, xmm0, A1_32, bImm 5497 ret 5596 IBT_ENDBRxx_WITHOUT_NOTRACK 5597 vpinsrw xmm0, xmm0, A1_32, bImm 5598 ret 5498 5599 %assign bImm bImm + 1 5499 5600 %endrep 5500 .immEnd: ; 256*6 == 0x600 5501 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5502 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5601 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 5503 5602 ENDPROC iemAImpl_vpinsrw_u128 5504 5603 … … 5516 5615 5517 5616 movq mm0, A1 5518 lea T0, [A2 + A2*4] ; sizeof(pextrw+ret) == 55519 5617 lea T1, [.imm0 xWrtRIP] 5618 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5619 lea T0, [A2 + A2*8] ; sizeof(endbrxx+pextrw+ret) == 9: A2 * 9 5620 %else 5621 lea T0, [A2 + A2*4] ; sizeof(pextrw+ret) == 5: A2 * 5 5622 %endif 5520 5623 lea T1, [T1 + T0] 5624 IBT_NOTRACK 5521 5625 call T1 5522 5626 mov word [A0], T0_16 … … 5527 5631 %rep 256 5528 5632 .imm %+ bImm: 5529 pextrw T0_32, mm0, bImm 5530 ret 5633 IBT_ENDBRxx_WITHOUT_NOTRACK 5634 pextrw T0_32, mm0, bImm 5635 ret 5531 5636 %assign bImm bImm + 1 5532 5637 %endrep 5533 .immEnd: ; 256*5 == 0x500 5534 dw 0xfaff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5535 dw 0x104ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5638 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x500 5536 5639 ENDPROC iemAImpl_pextrw_u64 5537 5640 … … 5542 5645 movdqu xmm0, [A1] 5543 5646 lea T1, [.imm0 xWrtRIP] 5544 lea T0, [A2 + A2*2] ; sizeof(pextrw+ret) == 6: (A2 * 3) *2 5647 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5648 lea T0, [A2 + A2*4] ; sizeof(endbrxx+pextrw+ret) == 10: A2 * 10 = (A2 * 5) * 2 5649 %else 5650 lea T0, [A2 + A2*2] ; sizeof(pextrw+ret) == 6: A2 * 6 = (A2 * 3) * 2 5651 %endif 5545 5652 lea T1, [T1 + T0*2] 5653 IBT_NOTRACK 5546 5654 call T1 5547 5655 mov word [A0], T0_16 … … 5552 5660 %rep 256 5553 5661 .imm %+ bImm: 5554 pextrw T0_32, xmm0, bImm 5555 ret 5662 IBT_ENDBRxx_WITHOUT_NOTRACK 5663 pextrw T0_32, xmm0, bImm 5664 ret 5556 5665 %assign bImm bImm + 1 5557 5666 %endrep 5558 .immEnd: ; 256*6 == 0x600 5559 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5560 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5667 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 5561 5668 ENDPROC iemAImpl_pextrw_u128 5562 5669 … … 5574 5681 movdqu xmm0, [A1] 5575 5682 lea T1, [.imm0 xWrtRIP] 5576 lea T0, [A2 + A2*2] ; sizeof(vpextrw+ret) == 6: (A2 * 3) *2 5683 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 5684 lea T0, [A2 + A2*4] ; sizeof(endbrxx+vpextrw+ret) == 10: A2 * 10 = (A2 * 5) * 2 5685 %else 5686 lea T0, [A2 + A2*2] ; sizeof(vpextrw+ret) == 6: A2 * 6 = (A2 * 3) * 2 5687 %endif 5577 5688 lea T1, [T1 + T0*2] 5689 IBT_NOTRACK 5578 5690 call T1 5579 5691 mov word [A0], T0_16 … … 5584 5696 %rep 256 5585 5697 .imm %+ bImm: 5586 vpextrw T0_32, xmm0, bImm 5587 ret 5698 IBT_ENDBRxx_WITHOUT_NOTRACK 5699 vpextrw T0_32, xmm0, bImm 5700 ret 5588 5701 %assign bImm bImm + 1 5589 5702 %endrep 5590 .immEnd: ; 256*6 == 0x600 5591 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 5592 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 5703 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 5593 5704 ENDPROC iemAImpl_vpextrw_u128 5594 5705 … … 6152 6263 movdqu xmm0, [A2 + IEMMEDIAF2XMMSRC.uSrc1] 6153 6264 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6154 lea T0, [A3 + A3*4] ; sizeof(cmpps+ret) == 56155 6265 lea T1, [.imm0 xWrtRIP] 6266 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6267 lea T0, [A3 + A3*8] ; sizeof(endbrxx+cmpps+ret) == 9: A3 * 9 6268 %else 6269 lea T0, [A3 + A3*4] ; sizeof(cmpps+ret) == 5: A3 * 5 6270 %endif 6156 6271 lea T1, [T1 + T0] 6272 IBT_NOTRACK 6157 6273 call T1 6158 6274 movdqu [A1], xmm0 … … 6164 6280 %rep 256 6165 6281 .imm %+ bImm: 6166 cmpps xmm0, xmm1, bImm 6167 ret 6282 IBT_ENDBRxx_WITHOUT_NOTRACK 6283 cmpps xmm0, xmm1, bImm 6284 ret 6168 6285 %assign bImm bImm + 1 6169 6286 %endrep 6170 .immEnd: ; 256*5 == 0x500 6171 dw 0xfaff + (.immEnd - .imm0) ; will cause warning if entries are too big. 6172 dw 0x104ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 6287 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x500 6173 6288 ENDPROC iemAImpl_cmpps_u128 6174 6289 … … 6195 6310 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6196 6311 lea T1, [.imm0 xWrtRIP] 6197 lea T0, [A3 + A3*2] ; sizeof(pshufXX+ret) == 6: (A3 * 3) *2 6312 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6313 lea T0, [A3 + A3*4] ; sizeof(endbrxx+cmpXX+ret) == 10: A3 * 10 = (A3 * 5) * 2 6314 %else 6315 lea T0, [A3 + A3*2] ; sizeof(cmpXX+ret) == 6: A3 * 6 = (A3 * 3) * 2 6316 %endif 6198 6317 lea T1, [T1 + T0*2] 6318 IBT_NOTRACK 6199 6319 call T1 6200 6320 movdqu [A1], xmm0 … … 6206 6326 %rep 256 6207 6327 .imm %+ bImm: 6208 %1 xmm0, xmm1, bImm 6209 ret 6328 IBT_ENDBRxx_WITHOUT_NOTRACK 6329 %1 xmm0, xmm1, bImm 6330 ret 6210 6331 %assign bImm bImm + 1 6211 6332 %endrep 6212 .immEnd: ; 256*6 == 0x600 6213 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 6214 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 6333 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 6215 6334 ENDPROC iemAImpl_ %+ %1 %+ _u128 6216 6335 %endmacro … … 6242 6361 movdqu xmm1, [A2 + IEMMEDIAF2XMMSRC.uSrc2] 6243 6362 lea T1, [.imm0 xWrtRIP] 6244 lea T0, [A3*2 + A3] ; sizeof(insn+ret) == 7: 2 * (A3 * 3) + A3 6245 lea T0, [T0*2] 6246 lea T0, [T0 + A3] 6247 lea T1, [T1 + T0] 6363 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6364 lea T0, [A3 + A3*2] ; sizeof(endbrxx+insn+ret+int3) == 12: A3 * 12 = (A3 * 3) * 4 6365 lea T1, [T1 + T0*4] 6366 %else 6367 lea T1, [T1 + A3*8] ; sizeof(insn+ret+int3) == 8: A3 * 8 6368 %endif 6369 IBT_NOTRACK 6248 6370 call T1 6249 6371 movdqu [A1], xmm0 … … 6255 6377 %rep 256 6256 6378 .imm %+ bImm: 6257 %1 xmm0, xmm1, bImm 6258 ret 6379 IBT_ENDBRxx_WITHOUT_NOTRACK 6380 %1 xmm0, xmm1, bImm 6381 ret 6382 int3 6259 6383 %assign bImm bImm + 1 6260 6384 %endrep 6261 .immEnd: ; 256*(6+1) == 0x700 6262 dw 0xf8ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 6263 dw 0x106ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 6385 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x800 6264 6386 ENDPROC iemAImpl_ %+ %1 %+ _u128 6265 6387 %endmacro … … 6406 6528 movdqu xmm1, [A1] 6407 6529 lea T1, [.imm0 xWrtRIP] 6408 lea T0, [A2 + A2*2] ; sizeof(insnX+ret) == 6: (A2 * 3) * 2 6530 %ifdef RT_WITH_IBT_BRANCH_PROTECTION_WITHOUT_NOTRACK 6531 lea T0, [A2 + A2*4] ; sizeof(endbrxx+sha1rnds4+ret) == 10: A2 * 10 = (A2 * 5) * 2 6532 %else 6533 lea T0, [A2 + A2*2] ; sizeof(sha1rnds4+ret) == 6: A2 * 6 = (A2 * 3) * 2 6534 %endif 6409 6535 lea T1, [T1 + T0*2] 6536 IBT_NOTRACK 6410 6537 call T1 6411 6538 movdqu [A0], xmm0 … … 6416 6543 %rep 256 6417 6544 .imm %+ bImm: 6418 sha1rnds4 xmm0, xmm1, bImm 6419 ret 6545 IBT_ENDBRxx_WITHOUT_NOTRACK 6546 sha1rnds4 xmm0, xmm1, bImm 6547 ret 6420 6548 %assign bImm bImm + 1 6421 6549 %endrep 6422 .immEnd: ; 256*6 == 0x600 6423 dw 0xf9ff + (.immEnd - .imm0) ; will cause warning if entries are too big. 6424 dw 0x105ff - (.immEnd - .imm0) ; will cause warning if entries are too small. 6550 .immEnd: IEMCHECK_256_JUMP_ARRAY_SIZE (.immEnd - .imm0), 0x600 6425 6551 ENDPROC iemAImpl_sha1rnds4_u128 6426 6552
Note:
See TracChangeset
for help on using the changeset viewer.