Lines Matching refs:opcode

36 bool __kprobes simulate_jal(u32 opcode, unsigned long addr, struct pt_regs *regs)  in simulate_jal()  argument
45 u32 index = (opcode >> 7) & 0x1f; in simulate_jal()
51 imm = ((opcode >> 21) & 0x3ff) << 1; in simulate_jal()
52 imm |= ((opcode >> 20) & 0x1) << 11; in simulate_jal()
53 imm |= ((opcode >> 12) & 0xff) << 12; in simulate_jal()
54 imm |= ((opcode >> 31) & 0x1) << 20; in simulate_jal()
61 bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_jalr() argument
70 u32 imm = (opcode >> 20) & 0xfff; in simulate_jalr()
71 u32 rd_index = (opcode >> 7) & 0x1f; in simulate_jalr()
72 u32 rs1_index = (opcode >> 15) & 0x1f; in simulate_jalr()
87 #define auipc_rd_idx(opcode) \ argument
88 ((opcode >> 7) & 0x1f)
90 #define auipc_imm(opcode) \ argument
91 ((((opcode) >> 12) & 0xfffff) << 12)
94 #define auipc_offset(opcode) sign_extend64(auipc_imm(opcode), 31) argument
96 #define auipc_offset(opcode) auipc_imm(opcode) argument
101 bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_auipc() argument
110 u32 rd_idx = auipc_rd_idx(opcode); in simulate_auipc()
111 unsigned long rd_val = addr + auipc_offset(opcode); in simulate_auipc()
121 #define branch_rs1_idx(opcode) \ argument
122 (((opcode) >> 15) & 0x1f)
124 #define branch_rs2_idx(opcode) \ argument
125 (((opcode) >> 20) & 0x1f)
127 #define branch_funct3(opcode) \ argument
128 (((opcode) >> 12) & 0x7)
130 #define branch_imm(opcode) \ argument
131 (((((opcode) >> 8) & 0xf ) << 1) | \
132 ((((opcode) >> 25) & 0x3f) << 5) | \
133 ((((opcode) >> 7) & 0x1 ) << 11) | \
134 ((((opcode) >> 31) & 0x1 ) << 12))
136 #define branch_offset(opcode) \ argument
137 sign_extend32((branch_imm(opcode)), 12)
139 bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_branch() argument
159 if (!rv_insn_reg_get_val(regs, branch_rs1_idx(opcode), &rs1_val) || in simulate_branch()
160 !rv_insn_reg_get_val(regs, branch_rs2_idx(opcode), &rs2_val)) in simulate_branch()
163 offset_tmp = branch_offset(opcode); in simulate_branch()
164 switch (branch_funct3(opcode)) { in simulate_branch()
192 bool __kprobes simulate_c_j(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_c_j() argument
202 offset = ((opcode >> 3) & 0x7) << 1; in simulate_c_j()
203 offset |= ((opcode >> 11) & 0x1) << 4; in simulate_c_j()
204 offset |= ((opcode >> 2) & 0x1) << 5; in simulate_c_j()
205 offset |= ((opcode >> 7) & 0x1) << 6; in simulate_c_j()
206 offset |= ((opcode >> 6) & 0x1) << 7; in simulate_c_j()
207 offset |= ((opcode >> 9) & 0x3) << 8; in simulate_c_j()
208 offset |= ((opcode >> 8) & 0x1) << 10; in simulate_c_j()
209 offset |= ((opcode >> 12) & 0x1) << 11; in simulate_c_j()
216 static bool __kprobes simulate_c_jr_jalr(u32 opcode, unsigned long addr, struct pt_regs *regs, in simulate_c_jr_jalr() argument
227 u32 rs1 = (opcode >> 7) & 0x1f; in simulate_c_jr_jalr()
243 bool __kprobes simulate_c_jr(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_c_jr() argument
245 return simulate_c_jr_jalr(opcode, addr, regs, false); in simulate_c_jr()
248 bool __kprobes simulate_c_jalr(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_c_jalr() argument
250 return simulate_c_jr_jalr(opcode, addr, regs, true); in simulate_c_jalr()
253 static bool __kprobes simulate_c_bnez_beqz(u32 opcode, unsigned long addr, struct pt_regs *regs, in simulate_c_bnez_beqz() argument
266 rs1 = 0x8 | ((opcode >> 7) & 0x7); in simulate_c_bnez_beqz()
272 offset = ((opcode >> 3) & 0x3) << 1; in simulate_c_bnez_beqz()
273 offset |= ((opcode >> 10) & 0x3) << 3; in simulate_c_bnez_beqz()
274 offset |= ((opcode >> 2) & 0x1) << 5; in simulate_c_bnez_beqz()
275 offset |= ((opcode >> 5) & 0x3) << 6; in simulate_c_bnez_beqz()
276 offset |= ((opcode >> 12) & 0x1) << 8; in simulate_c_bnez_beqz()
287 bool __kprobes simulate_c_bnez(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_c_bnez() argument
289 return simulate_c_bnez_beqz(opcode, addr, regs, true); in simulate_c_bnez()
292 bool __kprobes simulate_c_beqz(u32 opcode, unsigned long addr, struct pt_regs *regs) in simulate_c_beqz() argument
294 return simulate_c_bnez_beqz(opcode, addr, regs, false); in simulate_c_beqz()