mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
x86: Teach syscall table generating script accept argument
We'll have to generate syscall table in another form, prepare for it . Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -17,7 +17,7 @@ CFLAGS += -c -fpie -Wstrict-prototypes -Wa,--noexecstack -D__ASSEMBLY__ -nostdl
|
||||
$(SYS-ASM): $(SYS-GEN) $(SYS-DEF) $(SYS-ASM-COMMON) $(SYS-TYPES)
|
||||
$(E) " GEN " $@
|
||||
$(Q) $(SH) \
|
||||
$(SYS-GEN) \
|
||||
$(SYS-GEN) --asm \
|
||||
$(SYS-DEF) \
|
||||
$(SYS-CODES) \
|
||||
$(SYS-PROTO) \
|
||||
|
@@ -1,32 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
in=$1
|
||||
codesout=$2
|
||||
protosout=$3
|
||||
asmout=$4
|
||||
asmcommon=$5
|
||||
prototypes=`echo $6 | sed -e 's/.*include\///g'`
|
||||
function gen_asm() {
|
||||
in=$1
|
||||
codesout=$2
|
||||
protosout=$3
|
||||
asmout=$4
|
||||
asmcommon=$5
|
||||
prototypes=`echo $6 | sed -e 's/.*include\///g'`
|
||||
|
||||
codesdef=`echo $codesout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
|
||||
protosdef=`echo $protosout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
|
||||
codesdef=`echo $codesout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
|
||||
protosdef=`echo $protosout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
|
||||
|
||||
echo "/* Autogenerated, don't edit */" > $codesout
|
||||
echo "#ifndef $codesdef" >> $codesout
|
||||
echo "#define $codesdef" >> $codesout
|
||||
echo "/* Autogenerated, don't edit */" > $codesout
|
||||
echo "#ifndef $codesdef" >> $codesout
|
||||
echo "#define $codesdef" >> $codesout
|
||||
|
||||
echo "/* Autogenerated, don't edit */" > $protosout
|
||||
echo "#ifndef $protosdef" >> $protosout
|
||||
echo "#define $protosdef" >> $protosout
|
||||
echo "#include \"$prototypes\"" >> $protosout
|
||||
echo "#include \"$codesout\"" >> $protosout
|
||||
echo "/* Autogenerated, don't edit */" > $protosout
|
||||
echo "#ifndef $protosdef" >> $protosout
|
||||
echo "#define $protosdef" >> $protosout
|
||||
echo "#include \"$prototypes\"" >> $protosout
|
||||
echo "#include \"$codesout\"" >> $protosout
|
||||
|
||||
echo "/* Autogenerated, don't edit */" > $asmout
|
||||
echo "#include \"$codesout\"" >> $asmout
|
||||
echo "#include \"$asmcommon\"" >> $asmout
|
||||
echo "/* Autogenerated, don't edit */" > $asmout
|
||||
echo "#include \"$codesout\"" >> $asmout
|
||||
echo "#include \"$asmcommon\"" >> $asmout
|
||||
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "extern long ", $3, $4, ";"}' >> $protosout
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", $3, ",", $2, ")"}' >> $asmout
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "extern long ", $3, $4, ";"}' >> $protosout
|
||||
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", $3, ",", $2, ")"}' >> $asmout
|
||||
|
||||
echo "#endif /* $codesdef */" >> $codesout
|
||||
echo "#endif /* $protosdef */" >> $protosout
|
||||
echo "#endif /* $codesdef */" >> $codesout
|
||||
echo "#endif /* $protosdef */" >> $protosout
|
||||
}
|
||||
|
||||
if [ "$1" = "--asm" ]; then
|
||||
shift
|
||||
gen_asm $@
|
||||
fi
|
||||
|
Reference in New Issue
Block a user