[PATCH] Build strace for RISC-V
Dmitry V. Levin
ldv at altlinux.org
Fri Aug 19 10:24:50 UTC 2016
On Fri, Aug 19, 2016 at 10:19:13AM +0100, Richard W.M. Jones wrote:
> The original port of strace was done by Palmer Dabbelt
> (eecs.berkeley.edu), based on strace 4.9.
>
> I only modified it to work with upstream strace, and fixed a few
> things.
[...]
> diff --git a/linux/riscv/ioctls_arch0.h b/linux/riscv/ioctls_arch0.h
> new file mode 100644
> index 0000000..d3c4f76
> --- /dev/null
> +++ b/linux/riscv/ioctls_arch0.h
> @@ -0,0 +1 @@
> +/* Generated by ioctls_gen.sh from definitions found in /var/tmp/kernel/arch/riscv/include/ tree. */
Please replace /var/tmp/kernel with $linux.
[...]
> diff --git a/linux/riscv/ioctls_inc0.h b/linux/riscv/ioctls_inc0.h
> new file mode 100644
> index 0000000..b7de83b
> --- /dev/null
> +++ b/linux/riscv/ioctls_inc0.h
> @@ -0,0 +1,2154 @@
> +/* Generated by ioctls_gen.sh from definitions found in /var/tmp/kernel//include/ tree. */
There is no need to add 2154 more lines, just include "64/ioctls_inc.h"
like .e.g. linux/tile/ioctls_inc0.h does.
btw, this generated list is already outdated.
> diff --git a/linux/riscv/ioctls_inc1.h b/linux/riscv/ioctls_inc1.h
> new file mode 100644
> index 0000000..7a11104
> --- /dev/null
> +++ b/linux/riscv/ioctls_inc1.h
> @@ -0,0 +1 @@
> +#include "ioctls_inc0.h"
I suppose this is wrong and the right file to include is "32/ioctls_inc.h".
[...]
> diff --git a/linux/riscv/syscallent.h b/linux/riscv/syscallent.h
> new file mode 100644
> index 0000000..52121cf
> --- /dev/null
> +++ b/linux/riscv/syscallent.h
> @@ -0,0 +1,274 @@
According to
https://github.com/riscv/riscv-linux/blob/master/arch/riscv/include/uapi/asm/unistd.h
the syscall table is based on the generic one, so this file should just
include "64/syscallent.h" and define arch specific entries, like e.g.
linux/tile/syscallent.h does.
btw, the list is outdated and contains errors.
It certainly does not pass the test suite.
> diff --git a/linux/riscv/syscallent1.h b/linux/riscv/syscallent1.h
> new file mode 100644
> index 0000000..78bc4c8
> --- /dev/null
> +++ b/linux/riscv/syscallent1.h
> @@ -0,0 +1,274 @@
Likewise, with "32/syscallent.h" file.
> diff --git a/mem.c b/mem.c
> index affc935..b5e6b04 100644
> --- a/mem.c
> +++ b/mem.c
> @@ -89,6 +89,7 @@ print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
> #if defined AARCH64 || defined ARM \
> || defined I386 || defined X86_64 || defined X32 \
> || defined M68K \
> + || defined RISCV \
> || defined S390 || defined S390X
> /* Params are pointed to by u_arg[0], offset is in bytes */
> SYS_FUNC(old_mmap)
riscv doesn't use old_mmap, so this is not needed.
> diff --git a/syscall.c b/syscall.c
> index 9627d68..98095d0 100644
> --- a/syscall.c
> +++ b/syscall.c
> @@ -63,6 +63,10 @@
> # define NT_PRSTATUS 1
> #endif
>
> +#if defined(RISCV)
> +# include <asm/ptrace.h>
> +#endif
> +
> #ifndef NSIG
> # warning: NSIG is not defined, using 32
> # define NSIG 32
This is also not needed as <asm/ptrace.h> is already included via "ptrace.h".
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160819/61d16007/attachment.bin>
More information about the Strace-devel
mailing list