scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

amd64-sysv.sh (401B)


      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 awk '/^#/	{next}
      9 		{name=$2 ".s"
     10 	        printf ".global %s\n" \
     11 	               "%s:\n" \
     12 	               "\tmovq\t$%d,%%rax\n" \
     13 	               "\tsyscall\n" \
     14 	               "\tret\n", $2, $2, $1 > name
     15 	        close(name)}' syscall.lst