[PATCH 03/13] riscv: compat: Add basic compat date type implementation

Arnd Bergmann arnd at arndb.de
Tue Dec 21 09:12:46 PST 2021


On Tue, Dec 21, 2021 at 5:35 PM <guoren at kernel.org> wrote:
>
> From: Guo Ren <guoren at linux.alibaba.com>
>
> Implement asm/compat.h for struct compat_xxx, RLIM_INFINITY,
> OFF_T_MAX, is_compat_task, compat_user_regset, regset convert.
>
> Signed-off-by: Guo Ren <guoren at linux.alibaba.com>
> ---
>  arch/riscv/include/asm/compat.h      | 259 +++++++++++++++++++++++++++

Since both the native and compat side use the generic interface, I think this
should all be part of asm-generic/compat.h, in case other architectures want to
share this in the future. Maybe see if any other architectures use the
same definition
for some of the structures and then remove the duplicates.

> +struct compat_stat {
> +       compat_ulong_t  st_dev;
> +       compat_ulong_t  st_ino;
> +       compat_uint_t   st_mode;
> +       compat_uint_t   st_nlink;

You should not need a compat_stat, because native rv32 does not have a
stat() syscall.

> +static inline int is_compat_task(void)
> +{
> +       return test_thread_flag(TIF_32BIT);
> +}
> +
> +struct compat_user_regs_struct {
> +       compat_ulong_t pc;
> +       compat_ulong_t ra;

These clearly need to stay in arch/riscv

        Arnd



More information about the linux-riscv mailing list