summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2020-03-23 20:47:07 -0400
committerPaul Moore <paul@paul-moore.com>2020-03-23 20:47:45 -0400
commitafc713a8fe289059a18350ab550ca28056356196 (patch)
tree1b173fd21a99c32368be7b6b960d84e9afdd7f39
parent9e49c06a6285779cf18edd618cbf1316102f1388 (diff)
downloadlibseccomp-afc713a8fe289059a18350ab550ca28056356196.tar.gz
arch: simplify the MIPS ABI syscall generation code
The MIPS ABIs now use the parser friendly syscall.tbl format so make use of that to simplify our code. Signed-off-by: Paul Moore <paul@paul-moore.com>
-rwxr-xr-xsrc/arch-syscall-validate72
1 files changed, 15 insertions, 57 deletions
diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate
index 7704c3e..7fea8d9 100755
--- a/src/arch-syscall-validate
+++ b/src/arch-syscall-validate
@@ -314,25 +314,11 @@ function dump_lib_aarch64() {
# Dump the architecture's syscall table to stdout.
#
function dump_sys_mips() {
- pushd $1 2>&1 > /dev/null
- make ARCH=mips archheaders
- popd 2>&1 > /dev/null
- # _MIPS_SIM values:
- # _MIPS_SIM_ABI32 == 1
- # _MIPS_SIM_NABI32 == 2
- # _MIPS_SIM_ABI64 == 3
- gcc -E -dM -I$1/arch/mips/include/uapi \
- -I$1/arch/mips/include/generated/uapi -D_MIPS_SIM=1 \
- $1/arch/mips/include/uapi/asm/unistd.h | \
- grep "^#define __NR_" | \
- grep -v "^#define __NR_O32_" | \
- grep -v "^#define __NR_N32_" | \
- grep -v "^#define __NR_64_" | \
- grep -v "^#define __NR_Linux" | \
- grep -v "^#define __NR_unused" | \
- grep -v "^#define __NR_reserved" | \
- sed 's/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+(__NR_Linux[ \t]*+[ \t]*\([0-9]\+\)).*/\1,\2/' | \
- sort
+ cat $1/arch/mips/kernel/syscalls/syscall_o32.tbl | \
+ grep -v "^#" | \
+ sed -e '/[ \t]\+reserved[0-9]\+[ \t]\+/d;' | \
+ sed -e '/[ \t]\+unused[0-9]\+[ \t]\+/d;' | \
+ awk '{ print $3","$1 }' | sort
}
#
@@ -353,25 +339,11 @@ function dump_lib_mips() {
# Dump the architecture's syscall table to stdout.
#
function dump_sys_mips64() {
- pushd $1 2>&1 > /dev/null
- make ARCH=mips archheaders
- popd 2>&1 > /dev/null
- # _MIPS_SIM values:
- # _MIPS_SIM_ABI32 == 1
- # _MIPS_SIM_NABI32 == 2
- # _MIPS_SIM_ABI64 == 3
- gcc -E -dM -I$1/arch/mips/include/uapi \
- -I$1/arch/mips/include/generated/uapi -D_MIPS_SIM=3 \
- $1/arch/mips/include/uapi/asm/unistd.h | \
- grep "^#define __NR_" | \
- grep -v "^#define __NR_O32_" | \
- grep -v "^#define __NR_N32_" | \
- grep -v "^#define __NR_64_" | \
- grep -v "^#define __NR_Linux" | \
- grep -v "^#define __NR_unused" | \
- grep -v "^#define __NR_reserved" | \
- sed 's/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+(__NR_Linux[ \t]*+[ \t]*\([0-9]\+\)).*/\1,\2/' | \
- sort
+ cat $1/arch/mips/kernel/syscalls/syscall_n64.tbl | \
+ grep -v "^#" | \
+ sed -e '/[ \t]\+reserved[0-9]\+[ \t]\+/d;' | \
+ sed -e '/[ \t]\+unused[0-9]\+[ \t]\+/d;' | \
+ awk '{ print $3","$1 }' | sort
}
#
@@ -392,25 +364,11 @@ function dump_lib_mips64() {
# Dump the architecture's syscall table to stdout.
#
function dump_sys_mips64n32() {
- pushd $1 2>&1 > /dev/null
- make ARCH=mips archheaders
- popd 2>&1 > /dev/null
- # _MIPS_SIM values:
- # _MIPS_SIM_ABI32 == 1
- # _MIPS_SIM_NABI32 == 2
- # _MIPS_SIM_ABI64 == 3
- gcc -E -dM -I$1/arch/mips/include/uapi \
- -I$1/arch/mips/include/generated/uapi -D_MIPS_SIM=2 \
- $1/arch/mips/include/uapi/asm/unistd.h | \
- grep "^#define __NR_" | \
- grep -v "^#define __NR_O32_" | \
- grep -v "^#define __NR_N32_" | \
- grep -v "^#define __NR_64_" | \
- grep -v "^#define __NR_Linux" | \
- grep -v "^#define __NR_unused" | \
- grep -v "^#define __NR_reserved" | \
- sed 's/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+(__NR_Linux[ \t]*+[ \t]*\([0-9]\+\)).*/\1,\2/' | \
- sort
+ cat $1/arch/mips/kernel/syscalls/syscall_n32.tbl | \
+ grep -v "^#" | \
+ sed -e '/[ \t]\+reserved[0-9]\+[ \t]\+/d;' | \
+ sed -e '/[ \t]\+unused[0-9]\+[ \t]\+/d;' | \
+ awk '{ print $3","$1 }' | sort
}
#