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

[Minios-devel] [UNIKRAFT PATCH 06/10] 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 | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/syscall_shim/Makefile.uk b/lib/syscall_shim/Makefile.uk
index 52a12f18..bb76d7b1 100644
--- a/lib/syscall_shim/Makefile.uk
+++ b/lib/syscall_shim/Makefile.uk
@@ -4,9 +4,12 @@ __GEN_INCLUDES_PATH := $(LIBSYSCALL_SHIM_BUILD)/include/uk/bits
 
 __PHONY_GEN_SRC := syscall_map.h syscall_stubs.h syscall_nrs.h
 __PHONY_GEN_SRC := $(addprefix $(__GEN_INCLUDES_PATH)/, $(__PHONY_GEN_SRC))
+__PHONY_GEN_SRC += $(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in
 __PHONY_GEN_SRC_NEW := $(addsuffix .new, $(__PHONY_GEN_SRC))
 
-UK_PREPARE-$(CONFIG_LIBSYSCALL_SHIM) += $(__PHONY_GEN_SRC)
+__GEN_SRC := $(__GEN_INCLUDES_PATH)/provided_syscalls.h
+
+UK_PREPARE-$(CONFIG_LIBSYSCALL_SHIM) += $(__PHONY_GEN_SRC) $(__GEN_SRC)
 
 
 __SYSCALL_SHIM_TEMPL := 
$(LIBSYSCALL_SHIM_BASE)/arch/$(CONFIG_UK_ARCH)/syscall.h.in
@@ -33,8 +36,18 @@ $(__GEN_INCLUDES_PATH)/syscall_map.h.new:
                }' \
                $(__SYSCALL_SHIM_TEMPL) > $@
 
+$(__GEN_INCLUDES_PATH)/provided_syscalls.h: 
$(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in
+       $Q $(AWK) -F '-' \
+       '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;}' \
+       $^ > $@
+
+$(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in.new:
+       $Q echo $(UK_PROVIDED_SYSCALLS-y) | tr ' ' '\n' > $@
+
 $(__GEN_INCLUDES_PATH)/syscall_stubs.h.new:
        $(Q) $(AWK) -f $(LIBSYSCALL_SHIM_BASE)/gen_stubs.awk \
                $(__SYSCALL_SHIM_TEMPL) > $@
 
-LIBSYSCALL_SHIM_CLEAN = $(__PHONY_GEN_SRC) $(__PHONY_GEN_SRC_NEW)
+LIBSYSCALL_SHIM_CLEAN = $(__PHONY_GEN_SRC) $(__PHONY_GEN_SRC_NEW) $(__GEN_SRC)
-- 
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®.