scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

gensys.sh (343B)


      1 #!/bin/sh
      2 
      3 #
      4 # This job is very easy because app and kernel ABI are identical
      5 # until the 4th parameter, so we only have to set the syscall
      6 # number in rax
      7 
      8 sed -n "
      9      s/[ 	]*#.*//
     10      /$1/p" syscall.lst |
     11 while read num name
     12 do
     13 
     14 cat <<EOF > $name.s
     15 	.file	"$name.s"
     16 
     17 	.globl	$name
     18 $name:
     19 	movq	\$$num,%rax
     20 	syscall
     21 	jmp	_cerrno
     22 EOF
     23 
     24 done