summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/cpu/int_syscall.s1
-rw-r--r--kernel/ipc.c11
-rw-r--r--kernel/ipc.h2
-rw-r--r--kernel/sched/scheduler.c6
4 files changed, 19 insertions, 1 deletions
diff --git a/kernel/cpu/int_syscall.s b/kernel/cpu/int_syscall.s
index b2c0de9..bda7312 100644
--- a/kernel/cpu/int_syscall.s
+++ b/kernel/cpu/int_syscall.s
@@ -2,6 +2,7 @@
.global int_syscall
.extern syscall_functions
int_syscall:
+sti
push ebp
mov ebp,esp
push edi
diff --git a/kernel/ipc.c b/kernel/ipc.c
index bce346a..eb7c1b7 100644
--- a/kernel/ipc.c
+++ b/kernel/ipc.c
@@ -2,7 +2,6 @@
#include <interrupts.h>
#include <ipc.h>
#include <math.h>
-#include <sched/scheduler.h>
#include <stdbool.h>
#include <string.h>
@@ -45,6 +44,16 @@ int ipc_get_mailbox(u32 id, struct IpcMailbox **out) {
return 1;
}
+int ipc_has_data(process_t *p) {
+ if (!p) {
+ p = get_current_task();
+ }
+ struct IpcMailbox *handler = &p->ipc_mailbox;
+ u32 read_ptr = handler->read_ptr;
+ struct IpcMessage *ipc_message = &handler->data[read_ptr];
+ return ipc_message->is_used;
+}
+
int ipc_read(u8 *buffer, u32 length, u32 *sender_pid) {
struct IpcMailbox *handler = &get_current_task()->ipc_mailbox;
diff --git a/kernel/ipc.h b/kernel/ipc.h
index ae67f71..d8db074 100644
--- a/kernel/ipc.h
+++ b/kernel/ipc.h
@@ -1,3 +1,4 @@
+#include <sched/scheduler.h>
#ifndef IPC_H
#define IPC_H
#include <stdbool.h>
@@ -23,4 +24,5 @@ bool ipc_register_endpoint(u32 endpoint);
int ipc_write_to_process(int pid, u8 *buffer, u32 length);
int ipc_write(int ipc_id, u8 *buffer, u32 length);
int ipc_read(u8 *buffer, u32 length, u32 *sender_pid);
+int ipc_has_data(process_t *p);
#endif
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c
index e34e7a7..949cdf2 100644
--- a/kernel/sched/scheduler.c
+++ b/kernel/sched/scheduler.c
@@ -373,6 +373,12 @@ int is_halted(process_t *process) {
}
}
+ if (process->is_halted) {
+ if (ipc_has_data(process)) {
+ return 0;
+ }
+ }
+
if (isset_fdhalt(process)) {
return 1;
}