kernel: Add processes and rework VFS access checking #48

Merged
apio merged 5 commits from processes into main 2024-12-07 12:19:51 +00:00
3 changed files with 17 additions and 1 deletions
Showing only changes of commit 853a6d7b38 - Show all commits

View File

@ -91,6 +91,9 @@ void handle_cpu_exception(int signo, const char* err, Registers* regs)
auto* current = Scheduler::current();
if (current->check_stack_on_exception(regs->rsp)) return;
auto space = current->process->address_space.lock();
(*space)->debug_log();
current->send_signal(signo);
current->process_pending_signals(regs);
return;

View File

@ -1,4 +1,5 @@
#include "memory/AddressSpace.h"
#include "Log.h"
#include "arch/MMU.h"
#include "memory/Heap.h"
#include "memory/MemoryManager.h"
@ -385,3 +386,13 @@ void VMRegion::sync_shared()
}
}
}
void AddressSpace::debug_log()
{
m_regions.for_each([this](VMRegion* region) {
kdbgln("VMRegion start: %p, end: %p, count: %zu, used: %s, persistent: %s, flags: %d, prot: %d, shmid: %lu, "
"offset: %ld",
(void*)region->start, (void*)region->end, region->count, region->used ? "true" : "false",
region->persistent ? "true" : "false", region->flags, region->prot, region->shmid, region->offset);
});
}

View File

@ -15,7 +15,7 @@ class VMRegion : LinkedListNode<VMRegion>
bool persistent { false };
int flags { 0 };
int prot { 0 };
u64 shmid;
u64 shmid { 0 };
off_t offset { 0 };
void cleanup_shared();
@ -52,6 +52,8 @@ class AddressSpace
static Result<OwnedPtr<AddressSpace>> try_create();
void debug_log();
Result<OwnedPtr<AddressSpace>> clone();
PageDirectory* page_directory() const