powerpc: Introduce functions for instruction equality
In preparation for an instruction data type that can not be directly used with the '==' operator use functions for checking equality. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Balamuruhan S <bala24@linux.ibm.com> Link: https://lore.kernel.org/r/20200506034050.24806-11-jniethe5@gmail.com
This commit is contained in:

committed by
Michael Ellerman

parent
aabd2233b6
commit
217862d9b9
@@ -479,7 +479,7 @@ static void __init test_branch_iform(void)
|
||||
/* Check flags are masked correctly */
|
||||
err = create_branch(&instr, &instr, addr, 0xFFFFFFFC);
|
||||
check(instr_is_branch_to_addr(&instr, addr));
|
||||
check(instr == ppc_inst(0x48000000));
|
||||
check(ppc_inst_equal(instr, ppc_inst(0x48000000)));
|
||||
}
|
||||
|
||||
static void __init test_create_function_call(void)
|
||||
@@ -564,7 +564,7 @@ static void __init test_branch_bform(void)
|
||||
/* Check flags are masked correctly */
|
||||
err = create_cond_branch(&instr, iptr, addr, 0xFFFFFFFC);
|
||||
check(instr_is_branch_to_addr(&instr, addr));
|
||||
check(instr == ppc_inst(0x43FF0000));
|
||||
check(ppc_inst_equal(instr, ppc_inst(0x43FF0000)));
|
||||
}
|
||||
|
||||
static void __init test_translate_branch(void)
|
||||
@@ -598,7 +598,7 @@ static void __init test_translate_branch(void)
|
||||
patch_instruction(q, instr);
|
||||
check(instr_is_branch_to_addr(p, addr));
|
||||
check(instr_is_branch_to_addr(q, addr));
|
||||
check(*q == ppc_inst(0x4a000000));
|
||||
check(ppc_inst_equal(*q, ppc_inst(0x4a000000)));
|
||||
|
||||
/* Maximum positive case, move x to x - 32 MB + 4 */
|
||||
p = buf + 0x2000000;
|
||||
@@ -609,7 +609,7 @@ static void __init test_translate_branch(void)
|
||||
patch_instruction(q, instr);
|
||||
check(instr_is_branch_to_addr(p, addr));
|
||||
check(instr_is_branch_to_addr(q, addr));
|
||||
check(*q == ppc_inst(0x49fffffc));
|
||||
check(ppc_inst_equal(*q, ppc_inst(0x49fffffc)));
|
||||
|
||||
/* Jump to x + 16 MB moved to x + 20 MB */
|
||||
p = buf;
|
||||
@@ -655,7 +655,7 @@ static void __init test_translate_branch(void)
|
||||
patch_instruction(q, instr);
|
||||
check(instr_is_branch_to_addr(p, addr));
|
||||
check(instr_is_branch_to_addr(q, addr));
|
||||
check(*q == ppc_inst(0x43ff8000));
|
||||
check(ppc_inst_equal(*q, ppc_inst(0x43ff8000)));
|
||||
|
||||
/* Maximum positive case, move x to x - 32 KB + 4 */
|
||||
p = buf + 0x8000;
|
||||
@@ -667,7 +667,7 @@ static void __init test_translate_branch(void)
|
||||
patch_instruction(q, instr);
|
||||
check(instr_is_branch_to_addr(p, addr));
|
||||
check(instr_is_branch_to_addr(q, addr));
|
||||
check(*q == ppc_inst(0x43ff7ffc));
|
||||
check(ppc_inst_equal(*q, ppc_inst(0x43ff7ffc)));
|
||||
|
||||
/* Jump to x + 12 KB moved to x + 20 KB */
|
||||
p = buf;
|
||||
|
Reference in New Issue
Block a user