 if (slot == 1 && bundle_encoding[template][1] == L) { lx_type_inst = 1; slot = 2; }  switch (slot) { case 0: major_opcode = (bundle->quad0.slot0 >> SLOT0_OPCODE_SHIFT); kprobe_inst = bundle->quad0.slot0; bundle->quad0.slot0 = BREAK_INST; break; case 1: major_opcode = (bundle->quad1.slot1_p1 >> SLOT1_p1_OPCODE_SHIFT); kprobe_inst = (bundle->quad0.slot1_p0 | (bundle->quad1.slot1_p1 << (64-46))); bundle->quad0.slot1_p0 = BREAK_INST; bundle->quad1.slot1_p1 = (BREAK_INST >> (64-46)); break; case 2: major_opcode = (bundle->quad1.slot2 >> SLOT2_OPCODE_SHIFT); kprobe_inst = bundle->quad1.slot2; bundle->quad1.slot2 = BREAK_INST; break; }  /* * Look for IP relative Branches, IP relative call or * IP relative predicate instructions */ if (bundle_encoding[template][slot] == B) { switch (major_opcode) { case INDIRECT_CALL_OPCODE: p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7); break; case IP_RELATIVE_PREDICT_OPCODE: case IP_RELATIVE_BRANCH_OPCODE: p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR; break; case IP_RELATIVE_CALL_OPCODE: p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR; p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7); break; default: /* Do nothing */ break; } } else if (lx_type_inst) { switch (major_opcode) { case LONG_CALL_OPCODE: p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7); break; default: /* Do nothing */ break; } }  
int arch_prepare_kprobe(struct kprobe *p){	unsigned long addr = (unsigned long) p->addr;	unsigned long bundle_addr = addr & ~0xFULL;	unsigned long slot = addr & 0xf;	bundle_t bundle;	unsigned long template;	/*	 * TODO: Verify that a probe is not being inserted	 *       in sensitive regions of code	 * TODO: Verify that the memory holding the probe is rwx	 * TODO: verify this is a kernel address	 */	memcpy(&bundle, (unsigned long *)bundle_addr, sizeof(bundle_t));	template = bundle.quad0.template;	if (((bundle_encoding[template][1] == L) && slot > 1) || (slot > 2)) {		printk(KERN_WARNING "Attempting to insert unaligned kprobe at 0x%lx\n", addr);		return -EINVAL;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8bc76772ad653bcaad1b0af72aafb6072ef0fa87/kprobes.c/buggy/arch/ia64/kernel/kprobes.c