@@ -306,6 +306,48 @@ function dump_lib_aarch64() {
306306 dump_lib_arch aarch64 | mangle_lib_syscall aarch64
307307}
308308
309+ #
310+ # Dump the loongarch64 syscall table
311+ #
312+ # Arguments:
313+ # 1 path to the kernel source
314+ #
315+ # Dump the architecture's syscall table to stdout.
316+ #
317+ function dump_sys_loongarch64() {
318+ local sed_filter=" "
319+
320+ sed_filter+=' s/__NR3264_fadvise64/223/;'
321+ sed_filter+=' s/__NR3264_fcntl/25/;'
322+ sed_filter+=' s/__NR3264_fstatfs/44/;'
323+ sed_filter+=' s/__NR3264_ftruncate/46/;'
324+ sed_filter+=' s/__NR3264_lseek/62/;'
325+ sed_filter+=' s/__NR3264_mmap/222/;'
326+ sed_filter+=' s/__NR3264_sendfile/71/;'
327+ sed_filter+=' s/__NR3264_statfs/43/;'
328+ sed_filter+=' s/__NR3264_truncate/45/;'
329+
330+ gcc -E -dM -I$1 /include/uapi \
331+ -D__BITS_PER_LONG=64 \
332+ -D__ARCH_WANT_SYS_CLONE \
333+ -D__ARCH_WANT_SYS_CLONE3 \
334+ $1 /arch/loongarch/include/uapi/asm/unistd.h | \
335+ grep " ^#define __NR_" | \
336+ sed ' /__NR_syscalls/d' | \
337+ sed ' /__NR_arch_specific_syscall/d' | \
338+ sed ' s/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+\(.*\)/\1,\2/' | \
339+ sed $sed_filter | sort
340+ }
341+
342+ #
343+ # Dump the loongarch64 library syscall table
344+ #
345+ # Dump the library's syscall table to stdout.
346+ #
347+ function dump_lib_loongarch64() {
348+ dump_lib_arch loongarch64 | mangle_lib_syscall loongarch64
349+ }
350+
309351#
310352# Dump the mips system syscall table
311353#
@@ -619,6 +661,9 @@ function dump_sys() {
619661 aarch64)
620662 dump_sys_aarch64 " $2 "
621663 ;;
664+ loongarch64)
665+ dump_sys_loongarch64 " $2 "
666+ ;;
622667 mips)
623668 dump_sys_mips " $2 "
624669 ;;
@@ -686,6 +731,9 @@ function dump_lib() {
686731 aarch64)
687732 dump_lib_aarch64
688733 ;;
734+ loongarch64)
735+ dump_lib_loongarch64
736+ ;;
689737 mips)
690738 dump_lib_mips
691739 ;;
@@ -750,6 +798,7 @@ function gen_csv() {
750798 abi_list=" "
751799 abi_list+=" x86 x86_64 x32"
752800 abi_list+=" arm aarch64"
801+ abi_list+=" loongarch64"
753802 abi_list+=" mips mips64 mips64n32"
754803 abi_list+=" parisc parisc64"
755804 abi_list+=" ppc ppc64"
@@ -861,6 +910,7 @@ if [[ $opt_arches == "" ]]; then
861910 opt_arches=" \
862911 x86 x86_64 x32 \
863912 arm aarch64 \
913+ loongarch64 \
864914 mips mips64 mips64n32 \
865915 parisc parisc64 \
866916 ppc ppc64 \
0 commit comments