@@ -250,10 +250,8 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
250
250
const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
251
251
// Here we do the dance of replacing the following sled:
252
252
//
253
- // In Version 0:
254
- //
255
253
// xray_sled_n:
256
- // jmp +20 // 2 bytes
254
+ // jmp +15 // 2 bytes
257
255
// ...
258
256
//
259
257
// With the following:
@@ -262,36 +260,17 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
262
260
// ...
263
261
//
264
262
//
265
- // The "unpatch" should just turn the 'nopw' back to a 'jmp +20'.
266
- //
267
- // ---
268
- //
269
- // In Version 1 or 2:
270
- //
271
- // The jump offset is now 15 bytes (0x0f), so when restoring the nopw back
272
- // to a jmp, use 15 bytes instead.
273
- //
263
+ // The "unpatch" should just turn the 'nopw' back to a 'jmp +15'.
274
264
const uint64_t Address = Sled.address ();
275
265
if (Enable) {
276
266
std::atomic_store_explicit (
277
267
reinterpret_cast <std::atomic<uint16_t > *>(Address), NopwSeq,
278
268
std::memory_order_release);
279
269
} else {
280
- switch (Sled.Version ) {
281
- case 1 :
282
- case 2 :
283
- std::atomic_store_explicit (
284
- reinterpret_cast <std::atomic<uint16_t > *>(Address), Jmp15Seq,
285
- std::memory_order_release);
286
- break ;
287
- case 0 :
288
- default :
289
- std::atomic_store_explicit (
290
- reinterpret_cast <std::atomic<uint16_t > *>(Address), Jmp20Seq,
291
- std::memory_order_release);
292
- break ;
293
- }
294
- }
270
+ std::atomic_store_explicit (
271
+ reinterpret_cast <std::atomic<uint16_t > *>(Address), Jmp15Seq,
272
+ std::memory_order_release);
273
+ }
295
274
return false ;
296
275
}
297
276
0 commit comments