Kernel: Rewrite all kernel mutexes

Now SpinLock is actually just a spin lock and I added a Mutex that
does the same as the old "SpinLock". This is in preparation for
starting to support smp and making the kernel smp safe. This commit
also removes obsolete PageTableScope and CriticalScope which should
now be used by alternative APIs.
This commit is contained in:
2024-02-25 21:29:43 +02:00
parent 6ebfe05fce
commit 40b626b0aa
83 changed files with 825 additions and 703 deletions

View File

@@ -4,7 +4,6 @@
#ifdef __is_kernel
#include <kernel/FS/VirtualFileSystem.h>
#include <kernel/Memory/PageTableScope.h>
#include <kernel/Process.h>
#endif
@@ -26,7 +25,7 @@ namespace LibELF
BAN::Vector<uint8_t> buffer;
TRY(buffer.resize(inode->size()));
TRY(inode->read(0, buffer.data(), inode->size()));
TRY(inode->read(0, { buffer.data(), inode->size() }));
ELF* elf_ptr = new ELF(BAN::move(buffer));
if (elf_ptr == nullptr)

View File

@@ -1,7 +1,6 @@
#include <BAN/ScopeGuard.h>
#include <kernel/CriticalScope.h>
#include <kernel/Memory/Heap.h>
#include <kernel/LockGuard.h>
#include <kernel/Lock/LockGuard.h>
#include <LibELF/LoadableELF.h>
#include <LibELF/Values.h>
@@ -315,12 +314,9 @@ namespace LibELF
if (paddr == 0)
return BAN::Error::from_errno(ENOMEM);
{
CriticalScope _;
PageTable::map_fast_page(paddr);
PageTable::with_fast_page(paddr, [&] {
memcpy(PageTable::fast_page_as_ptr(), (void*)(start + i * PAGE_SIZE), PAGE_SIZE);
PageTable::unmap_fast_page();
}
});
new_page_table.map_page_at(paddr, start + i * PAGE_SIZE, flags);
elf->m_physical_page_count++;