forked from checkpoint-restore/criu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compel: plugins,std -- Implement syscalls in std plugin
And use it in CRIU directly instead: - move syscalls into compel/arch/ARCH/plugins/std/syscalls - drop old symlinks - no build for 32bit on x86 as expected - use std.built-in.o inside criu directly (compel_main stub) - drop syscalls on x86 criu directory, I copied them already in first compel commist, so we can't move them now, but delete in place Signed-off-by: Cyrill Gorcunov <[email protected]> Signed-off-by: Pavel Emelyanov <[email protected]> Signed-off-by: Andrei Vagin <[email protected]>
- Loading branch information
Showing
46 changed files
with
311 additions
and
808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../arm/plugins/std/syscalls/Makefile.syscalls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../arm/plugins/std/syscalls/gen-sys-exec-tbl.pl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../arm/plugins/std/syscalls/gen-syscalls.pl |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../arm/plugins/std/syscalls/syscall.def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/ | ||
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/ | ||
|
||
sys-types := $(obj)/include/uapi/std/syscall-types.h | ||
sys-codes := $(obj)/include/uapi/std/syscall-codes.h | ||
sys-proto := $(obj)/include/uapi/std/syscall.h | ||
|
||
sys-def := $(PLUGIN_ARCH_DIR)/std/syscalls/syscall.def | ||
sys-asm-common-name := std/syscalls/syscall-common.S | ||
sys-asm-common := $(PLUGIN_ARCH_DIR)/$(sys-asm-common-name) | ||
sys-asm-types := $(obj)/include/uapi/std/asm/syscall-types.h | ||
sys-exec-tbl = $(PLUGIN_ARCH_DIR)/std/sys-exec-tbl.c | ||
|
||
sys-gen := $(PLUGIN_ARCH_DIR)/std/syscalls/gen-syscalls.pl | ||
sys-gen-tbl := $(PLUGIN_ARCH_DIR)/std/syscalls/gen-sys-exec-tbl.pl | ||
|
||
sys-asm := ./$(PLUGIN_ARCH_DIR)/std/syscalls/syscalls.S | ||
std-obj-y += $(sys-asm:.S=).o | ||
|
||
ifeq ($(ARCH),arm) | ||
arch_bits := 32 | ||
else | ||
arch_bits := 64 | ||
endif | ||
|
||
sys-exec-tbl := sys-exec-tbl.c | ||
|
||
$(sys-asm) $(sys-types) $(sys-codes) $(sys-proto): $(sys-gen) $(sys-def) $(sys-asm-common) | ||
$(E) " GEN " $@ | ||
$(Q) perl \ | ||
$(sys-gen) \ | ||
$(sys-def) \ | ||
$(sys-codes) \ | ||
$(sys-proto) \ | ||
$(sys-asm) \ | ||
$(sys-asm-common-name) \ | ||
$(sys-types) \ | ||
$(arch_bits) | ||
|
||
$(sys-asm:.S=).o: $(sys-asm) | ||
|
||
$(sys-exec-tbl): $(sys-gen-tbl) $(sys-def) | ||
$(E) " GEN " $@ | ||
$(Q) perl \ | ||
$(sys-gen-tbl) \ | ||
$(sys-def) \ | ||
$(sys-exec-tbl) \ | ||
$(arch_bits) | ||
|
||
$(sys-asm-types): $(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h | ||
$(call msg-gen, $@) | ||
$(Q) ln -s ../../../../../../$(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h $(sys-asm-types) | ||
$(Q) ln -s ../../../../../$(PLUGIN_ARCH_DIR)/std/syscalls/syscall-aux.S $(obj)/include/uapi/std/syscall-aux.S | ||
$(Q) ln -s ../../../../../$(PLUGIN_ARCH_DIR)/std/syscalls/syscall-aux.h $(obj)/include/uapi/std/syscall-aux.h | ||
|
||
std-headers-deps += $(sys-codes) $(sys-proto) $(sys-asm-types) | ||
mrproper-y += $(std-headers-deps) | ||
mrproper-y += $(obj)/include/uapi/std/syscall-aux.S | ||
mrproper-y += $(obj)/include/uapi/std/syscall-aux.h |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/ | ||
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/ | ||
|
||
sys-types := $(obj)/include/uapi/std/syscall-types.h | ||
sys-codes := $(obj)/include/uapi/std/syscall-codes.h | ||
sys-proto := $(obj)/include/uapi/std/syscall.h | ||
|
||
sys-def := $(PLUGIN_ARCH_DIR)/std/syscalls/syscall-ppc64.tbl | ||
sys-asm-common-name := std/syscalls/syscall-common-ppc64.S | ||
sys-asm-common := $(PLUGIN_ARCH_DIR)/$(sys-asm-common-name) | ||
sys-asm-types := $(obj)/include/uapi/std/asm/syscall-types.h | ||
sys-exec-tbl = $(PLUGIN_ARCH_DIR)/std/sys-exec-tbl.c | ||
|
||
sys-asm := ./$(PLUGIN_ARCH_DIR)/std/syscalls/syscalls.S | ||
std-obj-y += $(sys-asm:.S=).o | ||
|
||
$(sys-codes): $(sys-def) | ||
$(E) " GEN " $@ | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@ | ||
$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__" >> $@ | ||
$(Q) cat $< | awk '/^__NR/{SYSN=$$1; sub("^__NR", "SYS", SYSN);'\ | ||
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\ | ||
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@ | ||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@ | ||
|
||
$(sys-proto): $(sys-def) | ||
$(E) " GEN " $@ | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H__" >> $@ | ||
$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__" >> $@ | ||
$(Q) echo "#include \"uapi/std/syscall-codes.h\"" >> $@ | ||
$(Q) echo "#include \"uapi/std/syscall-types.h\"" >> $@ | ||
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@ | ||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@ | ||
|
||
$(sys-asm): $(sys-def) $(sys-asm-common) $(sys-codes) $(sys-proto) | ||
$(E) " GEN " $@ | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "#include \"uapi/std/syscall-codes.h\"" >> $@ | ||
$(Q) echo "#include \"$(sys-asm-common-name)\"" >> $@ | ||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@ | ||
|
||
$(sys-exec-tbl): $(sys-def) $(sys-codes) $(sys-proto) | ||
$(E) " GEN " $@ | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "static struct syscall_exec_desc sc_exec_table[] = {" >> $@ | ||
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@ | ||
$(Q) echo " { }, /* terminator */" >> $@ | ||
$(Q) echo "};" >> $@ | ||
|
||
$(sys-asm-types): $(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h | ||
$(call msg-gen, $@) | ||
$(Q) ln -s ../../../../../../$(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h $(sys-asm-types) | ||
|
||
std-headers-deps += $(sys-codes) $(sys-proto) $(sys-asm-types) | ||
mrproper-y += $(std-headers-deps) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/syscalls-64.o | ||
|
||
sys-proto-types := $(obj)/include/uapi/std/syscall-types.h | ||
sys-proto-generic := $(obj)/include/uapi/std/syscall.h | ||
sys-codes-generic := $(obj)/include/uapi/std/syscall-codes.h | ||
sys-codes = $(obj)/include/uapi/std/syscall-codes-$(1).h | ||
sys-proto = $(obj)/include/uapi/std/syscall-$(1).h | ||
sys-def = $(PLUGIN_ARCH_DIR)/std/syscalls/syscall_$(1).tbl | ||
sys-asm = $(PLUGIN_ARCH_DIR)/std/syscalls-$(1).S | ||
sys-asm-common-name = std/syscalls/syscall-common-x86-$(1).S | ||
sys-asm-common = $(PLUGIN_ARCH_DIR)/$(sys-asm-common-name) | ||
sys-asm-types := $(obj)/include/uapi/std/asm/syscall-types.h | ||
sys-exec-tbl = $(PLUGIN_ARCH_DIR)/std/sys-exec-tbl-$(1).c | ||
|
||
sys-bits := 64 | ||
|
||
AV := $$$$ | ||
|
||
define gen-rule-sys-codes | ||
$(sys-codes): $(sys-def) $(sys-proto-types) | ||
$(call msg-gen, $$@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $$@ | ||
$(Q) echo "#ifndef ASM_SYSCALL_CODES_H_$(1)__" >> $$@ | ||
$(Q) echo "#define ASM_SYSCALL_CODES_H_$(1)__" >> $$@ | ||
$(Q) cat $$< | awk '/^__NR/{SYSN=$(AV)1; \ | ||
sub("^__NR", "SYS", SYSN); \ | ||
print "\n#ifndef ", $(AV)1; \ | ||
print "#define", $(AV)1, $(AV)2; \ | ||
print "#endif"; \ | ||
print "\n#ifndef ", SYSN; \ | ||
print "#define ", SYSN, $(AV)1; \ | ||
print "#endif";}' >> $$@ | ||
$(Q) echo "#endif /* ASM_SYSCALL_CODES_H_$(1)__ */" >> $$@ | ||
endef | ||
|
||
define gen-rule-sys-proto | ||
$(sys-proto): $(sys-def) $(sys-proto-types) | ||
$(call msg-gen, $$@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $$@ | ||
$(Q) echo "#ifndef ASM_SYSCALL_PROTO_H_$(1)__" >> $$@ | ||
$(Q) echo "#define ASM_SYSCALL_PROTO_H_$(1)__" >> $$@ | ||
$(Q) echo '#include "uapi/std/syscall-codes-$(1).h"' >> $$@ | ||
$(Q) echo '#include "uapi/std/syscall-types.h"' >> $$@ | ||
ifeq ($(1),32) | ||
$(Q) echo '#include "asm/syscall32.h"' >> $$@ | ||
endif | ||
$(Q) cat $$< | awk '/^__NR/{print "extern long", $(AV)3, \ | ||
substr($(AV)0, index($(AV)0,$(AV)4)), ";"}' >> $$@ | ||
$(Q) echo "#endif /* ASM_SYSCALL_PROTO_H_$(1)__ */" >> $$@ | ||
endef | ||
|
||
define gen-rule-sys-asm | ||
$(sys-asm): $(sys-def) $(sys-asm-common) $(sys-codes) $(sys-proto) $(sys-proto-types) | ||
$(call msg-gen, $$@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $$@ | ||
$(Q) echo '#include "uapi/std/syscall-codes-$(1).h"' >> $$@ | ||
$(Q) echo '#include "$(sys-asm-common-name)"' >> $$@ | ||
$(Q) cat $$< | awk '/^__NR/{print "SYSCALL(", $(AV)3, ",", $(AV)2, ")"}' >> $$@ | ||
endef | ||
|
||
define gen-rule-sys-exec-tbl | ||
$(sys-exec-tbl): $(sys-def) $(sys-codes) $(sys-proto) $(sys-proto-generic) $(sys-proto-types) | ||
$(call msg-gen, $$@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $$@ | ||
$(Q) cat $$< | awk '/^__NR/{print \ | ||
"SYSCALL(", substr($(AV)3, 5), ",", $(AV)2, ")"}' >> $$@ | ||
endef | ||
|
||
$(sys-codes-generic): $(PLUGIN_ARCH_DIR)/std/syscalls/syscall_32.tbl $(sys-proto-types) | ||
$(call msg-gen, $@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@ | ||
$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__" >> $@ | ||
$(Q) echo '#include "uapi/std/syscall-codes-64.h"' >> $@ | ||
$(Q) cat $< | awk '/^__NR/{NR32=$$1; \ | ||
sub("^__NR", "__NR32", NR32); \ | ||
print "\n#ifndef ", NR32; \ | ||
print "#define ", NR32, $$2; \ | ||
print "#endif";}' >> $@ | ||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@ | ||
mrproper-y += $(sys-codes-generic) | ||
|
||
$(sys-proto-generic): $(strip $(call map,sys-proto,$(sys-bits))) $(sys-proto-types) | ||
$(call msg-gen, $@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $@ | ||
$(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H__" >> $@ | ||
$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__" >> $@ | ||
$(Q) echo "" >> $@ | ||
$(Q) echo "#ifdef CONFIG_X86_32" >> $@ | ||
$(Q) echo '#include "uapi/std/syscall-32.h"' >> $@ | ||
$(Q) echo "#else" >> $@ | ||
$(Q) echo '#include "uapi/std/syscall-64.h"' >> $@ | ||
$(Q) echo "#endif /* CONFIG_X86_32 */" >> $@ | ||
$(Q) echo "" >> $@ | ||
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@ | ||
mrproper-y += $(sys-proto-generic) | ||
|
||
define gen-rule-sys-exec-tbl | ||
$(sys-exec-tbl): $(sys-def) $(sys-codes) $(sys-proto) $(sys-proto-generic) | ||
$(call msg-gen, $$@) | ||
$(Q) echo "/* Autogenerated, don't edit */" > $$@ | ||
$(Q) cat $$< | awk '/^__NR/{print \ | ||
"SYSCALL(", substr($(AV)3, 5), ",", $(AV)2, ")"}' >> $$@ | ||
endef | ||
|
||
$(eval $(call map,gen-rule-sys-codes,$(sys-bits))) | ||
$(eval $(call map,gen-rule-sys-proto,$(sys-bits))) | ||
$(eval $(call map,gen-rule-sys-asm,$(sys-bits))) | ||
$(eval $(call map,gen-rule-sys-exec-tbl,$(sys-bits))) | ||
|
||
$(sys-asm-types): $(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h | ||
$(call msg-gen, $@) | ||
$(Q) ln -s ../../../../../../$(PLUGIN_ARCH_DIR)/include/asm/syscall-types.h $(sys-asm-types) | ||
|
||
std-headers-deps += $(call sys-codes,$(sys-bits)) | ||
std-headers-deps += $(call sys-proto,$(sys-bits)) | ||
std-headers-deps += $(call sys-asm,$(sys-bits)) | ||
std-headers-deps += $(call sys-exec-tbl,$(sys-bits)) | ||
std-headers-deps += $(sys-codes-generic) | ||
std-headers-deps += $(sys-proto-generic) | ||
std-headers-deps += $(sys-asm-types) | ||
mrproper-y += $(std-headers-deps) |
Oops, something went wrong.