lkml.org 
[lkml]   [2018]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [patches] [PATCH v2 2/6] riscv/ftrace: Add dynamic function tracer support
On Sun, Jan 14, 2018 at 10:47 PM, Alan Kao <nonerkao@gmail.com> wrote:
> + /*
> + * For the dynamic ftrace to work, here we should reserve at least
> + * 8 bytes for a functional auipc-jalr pair. Pseudo inst nop may be
> + * interpreted as different length in different models, so we manually
> + * *expand* two 4-byte nops here.
> + *
> + * Calling ftrace_update_ftrace_func would overwrite the nops below.
> + * Check ftrace_modify_all_code for details.
> + */
> + addi x0, x0, 0
> + addi x0, x0, 0

This relies on behavior of the assembler which is undocumented and, if
my reading of the specification is correct, a bug.

The documented way to assemble an sequence of 2 4-byte NOPs regardless
of subtarget is as follows:

.option push
.option norvc
nop
nop
.option pop

I have filed https://github.com/riscv/riscv-binutils-gdb/issues/135 to
get clarity on the assembler behavior; the explicit approach may be
preferable even if the assembler behavior turns out to be correct.

-s

\
 
 \ /
  Last update: 2018-01-15 08:25    [W:0.045 / U:3.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site