[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] kernel2: pm_scheduler_yield()
From: Kevin Wolf <kevin@xxxxxxxxxx>
+ kernel2: pm_scheduler_yield um Kontrolle an einen anderen Thread zu
uebergeben.
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/kernel2/include/tasks.h | 3 +++
src/kernel2/src/tasks/scheduler.c | 9 +++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/kernel2/include/tasks.h b/src/kernel2/include/tasks.h
index d1b031c..bba42d5 100644
--- a/src/kernel2/include/tasks.h
+++ b/src/kernel2/include/tasks.h
@@ -197,6 +197,9 @@ void pm_scheduler_get(pm_thread_t* thread);
/// Einen ausgefuerten Thread wieder zurueck an den Scheduler geben
void pm_scheduler_push(pm_thread_t* thread);
+/// Kontrolle vom aktuellen Kernelthread an einen anderen Thread abgeben
+void pm_scheduler_yield(void);
+
/**
* Initialisierung
*/
diff --git a/src/kernel2/src/tasks/scheduler.c b/src/kernel2/src/tasks/scheduler.c
index 90e457a..84c7348 100644
--- a/src/kernel2/src/tasks/scheduler.c
+++ b/src/kernel2/src/tasks/scheduler.c
@@ -37,6 +37,7 @@
#include <lost/config.h>
#include <stdlib.h>
#include <collections.h>
+#include <syscallno.h>
#include "kernel.h"
#include "tasks.h"
@@ -211,3 +212,11 @@ void pm_scheduler_push(pm_thread_t* thread)
unlock(&thread->lock);
}
+/**
+ * Kontrolle vom aktuellen Kernelthread an einen anderen Thread abgeben
+ */
+void pm_scheduler_yield(void)
+{
+ asm volatile("int $0x30;" : : "a" (SYSCALL_PM_SLEEP));
+}
+
--
1.6.4.4