Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump Eliminate weak symbols from rump kernel syscall han...
details: https://anonhg.NetBSD.org/src/rev/44ef08d67132
branches: trunk
changeset: 795747:44ef08d67132
user: pooka <pooka%NetBSD.org@localhost>
date: Sun Apr 27 15:05:30 2014 +0000
description:
Eliminate weak symbols from rump kernel syscall handlers, part 3:
Add a tool to autogenerate callbacks from components to establish system
call handlers for non-modular syscalls.
diffstat:
sys/rump/makerumpsyscalls.sh | 112 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 112 insertions(+), 0 deletions(-)
diffs (116 lines):
diff -r e1e7e3d4f440 -r 44ef08d67132 sys/rump/makerumpsyscalls.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/makerumpsyscalls.sh Sun Apr 27 15:05:30 2014 +0000
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# $NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $
+#
+
+#
+# This utility generates component-specific initializers for the
+# rump kernel syscall vector.
+#
+# Procedure is:
+# 1) edit syscalls.master
+# 2) run makesyscalls.sh
+# 3) do a build in sys/rump
+# 4) run this script
+# 5) commit results
+#
+
+# default, override by giving argument
+LIBDIR=/usr/lib
+
+SYSCOMPONENT_librump=librump/rumpkern/rumpkern_syscalls.c
+SYSCOMPONENT_librumpnet=librump/rumpnet/rumpnet_syscalls.c
+SYSCOMPONENT_librumpvfs=librump/rumpvfs/rumpvfs_syscalls.c
+
+die ()
+{
+
+ echo '>> ERROR:' $*
+ exit 1
+}
+
+[ -f "./rump.sysmap" ] || die rump.sysmap not found
+[ -f "./Makefile.rump" ] || die run script in src/sys/rump
+[ -z "${1}" ] || LIBDIR=$1
+
+#
+# BEGIN
+#
+
+IFS=' '
+AWKPROG='BEGIN {
+ while ((getline < "rump.sysmap") == 1) {
+ if ($2 != "sys_nomodule")
+ syscalls[$2] = $1
+ }
+}
+
+$5 == "GLOBAL" && $7 != "UND" {
+ sub("rumpns_", "", $8)
+ if (syscalls[$8] != 0)
+ results[$8] = 1
+}
+
+END {
+ for (res in results) {
+ printf "%d %s\n", syscalls[res], res | "sort -n"
+ }
+}
+'
+
+SYSCOMP_HDR='/* $NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $ */
+
+/* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $");
+
+#include <sys/param.h>
+
+#include "rump_private.h"
+'
+
+SYSCOMP_BODY='
+RUMP_COMPONENT(RUMP_COMPONENT_SYSCALL)
+{
+
+ rump_syscall_boot_establish(mysys, __arraycount(mysys));
+}'
+
+makesyscomponent ()
+{
+
+ echo Generating $1
+ exec 3>&1 >${1}
+
+ echo "${SYSCOMP_HDR}"
+
+ echo ${2} | awk '{printf "extern const sy_call_t %s;\n", $2}'
+ printf '\nstatic const struct rump_onesyscall mysys[] = {\n'
+ echo ${2} | awk '{printf "\t{ %d,\t%s },\n", $1, $2}'
+ printf '};\n'
+
+ echo "${SYSCOMP_BODY}"
+
+ exec 1>&3
+}
+
+sawlibrump=false
+for file in ${LIBDIR}/librump*.so ; do
+ b=$(basename ${file})
+ b=${b%%.*}
+ res=$(readelf -W --syms ${file} | awk "${AWKPROG}")
+ if [ ! -z "${res}" ]; then
+ eval outname=\${SYSCOMPONENT_${b}}
+ [ -z "${outname}" ] && die Unknown syscall provider $b
+ makesyscomponent $outname "$res"
+
+ [ $b = "librump" ] && sawlibrump=true
+ fi
+done
+
+${sawlibrump} || die Did not see librump. Wrong directory?
Home |
Main Index |
Thread Index |
Old Index