예제 #1
0
void NativeJump::patch_verified_entry(address entry, address verified_entry, address dest) {
  uint41_t new_X;
  uint41_t new_L;

  // Not even remotely MT safe
  IPF_Bundle *bundle = (IPF_Bundle *)(nativeInstruction_at(verified_entry)->addr_at(0));

  M37 nopfill(1, 0, PR0);
  X3 branch(0, (uint) Assembler::sptk, (uint) Assembler::few, (uint) Assembler::keep, 0, PR0);

  branch.set_target((uint64_t)(dest - verified_entry), branch.bits(), new_X, new_L);

  bundle->set(IPF_Bundle::MLX, nopfill.bits(), new_L, new_X);

  ICache::invalidate_range((address)bundle, sizeof(bundle));
}