Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-15 Thread Masami Hiramatsu
On Wed, 14 Nov 2018 21:52:57 +0100 Patrick Staehlin wrote: > Hi Masami, > > thank you for your remarks. > > On 14.11.18 09:37, Masami Hiramatsu wrote> > > Thank you very much for implementing kprobes on RISC-V :) > > > > On Tue, 13 Nov 2018 20:58:04 +0100 > > Patrick Stählin wrote: > > > >>

Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-14 Thread Masami Hiramatsu
On Wed, 14 Nov 2018 22:10:52 +0100 Patrick Staehlin wrote: > On 14.11.18 16:49, Masami Hiramatsu wrote: > > On Wed, 14 Nov 2018 00:37:30 -0800 > > Masami Hiramatsu wrote: > > > >>> + > >>> +static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) > >>> +{ > >>> + if (is_compressed_ins

Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-14 Thread Patrick Staehlin
On 14.11.18 16:49, Masami Hiramatsu wrote: > On Wed, 14 Nov 2018 00:37:30 -0800 > Masami Hiramatsu wrote: > >>> + >>> +static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) >>> +{ >>> + if (is_compressed_insn(opcode)) >>> + *(u16 *)addr = cpu_to_le16(opcode); >>> + else

Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-14 Thread Patrick Staehlin
Hi Masami, thank you for your remarks. On 14.11.18 09:37, Masami Hiramatsu wrote> > Thank you very much for implementing kprobes on RISC-V :) > > On Tue, 13 Nov 2018 20:58:04 +0100 > Patrick Stählin wrote: > >> First implementation, adapted from arm64. The C.ADDISP16 instruction >> gets simula

Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-14 Thread Masami Hiramatsu
On Wed, 14 Nov 2018 00:37:30 -0800 Masami Hiramatsu wrote: > > + > > +static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) > > +{ > > + if (is_compressed_insn(opcode)) > > + *(u16 *)addr = cpu_to_le16(opcode); > > + else > > + *addr = cpu_to_le32(opcode); > >

Re: [RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-14 Thread Masami Hiramatsu
Hi Patrick, Thank you very much for implementing kprobes on RISC-V :) On Tue, 13 Nov 2018 20:58:04 +0100 Patrick Stählin wrote: > First implementation, adapted from arm64. The C.ADDISP16 instruction > gets simulated and the kprobes-handler called by inserting a C.EBREAK > instruction. > > C.AD

[RFC/RFT 2/2] RISC-V: kprobes/kretprobe support

2018-11-13 Thread Patrick Stählin
First implementation, adapted from arm64. The C.ADDISP16 instruction gets simulated and the kprobes-handler called by inserting a C.EBREAK instruction. C.ADDISP16 was chosen as it sets-up the stack frame for functions. Some work has been done to support probes on non-compressed instructions but th