Closes T118: libbarrelfish: Extract common syscalls into architecture-independant...
authorMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Thu, 11 Jun 2015 14:50:28 +0000 (16:50 +0200)
committerMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Tue, 16 Jun 2015 11:37:41 +0000 (13:37 +0200)
Signed-off-by: Moritz Hoffmann <moritz.hoffmann@inf.ethz.ch>

lib/barrelfish/Hakefile
lib/barrelfish/arch/arm/syscalls.c
lib/barrelfish/arch/x86_32/syscalls.c
lib/barrelfish/arch/x86_64/syscalls.c
lib/barrelfish/syscalls.c [new file with mode: 0644]

index bf31e4e..34dc33d 100644 (file)
@@ -27,7 +27,7 @@
                       "slot_alloc/single_slot_alloc.c", "slot_alloc/multi_slot_alloc.c",
                       "slot_alloc/slot_alloc.c", "slot_alloc/range_slot_alloc.c",
                       "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
-                      "inthandler.c", "deferred.c"
+                      "inthandler.c", "deferred.c", "syscalls.c"
                     ]
 
       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
                       "slot_alloc/single_slot_alloc.c", "slot_alloc/multi_slot_alloc.c",
                       "slot_alloc/slot_alloc.c", "slot_alloc/range_slot_alloc.c",
                       "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
-                      "inthandler.c", "deferred.c"
+                      "inthandler.c", "deferred.c", "syscalls.c"
                     ]
 
       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
index 53fc128..cfec6a3 100644 (file)
@@ -24,23 +24,6 @@ STATIC_ASSERT(SYSCALL_REG == 0, "Bad register for system call argument.");
 // System call wrappers
 //
 
-errval_t sys_print(const char* string, size_t length)
-{
-    return syscall3(SYSCALL_PRINT, (uintptr_t)string, (uintptr_t)length).error;
-}
-
-errval_t sys_suspend(bool halt)
-{
-    return syscall2(SYSCALL_SUSPEND, halt).error;
-}
-
-errval_t sys_yield(capaddr_t target)
-{
-    STATIC_ASSERT_SIZEOF(target, sizeof(uintptr_t));
-    return syscall2(SYSCALL_YIELD, (uintptr_t) target).error;
-}
-
-
 #ifdef __ARM_ARCH_7M__  //cortex-m3 on pandaboard
 //add syscall for restoring a context that the dispatcher can not restore by itself
 errval_t sys_resume_context(arch_registers_state_t* registers){
index 341113e..500aa5a 100644 (file)
  * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
  */
 
-#include <barrelfish/barrelfish.h>
-#include <barrelfish/caddr.h>
-#include <barrelfish/dispatch.h>
-#include <barrelfish/syscall_arch.h>
-
-/* For documentation on system calls see include/barrelfish/syscalls.h
+/*
+ * No architecture specific system calls.
  */
-
-// XXX: sleep hack
-uint32_t yield_timeslices = 0;
-
-errval_t sys_yield(capaddr_t target)
-{
-    return syscall3(SYSCALL_YIELD, target, yield_timeslices).error;
-}
-
-errval_t sys_suspend(bool halt)
-{
-    return syscall2(SYSCALL_SUSPEND, halt).error;
-}
-
-errval_t sys_print(const char *string, size_t length)
-{
-    return syscall3(SYSCALL_PRINT, (uintptr_t)string, length).error;
-}
index a7b20d0..538e561 100644 (file)
 /* For documentation on system calls see include/barrelfish/syscalls.h
  */
 
-errval_t sys_yield(capaddr_t target)
-{
-    return syscall2(SYSCALL_YIELD, target).error;
-}
-
-errval_t sys_suspend(bool halt)
-{
-    return syscall2(SYSCALL_SUSPEND, halt).error;
-}
-
-errval_t sys_print(const char *string, size_t length)
-{
-    return syscall3(SYSCALL_PRINT, (uintptr_t)string, length).error;
-}
-
 uint64_t sys_get_absolute_time(void)
 {
     struct sysret r = syscall1(SYSCALL_GET_ABS_TIME);
diff --git a/lib/barrelfish/syscalls.c b/lib/barrelfish/syscalls.c
new file mode 100644 (file)
index 0000000..4a629e5
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * \file
+ * \brief User-side system call implementation, architecture-independent
+ */
+
+/*
+ * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich.
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached LICENSE file.
+ * If you do not find this file, copies can be found by writing to:
+ * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+ */
+
+#include <barrelfish/barrelfish.h>
+#include <barrelfish/caddr.h>
+#include <barrelfish/dispatch.h>
+#include <barrelfish/syscall_arch.h>
+
+/* For documentation on system calls see include/barrelfish/syscalls.h
+ */
+
+errval_t sys_yield(capaddr_t target)
+{
+    return syscall2(SYSCALL_YIELD, target).error;
+}
+
+errval_t sys_suspend(bool halt)
+{
+    return syscall2(SYSCALL_SUSPEND, halt).error;
+}
+
+errval_t sys_print(const char *string, size_t length)
+{
+    return syscall3(SYSCALL_PRINT, (uintptr_t)string, length).error;
+}
+
+errval_t
+sys_debug_print_capabilities(void) {
+    return syscall1(SYSCALL_DEBUG_PRINT_CAPABILITIES).error;
+}