#define DPRINTK(fmt, args...) \ do { \ if (debug_alternative) \
printk(KERN_DEBUG "%s: " fmt "\n", __func__, ##args); \
} while (0)
#define DUMP_WORDS(buf, count, fmt, args...) \ do { \ if (unlikely(debug_alternative)) { \ int _j; \ union loongarch_instruction *_buf = buf; \
\ if (!(count)) \ break; \
\
printk(KERN_DEBUG fmt, ##args); \ for (_j = 0; _j < count - 1; _j++) \
printk(KERN_CONT "<%08x> ", _buf[_j].word); \
printk(KERN_CONT "<%08x>\n", _buf[_j].word); \
} \
} while (0)
/* Use this to add nops to a buffer, then text_poke the whole buffer. */ staticvoid __init_or_module add_nops(union loongarch_instruction *insn, int count)
{ while (count--) {
insn->word = INSN_NOP;
insn++;
}
}
/* Is the jump addr in local .altinstructions */ staticinlinebool in_alt_jump(unsignedlong jump, void *start, void *end)
{ return jump >= (unsignedlong)start && jump < (unsignedlong)end;
}
staticvoid __init_or_module recompute_jump(union loongarch_instruction *buf, union loongarch_instruction *dest, union loongarch_instruction *src, void *start, void *end)
{ unsignedint si, si_l, si_h; unsignedlong cur_pc, jump_addr, pc; long offset;
cur_pc = (unsignedlong)src;
pc = (unsignedlong)dest;
si = src->reg2i16_format.immediate; switch (src->reg2i16_format.opcode) { case beq_op: case bne_op: case blt_op: case bge_op: case bltu_op: case bgeu_op:
jump_addr = cur_pc + sign_extend64(si << 2, 17); if (in_alt_jump(jump_addr, start, end)) return;
offset = jump_addr - pc;
BUG_ON(offset < -SZ_128K || offset >= SZ_128K);
offset >>= 2;
buf->reg2i16_format.immediate = offset; return;
}
}
staticint __init_or_module copy_alt_insns(union loongarch_instruction *buf, union loongarch_instruction *dest, union loongarch_instruction *src, int nr)
{ int i;
for (i = 0; i < nr; i++) {
buf[i].word = src[i].word;
if (is_pc_ins(&src[i])) {
pr_err("Not support pcrel instruction at present!"); return -EINVAL;
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.7Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.