summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-04-09 19:03:29 +0200
committerdzwdz2022-04-09 19:03:29 +0200
commit59ca1c46970fa8df2d0fa4b8163a99ca418bd2cf (patch)
treeb07438ddb940f206a3370bc7524f547661b41c6c /src
parente17137d8d74e65e3cce7c04263d73a111bae25c0 (diff)
kernel/vfs: prevent the vfs functions from switching processes
Diffstat (limited to 'src')
-rw-r--r--src/kernel/arch/i386/sysenter.c9
-rw-r--r--src/kernel/vfs/request.c6
-rw-r--r--src/kernel/vfs/request.h3
3 files changed, 9 insertions, 9 deletions
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index cda4f15..5712ee3 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -23,7 +23,10 @@ _Noreturn void sysenter_stage2(void) {
val = _syscall(regs->eax, regs->ebx,
regs->esi, regs->edi, (uintptr_t)regs->ebp);
- regs_savereturn(&process_current->regs, val);
-
- process_switch(process_current); // TODO process_resume
+ if (process_current->state == PS_RUNNING) { // TODO move to _syscall()
+ regs_savereturn(&process_current->regs, val);
+ process_switch(process_current); // TODO process_resume
+ } else {
+ process_switch_any();
+ }
}
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index ecd862a..5b65e52 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -5,7 +5,6 @@
#include <kernel/vfs/request.h>
#include <kernel/vfs/root.h>
-// dispatches a VFS operation to the correct process
int vfs_request_create(struct vfs_request req_) {
struct vfs_request *req;
int ret;
@@ -29,15 +28,14 @@ int vfs_request_create(struct vfs_request req_) {
&& req->backend->handler->state == PS_WAITS4REQUEST)
{
vfs_request_accept(req);
- process_switch(req->backend->handler);
} else {
// backend isn't ready yet, join the queue
struct process **iter = &req->backend->queue;
while (*iter != NULL)
iter = &(*iter)->waits4fs.queue_next;
*iter = process_current;
- process_switch_any();
}
+ return -1; // isn't passed to the caller process anyways
default:
panic_invalid_state();
}
@@ -77,7 +75,7 @@ int vfs_request_accept(struct vfs_request *req) {
handler->state = PS_RUNNING;
handler->handled_req = req;
regs_savereturn(&handler->regs, 0);
- return;
+ return 0;
fail:
panic_unimplemented(); // TODO
}
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h
index 2bcaae6..37b8c3a 100644
--- a/src/kernel/vfs/request.h
+++ b/src/kernel/vfs/request.h
@@ -40,8 +40,7 @@ struct vfs_request {
struct vfs_backend *backend;
};
-/** Assigns the vfs_request to the caller, and calls the backend. Might not
- * return - can switch processes! TODO no it can't*/
+/** Assigns the vfs_request to the caller, and dispatches the call */
int vfs_request_create(struct vfs_request);
int vfs_request_accept(struct vfs_request *);
int vfs_request_finish(struct vfs_request *, int ret);