Start working on a VFS implementation #22

Closed
apio wants to merge 44 commits from oop-vfs into main

44 Commits

Author SHA1 Message Date
eebbbf0b16
luna -> libluna
Some checks failed
continuous-integration/drone/pr Build is failing
2023-02-27 15:19:18 +01:00
32dc5473a5
TmpFS: Use StaticString<128> instead of char[128]
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-27 15:14:07 +01:00
76f9bd8112
luna: Add StaticString, an OOP char[] 2023-02-27 15:13:23 +01:00
55b430a4fd
TmpFS: Use a fixed char array in DirInode's Entry instead of OwnedStringView
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-27 15:04:29 +01:00
19b72fe779
luna: Add strlcpy() 2023-02-27 15:03:22 +01:00
ec146caeea
Vector: Fix try_append (hopefully)
Still doesn't work with OwnedStringViews inside of structs.
2023-02-27 15:02:55 +01:00
7f1884213a
InitRD: Use MMU::translate_physical_address instead of allocating VM
Some checks reported errors
continuous-integration/drone/pr Build was killed
This one is a perfect candidate, since we're just mapping a fixed continuous range of physical memory to virtual memory.
2023-02-27 13:31:36 +01:00
3654cc5bee
MemoryManager: Initialize KernelVM at the end of init()
KernelVM is not needed for MMU's init process anymore.
2023-02-27 13:31:36 +01:00
a0252e42a4
x86_64: Remove recursive mapping related things from MMU.h 2023-02-27 13:31:36 +01:00
2038ee1929
x86_64/MMU: Do not allocate level 1 page tables for huge page entries
This would leak memory, since we would never end up using them.
2023-02-27 13:31:36 +01:00
9af6a3f30f
MemoryManager: Reuse the existing mapping of physical memory that MMU has 2023-02-27 13:31:36 +01:00
ff01f49b41
x86_64/MMU: Map the physical address space using huge pages 2023-02-27 13:31:35 +01:00
efdd64736f
x86_64: Allow mapping huge pages, but don't do it yet 2023-02-27 13:31:35 +01:00
9da5204079
x86_64/MMU: Copy from the mapped kernel directory instead of the physical version 2023-02-27 13:31:35 +01:00
78cea0a47e
x86_64/MMU: Map all physical memory into the higher half instead of using recursive mapping
This still has a few problems. Notably, we are not using huge pages for this mapping, which would be a lot more efficient.
Right now, used memory is 8.1 MiB at boot for a 256MiB system.
But after improving it, this system will be much better than recursive mapping.
fork() will be MUCH easier to implement, for example.
2023-02-27 13:31:35 +01:00
5b43345b7d
kernel: Implement creating file inodes in tmpfs directories
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-25 19:22:05 +01:00
9248a5b3cc
tmpfs: make the root inode a DirInode instead of a FileInode 2023-02-25 19:08:55 +01:00
cca4743a51
tmpfs: add DirInode skeleton 2023-02-25 19:06:50 +01:00
0635f1c243
Update README.md with realism
Some checks reported errors
continuous-integration/drone/pr Build was killed
2023-02-25 18:19:00 +01:00
b71d899b52
tmpfs: rename tmpfs::Inode to tmpfs::FileInode
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-25 18:11:39 +01:00
05b627d037
tmpfs: Make m_next_inode_number atomic 2023-02-25 18:06:23 +01:00
6daad7787a
kernel: Rename FileSystem::root() to root_inode() and add a shortcut for the root filesystem's root inode 2023-02-25 18:05:25 +01:00
ddc4692671
kernel: Make a factory function for filesystem creation of inodes, and add inode numbers
Now every filesystem must provide fs->create_file_inode() for new inodes :)
2023-02-25 18:03:11 +01:00
5edd316198
kernel: Add a subclass of VFS::Inode to make it easier to implement file inodes 2023-02-25 17:54:01 +01:00
045efc7046
kernel, luna: Port non-VFS changes over from pull request #22
All checks were successful
continuous-integration/drone/pr Build is passing
OwnedPtr, SharedPtr: Add operator bool
Option, Result: Make try_move_value() non-const since it modifies the Option
kernel: Switch to a stack we control for the main task as soon as we leave early boot
Heap: Fix GPF caused when making many small allocations
Heap: Avoid accessing a block after it's potentially deleted
luna: Skip UBSAN.cpp in CMakeLists as that's not implemented yet
luna: Use spinlocks in the heap implementation
kernel, luna: Move Spinlock.h to luna
Option: Use __builtin_launder to ensure that the compiler doesn't label this as UB
SharedPtr: Implement make_shared using adopt_shared
SharedPtr: Delete ptr on failure in all adopt_shared* functions
2023-02-25 17:47:58 +01:00
6fc02e042a
SharedPtr: Implement make_shared using adopt_shared
Some checks failed
continuous-integration/drone/pr Build is failing
2023-02-25 17:45:41 +01:00
620810d720
SharedPtr: Delete ptr on failure in all adopt_shared* functions 2023-02-25 17:45:41 +01:00
32ada00b72
kernel: Add a guard page to the bootstrap stack so that we can catch more stack overflows 2023-02-25 17:45:41 +01:00
dc795ff491
luna: Introduce fail(...), a replacement for expect(false, ...) 2023-02-25 17:45:40 +01:00
5f6a659fa1
kernel: Enable UBSAN when building in debug mode 2023-02-25 17:45:40 +01:00
d82b3f809b
luna: Add UB sanitizer, for both kernel-space and userspace 2023-02-25 17:45:40 +01:00
96a213ec5c
libc: Make dbgln() also print a newline in userspace
Previously, dbgln() only printed a newline in kernel-space.
2023-02-25 17:45:40 +01:00
e9e1bef89c
OwnedPtr, SharedPtr: Add operator bool
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-25 16:27:36 +01:00
ae22321648
Option, Result: Make try_move_value() non-const since it modifies the Option
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-25 16:22:11 +01:00
d842443869
kernel: Switch to a stack we control for the main task as soon as we leave early boot
All checks were successful
continuous-integration/drone/pr Build is passing
This is probably pointless as the main task only exists up until the point where the Scheduler starts running, but some init code was running into a stack overflow due to the fact that we only had one bootloader-provided page of stack.

This should probably be changed afterwards.
2023-02-18 00:18:42 +01:00
37bbc04719
Heap: Fix GPF caused when making many small allocations
All checks were successful
continuous-integration/drone/pr Build is passing
Apparently space was too tight to split(), but we did it anyways, corrupting the next block.
This patch fixes this behavior.
2023-02-17 22:47:15 +01:00
4697a16206
Heap: Avoid accessing a block after it's potentially deleted
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-14 20:17:31 +01:00
08d5d727ee
luna: Skip UBSAN.cpp in CMakeLists as that's not implemented yet
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-14 20:10:02 +01:00
38bd3d3eef
luna: Use spinlocks in the heap implementation
Some checks failed
continuous-integration/drone/pr Build is failing
2023-02-14 20:07:30 +01:00
4e88a7482c
kernel, luna: Move Spinlock.h to luna 2023-02-14 20:05:00 +01:00
6eff41e7af
Option: Use __builtin_launder to ensure that the compiler doesn't label this as UB 2023-02-14 20:03:29 +01:00
79078ff21e
SharedPtr: Implement make_shared using adopt_shared
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-14 19:59:44 +01:00
cb4246b98d
kernel: Start working on a VFS implementation using OOP and SharedPtr
All checks were successful
continuous-integration/drone/pr Build is passing
2023-02-03 22:20:00 +01:00
51024f879d
SharedPtr: Delete ptr on failure in all adopt_shared* functions 2023-02-03 22:20:00 +01:00