Skip to content

Commit 199f7dd

Browse files
committed
[XRay][X86] Remove sled version 0 support from patchCustomEvent
This is remnant after D140739.
1 parent b7a86d0 commit 199f7dd

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

compiler-rt/lib/xray/xray_x86_64.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,8 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
250250
const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
251251
// Here we do the dance of replacing the following sled:
252252
//
253-
// In Version 0:
254-
//
255253
// xray_sled_n:
256-
// jmp +20 // 2 bytes
254+
// jmp +15 // 2 bytes
257255
// ...
258256
//
259257
// With the following:
@@ -262,36 +260,17 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
262260
// ...
263261
//
264262
//
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'.
274264
const uint64_t Address = Sled.address();
275265
if (Enable) {
276266
std::atomic_store_explicit(
277267
reinterpret_cast<std::atomic<uint16_t> *>(Address), NopwSeq,
278268
std::memory_order_release);
279269
} 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+
}
295274
return false;
296275
}
297276

0 commit comments

Comments
 (0)