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

[UNIKRAFT PATCH 2/5] lib/ukmmap: Register `mmap` and `munmap` to syscall_shim



Registers `mmap` and `munmap` system calls to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@xxxxxxxxx>
---
 lib/ukmmap/Makefile.uk   | 2 ++
 lib/ukmmap/exportsyms.uk | 4 ++++
 lib/ukmmap/mmap.c        | 7 ++++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/ukmmap/Makefile.uk b/lib/ukmmap/Makefile.uk
index 71ff432..ac49d36 100644
--- a/lib/ukmmap/Makefile.uk
+++ b/lib/ukmmap/Makefile.uk
@@ -1,3 +1,5 @@
 $(eval $(call addlib_s,libukmmap,$(CONFIG_LIBUKMMAP)))
 
 LIBUKMMAP_SRCS-y += $(LIBUKMMAP_BASE)/mmap.c
+
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBUKMMAP) += mmap-6 munmap-2
diff --git a/lib/ukmmap/exportsyms.uk b/lib/ukmmap/exportsyms.uk
index 6b8c116..eb1c19a 100644
--- a/lib/ukmmap/exportsyms.uk
+++ b/lib/ukmmap/exportsyms.uk
@@ -1,3 +1,7 @@
 mmap
+uk_syscall_e_mmap
+uk_syscall_r_mmap
 munmap
+uk_syscall_e_munmap
+uk_syscall_r_munmap
 mremap
diff --git a/lib/ukmmap/mmap.c b/lib/ukmmap/mmap.c
index 39ecbef..ea0173a 100644
--- a/lib/ukmmap/mmap.c
+++ b/lib/ukmmap/mmap.c
@@ -37,6 +37,7 @@
 #include <sys/mman.h>
 #include <uk/alloc.h>
 #include <string.h>
+#include <uk/syscall.h>
 
 struct mmap_addr {
        void *begin;
@@ -64,8 +65,8 @@ static struct mmap_addr *mmap_addr;
  *
  */
 
-void *mmap(void *addr, size_t len, int prot,
-               int flags, int fildes, off_t off)
+UK_SYSCALL_DEFINE(void*, mmap, void*, addr, size_t, len, int, prot,
+               int, flags, int, fildes, off_t, off)
 {
        struct mmap_addr *tmp = mmap_addr, *last = NULL, *new = NULL;
 
@@ -125,7 +126,7 @@ void *mmap(void *addr, size_t len, int prot,
  * Otherwise the initial memory block is replaced by a smaller one.
  */
 
-int munmap(void *addr, size_t len)
+UK_SYSCALL_DEFINE(int, munmap, void*, addr, size_t, len)
 {
        struct mmap_addr *tmp = mmap_addr, *prev = NULL;
        size_t remain_mem;
-- 
2.17.1




 


Rackspace

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