lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 26 Jun 2006 10:09:10 +0200
FromHeiko Carstens <>
SubjectRe: [PATCH] kprobes for s390 architecture
> 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.

Indeed. Another thing that should not be forgotten: it could be that the
whole kernel text segment resides in a shared read only segment. So it can
be shared by multiple z/VM guests.
In that case the cs instruction will fail. Looks like you need to write the
part that replaces the instruction in assembly and supply a fixup section
which in turn makes sure that -EFAULT is returned.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-26 10:12    [from the cache]
©2003-2008