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

[Lost] [Patch 2/3] kernel2: wait_for_rpc



+ kernel2: syscall_wait_for_rpc


Index: trunk/src/kernel2/include/syscall.h
===================================================================
--- trunk.orig/src/kernel2/include/syscall.h
+++ trunk/src/kernel2/include/syscall.h
@@ -99,6 +99,9 @@ int syscall_pm_v(pid_t pid);
 /// Die Kontrolle an einen anderen Task abgeben
 void syscall_pm_sleep(void);
 
+/// Warten, bis ein RPC zu bearbeiten ist
+void syscall_pm_wait_for_rpc(void);
+
 /// Prozess erstellen
 pid_t syscall_pm_create_process(vaddr_t start, uid_t uid,
     const char* cmdline, pid_t parent_pid);
Index: trunk/src/kernel2/src/syscall.c
===================================================================
--- trunk.orig/src/kernel2/src/syscall.c
+++ trunk/src/kernel2/src/syscall.c
@@ -58,6 +58,7 @@ void syscall_init()
         0);
 
     syscall_register(SYSCALL_PM_SLEEP, &syscall_pm_sleep, 0);
+    syscall_register(SYSCALL_PM_WAIT_FOR_RPC, &syscall_pm_wait_for_rpc, 0);
 
     syscall_register(SYSCALL_PM_P, (void*) &syscall_pm_p, 0);
     syscall_register(SYSCALL_PM_V, (void*) &syscall_pm_v, 1);
Index: trunk/src/kernel2/src/syscalls/pm.c
===================================================================
--- trunk.orig/src/kernel2/src/syscalls/pm.c
+++ trunk/src/kernel2/src/syscalls/pm.c
@@ -188,3 +188,14 @@ void syscall_pm_sleep(void)
 
     cpu_get_current()->thread = thread;
 }
+
+/**
+ * Die Kontrolle an einen anderen Task abgeben und erst wieder aufwachen,
+ * wenn ein RPC zu bearbeiten ist
+ */
+void syscall_pm_wait_for_rpc(void)
+{
+    pm_thread_t* thread = cpu_get_current()->thread;
+    thread->status = PM_STATUS_WAIT_FOR_RPC;
+    syscall_pm_sleep();
+}