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 #       mksysent - generate the sysent table from the list of system calls
  28 #
  29 /usr/xpg4/bin/awk '
  30 BEGIN {
  31         print "#include <sys/asm_linkage.h>"
  32         print "#include <sys/syscall.h>"
  33         print ""
  34         print "! This file is automatically generated from syscalls.list."
  35         print "! Do not edit by hand or your changes will be lost."
  36         print "! See mksysent and syscalls.list for details."
  37         print ""
  38         print " .section        \".text\""
  39         print " .align  4"
  40         print "sysent:"
  41 }
  42 /^#/    { next; }               # ignore comment lines
  43 {
  44         f = $1;
  45         if ($2 == "TRAP") {
  46                 printf "! %s\n", f;
  47                 printf "\trestore\t%%g0, SYS_%s, %%g1\n", f;
  48                 printf "\tta\t8\n";
  49                 printf "\tjmp\t%%g6\n";
  50                 printf "\tnop\n";
  51         } else if ($2 == "SIMPLE") {
  52                 printf "! %s\n", f;
  53                 printf "\t.global\t%s\n", f;
  54                 printf "\tcall\t%s\n", f;
  55                 printf "\tnop\n";
  56                 printf "\tb,a\ttrap0rtn\n";
  57                 printf "\tnop\n";
  58         } else {
  59                 printf "! %s\n", f;
  60                 printf "\tb,a\tnosys\n";
  61                 printf "\tnop\n";
  62                 printf "\tnop\n";
  63                 printf "\tnop\n";
  64         }
  65 }
  66 ' <syscalls.list