Skip to content

Commit 9308579

Browse files
MQ-mengqingtsbogend
authored andcommitted
MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op
mm16_r5_format.rt is 5 bits, so directly judge the value if equal or not. mm_jalr_op requires 7th to 16th bits. These 10 which bits generated by shifting u_format.uimmediate by 6 may be affected by sign extension. Thus, take out the 10 bits for comparison. Without this patch, errors may occur, such as these bits are all ones. Signed-off-by: Jinyang He <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent fa85d6a commit 9308579

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/mips/kernel/process.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ static inline int is_jump_ins(union mips_instruction *ip)
294294
* microMIPS is kind of more fun...
295295
*/
296296
if (mm_insn_16bit(ip->word >> 16)) {
297-
if ((ip->mm16_r5_format.opcode == mm_pool16c_op &&
298-
(ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op))
297+
if (ip->mm16_r5_format.opcode == mm_pool16c_op &&
298+
ip->mm16_r5_format.rt == mm_jr16_op)
299299
return 1;
300300
return 0;
301301
}
@@ -307,7 +307,7 @@ static inline int is_jump_ins(union mips_instruction *ip)
307307
if (ip->r_format.opcode != mm_pool32a_op ||
308308
ip->r_format.func != mm_pool32axf_op)
309309
return 0;
310-
return ((ip->u_format.uimmediate >> 6) & mm_jalr_op) == mm_jalr_op;
310+
return ((ip->u_format.uimmediate >> 6) & GENMASK(9, 0)) == mm_jalr_op;
311311
#else
312312
if (ip->j_format.opcode == j_op)
313313
return 1;

0 commit comments

Comments
 (0)