T119: kernel: Implement cap invocation for arm, x86_32
authorMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Tue, 16 Jun 2015 11:35:47 +0000 (13:35 +0200)
committerMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Tue, 16 Jun 2015 11:37:42 +0000 (13:37 +0200)
Signed-off-by: Moritz Hoffmann <moritz.hoffmann@inf.ethz.ch>

include/arch/arm/barrelfish/invocations_arch.h
include/arch/k1om/barrelfish/invocations_arch.h
include/arch/x86_32/barrelfish/invocations_arch.h
include/barrelfish/syscalls.h
kernel/arch/arm/syscall.c
kernel/arch/x86_32/syscall.c
kernel/capabilities.c
kernel/syscall.c

index 036e528..c77b40d 100644 (file)
@@ -587,6 +587,15 @@ static inline errval_t invoke_dispatcher_dump_ptables(struct capref dispcap)
             SYSCALL_INVOKE, invoke_cptr).error;
 }
 
+static inline errval_t invoke_dispatcher_dump_capabilities(struct capref dispcap)
+{
+    uint8_t invoke_bits = get_cap_valid_bits(dispcap);
+    capaddr_t invoke_cptr = get_cap_addr(dispcap) >> (CPTR_BITS - invoke_bits);
+
+    return syscall2((invoke_bits << 16) | (DispatcherCmd_DumpCapabilities << 8) |
+            SYSCALL_INVOKE, invoke_cptr).error;
+}
+
 static inline errval_t
 invoke_dispatcher_properties(
     struct capref dispatcher,
index 337def4..07cc2d8 100644 (file)
@@ -379,6 +379,11 @@ static inline errval_t invoke_dispatcher_dump_ptables(struct capref dispcap)
     return cap_invoke1(dispcap, DispatcherCmd_DumpPTables).error;
 }
 
+static inline errval_t invoke_dispatcher_dump_capabilities(struct capref dispcap)
+{
+    return cap_invoke1(dispcap, DispatcherCmd_DumpCapabilities).error;
+}
+
 static inline errval_t invoke_perfmon_activate(struct capref perfmon_cap,
                                                uint8_t event, uint8_t perf_umask,
                                                bool kernel, uint8_t counter_id,
index f5261a2..deb5261 100644 (file)
@@ -540,6 +540,15 @@ static inline errval_t invoke_dispatcher_dump_ptables(struct capref dispcap)
             SYSCALL_INVOKE, invoke_cptr).error;
 }
 
+static inline errval_t invoke_dispatcher_dump_capabilities(struct capref dispcap)
+{
+    uint8_t invoke_bits = get_cap_valid_bits(dispcap);
+    capaddr_t invoke_cptr = get_cap_addr(dispcap) >> (CPTR_BITS - invoke_bits);
+
+    return syscall2((invoke_bits << 16) | (DispatcherCmd_DumpCapabilities << 8) |
+            SYSCALL_INVOKE, invoke_cptr).error;
+}
+
 static inline errval_t invoke_ipi_notify_send(struct capref notify_cap)
 {
     uint8_t invoke_bits = get_cap_valid_bits(notify_cap);
index ad0e47e..9a72da3 100644 (file)
@@ -59,7 +59,6 @@ errval_t sys_print(const char *string, size_t length);
  * \brief get time elapsed since system boot.
  */
 uint64_t sys_get_absolute_time(void);
-
 __END_DECLS
 
 #endif //LIBBARRELFISH_SYSCALL_H
index c027411..7ec93b6 100644 (file)
@@ -21,6 +21,7 @@
 #include <dispatch.h>
 #include <exec.h>
 #include <stdio.h>
+#include <sys_debug.h>
 #include <syscall.h>
 #include <arch/arm/syscall_arm.h>
 #include <start_aps.h>
@@ -757,6 +758,16 @@ static struct sysret dispatcher_dump_ptables(
     return SYSRET(SYS_ERR_OK);
 }
 
+static struct sysret dispatcher_dump_capabilities(struct capability *cap,
+        arch_registers_state_t* context, int argc)
+{
+    assert(cap->type == ObjType_Dispatcher);
+    assert(2 == argc);
+    struct dcb *dispatcher = cap->u.dispatcher.dcb;
+    errval_t err = debug_print_cababilities(dispatcher);
+    return SYSRET(err);
+}
+
 static struct sysret handle_idcap_identify(struct capability *to,
                                            arch_registers_state_t *context,
                                            int argc)
@@ -790,7 +801,8 @@ static invocation_t invocations[ObjType_Num][CAP_MAX_CMD] = {
         [DispatcherCmd_Setup]       = handle_dispatcher_setup,
         [DispatcherCmd_Properties]  = handle_dispatcher_properties,
         [DispatcherCmd_PerfMon]     = handle_dispatcher_perfmon,
-        [DispatcherCmd_DumpPTables] = dispatcher_dump_ptables,
+        [DispatcherCmd_DumpPTables]  = dispatcher_dump_ptables,
+        [DispatcherCmd_DumpCapabilities] = dispatcher_dump_capabilities
     },
     [ObjType_KernelControlBlock] = {
         [FrameCmd_Identify] = handle_kcb_identify
@@ -1025,11 +1037,6 @@ static struct sysret handle_debug_syscall(int msg)
             break;
         #endif
 
-        case DEBUG_PRINT_CAPABILITIES: {
-            retval = sys_debug_print_capabilities();
-            break;
-        }
-
         default:
             printk(LOG_ERR, "invalid sys_debug msg type %d\n", msg);
             retval.error = err_push(retval.error, SYS_ERR_ILLEGAL_SYSCALL);
index aac69cc..4e6b0ab 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <kernel.h>
+#include <sys_debug.h>
 #include <syscall.h>
 #include <barrelfish_kpi/syscalls.h>
 #include <capabilities.h>
@@ -804,6 +805,16 @@ static struct sysret dispatcher_dump_ptables(struct capability *cap,
     return SYSRET(SYS_ERR_OK);
 }
 
+static struct sysret dispatcher_dump_capabilities(struct capability *cap,
+                                             int cmd, uintptr_t *args)
+{
+    assert(cap->type == ObjType_Dispatcher);
+    struct dcb *dispatcher = cap->u.dispatcher.dcb;
+    errval_t err = debug_print_cababilities(dispatcher);
+    return SYSRET(err);
+}
+
+
 static struct sysret kernel_add_kcb(struct capability *kern_cap,
                                     int cmd, uintptr_t *args)
 {
@@ -845,6 +856,7 @@ static invocation_handler_t invocations[ObjType_Num][CAP_MAX_CMD] = {
         [DispatcherCmd_Properties]   = handle_dispatcher_properties,
         [DispatcherCmd_PerfMon]      = handle_dispatcher_perfmon,
         [DispatcherCmd_DumpPTables]  = dispatcher_dump_ptables,
+        [DispatcherCmd_DumpCapabilities] = dispatcher_dump_capabilities
     },
     [ObjType_KernelControlBlock] = {
         [FrameCmd_Identify] = handle_kcb_identify,
index 94e19b5..e1b2411 100644 (file)
@@ -1318,4 +1318,3 @@ errval_t caps_copy_to_cte(struct cte *dest_cte, struct cte *src_cte, bool mint,
 
     return SYS_ERR_OK;
 }
-
index 7b38f7b..9dde989 100644 (file)
@@ -630,5 +630,3 @@ struct sysret sys_get_absolute_time(void)
         .value = kernel_now + kcb_current->kernel_off,
     };
 }
-
-