[PATCH] kprobes for s390 architecture

Mike Grundy grundym@us.ibm.com
Mon Jun 26 08:10:00 GMT 2006


On Sat, Jun 24, 2006 at 02:15:41PM +0200, Heiko Carstens wrote:
> > Just do a compare and swap operation on the instruction you want to replace,
> > then do an smp_call_function() with the wait parameter set to 1 and passing
> > a pointer to a function that does nothing but return.
Here's what I came up with Friday before I jumped timezones back east:

void smp_replace_instruction(void *info)
{
	struct ins_replace_args *parms;

	parms = (struct ins_replace_args *) info;
	cmpxchg(parms->addr, parms->oinsn, parms->ninsn);
}

void __kprobes arch_arm_kprobe(struct kprobe *p)
{
	struct ins_replace_args parms;
	parms.addr = p->addr;
	parms.ninsn = BREAKPOINT_INSTRUCTION;
	parms.oinsn = p->opcode;

	on_each_cpu(smp_replace_instruction, &parms, 0, 1);
} etc...

After reading your notes it's probably overkill doing the cs on each cpu, since
the interrupt will discard the prefetched instructions.

-- 
Thanks
Mike

=========================================
Michael Grundy - grundym@us.ibm.com
Advanced Linux Response Team (ALRT)
http://ltc.linux.ibm.com/teamweb/alrt/
845-435-8842 (T/L 295)

If at first you don't succeed, call in an air strike.



More information about the Systemtap mailing list