Huacai Chen <chenhuacai@xxxxxxxxxxx> writes: > Add ucontext/sigcontext definition and signal handling support for > LoongArch. > > Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx> > Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> > Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> > --- > arch/loongarch/include/uapi/asm/sigcontext.h | 44 ++ > arch/loongarch/include/uapi/asm/signal.h | 13 + > arch/loongarch/include/uapi/asm/ucontext.h | 35 ++ > arch/loongarch/kernel/signal.c | 566 +++++++++++++++++++ > 4 files changed, 658 insertions(+) > create mode 100644 arch/loongarch/include/uapi/asm/sigcontext.h > create mode 100644 arch/loongarch/include/uapi/asm/signal.h > create mode 100644 arch/loongarch/include/uapi/asm/ucontext.h > create mode 100644 arch/loongarch/kernel/signal.c > > diff --git a/arch/loongarch/include/uapi/asm/sigcontext.h b/arch/loongarch/include/uapi/asm/sigcontext.h > new file mode 100644 > index 000000000000..be3d3c6ac83e > --- /dev/null > +++ b/arch/loongarch/include/uapi/asm/sigcontext.h > @@ -0,0 +1,44 @@ > +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ > +/* > + * Author: Hanlu Li <lihanlu@xxxxxxxxxxx> > + * Huacai Chen <chenhuacai@xxxxxxxxxxx> > + * > + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited > + */ > +#ifndef _UAPI_ASM_SIGCONTEXT_H > +#define _UAPI_ASM_SIGCONTEXT_H > + > +#include <linux/types.h> > +#include <linux/posix_types.h> > + > +/* FP context was used */ > +#define SC_USED_FP (1 << 0) > +/* Address error was due to memory load */ > +#define SC_ADDRERR_RD (1 << 30) > +/* Address error was due to memory store */ > +#define SC_ADDRERR_WR (1 << 31) > + > +struct sigcontext { > + __u64 sc_pc; > + __u64 sc_regs[32]; > + __u32 sc_flags; > + __u64 sc_extcontext[0] __attribute__((__aligned__(16))); > +}; > + > +#define CONTEXT_INFO_ALIGN 16 > +struct _ctxinfo { > + __u32 magic; > + __u32 size; > + __u64 padding; /* padding to 16 bytes */ > +}; This is probably something I a missing but what is struct _ctxinfo and why is it in a uapi header? I don't see anything else in the uapi implementation using it. Symbols that start with an underscore "_" are reserved and should not be used in general, and especially not in uapi header files. Eric