summaryrefslogtreecommitdiff
path: root/src/arch-syscall-validate
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2015-08-28 15:38:34 -0400
committerPaul Moore <pmoore@redhat.com>2015-08-28 15:38:34 -0400
commitfc886cbe8128e8544f5d197dfd0971403ee203b5 (patch)
tree71e20e3c8acac4b67da61842bef34e23f972ebe9 /src/arch-syscall-validate
parent6e26af4f027f6d6d3c8045f3b2c57b2255e911e3 (diff)
parenta06972c8f7a287b83d3d5237f83b17ec2ab2047e (diff)
downloadlibseccomp-fc886cbe8128e8544f5d197dfd0971403ee203b5.tar.gz
Merge branch 'working-s390' into master
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'src/arch-syscall-validate')
-rwxr-xr-xsrc/arch-syscall-validate87
1 files changed, 74 insertions, 13 deletions
diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate
index ba5cd89..89cce3a 100755
--- a/src/arch-syscall-validate
+++ b/src/arch-syscall-validate
@@ -319,6 +319,29 @@ function dump_lib_mips64n32() {
}
#
+# Dump the ppc system syscall table
+#
+# Arguments:
+# 1 path to the kernel source
+#
+# Dump the architecture's syscall table to stdout.
+#
+function dump_sys_ppc() {
+ gcc -E -dM $1/arch/powerpc/include/uapi/asm/unistd.h | \
+ grep "^#define __NR_" | sort | \
+ sed -e 's/#define[ \t]\+__NR_\([a-z0-9_]\+\)[ \t]\+\([0-9]\+\)/\1\t\2/'
+}
+
+#
+# Dump the ppc library syscall table
+#
+# Dump the library's syscall table to stdout.
+#
+function dump_lib_ppc() {
+ $LIB_SYS_DUMP -a ppc | sed -e '/[^\t]\+\t-[0-9]\+/d'
+}
+
+#
# Dump the ppc64 system syscall table
#
# Arguments:
@@ -342,26 +365,47 @@ function dump_lib_ppc64() {
}
#
-# Dump the ppc system syscall table
+# Dump the s390 system syscall table
#
# Arguments:
# 1 path to the kernel source
#
# Dump the architecture's syscall table to stdout.
#
-function dump_sys_ppc() {
- gcc -E -dM $1/arch/powerpc/include/uapi/asm/unistd.h | \
- grep "^#define __NR_" | sort | \
- sed -e 's/#define[ \t]\+__NR_\([a-z0-9_]\+\)[ \t]\+\([0-9]\+\)/\1\t\2/'
+function dump_sys_s390() {
+ gcc -dM -m31 -E $1/arch/s390/include/uapi/asm/unistd.h | grep __NR | \
+ sed 's/#define __NR_//g' | sed 's/ /\t/g' | sort
}
#
-# Dump the ppc library syscall table
+# Dump the s390 library syscall table
#
# Dump the library's syscall table to stdout.
#
-function dump_lib_ppc() {
- $LIB_SYS_DUMP -a ppc | sed -e '/[^\t]\+\t-[0-9]\+/d'
+function dump_lib_s390() {
+ $LIB_SYS_DUMP -a s390 | grep -v - | sort
+}
+
+#
+# Dump the s390x system syscall table
+#
+# Arguments:
+# 1 path to the kernel source
+#
+# Dump the architecture's syscall table to stdout.
+#
+function dump_sys_s390x() {
+ gcc -dM -E $1/arch/s390/include/uapi/asm/unistd.h | grep __NR | \
+ sed 's/#define __NR_//g' | sed 's/ /\t/g' | sort
+}
+
+#
+# Dump the s390x library syscall table
+#
+# Dump the library's syscall table to stdout.
+#
+function dump_lib_s390x() {
+ $LIB_SYS_DUMP -a s390x | grep -v - | sort
}
#
@@ -399,11 +443,17 @@ function dump_sys() {
mips64n32)
dump_sys_mips64n32 "$2"
;;
+ ppc)
+ dump_sys_ppc "$2"
+ ;;
ppc64)
dump_sys_ppc64 "$2"
;;
- ppc)
- dump_sys_ppc "$2"
+ s390)
+ dump_sys_s390 "$2"
+ ;;
+ s390x)
+ dump_sys_s390x "$2"
;;
*)
echo ""
@@ -445,11 +495,17 @@ function dump_lib() {
mips64n32)
dump_lib_mips64n32
;;
+ ppc)
+ dump_lib_ppc "$2"
+ ;;
ppc64)
dump_lib_ppc64 "$2"
;;
- ppc)
- dump_lib_ppc "$2"
+ s390)
+ dump_lib_s390 "$2"
+ ;;
+ s390x)
+ dump_lib_s390x "$2"
;;
*)
echo ""
@@ -497,7 +553,12 @@ shift $(($OPTIND - 1))
# defaults
if [[ $opt_arches == "" ]]; then
- opt_arches="x86 x86_64 x32 arm aarch64 mips mips64 mips64n32 ppc pcc64"
+ opt_arches=" \
+ x86 x86_64 x32 \
+ arm aarch64 \
+ mips mips64 mips64n32 \
+ ppc pcc64 \
+ s390 s390x"
fi
# sanity checks