Lines Matching +full:0 +full:x4a000000

17 	return 0;  in instr_is_branch_to_addr()
28 } while (0)
39 check(instr_is_branch_iform(ppc_inst(0x48000000))); in test_branch_iform()
41 check(instr_is_branch_iform(ppc_inst(0x4bffffff))); in test_branch_iform()
43 check(!instr_is_branch_iform(ppc_inst(0xcbffffff))); in test_branch_iform()
45 check(!instr_is_branch_iform(ppc_inst(0x7bffffff))); in test_branch_iform()
48 check(instr_is_branch_iform(ppc_inst(0x48000001))); in test_branch_iform()
50 check(instr_is_branch_iform(ppc_inst(0x4bfffffd))); in test_branch_iform()
52 check(instr_is_branch_iform(ppc_inst(0x4bff00fd))); in test_branch_iform()
54 check(!instr_is_branch_iform(ppc_inst(0x7bfffffd))); in test_branch_iform()
56 /* Absolute branch to 0x100 */ in test_branch_iform()
57 ppc_inst_write(iptr, ppc_inst(0x48000103)); in test_branch_iform()
58 check(instr_is_branch_to_addr(iptr, 0x100)); in test_branch_iform()
59 /* Absolute branch to 0x420fc */ in test_branch_iform()
60 ppc_inst_write(iptr, ppc_inst(0x480420ff)); in test_branch_iform()
61 check(instr_is_branch_to_addr(iptr, 0x420fc)); in test_branch_iform()
63 ppc_inst_write(iptr, ppc_inst(0x49fffffc)); in test_branch_iform()
64 check(instr_is_branch_to_addr(iptr, addr + 0x1FFFFFC)); in test_branch_iform()
66 ppc_inst_write(iptr, ppc_inst(0x4bfffffc)); in test_branch_iform()
69 ppc_inst_write(iptr, ppc_inst(0x4a000000)); in test_branch_iform()
70 check(instr_is_branch_to_addr(iptr, addr - 0x2000000)); in test_branch_iform()
77 /* Branch to self - 0x100, with link */ in test_branch_iform()
78 err = create_branch(&instr, iptr, addr - 0x100, BRANCH_SET_LINK); in test_branch_iform()
80 check(instr_is_branch_to_addr(iptr, addr - 0x100)); in test_branch_iform()
82 /* Branch to self + 0x100, no link */ in test_branch_iform()
83 err = create_branch(&instr, iptr, addr + 0x100, 0); in test_branch_iform()
85 check(instr_is_branch_to_addr(iptr, addr + 0x100)); in test_branch_iform()
88 err = create_branch(&instr, iptr, addr - 0x2000000, BRANCH_SET_LINK); in test_branch_iform()
90 check(instr_is_branch_to_addr(iptr, addr - 0x2000000)); in test_branch_iform()
93 err = create_branch(&instr, iptr, addr - 0x2000004, BRANCH_SET_LINK); in test_branch_iform()
97 err = create_branch(&instr, iptr, addr + 0x2000000, BRANCH_SET_LINK); in test_branch_iform()
105 err = create_branch(&instr, iptr, addr, 0xFFFFFFFC); in test_branch_iform()
108 check(ppc_inst_equal(instr, ppc_inst(0x48000000))); in test_branch_iform()
137 check(instr_is_branch_bform(ppc_inst(0x40000000))); in test_branch_bform()
139 check(instr_is_branch_bform(ppc_inst(0x43ffffff))); in test_branch_bform()
141 check(!instr_is_branch_bform(ppc_inst(0xc3ffffff))); in test_branch_bform()
143 check(!instr_is_branch_bform(ppc_inst(0x7bffffff))); in test_branch_bform()
145 /* Absolute conditional branch to 0x100 */ in test_branch_bform()
146 ppc_inst_write(iptr, ppc_inst(0x43ff0103)); in test_branch_bform()
147 check(instr_is_branch_to_addr(iptr, 0x100)); in test_branch_bform()
148 /* Absolute conditional branch to 0x20fc */ in test_branch_bform()
149 ppc_inst_write(iptr, ppc_inst(0x43ff20ff)); in test_branch_bform()
150 check(instr_is_branch_to_addr(iptr, 0x20fc)); in test_branch_bform()
152 ppc_inst_write(iptr, ppc_inst(0x43ff7ffc)); in test_branch_bform()
153 check(instr_is_branch_to_addr(iptr, addr + 0x7FFC)); in test_branch_bform()
155 ppc_inst_write(iptr, ppc_inst(0x43fffffc)); in test_branch_bform()
158 ppc_inst_write(iptr, ppc_inst(0x43ff8000)); in test_branch_bform()
159 check(instr_is_branch_to_addr(iptr, addr - 0x8000)); in test_branch_bform()
162 flags = 0x3ff000 | BRANCH_SET_LINK; in test_branch_bform()
169 /* Branch to self - 0x100 */ in test_branch_bform()
170 err = create_cond_branch(&instr, iptr, addr - 0x100, flags); in test_branch_bform()
172 check(instr_is_branch_to_addr(iptr, addr - 0x100)); in test_branch_bform()
174 /* Branch to self + 0x100 */ in test_branch_bform()
175 err = create_cond_branch(&instr, iptr, addr + 0x100, flags); in test_branch_bform()
177 check(instr_is_branch_to_addr(iptr, addr + 0x100)); in test_branch_bform()
180 err = create_cond_branch(&instr, iptr, addr - 0x8000, flags); in test_branch_bform()
182 check(instr_is_branch_to_addr(iptr, addr - 0x8000)); in test_branch_bform()
185 err = create_cond_branch(&instr, iptr, addr - 0x8004, flags); in test_branch_bform()
189 err = create_cond_branch(&instr, iptr, addr + 0x8000, flags); in test_branch_bform()
197 err = create_cond_branch(&instr, iptr, addr, 0xFFFFFFFC); in test_branch_bform()
200 check(ppc_inst_equal(instr, ppc_inst(0x43FF0000))); in test_branch_bform()
210 buf = vmalloc(PAGE_ALIGN(0x2000000 + 1)); in test_translate_branch()
218 create_branch(&instr, p, addr, 0); in test_translate_branch()
229 create_branch(&instr, p, addr, 0); in test_translate_branch()
231 q = buf + 0x2000000; in test_translate_branch()
236 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x4a000000))); in test_translate_branch()
239 p = buf + 0x2000000; in test_translate_branch()
241 create_branch(&instr, p, addr, 0); in test_translate_branch()
248 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x49fffffc))); in test_translate_branch()
252 addr = 0x1000000 + (unsigned long)buf; in test_translate_branch()
255 q = buf + 0x1400000; in test_translate_branch()
262 p = buf + 0x1000000; in test_translate_branch()
263 addr = 0x2000000 + (unsigned long)buf; in test_translate_branch()
264 create_branch(&instr, p, addr, 0); in test_translate_branch()
278 create_cond_branch(&instr, p, addr, 0); in test_translate_branch()
289 create_cond_branch(&instr, p, addr, 0xFFFFFFFC); in test_translate_branch()
291 q = buf + 0x8000; in test_translate_branch()
296 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x43ff8000))); in test_translate_branch()
299 p = buf + 0x8000; in test_translate_branch()
301 create_cond_branch(&instr, p, addr, 0xFFFFFFFC); in test_translate_branch()
308 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x43ff7ffc))); in test_translate_branch()
312 addr = 0x3000 + (unsigned long)buf; in test_translate_branch()
315 q = buf + 0x5000; in test_translate_branch()
322 p = buf + 0x2000; in test_translate_branch()
323 addr = 0x4000 + (unsigned long)buf; in test_translate_branch()
324 create_cond_branch(&instr, p, addr, 0); in test_translate_branch()
339 u32 expected[2] = {OP_PREFIX << 26, 0}; in test_prefixed_patching()
340 ppc_inst_t inst = ppc_inst_prefix(OP_PREFIX << 26, 0); in test_prefixed_patching()
368 check(addr32[0] == 0); in test_multi_instruction_patching()
372 check(addr32[4] == 0); in test_multi_instruction_patching()
382 check(addr64[0] == 0); in test_multi_instruction_patching()
386 check(addr64[4] == 0); in test_multi_instruction_patching()
392 for (int i = 0; i < ARRAY_SIZE(code); i++) in test_multi_instruction_patching()
397 check(addr32[0] == 0); in test_multi_instruction_patching()
399 check(addr32[ARRAY_SIZE(code) + 1] == 0); in test_multi_instruction_patching()
405 check(addr32[0] == 0); in test_multi_instruction_patching()
409 check(addr32[4] == 0); in test_multi_instruction_patching()
419 check(addr64[0] == 0); in test_multi_instruction_patching()
423 check(addr64[4] == 0); in test_multi_instruction_patching()
429 for (int i = 0; i < ARRAY_SIZE(code); i++) in test_multi_instruction_patching()
434 check(addr32[0] == 0); in test_multi_instruction_patching()
436 check(addr32[ARRAY_SIZE(code) + 1] == 0); in test_multi_instruction_patching()
453 addr32[1] = 0xA0A1A2A3; in test_data_patching()
454 addr32[2] = 0xB0B1B2B3; in test_data_patching()
456 check(!patch_uint(&addr32[1], 0xC0C1C2C3)); in test_data_patching()
458 check(addr32[0] == 0); in test_data_patching()
459 check(addr32[1] == 0xC0C1C2C3); in test_data_patching()
460 check(addr32[2] == 0xB0B1B2B3); in test_data_patching()
461 check(addr32[3] == 0); in test_data_patching()
465 check(patch_ulong(&addr32[1], 0xD0D1D2D3) == -EINVAL); in test_data_patching()
467 check(!patch_ulong(&addr32[2], 0xD0D1D2D3)); in test_data_patching()
469 check(addr32[0] == 0); in test_data_patching()
470 check(addr32[1] == 0xC0C1C2C3); in test_data_patching()
471 check(*(unsigned long *)(&addr32[2]) == 0xD0D1D2D3); in test_data_patching()
474 check(addr32[3] == 0); in test_data_patching()
476 check(addr32[4] == 0); in test_data_patching()
493 return 0; in test_code_patching()