@@ -149,146 +149,118 @@ DECLSPEC_GUARDIGNORE _NOINLINE intptr_t GetNonTableMethodAddress(ThreadContextI
149
149
// DllImport methods
150
150
//
151
151
#if defined(_M_IX86)
152
- // TODO: OOP JIT, have some way to validate that these are all loaded from CRT
152
+ // These are internal CRT functions which don't use a standard calling convention
153
153
case HelperDirectMath_Acos:
154
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_acos);
154
+ return ShiftAddr (context, __libm_sse2_acos);
155
155
156
156
case HelperDirectMath_Asin:
157
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_asin);
157
+ return ShiftAddr (context, __libm_sse2_asin);
158
158
159
159
case HelperDirectMath_Atan:
160
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_atan);
160
+ return ShiftAddr (context, __libm_sse2_atan);
161
161
162
162
case HelperDirectMath_Atan2:
163
- return ShiftAddr (context, ( double (*)( double , double )) __libm_sse2_atan2);
163
+ return ShiftAddr (context, __libm_sse2_atan2);
164
164
165
165
case HelperDirectMath_Cos:
166
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_cos);
166
+ return ShiftAddr (context, __libm_sse2_cos);
167
167
168
168
case HelperDirectMath_Exp:
169
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_exp);
169
+ return ShiftAddr (context, __libm_sse2_exp);
170
170
171
171
case HelperDirectMath_Log:
172
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_log);
172
+ return ShiftAddr (context, __libm_sse2_log);
173
173
174
174
case HelperDirectMath_Sin:
175
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_sin);
175
+ return ShiftAddr (context, __libm_sse2_sin);
176
176
177
177
case HelperDirectMath_Tan:
178
- return ShiftAddr (context, ( double (*)( double )) __libm_sse2_tan);
178
+ return ShiftAddr (context, __libm_sse2_tan);
179
179
#endif
180
180
181
181
case HelperDirectMath_FloorDb:
182
- return ShiftAddr (context, ( double (*)( double )) floor );
182
+ return ShiftStdcallAddr (context, Js::JavascriptMath::Floor );
183
183
184
184
case HelperDirectMath_CeilDb:
185
- return ShiftAddr (context, (double (*)(double ))ceil );
186
-
187
- //
188
- // These are statically initialized to an import thunk, but let's keep them out of the table in case a new CRT changes this
189
- //
190
- case HelperWMemCmp:
191
- return ShiftAddr (context, (int (*)(const char16 *, const char16 *, size_t ))wmemcmp);
192
-
193
- case HelperMemCpy:
194
- return ShiftAddr (context, (void *(*)(void *, void const *, size_t ))memcpy );
185
+ return ShiftStdcallAddr (context, Js::JavascriptMath::Ceil);
195
186
196
187
case HelperDirectMath_FloorFlt:
197
- return ShiftAddr (context, ( float (*)( float )) floorf );
188
+ return ShiftStdcallAddr (context, Js::JavascriptMath::FloorF );
198
189
199
190
case HelperDirectMath_CeilFlt:
200
- return ShiftAddr (context, (float (*)(float ))ceilf );
201
-
202
- #if defined(_M_X64)
203
- case HelperDirectMath_Acos:
204
- return ShiftAddr (context, (double (*)(double ))acos );
191
+ return ShiftStdcallAddr (context, Js::JavascriptMath::CeilF);
205
192
206
- case HelperDirectMath_Asin:
207
- return ShiftAddr (context, (double (*)(double ))asin );
208
-
209
- case HelperDirectMath_Atan:
210
- return ShiftAddr (context, (double (*)(double ))atan );
211
-
212
- case HelperDirectMath_Atan2:
213
- return ShiftAddr (context, (double (*)(double , double ))atan2 );
214
-
215
- case HelperDirectMath_Cos:
216
- return ShiftAddr (context, (double (*)(double ))cos );
217
-
218
- case HelperDirectMath_Exp:
219
- return ShiftAddr (context, (double (*)(double ))exp );
220
-
221
- case HelperDirectMath_Log:
222
- return ShiftAddr (context, (double (*)(double ))log );
223
-
224
- case HelperDirectMath_Sin:
225
- return ShiftAddr (context, (double (*)(double ))sin );
193
+ //
194
+ // These are statically initialized to an import thunk, but let's keep them out of the table in case a new CRT changes this
195
+ //
196
+ case HelperWMemCmp:
197
+ return ShiftCdeclAddr (context, wmemcmp);
226
198
227
- case HelperDirectMath_Tan :
228
- return ShiftAddr (context, (double ( *)(double )) tan );
199
+ case HelperMemCpy :
200
+ return ShiftCdeclAddr (context, (void *(__cdecl *)(void *, void const *, size_t )) memcpy );
229
201
230
- #elif defined(_M_ARM32_OR_ARM64)
202
+ #if defined(_M_X64) || defined(_M_ARM32_OR_ARM64)
231
203
case HelperDirectMath_Acos:
232
- return ShiftAddr (context, (double (*)(double ))acos );
204
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))acos );
233
205
234
206
case HelperDirectMath_Asin:
235
- return ShiftAddr (context, (double (*)(double ))asin );
207
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))asin );
236
208
237
209
case HelperDirectMath_Atan:
238
- return ShiftAddr (context, (double (*)(double ))atan );
210
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))atan );
239
211
240
212
case HelperDirectMath_Atan2:
241
- return ShiftAddr (context, (double (*)(double , double ))atan2 );
213
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double , double ))atan2 );
242
214
243
215
case HelperDirectMath_Cos:
244
- return ShiftAddr (context, (double (*)(double ))cos );
216
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))cos );
245
217
246
218
case HelperDirectMath_Exp:
247
- return ShiftAddr (context, (double (*)(double ))exp );
219
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))exp );
248
220
249
221
case HelperDirectMath_Log:
250
- return ShiftAddr (context, (double (*)(double ))log );
222
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))log );
251
223
252
224
case HelperDirectMath_Sin:
253
- return ShiftAddr (context, (double (*)(double ))sin );
225
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))sin );
254
226
255
227
case HelperDirectMath_Tan:
256
- return ShiftAddr (context, (double (*)(double ))tan );
228
+ return ShiftCdeclAddr (context, (double (__cdecl *)(double ))tan );
257
229
#endif
258
230
259
- //
260
- // Methods that we don't want to get marked as CFG targets as they make unprotected calls
261
- //
231
+ //
232
+ // Methods that we don't want to get marked as CFG targets as they make unprotected calls
233
+ //
262
234
263
235
#ifdef _CONTROL_FLOW_GUARD
264
236
case HelperGuardCheckCall:
265
237
return (intptr_t )__guard_check_icall_fptr; // OOP JIT: ntdll load at same address across all process
266
238
#endif
267
239
268
240
case HelperOp_TryCatch:
269
- return ShiftAddr (context, Js::JavascriptExceptionOperators::OP_TryCatch);
241
+ return ShiftStdcallAddr (context, Js::JavascriptExceptionOperators::OP_TryCatch);
270
242
271
243
case HelperOp_TryFinally:
272
- return ShiftAddr (context, Js::JavascriptExceptionOperators::OP_TryFinally);
244
+ return ShiftStdcallAddr (context, Js::JavascriptExceptionOperators::OP_TryFinally);
273
245
274
246
275
247
case HelperOp_TryFinallySimpleJit:
276
- return ShiftAddr (context, Js::JavascriptExceptionOperators::OP_TryFinallySimpleJit);
248
+ return ShiftStdcallAddr (context, Js::JavascriptExceptionOperators::OP_TryFinallySimpleJit);
277
249
278
- //
279
- // Methods that we don't want to get marked as CFG targets as they dump all registers to a controlled address
280
- //
250
+ //
251
+ // Methods that we don't want to get marked as CFG targets as they dump all registers to a controlled address
252
+ //
281
253
case HelperSaveAllRegistersAndBailOut:
282
- return ShiftAddr (context, LinearScanMD::SaveAllRegistersAndBailOut);
254
+ return ShiftStdcallAddr (context, LinearScanMD::SaveAllRegistersAndBailOut);
283
255
case HelperSaveAllRegistersAndBranchBailOut:
284
- return ShiftAddr (context, LinearScanMD::SaveAllRegistersAndBranchBailOut);
256
+ return ShiftStdcallAddr (context, LinearScanMD::SaveAllRegistersAndBranchBailOut);
285
257
286
- #ifdef _M_IX86
258
+ #ifdef _M_IX86
287
259
case HelperSaveAllRegistersNoSse2AndBailOut:
288
- return ShiftAddr (context, LinearScanMD::SaveAllRegistersNoSse2AndBailOut);
260
+ return ShiftStdcallAddr (context, LinearScanMD::SaveAllRegistersNoSse2AndBailOut);
289
261
case HelperSaveAllRegistersNoSse2AndBranchBailOut:
290
- return ShiftAddr (context, LinearScanMD::SaveAllRegistersNoSse2AndBranchBailOut);
291
- #endif
262
+ return ShiftStdcallAddr (context, LinearScanMD::SaveAllRegistersNoSse2AndBranchBailOut);
263
+ #endif
292
264
293
265
}
294
266
0 commit comments