xref: /titanic_51/usr/src/ucbcmd/sbcp/mksysent (revision c3a558e7c77127215b010652905be7916ec5a080)
1#!/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 1993-2003 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28#
29#	mksysent - generate the sysent table from the list of system calls
30#
31nawk '
32BEGIN {
33	print "#include <sys/asm_linkage.h>"
34	print "#include <sys/syscall.h>"
35	print ""
36	print "! This file is automatically generated from syscalls.list."
37	print "! Do not edit by hand or your changes will be lost."
38	print "! See mksysent and syscalls.list for details."
39	print ""
40	print "	.section	\".text\""
41	print "	.align	4"
42	print "sysent:"
43}
44/^#/	{ next; }		# ignore comment lines
45{
46	f = $1;
47	if ($2 == "TRAP") {
48		printf "! %s\n", f;
49		printf "\trestore\t%%g0, SYS_%s, %%g1\n", f;
50		printf "\tta\t8\n";
51		printf "\tjmp\t%%g6\n";
52		printf "\tnop\n";
53	} else if ($2 == "SIMPLE") {
54		printf "! %s\n", f;
55		printf "\t.global\t%s\n", f;
56		printf "\tcall\t%s\n", f;
57		printf "\tnop\n";
58		printf "\tb,a\ttrap0rtn\n";
59		printf "\tnop\n";
60	} else {
61		printf "! %s\n", f;
62		printf "\tb,a\tnosys\n";
63		printf "\tnop\n";
64		printf "\tnop\n";
65		printf "\tnop\n";
66	}
67}
68' <syscalls.list
69