Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
struct alt_instr *start
struct alt_instr *end
377  DPRINTK("alt table %px, -> %px", start, end)
387  When a < end cycle
388  insn_buff_sz = 0
390  instr = (u8 * ) & original instruction + original instruction
391  replacement = (u8 * ) & offset to replacement instruction + offset to replacement 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)
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)
410  memcpy(insn_buff, replacement, length of new instruction )
411  insn_buff_sz = length of new instruction
419  If length of new instruction == 5 && insn_buff == 0xe8 Then
420  *(insn_buff + 1) += replacement - instr
421  DPRINTK("Fix CALL offset: 0x%x, CALL 0x%lx", * (s32 * )(insn_buff + 1), (unsignedlong)instr + * (s32 * )(insn_buff + 1) + 5)
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)
434  DUMP_BYTES(insn_buff, insn_buff_sz, "%px: final_insn: ", instr)
436  xt_poke_early - Update instructions on a live kernel at boot time*@addr: address to modify*@opcode: source of the copy*@len: length to copy* When you use this code to patch more than one byte of an instruction
Caller
NameDescribe
alternative_instructions
arch_klp_init_object_loadedApply per-object alternatives. Based on x86 module_finalize()
module_finalize