Open ZMer2019 opened 5 years ago
It seems that you are really curious about this issue... ;) (https://github.com/didi/kemon/issues/2)
Let me answer this question for @SilverMoonSecurity / Yuefeng, here is the solution: https://developer.apple.com/library/archive/releasenotes/Performance/RN-AffinityAPI/#//apple_ref/doc/uid/TP40006635-CH1-DontLinkElementID_2
An application that wants to place a thread on every available processor would do the following:
By using the above method, you can have one thread complete the inline hook operation and the rest start to spin.
code:
Actually,"trampoline" generally destroys multiple instructions, in SMP system, how to make theses code thread safe?