[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 5/9] lib/syscall_shim: generate provided_syscalls.h



The provided_syscalls.h will be containing prototypes for every
syscall present in the system.

It will be the responsibility of the libraries to tell syscall_shim if
certain syscall is provided. If syscall is available, it must be
listed in the makefile's variable 'UK_PROVIDED_SYSCALLS' in the format
<syscall_name>-<number_of_arguments>. For example:

UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += writev-3

Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 lib/syscall_shim/Makefile.uk      | 16 ++++++++++++++--
 lib/syscall_shim/gen_provided.awk |  5 +++++
 2 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 lib/syscall_shim/gen_provided.awk

diff --git a/lib/syscall_shim/Makefile.uk b/lib/syscall_shim/Makefile.uk
index 520e9206..0f7754df 100644
--- a/lib/syscall_shim/Makefile.uk
+++ b/lib/syscall_shim/Makefile.uk
@@ -4,10 +4,12 @@ LIBSYSCALL_SHIM_INCLUDES_PATH := 
$(LIBSYSCALL_SHIM_BUILD)/include/uk/bits
 
 LIBSYSCALL_SHIM_PHONY_SRC := syscall_map.h syscall_stubs.h syscall_nrs.h
 LIBSYSCALL_SHIM_PHONY_SRC := $(addprefix $(LIBSYSCALL_SHIM_INCLUDES_PATH)/, 
$(LIBSYSCALL_SHIM_PHONY_SRC))
+LIBSYSCALL_SHIM_PHONY_SRC += $(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in
 LIBSYSCALL_SHIM_PHONY_SRC_NEW := $(addsuffix .new, 
$(LIBSYSCALL_SHIM_PHONY_SRC))
 
-UK_PREPARE-$(CONFIG_LIBSYSCALL_SHIM) += $(LIBSYSCALL_SHIM_PHONY_SRC)
+LIBSYSCALL_SHIM_GEN_SRC := $(LIBSYSCALL_SHIM_INCLUDES_PATH)/provided_syscalls.h
 
+UK_PREPARE-$(CONFIG_LIBSYSCALL_SHIM) += $(LIBSYSCALL_SHIM_PHONY_SRC) 
$(LIBSYSCALL_SHIM_GEN_SRC)
 
 LIBSYSCALL_SHIM_TEMPL := 
$(LIBSYSCALL_SHIM_BASE)/arch/$(CONFIG_UK_ARCH)/syscall.h.in
 
@@ -30,9 +32,19 @@ $(LIBSYSCALL_SHIM_INCLUDES_PATH)/syscall_map.h.new:
                $(AWK) -f  $(LIBSYSCALL_SHIM_BASE)/gen_syscall_map.awk \
                $(LIBSYSCALL_SHIM_TEMPL) > $@)
 
+$(LIBSYSCALL_SHIM_INCLUDES_PATH)/provided_syscalls.h: 
$(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in
+       $(call build_cmd,GEN,SYSCALL_SHIM,$(notdir $@), \
+               $(AWK) -F '-' -f  $(LIBSYSCALL_SHIM_BASE)/gen_provided.awk \
+               $^ > $@)
+
+$(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in.new:
+       $(call build_cmd,GEN,SYSCALL_SHIM,$(notdir $@), \
+               echo $(UK_PROVIDED_SYSCALLS-y) | tr ' ' '\n' > $@)
+
 $(LIBSYSCALL_SHIM_INCLUDES_PATH)/syscall_stubs.h.new:
        $(call build_cmd,GEN,SYSCALL_SHIM,$(notdir $@), \
                $(AWK) -f $(LIBSYSCALL_SHIM_BASE)/gen_stubs.awk \
                $(LIBSYSCALL_SHIM_TEMPL) > $@)
 
-LIBSYSCALL_SHIM_CLEAN = $(LIBSYSCALL_SHIM_PHONY_SRC) 
$(LIBSYSCALL_SHIM_PHONY_SRC_NEW)
+LIBSYSCALL_SHIM_CLEAN = $(LIBSYSCALL_SHIM_PHONY_SRC) 
$(LIBSYSCALL_SHIM_PHONY_SRC_NEW) $(LIBSYSCALL_SHIM_GEN_SRC)
+
diff --git a/lib/syscall_shim/gen_provided.awk 
b/lib/syscall_shim/gen_provided.awk
new file mode 100644
index 00000000..0810893b
--- /dev/null
+++ b/lib/syscall_shim/gen_provided.awk
@@ -0,0 +1,5 @@
+BEGIN {print "/* Automatically generated file; DO NOT EDIT */"}
+/[a-zA-Z0-9]+-[0-9]+/{
+       printf "\n#define HAVE_uk_syscall_%s t", $1;
+       printf "\nUK_SYSCALL_PROTO(%s, %s);\n", $2, $1;
+}
-- 
2.19.2


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.