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

Re: [Minios-devel] [UNIKRAFT PATCH 4/6] plat/*: Add binary system call feature and API


  • To: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
  • From: gaulthier.gain@xxxxxxxxx
  • Date: Thu, 12 Dec 2019 14:38:38 +0100 (CET)
  • Cc: Felipe Huici <felipe.huici@xxxxxxxxx>, minios-devel@xxxxxxxxxxxxx
  • Delivery-date: Thu, 12 Dec 2019 13:38:42 +0000
  • Dkim-filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be AECD72012360
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: wywDF5RjpD2uU64lS6bHw9sfG0kj9w==
  • Thread-topic: plat/*: Add binary system call feature and API

Reviewed-by: Gaulthier Gain <gaulthier.gain@xxxxxxxxx>

----- Mail original -----
De: "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
À: minios-devel@xxxxxxxxxxxxx
Cc: "Gaulthier Gain" <gaulthier.gain@xxxxxxxxx>, "Felipe Huici" 
<felipe.huici@xxxxxxxxx>, "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
Envoyé: Jeudi 5 Décembre 2019 15:02:20
Objet: [UNIKRAFT PATCH 4/6] plat/*: Add binary system call feature and API

Introduces the `HAVE_SYSCALL` feature flag that enables handling of
binary system calls. It is intended that the platform libraries are
enabling and implementing system call entrance for binary system call
requests when this flag is set.
This patch also introduces an extension to the platform API
(`include/uk/plat/syscall.h`) that defines a system call handler
prototype. It is intended that this handler should be implemented by a
non-platform library. A desing principle is that different system call
ABIs could be with this function signature. For this purpose, the trap
handler in the platform should save the CPU registers state and
hand-over a reference to the handler. The handler modifies this saved
state accordingly to the ABI standard. On returning, the trap should
then load the updated register values to the CPU and continue execution.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 include/uk/plat/syscall.h | 67 +++++++++++++++++++++++++++++++++++++++
 lib/Config.uk             |  4 +++
 plat/kvm/Config.uk        |  1 +
 plat/linuxu/Config.uk     |  1 +
 plat/xen/Config.uk        |  1 +
 5 files changed, 74 insertions(+)
 create mode 100644 include/uk/plat/syscall.h

diff --git a/include/uk/plat/syscall.h b/include/uk/plat/syscall.h
new file mode 100644
index 00000000..f62ddfe3
--- /dev/null
+++ b/include/uk/plat/syscall.h
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef __UKPLAT_SYSCALL__
+#define __UKPLAT_SYSCALL__
+
+#include <uk/config.h>
+#include <uk/arch/lcpu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef CONFIG_HAVE_SYSCALL
+
+/**
+ * Called by platform library when a binary system call was trapped.
+ * This function has to be provided by a non-platform library for
+ * executing the actual system call. Such a library has to set
+ * CONFIG_HAVE_SYSCALL to enable system call support on the platform
+ * library.
+ * It is intended that the handler modifies the register(s) state
+ * according to the implemented ABI.
+ *
+ * @param r Referenced to saved registers. After the call, the
+ *          the struct will be restored for the caller as state.
+ */
+void ukplat_syscall_handler(struct __regs *r);
+#endif /* CONFIG_HAVE_SYSCALL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UKPLAT_SYSCALL__ */
diff --git a/lib/Config.uk b/lib/Config.uk
index 7565257d..e83ed30b 100644
--- a/lib/Config.uk
+++ b/lib/Config.uk
@@ -24,3 +24,7 @@ config HAVE_SCHED
 config HAVE_NW_STACK
        bool
        default n
+
+config HAVE_SYSCALL
+       bool
+       default n
diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index 47ae8e2f..2bce43ea 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -2,6 +2,7 @@ menuconfig PLAT_KVM
        bool "KVM guest"
        default n
        depends on (ARCH_X86_64 || ARCH_ARM_64)
+       depends on !HAVE_SYSCALL
        select LIBUKDEBUG
        select LIBUKALLOC
        select LIBUKTIMECONV
diff --git a/plat/linuxu/Config.uk b/plat/linuxu/Config.uk
index ede9589a..d8c86d81 100644
--- a/plat/linuxu/Config.uk
+++ b/plat/linuxu/Config.uk
@@ -2,6 +2,7 @@ menuconfig PLAT_LINUXU
        bool "Linux user space"
        default n
        depends on (ARCH_X86_64) || (ARCH_ARM_32)
+       depends on !HAVE_SYSCALL
        select LIBUKDEBUG
        select LIBNOLIBC if !HAVE_LIBC
        help
diff --git a/plat/xen/Config.uk b/plat/xen/Config.uk
index bc103f14..366ab344 100644
--- a/plat/xen/Config.uk
+++ b/plat/xen/Config.uk
@@ -3,6 +3,7 @@ menuconfig PLAT_XEN
        default n
        depends on (ARCH_X86_32 || ARCH_X86_64 || ARCH_ARM_32)
        imply XEN_PV_BUILD_P2M
+       depends on !HAVE_SYSCALL
        select LIBUKDEBUG
        select LIBNOLIBC if !HAVE_LIBC
        select LIBUKTIME if !HAVE_LIBC && ARCH_X86_64
-- 
2.20.1

_______________________________________________
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®.