Commit 19fadee9 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 35726a76
...@@ -228,9 +228,9 @@ $(SOCCR_A): |soccr/built-in.o ...@@ -228,9 +228,9 @@ $(SOCCR_A): |soccr/built-in.o
# #
# But note that we're already included # But note that we're already included
# the nmk so we can reuse it there. # the nmk so we can reuse it there.
criu/%: images/built-in.o compel/compel-host $(VERSION_HEADER) .FORCE criu/%: images/built-in.o compel/plugins/std.built-in.o compel/compel-host $(VERSION_HEADER) .FORCE
$(Q) $(MAKE) $(build)=criu $@ $(Q) $(MAKE) $(build)=criu $@
criu: images/built-in.o compel/compel-host $(SOCCR_A) $(VERSION_HEADER) criu: images/built-in.o compel/plugins/std.built-in.o compel/compel-host $(SOCCR_A) $(VERSION_HEADER)
$(Q) $(MAKE) $(build)=criu all $(Q) $(MAKE) $(build)=criu all
.PHONY: criu .PHONY: criu
...@@ -256,6 +256,7 @@ clean: subclean ...@@ -256,6 +256,7 @@ clean: subclean
$(Q) $(MAKE) $(build)=soccr $@ $(Q) $(MAKE) $(build)=soccr $@
$(Q) $(MAKE) $(build)=lib $@ $(Q) $(MAKE) $(build)=lib $@
$(Q) $(MAKE) $(build)=compel $@ $(Q) $(MAKE) $(build)=compel $@
$(Q) $(MAKE) $(build)=compel/plugins $@
.PHONY: clean .PHONY: clean
# mrproper depends on clean in nmk # mrproper depends on clean in nmk
...@@ -265,6 +266,7 @@ mrproper: subclean ...@@ -265,6 +266,7 @@ mrproper: subclean
$(Q) $(MAKE) $(build)=soccr $@ $(Q) $(MAKE) $(build)=soccr $@
$(Q) $(MAKE) $(build)=lib $@ $(Q) $(MAKE) $(build)=lib $@
$(Q) $(MAKE) $(build)=compel $@ $(Q) $(MAKE) $(build)=compel $@
$(Q) $(MAKE) $(build)=compel/plugins $@
$(Q) $(RM) $(CONFIG_HEADER) $(Q) $(RM) $(CONFIG_HEADER)
$(Q) $(RM) $(SOCCR_CONFIG) $(Q) $(RM) $(SOCCR_CONFIG)
$(Q) $(RM) $(VERSION_HEADER) $(Q) $(RM) $(VERSION_HEADER)
......
...@@ -40,13 +40,3 @@ endif ...@@ -40,13 +40,3 @@ endif
cleanup-y += compel/compel cleanup-y += compel/compel
cleanup-y += compel/compel-host cleanup-y += compel/compel-host
cleanup-y += compel/libcompel.so cleanup-y += compel/libcompel.so
#
# FIXME Fake target for syscalls headers generation,
# drop after syscalls generation.
$(obj)/plugins/include/uapi/std/asm/syscall-types.h: $(obj)/arch/$(ARCH)/plugins/include/asm/syscall-types.h
$(call msg-gen,$@)
$(Q) ln -s ../../../../../arch/$(ARCH)/plugins/include/asm/syscall-types.h $@
cleanup-y += $(obj)/plugins/include/uapi/std/asm/syscall-types.h
$(obj)/compel-host: $(obj)/plugins/include/uapi/std/asm/syscall-types.h
../../../../arm/plugins/std/syscalls/Makefile.syscalls
\ No newline at end of file
../../../../arm/plugins/std/syscalls/gen-sys-exec-tbl.pl
\ No newline at end of file
../../../../arm/plugins/std/syscalls/gen-syscalls.pl
\ No newline at end of file
../../../../arm/plugins/std/syscalls/syscall.def
\ No newline at end of file
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
...@@ -17,9 +17,9 @@ $prototypes =~ s/.*include\///g; ...@@ -17,9 +17,9 @@ $prototypes =~ s/.*include\///g;
my $bits = $ARGV[6]; my $bits = $ARGV[6];
my $codesdef = $codes; my $codesdef = $codes;
$codesdef =~ tr/.-/_/; $codesdef =~ tr/.\-\//_/;
my $protosdef = $protos; my $protosdef = $protos;
$protosdef =~ tr/.-/_/; $protosdef =~ tr/.\-\//_/;
my $code = "code$bits"; my $code = "code$bits";
my $need_aux = 0; my $need_aux = 0;
...@@ -91,8 +91,8 @@ for (<IN>) { ...@@ -91,8 +91,8 @@ for (<IN>) {
} }
if ($need_aux == 1) { if ($need_aux == 1) {
print ASMOUT "#include \"asm/syscall-aux.S\"\n"; print ASMOUT "#include \"uapi/std/syscall-aux.S\"\n";
print CODESOUT "#include \"asm/syscall-aux.h\"\n"; print CODESOUT "#include \"uapi/std/syscall-aux.h\"\n";
} }
print CODESOUT "#endif /* $codesdef */"; print CODESOUT "#endif /* $codesdef */";
......
builtin-name := syscalls.built-in.o ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/std/syscalls/
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) 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-TYPES := ../../include/syscall-types.h sys-def := $(PLUGIN_ARCH_DIR)/std/syscalls/syscall-ppc64.tbl
SYS-CODES := ../../include/syscall-codes.h sys-asm-common-name := std/syscalls/syscall-common-ppc64.S
SYS-PROTO := ../../include/syscall.h sys-asm-common := $(PLUGIN_ARCH_DIR)/$(sys-asm-common-name)
SYS-DEF := syscall-ppc64.tbl sys-asm-types := $(obj)/include/uapi/std/asm/syscall-types.h
SYS-ASM-COMMON := syscall-common-ppc64.S sys-exec-tbl = $(PLUGIN_ARCH_DIR)/std/sys-exec-tbl.c
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer sys-asm := ./$(PLUGIN_ARCH_DIR)/std/syscalls/syscalls.S
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack std-obj-y += $(sys-asm:.S=).o
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S $(sys-codes): $(sys-def)
obj-y += $(SYS-ASM:.S=).o
$(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@ $(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@ $(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@ $(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@
...@@ -24,34 +23,35 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF) ...@@ -24,34 +23,35 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\ 'print "\n#ifndef ", $$1, "\n#define", $$1, $$2, "\n#endif";'\
'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@ 'print "#ifndef ", SYSN, "\n#define ", SYSN, $$1, "\n#endif"}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@ $(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
mrproper-y += $(obj)/$(SYS-CODES)
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF) $(sys-proto): $(sys-def)
$(E) " GEN " $@ $(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@ $(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H__" >> $@ $(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H__" >> $@
$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__" >> $@ $(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__" >> $@
$(Q) echo "#include \"syscall-codes.h\"" >> $@ $(Q) echo "#include \"uapi/std/syscall-codes.h\"" >> $@
$(Q) echo "#include \"syscall-types.h\"" >> $@ $(Q) echo "#include \"uapi/std/syscall-types.h\"" >> $@
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@ $(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@ $(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
mrproper-y += $(obj)/$(SYS-PROTO)
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO) $(sys-asm): $(sys-def) $(sys-asm-common) $(sys-codes) $(sys-proto)
$(E) " GEN " $@ $(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@ $(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#include \"syscall-codes.h\"" >> $@ $(Q) echo "#include \"uapi/std/syscall-codes.h\"" >> $@
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@ $(Q) echo "#include \"$(sys-asm-common-name)\"" >> $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@ $(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
mrproper-y += $(obj)/$(SYS-ASM)
SYS-EXEC-TBL := sys-exec-tbl.c $(sys-exec-tbl): $(sys-def) $(sys-codes) $(sys-proto)
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
$(E) " GEN " $@ $(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@ $(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "static struct syscall_exec_desc sc_exec_table[] = {" >> $@ $(Q) echo "static struct syscall_exec_desc sc_exec_table[] = {" >> $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@ $(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
$(Q) echo " { }, /* terminator */" >> $@ $(Q) echo " { }, /* terminator */" >> $@
$(Q) echo "};" >> $@ $(Q) echo "};" >> $@
mrproper-y += $(obj)/$(SYS-EXEC-TBL)
all-y += $(obj)/$(SYS-EXEC-TBL) $(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)
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)
.PHONY: .FORCE .PHONY: .FORCE
ARCH_DIR := compel/arch/$(ARCH)/plugins PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
# #
# CFLAGS, ASFLAGS, LDFLAGS # CFLAGS, ASFLAGS, LDFLAGS
# General compel includes # General compel includes
ccflags-y += -iquote $(SRC_DIR)/compel/include ccflags-y += -iquote $(SRC_DIR)/compel/include
ccflags-y += -fno-stack-protector
# General compel/plugins includes # General compel/plugins includes
ccflags-y += -iquote $(obj)/include ccflags-y += -iquote $(obj)/include
...@@ -15,13 +16,14 @@ asflags-y += -iquote $(obj)/include ...@@ -15,13 +16,14 @@ asflags-y += -iquote $(obj)/include
asflags-y += -iquote $(obj)/include/uapi asflags-y += -iquote $(obj)/include/uapi
# Arch compel/plugins includes # Arch compel/plugins includes
ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include asflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR) asflags-y += -iquote $(PLUGIN_ARCH_DIR)
# General flags for assembly # General flags for assembly
asflags-y += -Wstrict-prototypes -Wa,--noexecstack asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fno-stack-protector
# #
# Fds plugin # Fds plugin
...@@ -38,111 +40,18 @@ shmem-obj-y += shmem/shmem.o ...@@ -38,111 +40,18 @@ shmem-obj-y += shmem/shmem.o
target += std target += std
std-obj-y += std/std.o std-obj-y += std/std.o
std-obj-y += std/string.o std-obj-y += std/string.o
std-obj-y += ./$(ARCH_DIR)/std/syscalls-64.o
std-obj-y += ./$(ARCH_DIR)/std/call32.o
std-obj-y += ./$(ARCH_DIR)/std/prologue.o
sys-proto-generic := $(obj)/include/uapi/std/syscall.h include ./$(PLUGIN_ARCH_DIR)/std/syscalls/Makefile.syscalls
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 = $(ARCH_DIR)/std/syscalls/syscall_$(1).tbl
sys-asm = $(ARCH_DIR)/std/syscalls-$(1).S
sys-asm-common-name = std/syscalls/syscall-common-x86-$(1).S
sys-asm-common = $(ARCH_DIR)/$(sys-asm-common-name)
sys-bits := 64 define syscall-priority
$(addprefix $(obj)/,$($(1):%.o=%.d)): | $($(2))
AV := $$$$ $(addprefix $(obj)/,$($(1):%.o=%.i)): | $($(2))
$(addprefix $(obj)/,$($(1):%.o=%.s)): | $($(2))
define gen-rule-sys-codes $(addprefix $(obj)/,$($(1))): | $($(2))
$(sys-codes): $(sys-def)
$(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)
$(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 "std/syscall-codes-$(1).h"' >> $$@
$(Q) echo '#include "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 endef
define gen-rule-sys-asm #
$(sys-asm): $(sys-def) $(sys-asm-common) $(sys-codes) $(sys-proto) # Almost all plugins depen on syscall headers
$(call msg-gen, $$@) # and definitions so we have to order their
$(Q) echo "/* Autogenerated, don't edit */" > $$@ # generation manually.
$(Q) echo '#include "std/syscall-codes-$(1).h"' >> $$@ $(foreach t,$(target),$(eval $(call syscall-priority,$(t)-obj-y,std-headers-deps)))
$(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)
$(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): $(ARCH_DIR)/std/syscalls/syscall_32.tbl
$(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 "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__ */" >> $@
$(sys-proto-generic): $(strip $(call map,sys-proto,$(sys-bits)))
$(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 "std/syscall-32.h"' >> $@
$(Q) echo "#else" >> $@
$(Q) echo '#include "std/syscall-64.h"' >> $@
$(Q) echo "#endif /* CONFIG_X86_32 */" >> $@
$(Q) echo "" >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
$(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)))
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 += $(sys-codes-generic)
std-headers-deps += $(sys-proto-generic)
$(addprefix $(obj)/,$(std-obj-y:%.o=%.d)): | $(std-headers-deps)
$(addprefix $(obj)/,$(std-obj-y:%.o=%.i)): | $(std-headers-deps)
$(addprefix $(obj)/,$(std-obj-y:%.o=%.s)): | $(std-headers-deps)
$(addprefix $(obj)/,$(std-obj-y)): | $(std-headers-deps)
../../../../../arch/x86/plugins/include/asm/syscall-types.h
\ No newline at end of file
../../../../../criu/include/syscall-codes.h
\ No newline at end of file
../../../../../criu/include/syscall.h
\ No newline at end of file
...@@ -222,6 +222,8 @@ fin: ...@@ -222,6 +222,8 @@ fin:
void *std_memcpy(void *to, const void *from, unsigned int n) void *std_memcpy(void *to, const void *from, unsigned int n)
{ {
/* FIXME: Per-arch support */
#if 0
int d0, d1, d2; int d0, d1, d2;
asm volatile("rep ; movsl \n" asm volatile("rep ; movsl \n"
"movl %4,%%ecx \n" "movl %4,%%ecx \n"
...@@ -232,6 +234,7 @@ void *std_memcpy(void *to, const void *from, unsigned int n) ...@@ -232,6 +234,7 @@ void *std_memcpy(void *to, const void *from, unsigned int n)
: "=&c" (d0), "=&D" (d1), "=&S" (d2) : "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from) : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
: "memory"); : "memory");
#endif
return to; return to;
} }
......
...@@ -35,16 +35,16 @@ include $(__nmk_dir)msg.mk ...@@ -35,16 +35,16 @@ include $(__nmk_dir)msg.mk
# Needed libraries checks # Needed libraries checks
include $(SRC_DIR)/criu/Makefile.packages include $(SRC_DIR)/criu/Makefile.packages
# ##
# System calls library. ## System calls library.
ifeq ($(ARCH),x86) #ifeq ($(ARCH),x86)
# Do not need 32-bit compatible syscall lib compiled in criu ## Do not need 32-bit compatible syscall lib compiled in criu
SYSCALL-LIB := $(ARCH_DIR)/syscalls-64.built-in.o #SYSCALL-LIB := $(ARCH_DIR)/syscalls-64.built-in.o
else #else
SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o #SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
endif #endif
syscalls_lib: #syscalls_lib:
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all # $(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all
.PHONY: syscalls_lib .PHONY: syscalls_lib
# #
...@@ -95,7 +95,6 @@ subclean: ...@@ -95,7 +95,6 @@ subclean:
$(Q) $(RM) $(obj)/*.{gcda,gcno,gcov} $(Q) $(RM) $(obj)/*.{gcda,gcno,gcov}
$(Q) $(RM) $(obj)/pie/*.{gcda,gcno,gcov} $(Q) $(RM) $(obj)/pie/*.{gcda,gcno,gcov}
$(Q) $(RM) -r $(obj)/gcov $(Q) $(RM) -r $(obj)/gcov
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) clean
$(Q) $(MAKE) $(build)=$(ARCH_DIR) clean $(Q) $(MAKE) $(build)=$(ARCH_DIR) clean
$(Q) $(MAKE) $(call build-as,Makefile.library,$(PIE_DIR)) clean $(Q) $(MAKE) $(call build-as,Makefile.library,$(PIE_DIR)) clean
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) clean $(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) clean
...@@ -107,7 +106,6 @@ clean: subclean ...@@ -107,7 +106,6 @@ clean: subclean
# #
# Delete all generated files # Delete all generated files
subproper: subproper:
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) mrproper
$(Q) $(MAKE) $(build)=$(ARCH_DIR) mrproper $(Q) $(MAKE) $(build)=$(ARCH_DIR) mrproper
$(Q) $(MAKE) $(call build-as,Makefile.library,$(PIE_DIR)) mrproper $(Q) $(MAKE) $(call build-as,Makefile.library,$(PIE_DIR)) mrproper
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) mrproper $(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) mrproper
......
...@@ -14,7 +14,7 @@ obj-y += cr-check.o ...@@ -14,7 +14,7 @@ obj-y += cr-check.o
obj-y += cr-dedup.o obj-y += cr-dedup.o
obj-y += cr-dump.o obj-y += cr-dump.o
obj-y += cr-errno.o obj-y += cr-errno.o
obj-y += cr-exec.o #obj-y += cr-exec.o
obj-y += cr-restore.o obj-y += cr-restore.o
obj-y += cr-service.o obj-y += cr-service.o
obj-y += crtools.o obj-y += crtools.o
......
...@@ -3,6 +3,8 @@ builtin-name := crtools.built-in.o ...@@ -3,6 +3,8 @@ builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) ccflags-y += -iquote $(obj) -iquote $(SRC_DIR)
ccflags-y += -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include ccflags-y += -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
ccflags-y += -iquote $(SRC_DIR)/include ccflags-y += -iquote $(SRC_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
asflags-y += -D__ASSEMBLY__ asflags-y += -D__ASSEMBLY__
obj-y += cpu.o obj-y += cpu.o
......
builtin-name := syscalls.built-in.o
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
SYS-TYPES := ../../include/syscall-types.h
SYS-CODES := ../../include/syscall-codes.h
SYS-PROTO := ../../include/syscall.h
SYS-DEF := syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S
obj-y += $(SYS-ASM:.S=).o
ARCH_BITS := 64
SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-CODES) \
$(obj)/$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
syscalls/$(SYS-ASM-COMMON) \
$(obj)/$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
all-y += $(obj)/$(SYS-EXEC-TBL)
mrproper-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
mrproper-y += $(obj)/$(SYS-CODES)
mrproper-y += $(obj)/$(SYS-PROTO)
../../arm/syscalls/syscall.def
\ No newline at end of file
...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o ...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
asflags-y += -D__ASSEMBLY__ asflags-y += -D__ASSEMBLY__
......
builtin-name := syscalls.built-in.o
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
SYS-TYPES := ../../include/syscall-types.h
SYS-CODES := ../../include/syscall-codes.h
SYS-PROTO := ../../include/syscall.h
SYS-DEF := syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S
obj-y += $(SYS-ASM:.S=).o
ARCH_BITS := 32
SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-CODES) \
$(obj)/$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
syscalls/$(SYS-ASM-COMMON) \
$(obj)/$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
all-y += $(obj)/$(SYS-EXEC-TBL)
mrproper-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
mrproper-y += $(obj)/$(SYS-CODES)
mrproper-y += $(obj)/$(SYS-PROTO)
...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o ...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
obj-y += cpu.o obj-y += cpu.o
obj-y += crtools.o obj-y += crtools.o
......
...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o ...@@ -2,6 +2,8 @@ builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
asflags-y += -Wstrict-prototypes -Wa,--noexecstack asflags-y += -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
......
include $(__nmk_dir)msg.mk
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
CFLAGS := $(filter-out -DCONFIG_X86_64,$(CFLAGS))
SYS-PROTO-GENERIC := $(obj)/../../include/syscall.h
SYS-CODES-GENERIC = $(obj)/../../include/syscall-codes.h
SYS-CODES = $(obj)/../../include/syscall-codes-$(1).h
SYS-PROTO = $(obj)/../../include/syscall-$(1).h
SYS-DEF = $(obj)/syscalls/syscall_$(1).tbl
SYS-ASM = syscalls-$(1).S
SYS-ASM-COMMON = syscall-common-x86-$(1).S
SYS-EXEC-TBL = $(obj)/sys-exec-tbl-$(1).c
target :=
target_32 := syscalls-32
target_64 := syscalls-64
SYS-BITS := 64
ifeq ($(CONFIG_COMPAT),y)
SYS-BITS += 32
endif
# targets
define gen-targets
target += $(target_$(1))
endef
$(eval $(call map,gen-targets,$(SYS-BITS)))
# AFLAGS, LDFLAGS
asflags-y += -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -iquote $(obj) -iquote $(obj)/include
asflags-y += -iquote $(SRC_DIR)/criu/include
AFLAGS_$(target_32) += -fno-pic -m32
AFLAGS_$(target_64) += -fpie
LDFLAGS_$(target_32) += -m elf_i386
$(target_32)-obj-y += syscalls/syscall32.o
$(obj)/syscalls/syscall32.d: $(obj)/../../include/syscall-codes-32.h \
$(obj)/../../include/syscall-32.h
CFLAGS_syscall32.o += -fno-pic -m32 -DCR_NOGLIBC -DCONFIG_X86_32
CFLAGS_syscall32.d += -fno-pic -m32 -DCR_NOGLIBC -DCONFIG_X86_32
cleanup-y += $(obj)/syscalls/syscall32.o
# Here are rules for 32/64-bit platforms. For compat mode we need both
# 32 and 64 bit syscalls, so generate the rules with SYS-BIT being
# $1 parameter in all gen-rule-*
# awk variable should be escaped twice
AV := $$$$
define gen-rule-sys-codes
$(SYS-CODES): $(SYS-DEF)
$(call msg-gen, $$@)
$(Q) echo "/* Autogenerated, don't edit */" > $$@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H_$(1)__" >> $$@
$(Q) echo "#define __ASM_CR_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_CR_SYSCALL_CODES_H_$(1)__ */" >> $$@
mrproper-y += $(SYS-CODES)
endef
define gen-rule-sys-proto
$(SYS-PROTO): $(SYS-DEF)
$(call msg-gen, $$@)
$(Q) echo "/* Autogenerated, don't edit */" > $$@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H_$(1)__" >> $$@
$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H_$(1)__" >> $$@
$(Q) echo "#ifndef CR_NOGLIBC" >> $$@
$(Q) echo "# error This file should only be used in the parasite code" \
>> $$@
$(Q) echo "#endif" >> $$@
$(Q) echo '#include "syscall-codes-$(1).h"' >> $$@
$(Q) echo '#include "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_CR_SYSCALL_PROTO_H_$(1)__ */" >> $$@
mrproper-y += $(SYS-PROTO)
endef
define gen-rule-sys-asm
$(obj)/$(SYS-ASM): $(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) \
$(SYS-CODES) $(SYS-PROTO)
$(call msg-gen, $$@)
$(Q) echo "/* Autogenerated, don't edit */" > $$@
$(Q) echo '#include "syscall-codes-$(1).h"' >> $$@
$(Q) echo '#include "syscalls/$(SYS-ASM-COMMON)"' >> $$@
$(Q) cat $$< | awk '/^__NR/{print "SYSCALL(", $(AV)3, ",", $(AV)2, ")"}'\
>> $$@
mrproper-y += $(obj)/$(SYS-ASM)
$(target_$(1))-obj-y += $(SYS-ASM:.S=).o
endef
# for 32-bit $(SYS-ASM)
AFLAGS_syscalls-32.o += -fno-pic -m32
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, ")"}' >> $$@
mrproper-y += $(SYS-EXEC-TBL)
all-y += $(SYS-EXEC-TBL)
endef
# Some parts of criu need SYS_memfd_create and other ifndef/define syscalls
# Use 64-bit, native syscalls as-is, add __NR32_*/SYS32_* defines
# to generic file
$(SYS-CODES-GENERIC): $(obj)/syscalls/syscall_32.tbl
$(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 "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)
all-y += $(SYS-CODES-GENERIC)
$(SYS-PROTO-GENERIC): $(strip $(call map,SYS-PROTO,$(SYS-BITS)))
$(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 "syscall-32.h"' >> $@
$(Q) echo "#else" >> $@
$(Q) echo '#include "syscall-64.h"' >> $@
$(Q) echo "#endif /* CONFIG_X86_32 */" >> $@
$(Q) echo "" >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
mrproper-y += $(SYS-PROTO-GENERIC)
$(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)))
#include "common/asm/linkage.h"
#define SYSCALL(name, opcode) \
ENTRY(name); \
movl $opcode, %eax; \
jmp __syscall_common; \
END(name)
ENTRY(__syscall_common)
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
#define __arg(n) (4 * (n) + 20)(%esp)
movl __arg(0),%ebx
movl __arg(1),%ecx
movl __arg(2),%edx
movl __arg(3),%esi
movl __arg(4),%edi
movl __arg(5),%ebp
#undef __arg
int $0x80
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
END(__syscall_common)
ENTRY(__cr_restore_rt)
movl $__NR_rt_sigreturn, %eax
jmp __syscall_common
END(__cr_restore_rt)
#include "common/asm/linkage.h"
#define SYSCALL(name, opcode) \
ENTRY(name); \
movl $opcode, %eax; \
jmp __syscall_common; \
END(name)
.text
.align 4
ENTRY(__syscall_common)
movq %rcx, %r10
syscall
ret
END(__syscall_common)
ENTRY(__cr_restore_rt)
movq $__NR_rt_sigreturn, %rax
syscall
END(__cr_restore_rt)
#include "asm/types.h"
#include "syscall-32.h"
#define SYS_SOCKET 1 /* sys_socket(2) */
#define SYS_BIND 2 /* sys_bind(2) */
#define SYS_CONNECT 3 /* sys_connect(2) */
#define SYS_SENDTO 11 /* sys_sendto(2) */
#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
long sys_socket(int domain, int type, int protocol)
{
u32 a[] = { (u32)domain, (u32)type, (u32)protocol };
return sys_socketcall(SYS_SOCKET, (unsigned long *)a);
}
long sys_connect(int sockfd, struct sockaddr *addr, int addrlen)
{
u32 a[] = {(u32)sockfd, (u32)addr, (u32)addrlen};
return sys_socketcall(SYS_CONNECT, (unsigned long *)a);
}
long sys_sendto(int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
{
u32 a[] = {(u32)sockfd, (u32)buff, (u32)len, (u32)flags, (u32)addr, (u32)addr_len};
return sys_socketcall(SYS_SENDTO, (unsigned long *)a);
}
long sys_recvfrom(int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
{
u32 a[] = {(u32)sockfd, (u32)ubuf, (u32)size, (u32)flags, (u32)addr, (u32)addr_len};
return sys_socketcall(SYS_RECVFROM, (unsigned long *)a);
}
long sys_sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
u32 a[] = {(u32)sockfd, (u32)msg, (u32)flags};
return sys_socketcall(SYS_SENDMSG, (unsigned long *)a);
}
long sys_recvmsg(int sockfd, struct msghdr *msg, int flags)
{
u32 a[] = {(u32)sockfd, (u32)msg, (u32)flags};
return sys_socketcall(SYS_RECVMSG, (unsigned long *)a);
}
long sys_shutdown(int sockfd, int how)
{
u32 a[] = {(u32)sockfd, (u32)how};
return sys_socketcall(SYS_SHUTDOWN, (unsigned long *)a);
}
long sys_bind(int sockfd, const struct sockaddr *addr, int addrlen)
{
u32 a[] = {(u32)sockfd, (u32)addr, (u32)addrlen};
return sys_socketcall(SYS_BIND, (unsigned long *)a);
}
long sys_setsockopt(int sockfd, int level, int optname, const void *optval, unsigned int optlen)
{
u32 a[] = {(u32)sockfd, (u32)level, (u32)optname, (u32)optval, (u32)optlen};
return sys_socketcall(SYS_SETSOCKOPT, (unsigned long *)a);
}
long sys_getsockopt(int sockfd, int level, int optname, const void *optval, unsigned int *optlen)
{
u32 a[] = {(u32)sockfd, (u32)level, (u32)optname, (u32)optval, (u32)optlen};
return sys_socketcall(SYS_GETSOCKOPT, (unsigned long *)a);
}
#define SHMAT 21
long sys_shmat(int shmid, void *shmaddr, int shmflag)
{
return sys_ipc(SHMAT, shmid, shmflag, 0, shmaddr, 0);
}
long sys_pread(unsigned int fd, char *ubuf, u32 count, u64 pos)
{
return sys_pread64(fd, ubuf, count, (u32)(pos & 0xffffffffu), (u32)(pos >> 32));
}
#
# System calls table, please make sure the table consist only the syscalls
# really used somewhere in project.
#
# code name arguments
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
__NR_restart_syscall 0 sys_restart_syscall (void)
__NR_exit 1 sys_exit (unsigned long error_code)
__NR_read 3 sys_read (int fd, void *buf, unsigned long count)
__NR_write 4 sys_write (int fd, const void *buf, unsigned long count)
__NR_open 5 sys_open (const char *filename, int flags, unsigned int mode)
__NR_close 6 sys_close (int fd)
__NR_unlink 10 sys_unlink (char *pathname)
__NR_lseek 19 sys_lseek (int fd, s32 offset, unsigned int origin)
__NR_getpid 20 sys_getpid (void)
__NR_mount 21 sys_mount (const char *dev_name, const char *dir_name, const char *type, unsigned long flags, const void *data)
__NR_ptrace 26 sys_ptrace (long request, pid_t pid, void *addr, void *data)
__NR_kill 37 sys_kill (long pid, int sig)
__NR_mkdir 39 sys_mkdir (const char *name, int mode)
__NR_rmdir 40 sys_rmdir (const char *name)
__NR_brk 45 sys_brk (void *addr)
__NR_umount2 52 sys_umount2 (char *name, int flags)
__NR_ioctl 54 sys_ioctl (unsigned int fd, unsigned int cmd, unsigned long arg)
__NR_fcntl 55 sys_fcntl (unsigned int fd, unsigned int cmd, unsigned long arg)
__NR_umask 60 sys_umask (int mask)
__NR_setrlimit 75 sys_setrlimit (unsigned int resource, struct krlimit *rlim)
__NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz)
__NR_munmap 91 sys_munmap (void *addr, unsigned long len)
__NR_setpriority 97 sys_setpriority (int which, int who, int nice)
__NR_socketcall 102 sys_socketcall (int call, unsigned long *args)
__NR_setitimer 104 sys_setitimer (int which, struct itimerval *in, struct itimerval *out)
__NR_getitimer 105 sys_getitimer (int which, struct itimerval *it)
__NR_wait4 114 sys_wait4 (pid_t pid, int *stat_addr, int options, struct rusage *ru)
__NR_ipc 117 sys_ipc (unsigned int call, int first, unsigned long second, unsigned long third, void *ptr, long fifth)
__NR_clone 120 sys_clone (unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
__NR_mprotect 125 sys_mprotect (const void *addr, unsigned long len, unsigned long prot)
__NR_getpgid 132 sys_getpgid (pid_t pid)
__NR_personality 136 sys_personality (unsigned int personality)
__NR_flock 143 sys_flock (int fd, unsigned long cmd)
__NR_getsid 147 sys_getsid (void)
__NR_sched_setscheduler 156 sys_sched_setscheduler (int pid, int policy, struct sched_param *p)
__NR_nanosleep 162 sys_nanosleep (struct timespec *rqtp, struct timespec *rmtp)
__NR_mremap 163 sys_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr)
__NR_prctl 172 sys_prctl (int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
__NR_rt_sigreturn 173 sys_rt_sigreturn (void)
__NR_rt_sigaction 174 sys_sigaction (int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
__NR_rt_sigprocmask 175 sys_sigprocmask (int how, k_rtsigset_t *set, k_rtsigset_t *oset, size_t sigsetsize)
__NR_rt_sigqueueinfo 178 sys_rt_sigqueueinfo (pid_t pid, int sig, siginfo_t *uinfo)
__NR_pread64 180 sys_pread64 (unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi)
__NR_capget 184 sys_capget (struct cap_header *h, struct cap_data *d)
__NR_capset 185 sys_capset (struct cap_header *h, struct cap_data *d)
__NR_sigaltstack 186 sys_sigaltstack (const void *uss_ptr, void *uoss_ptr)
__NR_mmap2 192 sys_mmap (void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff)
__NR_getgroups32 205 sys_getgroups (int gsize, unsigned int *groups)
__NR_setgroups32 206 sys_setgroups (int gsize, unsigned int *groups)
__NR_setresuid32 208 sys_setresuid (int uid, int euid, int suid)
__NR_getresuid32 209 sys_getresuid (int *uid, int *euid, int *suid)
__NR_setresgid32 210 sys_setresgid (int gid, int egid, int sgid)
__NR_getresgid32 211 sys_getresgid (int *gid, int *egid, int *sgid)
__NR_setfsuid32 215 sys_setfsuid (int fsuid)
__NR_setfsgid32 216 sys_setfsgid (int fsgid)
__NR_mincore 218 sys_mincore (void *addr, unsigned long size, unsigned char *vec)
__NR_madvise 219 sys_madvise (unsigned long start, size_t len, int behavior)
__NR_gettid 224 sys_gettid (void)
__NR_futex 240 sys_futex (u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
__NR_set_thread_area 243 sys_set_thread_area (user_desc_t *info)
__NR_get_thread_area 244 sys_get_thread_area (user_desc_t *info)
__NR_io_setup 245 sys_io_setup (unsigned nr_reqs, aio_context_t *ctx32p)
__NR_io_getevents 247 sys_io_getevents (aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout)
__NR_io_submit 248 sys_io_submit (aio_context_t ctx_id, long nr, struct iocb **iocbpp)
__NR_exit_group 252 sys_exit_group (int error_code)
__NR_set_tid_address 258 sys_set_tid_address (int *tid_addr)
__NR_timer_create 259 sys_timer_create (clockid_t which_clock, struct sigevent *timer_event_spec, kernel_timer_t *created_timer_id)
__NR_timer_settime 260 sys_timer_settime (kernel_timer_t timer_id, int flags, struct itimerspec *new, struct itimerspec *old)
__NR_timer_gettime 261 sys_timer_gettime (int timer_id, struct itimerspec *setting)
__NR_timer_getoverrun 262 sys_timer_getoverrun (int timer_id)
__NR_timer_delete 263 sys_timer_delete (kernel_timer_t timer_id)
__NR_clock_gettime 265 sys_clock_gettime (int which_clock, struct timespec *tp)
__NR_waitid 284 sys_waitid (int which, pid_t pid, struct siginfo *infop, int options, struct rusage *ru)
__NR_openat 295 sys_openat (int dfd, const char *filename, int flags, int mode)
__NR_readlinkat 305 sys_readlinkat (int fd, const char *path, char *buf, int bufsize)
__NR_set_robust_list 311 sys_set_robust_list (struct robust_list_head *head, size_t len)
__NR_get_robust_list 312 sys_get_robust_list (int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
__NR_vmsplice 316 sys_vmsplice (int fd, const struct iovec *iov, unsigned int nr_segs, unsigned int flags)
__NR_signalfd 321 sys_signalfd (int ufd, const k_rtsigset_t *sigmask, size_t sigsetsize)
__NR_timerfd_settime 325 sys_timerfd_settime (int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
__NR_rt_tgsigqueueinfo 335 sys_rt_tgsigqueueinfo (pid_t tgid, pid_t pid, int sig, siginfo_t *uinfo)
__NR_fanotify_init 338 sys_fanotify_init (unsigned int flags, unsigned int event_f_flags)
__NR_fanotify_mark 339 sys_fanotify_mark (int fanotify_fd, unsigned int flag, u32 mask, int dfd, const char *pathname)
__NR_open_by_handle_at 342 sys_open_by_handle_at (int mountdirfd, struct file_handle *handle, int flags)
__NR_setns 346 sys_setns (int fd, int nstype)
__NR_kcmp 349 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
__NR_seccomp 354 sys_seccomp (unsigned int op, unsigned int flags, const char *uargs)
__NR_memfd_create 356 sys_memfd_create (const char *name, unsigned int flags)
#
# System calls table, please make sure the table consist only the syscalls
# really used somewhere in project.
#
# __NR_name code name arguments
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
__NR_read 0 sys_read (int fd, void *buf, unsigned long count)
__NR_write 1 sys_write (int fd, const void *buf, unsigned long count)
__NR_open 2 sys_open (const char *filename, unsigned long flags, unsigned long mode)
__NR_close 3 sys_close (int fd)
__NR_lseek 8 sys_lseek (int fd, unsigned long offset, unsigned long origin)
__NR_mmap 9 sys_mmap (void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
__NR_mprotect 10 sys_mprotect (const void *addr, unsigned long len, unsigned long prot)
__NR_munmap 11 sys_munmap (void *addr, unsigned long len)
__NR_brk 12 sys_brk (void *addr)
__NR_rt_sigaction 13 sys_sigaction (int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
__NR_rt_sigprocmask 14 sys_sigprocmask (int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
__NR_rt_sigreturn 15 sys_rt_sigreturn (void)
__NR_ioctl 16 sys_ioctl (unsigned int fd, unsigned int cmd, unsigned long arg)
__NR_pread64 17 sys_pread (unsigned int fd, char *buf, size_t count, loff_t pos)
__NR_mremap 25 sys_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr)
__NR_mincore 27 sys_mincore (void *addr, unsigned long size, unsigned char *vec)
__NR_madvise 28 sys_madvise (unsigned long start, size_t len, int behavior)
__NR_shmat 30 sys_shmat (int shmid, void *shmaddr, int shmflag)
__NR_dup2 33 sys_dup2 (int oldfd, int newfd)
__NR_nanosleep 35 sys_nanosleep (struct timespec *req, struct timespec *rem)
__NR_getitimer 36 sys_getitimer (int which, const struct itimerval *val)
__NR_setitimer 38 sys_setitimer (int which, const struct itimerval *val, struct itimerval *old)
__NR_getpid 39 sys_getpid (void)
__NR_socket 41 sys_socket (int domain, int type, int protocol)
__NR_connect 42 sys_connect (int sockfd, struct sockaddr *addr, int addrlen)
__NR_sendto 44 sys_sendto (int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
__NR_recvfrom 45 sys_recvfrom (int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
__NR_sendmsg 46 sys_sendmsg (int sockfd, const struct msghdr *msg, int flags)
__NR_recvmsg 47 sys_recvmsg (int sockfd, struct msghdr *msg, int flags)
__NR_shutdown 48 sys_shutdown (int sockfd, int how)
__NR_bind 49 sys_bind (int sockfd, const struct sockaddr *addr, int addrlen)
__NR_setsockopt 54 sys_setsockopt (int sockfd, int level, int optname, const void *optval, socklen_t optlen)
__NR_getsockopt 55 sys_getsockopt (int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
__NR_clone 56 sys_clone (unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
__NR_exit 60 sys_exit (unsigned long error_code)
__NR_wait4 61 sys_wait4 (int pid, int *status, int options, struct rusage *ru)
__NR_kill 62 sys_kill (long pid, int sig)
__NR_fcntl 72 sys_fcntl (int fd, int type, long arg)
__NR_flock 73 sys_flock (int fd, unsigned long cmd)
__NR_mkdir 83 sys_mkdir (const char *name, int mode)
__NR_rmdir 84 sys_rmdir (const char *name)
__NR_unlink 87 sys_unlink (char *pathname)
__NR_umask 95 sys_umask (int mask)
__NR_gettimeofday 96 sys_gettimeofday (struct timeval *tv, struct timezone *tz)
__NR_ptrace 101 sys_ptrace (long request, pid_t pid, void *addr, void *data)
__NR_getgroups 115 sys_getgroups (int gsize, unsigned int *groups)
__NR_setgroups 116 sys_setgroups (int gsize, unsigned int *groups)
__NR_setresuid 117 sys_setresuid (int uid, int euid, int suid)
__NR_getresuid 118 sys_getresuid (int *uid, int *euid, int *suid)
__NR_setresgid 119 sys_setresgid (int gid, int egid, int sgid)
__NR_getresgid 120 sys_getresgid (int *gid, int *egid, int *sgid)
__NR_getpgid 121 sys_getpgid (pid_t pid)
__NR_setfsuid 122 sys_setfsuid (int fsuid)
__NR_setfsgid 123 sys_setfsgid (int fsgid)
__NR_getsid 124 sys_getsid (void)
__NR_capget 125 sys_capget (struct cap_header *h, struct cap_data *d)
__NR_capset 126 sys_capset (struct cap_header *h, struct cap_data *d)
__NR_rt_sigqueueinfo 129 sys_rt_sigqueueinfo (pid_t pid, int sig, siginfo_t *info)
__NR_sigaltstack 131 sys_sigaltstack (const void *uss, void *uoss)
__NR_personality 135 sys_personality (unsigned int personality)
__NR_setpriority 141 sys_setpriority (int which, int who, int nice)
__NR_sched_setscheduler 144 sys_sched_setscheduler (int pid, int policy, struct sched_param *p)
__NR_prctl 157 sys_prctl (int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
__NR_arch_prctl 158 sys_arch_prctl (int option, unsigned long addr)
__NR_setrlimit 160 sys_setrlimit (int resource, struct krlimit *rlim)
__NR_mount 165 sys_mount (char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
__NR_umount2 166 sys_umount2 (char *name, int flags)
__NR_gettid 186 sys_gettid (void)
__NR_futex 202 sys_futex (u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
__NR_set_thread_area 205 sys_set_thread_area (user_desc_t *info)
__NR_io_setup 206 sys_io_setup (unsigned nr_events, aio_context_t *ctx)
__NR_io_getevents 208 sys_io_getevents (aio_context_t ctx, long min_nr, long nr, struct io_event *evs, struct timespec *tmo)
__NR_io_submit 209 sys_io_submit (aio_context_t ctx, long nr, struct iocb **iocbpp)
__NR_get_thread_area 211 sys_get_thread_area (user_desc_t *info)
__NR_set_tid_address 218 sys_set_tid_address (int *tid_addr)
__NR_restart_syscall 219 sys_restart_syscall (void)
__NR_sys_timer_create 222 sys_timer_create (clockid_t which_clock, struct sigevent *timer_event_spec, kernel_timer_t *created_timer_id)
__NR_sys_timer_settime 223 sys_timer_settime (kernel_timer_t timer_id, int flags, const struct itimerspec *new_setting, struct itimerspec *old_setting)
__NR_sys_timer_gettime 224 sys_timer_gettime (int timer_id, const struct itimerspec *setting)
__NR_sys_timer_getoverrun 225 sys_timer_getoverrun (int timer_id)
__NR_sys_timer_delete 226 sys_timer_delete (kernel_timer_t timer_id)
__NR_clock_gettime 228 sys_clock_gettime (const clockid_t which_clock, const struct timespec *tp)
__NR_exit_group 231 sys_exit_group (int error_code)
__NR_openat 257 sys_openat (int dfd, const char *filename, int flags, int mode)
__NR_waitid 247 sys_waitid (int which, pid_t pid, struct siginfo *infop, int options, struct rusage *ru)
__NR_readlinkat 267 sys_readlinkat (int fd, const char *path, char *buf, int bufsize)
__NR_set_robust_list 273 sys_set_robust_list (struct robust_list_head *head, size_t len)
__NR_get_robust_list 274 sys_get_robust_list (int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
__NR_seccomp 317 sys_seccomp (unsigned int op, unsigned int flags, const char *uargs)
__NR_vmsplice 278 sys_vmsplice (int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags)
__NR_timerfd_settime 286 sys_timerfd_settime (int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
__NR_signalfd4 289 sys_signalfd (int fd, k_rtsigset_t *mask, size_t sizemask, int flags)
__NR_rt_tgsigqueueinfo 297 sys_rt_tgsigqueueinfo (pid_t tgid, pid_t pid, int sig, siginfo_t *info)
__NR_fanotify_init 300 sys_fanotify_init (unsigned int flags, unsigned int event_f_flags)
__NR_fanotify_mark 301 sys_fanotify_mark (int fanotify_fd, unsigned int flags, u64 mask, int dfd, const char *pathname)
__NR_open_by_handle_at 304 sys_open_by_handle_at (int mountdirfd, struct file_handle *handle, int flags)
__NR_setns 308 sys_setns (int fd, int nstype)
__NR_kcmp 312 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
__NR_memfd_create 319 sys_memfd_create (const char *name, unsigned int flags)
...@@ -764,6 +764,7 @@ int main(int argc, char *argv[], char *envp[]) ...@@ -764,6 +764,7 @@ int main(int argc, char *argv[], char *envp[])
if (!strcmp(argv[optind], "check")) if (!strcmp(argv[optind], "check"))
return cr_check() != 0; return cr_check() != 0;
#if 0
if (!strcmp(argv[optind], "exec")) { if (!strcmp(argv[optind], "exec")) {
if (!pid) if (!pid)
pid = tree_id; /* old usage */ pid = tree_id; /* old usage */
...@@ -771,6 +772,7 @@ int main(int argc, char *argv[], char *envp[]) ...@@ -771,6 +772,7 @@ int main(int argc, char *argv[], char *envp[])
goto opt_pid_missing; goto opt_pid_missing;
return cr_exec(pid, argv + optind + 1) != 0; return cr_exec(pid, argv + optind + 1) != 0;
} }
#endif
if (!strcmp(argv[optind], "page-server")) if (!strcmp(argv[optind], "page-server"))
return cr_page_server(opts.daemon_mode, -1) != 0; return cr_page_server(opts.daemon_mode, -1) != 0;
......
...@@ -13,7 +13,7 @@ restorer-obj-y += restorer.o ...@@ -13,7 +13,7 @@ restorer-obj-y += restorer.o
restorer-obj-y += ./$(ARCH_DIR)/restorer.o restorer-obj-y += ./$(ARCH_DIR)/restorer.o
ifeq ($(ARCH),x86) ifeq ($(ARCH),x86)
restorer-obj-e += ./$(ARCH_DIR)/syscalls-64.built-in.o restorer-obj-e += ./compel/plugins/std.built-in.o
ifeq ($(CONFIG_COMPAT),y) ifeq ($(CONFIG_COMPAT),y)
restorer-obj-y += ./$(ARCH_DIR)/call32.o restorer-obj-y += ./$(ARCH_DIR)/call32.o
...@@ -21,9 +21,9 @@ ifeq ($(ARCH),x86) ...@@ -21,9 +21,9 @@ ifeq ($(ARCH),x86)
endif endif
native-obj-y += ./$(ARCH_DIR)/parasite-head-64.o native-obj-y += ./$(ARCH_DIR)/parasite-head-64.o
native-obj-e += ./$(ARCH_DIR)/syscalls-64.built-in.o native-obj-e += ./compel/plugins/std.built-in.o
compat-obj-y += ./$(ARCH_DIR)/parasite-head-32.o compat-obj-y += ./$(ARCH_DIR)/parasite-head-32.o
compat-obj-e += ./$(ARCH_DIR)/syscalls-32.built-in.o compat-obj-e += ./compel/plugins/std-32.built-in.o
AFLAGS_parasite-head-64.o += -fpie -DCONFIG_X86_64 AFLAGS_parasite-head-64.o += -fpie -DCONFIG_X86_64
AFLAGS_parasite-head-64.d += -fpie -DCONFIG_X86_64 AFLAGS_parasite-head-64.d += -fpie -DCONFIG_X86_64
...@@ -32,8 +32,8 @@ ifeq ($(ARCH),x86) ...@@ -32,8 +32,8 @@ ifeq ($(ARCH),x86)
AFLAGS_parasite-head-32.d += -fno-pic -m32 -DCONFIG_X86_32 AFLAGS_parasite-head-32.d += -fno-pic -m32 -DCONFIG_X86_32
else else
native-obj-y += ./$(ARCH_DIR)/parasite-head.o native-obj-y += ./$(ARCH_DIR)/parasite-head.o
native-obj-e += ./$(ARCH_DIR)/syscalls.built-in.o native-obj-e += ./compel/plugins/std.built-in.o
restorer-obj-e += ./$(ARCH_DIR)/syscalls.built-in.o restorer-obj-e += ./compel/plugins/std.built-in.o
endif endif
target += $(parasite_target) restorer target += $(parasite_target) restorer
...@@ -54,7 +54,8 @@ CFLAGS += -iquote $(SRC_DIR) ...@@ -54,7 +54,8 @@ CFLAGS += -iquote $(SRC_DIR)
CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0 CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
ccflags-y += -DCR_NOGLIBC ccflags-y += -DCR_NOGLIBC
ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),) ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),)
NATIVE_CFLAGS := $(shell $(SRC_DIR)/compel/compel-host --arch=$(ARCH) cflags) NATIVE_CFLAGS := $(shell $(SRC_DIR)/compel/compel-host --arch=$(ARCH) cflags)
......
...@@ -63,6 +63,8 @@ iquotes += -iquote $(SRC_DIR)/$(ARCH_DIR)/include ...@@ -63,6 +63,8 @@ iquotes += -iquote $(SRC_DIR)/$(ARCH_DIR)/include
iquotes += -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include iquotes += -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes) CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
asflags-y := -D__ASSEMBLY__ $(iquotes) asflags-y := -D__ASSEMBLY__ $(iquotes)
ccflags-y += -iquote $(SRC_DIR)/compel/plugins/include
ccflags-y += -iquote $(SRC_DIR)/compel/include
ifeq ($(SRCARCH),arm) ifeq ($(SRCARCH),arm)
ccflags-y += -marm ccflags-y += -marm
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
#include "asm/parasite.h" #include "asm/parasite.h"
#include "restorer.h" #include "restorer.h"
int compel_main(void *arg_p, unsigned int arg_s)
{
return 0;
}
static int tsock = -1; static int tsock = -1;
static struct rt_sigframe *sigframe; static struct rt_sigframe *sigframe;
......
...@@ -61,6 +61,11 @@ static int n_helpers; ...@@ -61,6 +61,11 @@ static int n_helpers;
static pid_t *zombies; static pid_t *zombies;
static int n_zombies; static int n_zombies;
int compel_main(void *arg_p, unsigned int arg_s)
{
return 0;
}
extern void cr_restore_rt (void) asm ("__cr_restore_rt") extern void cr_restore_rt (void) asm ("__cr_restore_rt")
__attribute__ ((visibility ("hidden"))); __attribute__ ((visibility ("hidden")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment