592 // Assert that we can identify the emitted call/jump. |
592 // Assert that we can identify the emitted call/jump. |
593 assert(is_bxx64_patchable_variant2_at((address)start_pc, link), |
593 assert(is_bxx64_patchable_variant2_at((address)start_pc, link), |
594 "can't identify emitted call"); |
594 "can't identify emitted call"); |
595 } else { |
595 } else { |
596 // variant 1: |
596 // variant 1: |
597 #if defined(ABI_ELFv2) |
|
598 nop(); |
|
599 calculate_address_from_global_toc(R12, dest, true, true, false); |
|
600 mtctr(R12); |
|
601 nop(); |
|
602 nop(); |
|
603 #else |
|
604 mr(R0, R11); // spill R11 -> R0. |
597 mr(R0, R11); // spill R11 -> R0. |
605 |
598 |
606 // Load the destination address into CTR, |
599 // Load the destination address into CTR, |
607 // calculate destination relative to global toc. |
600 // calculate destination relative to global toc. |
608 calculate_address_from_global_toc(R11, dest, true, true, false); |
601 calculate_address_from_global_toc(R11, dest, true, true, false); |
609 |
602 |
610 mtctr(R11); |
603 mtctr(R11); |
611 mr(R11, R0); // spill R11 <- R0. |
604 mr(R11, R0); // spill R11 <- R0. |
612 nop(); |
605 nop(); |
613 #endif |
|
614 |
606 |
615 // do the call/jump |
607 // do the call/jump |
616 if (link) { |
608 if (link) { |
617 bctrl(); |
609 bctrl(); |
618 } else{ |
610 } else{ |