I'm writing hooker code which patch ARM function prologue to do it. Since ARM can run in two mode, Hooker have to choose right opcode (thumb or not) to patch prologue.
How can I make it to determine patching target is using thumb or 32-bit ARM instruction?
In my case, I was working in linux kernel. After looking around for kprobe() code, I found CONFIG_THUMB2_KERNEL macro.
Since it is not generic solution, I can solve my problem with that macro to decide opcode to patch in compile time.