LoongArch: extable: Add a dedicated uaccess handler
authorYouling Tang <tangyouling@loongson.cn>
Sat, 10 Dec 2022 14:39:59 +0000 (22:39 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 14 Dec 2022 00:36:11 +0000 (08:36 +0800)
commit672999cfae3e830a64c4996362a26934fd555ff9
tree7f271c51048e7673a165e7f818e9755884686d76
parent26bc82441250f2e01621f5b26606a4f6926ee3ad
LoongArch: extable: Add a dedicated uaccess handler

Inspired by commit 2e77a62cb3a6("arm64: extable: add a dedicated uaccess
handler"), do similar to LoongArch to add a dedicated uaccess exception
handler to update registers in exception context and subsequently return
back into the function which faulted, so we remove the need for fixups
specialized to each faulting instruction.

Add gpr-num.h here because we need to map the same GPR names to integer
constants, so that we can use this to build meta-data for the exception
fixups.

The compiler treats gpr 0 as zero rather than $r0, so set it separately
to .L__gpr_num_zero, otherwise the following assembly error will occurs:

{standard input}: Assembler messages:
{standard input}:1074: Error: invalid operands (*UND* and *ABS* sections) for `<<'
{standard input}:1160: Error: invalid operands (*UND* and *ABS* sections) for `<<'
make[1]: *** [scripts/Makefile.build:249: fs/fcntl.o] Error 1

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/asm-extable.h
arch/loongarch/include/asm/futex.h
arch/loongarch/include/asm/gpr-num.h [new file with mode: 0644]
arch/loongarch/include/asm/uaccess.h
arch/loongarch/mm/extable.c