Function report |
Source Code:arch\x86\kernel\alternative.c |
Create Date:2022-07-28 07:45:03 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Replace instructions with better alternatives for this CPU type. This runs* before SMP is initialized to avoid SMP problems with self modifying code.* This implies that asymmetric systems where APs have less capabilities than
Proto:void __init_or_module noinline apply_alternatives(struct alt_instr *start, struct alt_instr *end)
Type:void
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct alt_instr * | start | |
| struct alt_instr * | end |
| 388 | insn_buff_sz = 0 |
| 390 | instr = (u8 * ) & original instruction + original instruction |
| 392 | BUG_ON( length of original instruction > size of insn_buff ) |
| 393 | BUG_ON( cpuid bit set for replacement >= (N 32-bit words worth of info + N 32-bit bug flags ) * 32) |
| 394 | If Not boot_cpu_has( cpuid bit set for replacement ) Then |
| 395 | If length of build-time padding > 1 Then "noinline" to cause control flow change and thus invalidate I$ and* cause refetch after modification. |
| 398 | Continue |
| 401 | DPRINTK("feat: %d*32+%d, old: (%pS (%px) len: %d), repl: (%px, len: %d), pad: %d", cpuid bit set for replacement >> 5, cpuid bit set for replacement & 0x1f, instr, instr, length of original instruction , replacement, length of new instruction , length of build-time padding ) |
| 407 | DUMP_BYTES(instr, length of original instruction , "%px: old_insn: ", instr) |
| 408 | DUMP_BYTES(replacement, length of new instruction , "%px: rpl_insn: ", replacement) |
| 419 | If length of new instruction == 5 && insn_buff == 0xe8 Then |
| 420 | *(insn_buff + 1) += replacement - instr |
| 426 | If length of new instruction && Are we looking at a near JMP with a 1 or 4-byte displacement. Then recompute_jump(a, instr, replacement, insn_buff) |
| 429 | If length of original instruction > length of new instruction Then |
| 434 | DUMP_BYTES(insn_buff, insn_buff_sz, "%px: final_insn: ", instr) |
| Name | Describe |
|---|---|
| alternative_instructions | |
| arch_klp_init_object_loaded | Apply per-object alternatives. Based on x86 module_finalize() |
| module_finalize |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |