[CRIU] [PATCH 7/8] arm: prepare syscall table generation scripts to be shared with AArch64

Alexander Kartashov alekskartashov at parallels.com
Mon Mar 10 01:51:27 PDT 2014


Proposed-by: Christopher Covington <cov at codeaurora.org>
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com
---
 arch/arm/Makefile                    |    4 +-
 arch/arm/gen-sys-exec-tbl.pl         |   39 --------------
 arch/arm/gen-syscalls.pl             |   95 ----------------------------------
 arch/scripts/arm/gen-sys-exec-tbl.pl |   39 ++++++++++++++
 arch/scripts/arm/gen-syscalls.pl     |   95 ++++++++++++++++++++++++++++++++++
 5 files changed, 136 insertions(+), 136 deletions(-)
 delete mode 100755 arch/arm/gen-sys-exec-tbl.pl
 delete mode 100755 arch/arm/gen-syscalls.pl
 create mode 100755 arch/scripts/arm/gen-sys-exec-tbl.pl
 create mode 100755 arch/scripts/arm/gen-syscalls.pl

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index b52abb7..2359a2c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -14,8 +14,8 @@ SYS-TYPES	:= include/syscall-types.h
 SYS-CODES	:= include/syscall-codes.h
 SYS-PROTO	:= include/syscall.h
 
-SYS-GEN		:= gen-syscalls.pl
-SYS-GEN-TBL	:= gen-sys-exec-tbl.pl
+SYS-GEN		:= ../scripts/arm/gen-syscalls.pl
+SYS-GEN-TBL	:= ../scripts/arm/gen-sys-exec-tbl.pl
 
 SYS-EXEC-TBL	:= sys-exec-tbl.c
 
diff --git a/arch/arm/gen-sys-exec-tbl.pl b/arch/arm/gen-sys-exec-tbl.pl
deleted file mode 100755
index a3037b7..0000000
--- a/arch/arm/gen-sys-exec-tbl.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-my $in		= $ARGV[0];
-my $tblout	= $ARGV[1];
-my $bits	= $ARGV[2];
-
-my $code	= "code$bits";
-
-open TBLOUT,	">", $tblout	or die $!;
-open IN,		"<", $in		or die $!;
-
-print TBLOUT "/* Autogenerated, don't edit */\n";
-
-for (<IN>) {
-	if ($_ =~ /\#/) {
-		next;
-	}
-
-	my $sys_name;
-	my $sys_num;
-
-	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
-		$sys_name = $+{alias};
-	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
-		$sys_name = $+{name};
-	} else {
-		unlink $tblout;
-		die "Invalid syscall definition file: invalid entry $_\n";
-	}
-
-	$sys_num = $+{$code};
-
-	if ($sys_num ne "!") {
-		print TBLOUT "SYSCALL($sys_name, $sys_num)\n";
-	}
-}
diff --git a/arch/arm/gen-syscalls.pl b/arch/arm/gen-syscalls.pl
deleted file mode 100755
index 6fb8f3b..0000000
--- a/arch/arm/gen-syscalls.pl
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-my $in         = $ARGV[0];
-my $codesout   = $ARGV[1];
-my $codes      = $ARGV[1];
-$codes         =~ s/.*include\///g;
-my $protosout  = $ARGV[2];
-my $protos     = $ARGV[2];
-$protos        =~ s/.*include\///g;
-my $asmout     = $ARGV[3];
-my $asmcommon  = $ARGV[4];
-my $prototypes = $ARGV[5];
-$prototypes    =~ s/.*include\///g;
-my $bits       = $ARGV[6];
-
-my $codesdef   = $codes;
-$codesdef      =~ tr/.-/_/;
-my $protosdef  = $protos;
-$protosdef     =~ tr/.-/_/;
-my $code       = "code$bits";
-my $need_aux   = 0;
-
-unlink $codesout;
-unlink $protosout;
-unlink $asmout;
-
-open CODESOUT,	">", $codesout	or die $!;
-open PROTOSOUT, ">", $protosout or die $!;
-open ASMOUT,	">", $asmout	or die $!;
-open IN,	"<", $in	or die $!;
-
-print CODESOUT <<"END";
-/* Autogenerated, don't edit */
-#ifndef $codesdef
-#define $codesdef
-END
-
-print PROTOSOUT <<"END";
-/* Autogenerated, don't edit */
-#ifndef $protosdef
-#define $protosdef
-#include "$prototypes"
-#include "$codes"
-END
-
-print ASMOUT <<"END";
-/* Autogenerated, don't edit */
-#include "$codes"
-#include "$asmcommon"
-END
-
-
-for (<IN>) {
-	if ($_ =~ /\#/) {
-		next;
-	}
-
-	my $code_macro;
-	my $sys_name;
-
-	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
-		$code_macro = "__NR_$+{name}";
-		$sys_name   = "sys_$+{alias}";
-	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
-		$code_macro = "__NR_$+{name}";
-		$sys_name   = "sys_$+{name}";
-	} else {
-		unlink $codesout;
-		unlink $protosout;
-		unlink $asmout;
-
-		die "Invalid syscall definition file: invalid entry $_\n";
-	}
-
-	if ($+{$code} ne "!") {
-		print CODESOUT "#define $code_macro $+{$code}\n";
-		print ASMOUT "syscall $sys_name, $code_macro\n";
-
-	} else {
-		$need_aux = 1;
-	}
-
-	print PROTOSOUT "extern long $sys_name($+{args});\n";
-}
-
-if ($need_aux == 1) {
-	print ASMOUT   "#include \"asm/syscall-aux.S\"\n";
-	print CODESOUT "#include \"asm/syscall-aux.h\"\n";
-}
-
-print CODESOUT  "#endif /* $codesdef */";
-print PROTOSOUT "#endif /* $protosdef */";
diff --git a/arch/scripts/arm/gen-sys-exec-tbl.pl b/arch/scripts/arm/gen-sys-exec-tbl.pl
new file mode 100755
index 0000000..a3037b7
--- /dev/null
+++ b/arch/scripts/arm/gen-sys-exec-tbl.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $in		= $ARGV[0];
+my $tblout	= $ARGV[1];
+my $bits	= $ARGV[2];
+
+my $code	= "code$bits";
+
+open TBLOUT,	">", $tblout	or die $!;
+open IN,		"<", $in		or die $!;
+
+print TBLOUT "/* Autogenerated, don't edit */\n";
+
+for (<IN>) {
+	if ($_ =~ /\#/) {
+		next;
+	}
+
+	my $sys_name;
+	my $sys_num;
+
+	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+		$sys_name = $+{alias};
+	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+		$sys_name = $+{name};
+	} else {
+		unlink $tblout;
+		die "Invalid syscall definition file: invalid entry $_\n";
+	}
+
+	$sys_num = $+{$code};
+
+	if ($sys_num ne "!") {
+		print TBLOUT "SYSCALL($sys_name, $sys_num)\n";
+	}
+}
diff --git a/arch/scripts/arm/gen-syscalls.pl b/arch/scripts/arm/gen-syscalls.pl
new file mode 100755
index 0000000..6fb8f3b
--- /dev/null
+++ b/arch/scripts/arm/gen-syscalls.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $in         = $ARGV[0];
+my $codesout   = $ARGV[1];
+my $codes      = $ARGV[1];
+$codes         =~ s/.*include\///g;
+my $protosout  = $ARGV[2];
+my $protos     = $ARGV[2];
+$protos        =~ s/.*include\///g;
+my $asmout     = $ARGV[3];
+my $asmcommon  = $ARGV[4];
+my $prototypes = $ARGV[5];
+$prototypes    =~ s/.*include\///g;
+my $bits       = $ARGV[6];
+
+my $codesdef   = $codes;
+$codesdef      =~ tr/.-/_/;
+my $protosdef  = $protos;
+$protosdef     =~ tr/.-/_/;
+my $code       = "code$bits";
+my $need_aux   = 0;
+
+unlink $codesout;
+unlink $protosout;
+unlink $asmout;
+
+open CODESOUT,	">", $codesout	or die $!;
+open PROTOSOUT, ">", $protosout or die $!;
+open ASMOUT,	">", $asmout	or die $!;
+open IN,	"<", $in	or die $!;
+
+print CODESOUT <<"END";
+/* Autogenerated, don't edit */
+#ifndef $codesdef
+#define $codesdef
+END
+
+print PROTOSOUT <<"END";
+/* Autogenerated, don't edit */
+#ifndef $protosdef
+#define $protosdef
+#include "$prototypes"
+#include "$codes"
+END
+
+print ASMOUT <<"END";
+/* Autogenerated, don't edit */
+#include "$codes"
+#include "$asmcommon"
+END
+
+
+for (<IN>) {
+	if ($_ =~ /\#/) {
+		next;
+	}
+
+	my $code_macro;
+	my $sys_name;
+
+	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+		$code_macro = "__NR_$+{name}";
+		$sys_name   = "sys_$+{alias}";
+	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+		$code_macro = "__NR_$+{name}";
+		$sys_name   = "sys_$+{name}";
+	} else {
+		unlink $codesout;
+		unlink $protosout;
+		unlink $asmout;
+
+		die "Invalid syscall definition file: invalid entry $_\n";
+	}
+
+	if ($+{$code} ne "!") {
+		print CODESOUT "#define $code_macro $+{$code}\n";
+		print ASMOUT "syscall $sys_name, $code_macro\n";
+
+	} else {
+		$need_aux = 1;
+	}
+
+	print PROTOSOUT "extern long $sys_name($+{args});\n";
+}
+
+if ($need_aux == 1) {
+	print ASMOUT   "#include \"asm/syscall-aux.S\"\n";
+	print CODESOUT "#include \"asm/syscall-aux.h\"\n";
+}
+
+print CODESOUT  "#endif /* $codesdef */";
+print PROTOSOUT "#endif /* $protosdef */";
-- 
1.7.9.5



More information about the CRIU mailing list