• Home
  • Raw
  • Download

Lines Matching full:addr

38 int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr)  in raw_patch_instruction()  argument
40 return __patch_instruction(addr, instr, addr); in raw_patch_instruction()
88 static int map_patch_area(void *addr, unsigned long text_poke_addr) in map_patch_area() argument
93 if (is_vmalloc_or_module_addr(addr)) in map_patch_area()
94 pfn = vmalloc_to_pfn(addr); in map_patch_area()
96 pfn = __pa_symbol(addr) >> PAGE_SHIFT; in map_patch_area()
100 pr_devel("Mapped addr %lx with pfn %lx:%d\n", text_poke_addr, pfn, err); in map_patch_area()
107 static inline int unmap_patch_area(unsigned long addr) in unmap_patch_area() argument
115 pgdp = pgd_offset_k(addr); in unmap_patch_area()
119 p4dp = p4d_offset(pgdp, addr); in unmap_patch_area()
123 pudp = pud_offset(p4dp, addr); in unmap_patch_area()
127 pmdp = pmd_offset(pudp, addr); in unmap_patch_area()
131 ptep = pte_offset_kernel(pmdp, addr); in unmap_patch_area()
135 pr_devel("clearing mm %p, pte %p, addr %lx\n", &init_mm, ptep, addr); in unmap_patch_area()
140 pte_clear(&init_mm, addr, ptep); in unmap_patch_area()
141 flush_tlb_kernel_range(addr, addr + PAGE_SIZE); in unmap_patch_area()
146 static int do_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) in do_patch_instruction() argument
152 unsigned long kaddr = (unsigned long)addr; in do_patch_instruction()
160 return raw_patch_instruction(addr, instr); in do_patch_instruction()
164 text_poke_addr = (unsigned long)__this_cpu_read(text_poke_area)->addr; in do_patch_instruction()
165 if (map_patch_area(addr, text_poke_addr)) { in do_patch_instruction()
172 __patch_instruction(addr, instr, patch_addr); in do_patch_instruction()
185 static int do_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) in do_patch_instruction() argument
187 return raw_patch_instruction(addr, instr); in do_patch_instruction()
192 int patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) in patch_instruction() argument
195 if (init_mem_is_free && init_section_contains(addr, 4)) { in patch_instruction()
196 pr_debug("Skipping init section patching addr: 0x%px\n", addr); in patch_instruction()
199 return do_patch_instruction(addr, instr); in patch_instruction()
203 int patch_branch(struct ppc_inst *addr, unsigned long target, int flags) in patch_branch() argument
207 create_branch(&instr, addr, target, flags); in patch_branch()
208 return patch_instruction(addr, instr); in patch_branch()
261 const struct ppc_inst *addr, in create_branch() argument
269 offset = offset - (unsigned long)addr; in create_branch()
281 int create_cond_branch(struct ppc_inst *instr, const struct ppc_inst *addr, in create_cond_branch() argument
288 offset = offset - (unsigned long)addr; in create_cond_branch()
370 int instr_is_branch_to_addr(const struct ppc_inst *instr, unsigned long addr) in instr_is_branch_to_addr() argument
374 return branch_target(instr) == addr; in instr_is_branch_to_addr()
396 void __patch_exception(int exc, unsigned long addr) in __patch_exception() argument
407 patch_branch((struct ppc_inst *)(ibase + (exc / 4) + 1), addr, 0); in __patch_exception()
425 unsigned long addr; in test_branch_iform() local
427 addr = (unsigned long)&instr; in test_branch_iform()
455 check(instr_is_branch_to_addr(&instr, addr + 0x1FFFFFC)); in test_branch_iform()
458 check(instr_is_branch_to_addr(&instr, addr - 4)); in test_branch_iform()
461 check(instr_is_branch_to_addr(&instr, addr - 0x2000000)); in test_branch_iform()
464 err = create_branch(&instr, &instr, addr, BRANCH_SET_LINK); in test_branch_iform()
465 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_iform()
468 err = create_branch(&instr, &instr, addr - 0x100, BRANCH_SET_LINK); in test_branch_iform()
469 check(instr_is_branch_to_addr(&instr, addr - 0x100)); in test_branch_iform()
472 err = create_branch(&instr, &instr, addr + 0x100, 0); in test_branch_iform()
473 check(instr_is_branch_to_addr(&instr, addr + 0x100)); in test_branch_iform()
476 err = create_branch(&instr, &instr, addr - 0x2000000, BRANCH_SET_LINK); in test_branch_iform()
477 check(instr_is_branch_to_addr(&instr, addr - 0x2000000)); in test_branch_iform()
480 err = create_branch(&instr, &instr, addr - 0x2000004, BRANCH_SET_LINK); in test_branch_iform()
484 err = create_branch(&instr, &instr, addr + 0x2000000, BRANCH_SET_LINK); in test_branch_iform()
488 err = create_branch(&instr, &instr, addr + 3, BRANCH_SET_LINK); in test_branch_iform()
492 err = create_branch(&instr, &instr, addr, 0xFFFFFFFC); in test_branch_iform()
493 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_iform()
514 unsigned long addr; in test_branch_bform() local
519 addr = (unsigned long)iptr; in test_branch_bform()
538 check(instr_is_branch_to_addr(&instr, addr + 0x7FFC)); in test_branch_bform()
541 check(instr_is_branch_to_addr(&instr, addr - 4)); in test_branch_bform()
544 check(instr_is_branch_to_addr(&instr, addr - 0x8000)); in test_branch_bform()
550 err = create_cond_branch(&instr, iptr, addr, flags); in test_branch_bform()
551 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_bform()
554 err = create_cond_branch(&instr, iptr, addr - 0x100, flags); in test_branch_bform()
555 check(instr_is_branch_to_addr(&instr, addr - 0x100)); in test_branch_bform()
558 err = create_cond_branch(&instr, iptr, addr + 0x100, flags); in test_branch_bform()
559 check(instr_is_branch_to_addr(&instr, addr + 0x100)); in test_branch_bform()
562 err = create_cond_branch(&instr, iptr, addr - 0x8000, flags); in test_branch_bform()
563 check(instr_is_branch_to_addr(&instr, addr - 0x8000)); in test_branch_bform()
566 err = create_cond_branch(&instr, iptr, addr - 0x8004, flags); in test_branch_bform()
570 err = create_cond_branch(&instr, iptr, addr + 0x8000, flags); in test_branch_bform()
574 err = create_cond_branch(&instr, iptr, addr + 3, flags); in test_branch_bform()
578 err = create_cond_branch(&instr, iptr, addr, 0xFFFFFFFC); in test_branch_bform()
579 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_bform()
585 unsigned long addr; in test_translate_branch() local
597 addr = (unsigned long)p; in test_translate_branch()
598 patch_branch(p, addr, 0); in test_translate_branch()
599 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
603 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
605 /* Maximum negative case, move b . to addr + 32 MB */ in test_translate_branch()
607 addr = (unsigned long)p; in test_translate_branch()
608 patch_branch(p, addr, 0); in test_translate_branch()
612 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
613 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
618 addr = (unsigned long)p; in test_translate_branch()
619 patch_branch(p, addr, 0); in test_translate_branch()
623 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
624 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
629 addr = 0x1000000 + (unsigned long)buf; in test_translate_branch()
630 patch_branch(p, addr, BRANCH_SET_LINK); in test_translate_branch()
634 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
635 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
639 addr = 0x2000000 + (unsigned long)buf; in test_translate_branch()
640 patch_branch(p, addr, 0); in test_translate_branch()
644 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
645 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
652 addr = (unsigned long)p; in test_translate_branch()
653 create_cond_branch(&instr, p, addr, 0); in test_translate_branch()
655 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
659 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
661 /* Maximum negative case, move b . to addr + 32 KB */ in test_translate_branch()
663 addr = (unsigned long)p; in test_translate_branch()
664 create_cond_branch(&instr, p, addr, 0xFFFFFFFC); in test_translate_branch()
669 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
670 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
675 addr = (unsigned long)p; in test_translate_branch()
676 create_cond_branch(&instr, p, addr, 0xFFFFFFFC); in test_translate_branch()
681 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
682 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
687 addr = 0x3000 + (unsigned long)buf; in test_translate_branch()
688 create_cond_branch(&instr, p, addr, BRANCH_SET_LINK); in test_translate_branch()
693 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
694 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
698 addr = 0x4000 + (unsigned long)buf; in test_translate_branch()
699 create_cond_branch(&instr, p, addr, 0); in test_translate_branch()
704 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
705 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()